<div dir="ltr"><div><div><div>Hello,<br><br></div>It's my first few hours playing with containers so maybe there's something I'm doing wrong or something I overlook, or both.<br><br></div><div>I'm on debian stretch if that's relevant, using :<br><br>➜  ~ lxc-info --version<br>2.0.7<br><br></div>I set up an unprivileged container this way:<br><br>➜  ~ lxc-create -t download -n u1 -- -d ubuntu -r xenial -a amd64<br>Using image from local cache<br>Unpacking the rootfs<br><br>---<br>You just created an Ubuntu container (release=xenial, arch=amd64, variant=default)<br><br>To enable sshd, run: apt-get install openssh-server<br><br>For security reason, container images ship without user accounts<br>and without a root password.<br><br>Use lxc-attach or chroot directly into the rootfs to set a root password<br>or create user accounts.<br><br>I then start it and attach:<br><br>➜  ~ lxc-start -n u1<br>➜  ~ lxc-attach -n u1<br>root@u1:/# echo $PATH<br>/home/HOST_USER/bin:/usr/local/bin:/home/HOST_USER/Applications/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games<br><br></div>Now as you can see /sbin is not in the PATH, which means any apt-get install BLABLABLA ends up with the following error:<br><br><div>dpkg: warning: 'ldconfig' not found in PATH or not executable<br>dpkg: warning: 'start-stop-daemon' not found in PATH or not executable<br>dpkg: error: 2 expected programs not found in PATH or not executable<br>Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin<br>E: Sub-process /usr/bin/dpkg returned an error code (2)<br><br></div><div>If I do the exact same commands with sudo, thus creating a NOT unprivileged container, if I got it correctly, well the PATH is "correctly" set up, at least /sbin is in it and I can apt-get install anything.<br></div><div><br>When I say correctly I should say: the way I would expect it when I'm root.<br>That makes me think there's a subtlety about unprivileged container I don't get.<br><br></div><div>Asking in IRC, I got this answer, which works, I should use:<br><br>➜  ~ lxc-execute -n u1 -- /bin/bash --login<br><br></div><div><br></div><div>Now reading both man pages for attach and execute, at first glance they seem to be doing the same except one spawn the instance while the other doesn't and uses the one that is running. <br><br>Again it's been only a few hours I'm playing with it.<br><br></div><div>I don't get why in the case of the container created with sudo the PATH is "correct", and not in the case of the unprivileged container.<br><br></div><div>Is it intended ? It's kind of weird to be root in a machine and unable to install a package because of the PATH, hence those questions.<br><br></div><div>Looking at the templates, it seems they export that PATH<br></div><div><br>➜  ~ grep PATH /usr/share/lxc/templates/lxc-ubuntu<br># Make sure the usual locations are in PATH<br>export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin<br><br></div><div>So the -t download switch doesn't use that ?<br><br><br></div><div>Thanks in advance<br></div><div><br><br><div><div><div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">benoit barthelet<br><a href="http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE" target="_blank">http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE</a><br></div></div></div></div>
</div></div></div></div></div>