liip / drifter

Drifter is a framework to help provision developer boxes using Ansible and Vagrant
https://liip-drifter.readthedocs.io/
Do What The F*ck You Want To Public License
57 stars 28 forks source link

User command fails during provisioning when host user ID is not 1000 #246

Closed francoisbruneau closed 5 years ago

francoisbruneau commented 5 years ago
RUNNING HANDLER [nodejs : install package.json] ********************************
fatal: [default]: FAILED! => {"changed": false, "cmd": "/usr/bin/npm install", "failed": true, "msg": "npm WARN checkPermissions Missing write access to /vagrant\nnpm

This happens when the host user ID is not the default one (1000), i.e. when multiple user accounts have been setup on the host machine.

Workaround Assuming host user ID is 1001:

$ vagrant halt
$ sudo su
$ cd /var/lib/lxc/CONTAINER_NAME
$ chroot rootfs

/# usermod -u 1001 vagrant
/# groupmod -g 1001 vagrant
/# exit

$ cd PROJECT_DIRECTORY
$ vagrant up --provision 

Drifter version: stretch-php7 https://github.com/liip/drifter/commit/88ac0c7df1ba97114947678906faccb2b6622ef5 Vagrant version: 2.2.2 OS and version: Ubuntu 18.10

Additional information:

LeBenLeBen commented 5 years ago

Duplicate of #107