vagga icon indicating copy to clipboard operation
vagga copied to clipboard

Vagrant errors

Open kismet010 opened this issue 11 years ago • 11 comments

Getting errors running on Vagrant OSX

Without sudo:

vagrant@vagrant-ubuntu-trusty-64:/var/project$ ./vagga/bin/vagga _build server
ERROR:vagga::container::monitor: Can't run container vagga_wrapper: Error writing uid_map: No such file or directory (os error 2)
Build returned 127

With sudo:

vagrant@vagrant-ubuntu-trusty-64:/var/project$ sudo ./vagga/bin/vagga _build server
Connecting to cdimage.ubuntu.com (91.189.92.164:80)
0e78368d-trusty-core 100% |*****************************************| 64239k  0:00:00 ETA
tar: can't create hardlink from bin/gunzip to bin/uncompress: Operation not permitted
tar: can't create hardlink from bin/bzip2 to bin/bzcat: Operation not permitted
tar: can't create hardlink from bin/bunzip2 to bin/bzcat: Operation not permitted
tar: can't create hardlink from sbin/agetty to sbin/getty: Operation not permitted
tar: can't create hardlink from usr/share/man/man8/agetty.8.gz to usr/share/man/man8/getty.8.gz: Operation not permitted
tar: can't create hardlink from usr/bin/perl to usr/bin/perl5.18.2: Operation not permitted
tar: can't create hardlink from usr/bin/psed to usr/bin/s2p: Operation not permitted
tar: can't create hardlink from usr/bin/lockfile-check to usr/bin/lockfile-create: Operation not permitted
tar: can't create hardlink from usr/bin/lockfile-remove to usr/bin/lockfile-create: Operation not permitted
tar: can't create hardlink from usr/bin/python3.4m to usr/bin/python3.4: Operation not permitted
tar: can't create hardlink from usr/bin/pstruct to usr/bin/c2ph: Operation not permitted
tar: can't create hardlink from usr/bin/mail-touchlock to usr/bin/mail-lock: Operation not permitted
tar: can't create hardlink from usr/bin/perlthanks to usr/bin/perlbug: Operation not permitted
tar: can't create hardlink from usr/bin/mail-unlock to usr/bin/mail-lock: Operation not permitted
tar: can't create hardlink from usr/bin/lockfile-touch to usr/bin/lockfile-create: Operation not permitted
ERROR:vagga::builder: Error building container "server": Error copying /etc/resolv.conf: Operation not permitted (os error 1)
ERROR:vagga::wrapper: Error executing _build: Builder exited with code 1
Build returned 124

#53 Workaround

Vagrantfile

config.vm.synced_folder ".", "/var/project", :mount_options => ["dmode=777","fmode=777"]
config.vm.provision :shell, path: "vagrant_provision.sh"

vagrant_provision.sh

mkdir /var/vagga
mount --bind /var/vagga /var/project/.vagga

kismet010 avatar Sep 03 '15 22:09 kismet010

ERROR:vagga::container::monitor: Can't run container vagga_wrapper: Error writing uid_map: No such file or directory (os error 2)

Pobably you have no "uidmap" package, i.e. no "newuidmap" and "newgidmap" commands (that's what "No such file or directory" mean here)

And you need provision for mount to be run always:

config.vm.provision :shell, path: "vagrant_provision.sh", run: "always"

Because bind mounts are lost on restart of machine.

tailhook avatar Sep 04 '15 07:09 tailhook

Yes I'd forgot to mention the last one :) Actually I'm creating another dir and copying .vagga/* to not be downloading the images everytime

kismet010 avatar Sep 04 '15 08:09 kismet010

Actually I'm creating another dir and copying .vagga/* to not be downloading the images everytime

Hm, It should work with the following limitations:

  1. You need to keep permissions, i.e. cp -pR instead of cp -R
  2. Because vboxsf works bad with hardlinks and user namespaces (and also symlinks if you are on windows), you need to copy .vagga somewhere inside the container on normal unix filesystem (and probably bind mount there)

You may also try to use rsync synced folder (but I gues it woun't work well with automatic image rebuilding in vagga) land/or nfs synced folder (but this may be slow).


At the end of the day, depending on your use case, you may wish to have just downloadable image:

initial-container:
  setup:
  - Ubuntu trusty
  - !Install ["python", "whatver", "large", "number", "of", "packages"]

quick-container:
  setup:
  - !Tar http://local.image.cache/image-v1.0.tar.gz

Then you build initial-container, pack it in the tar (IIRC tar -cJf image-v1.0.tar.gz -C ".vagga/initial-container/" .), put into cache and update version (so everybody got new image version).

tailhook avatar Sep 04 '15 08:09 tailhook

Rsync works perfect, thanks :)

Anyway, starting Apache (even outside Vagrant on a fresh Ubuntu Vivid) throws:

 * Starting web server apache2
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80

@tailhook Do you know any solution for this?

kismet010 avatar Sep 06 '15 20:09 kismet010

@kismet010, basically it's norm, you can't use 80th port as ordinary user (starting with sudo might help, but I usually don't recommend running vagga with sudo). Better idea is to change apache configuration to listen different port. You use vagrant's port forwarding anyway, right?

tailhook avatar Sep 06 '15 20:09 tailhook

Yes I use port forwarding in Vagrant and it works. The thing is that I want to run the container in a production server and got those errors even with root user (don't worry, I know it's beta and secutiry is not a problem here) with default port 80. Do you know any workaround?

kismet010 avatar Sep 06 '15 21:09 kismet010

@kismet010, sometimes I use iptables as a workaround. I.e. bind to some other port like 8000 and forward all packets from port 80 to port 8000. Is this a suitable workaround?

tailhook avatar Sep 06 '15 21:09 tailhook

Yes, I was thinking on that. The problem is having apache on the host server running other sites. Thanks a lot.

kismet010 avatar Sep 06 '15 21:09 kismet010

Should this issue be closed now?

tailhook avatar Sep 07 '15 22:09 tailhook

@tailhook You should have a better error message for this situation. I had the same issue on (K)Ubuntu 15.10 beta2. Luckily I read all the documentation first and I remembered that I saw something about uidmap package under Ubuntu: Old Releases (precise, 12.04) and just did sudo apt-get install uidmap -y. If you are not sure at that moment that the user has uidmap installed or not, you could leave the error message + another message under that says something like Please make sure you have uidmap installed on your system.

lilianmoraru avatar Oct 03 '15 12:10 lilianmoraru

@lilianmoraru, sure, I've opened #64 for that. Feel free to just open issue, when you think you know how to report some error better.

tailhook avatar Oct 03 '15 13:10 tailhook