[lxc-users] user 'ubuntu' does not exist within LXD container

Francesco Longo flongo at unime.it
Fri Mar 31 07:53:29 UTC 2017


Yeah, that's of course possible. I was just wondering if something like
that comes built-in with LXD/LXC.

Thanks,
Francesco

On Thu, Mar 30, 2017 at 12:53 PM, Simos Xenitellis <
simos.lists at googlemail.com> wrote:

> On Thu, Mar 23, 2017 at 3:39 PM, Francesco Longo <flongo at unime.it> wrote:
> > Thanks for your reply. It seems that if I put a sleep after container
> > creation _sometimes_ it works. Probably, I have to play with the delay.
> >
> > Is there a correct way to do that? I mean, is there a way to execute a
> set
> > of commands inside the container after the container has properly
> booted? I
> > guess that I could use cloud-init but that means it would work only in
> > ubuntu images right?
> >
>
> Add some code that will check whether the "ubuntu" account has been
> created in the container.
> If it has not been created yet, you can "sleep 1", and check again.
> Keep checking until the account gets created.
>
> Simos
>
> > Francesco
> >
> >
> > On Thu, Mar 23, 2017 at 12:32 PM, Simos Xenitellis
> > <simos.lists at googlemail.com> wrote:
> >>
> >> On Thu, Mar 23, 2017 at 12:41 PM, Francesco Longo <flongo at unime.it>
> wrote:
> >> > Hi all,
> >> > I'm playing with Raspberry Pi virtualization, i.e., in few words,
> >> > creating
> >> > LXD containers on top of a Raspberry Pi and attaching to them a couple
> >> > of
> >> > FUSE filesystems mirroring the GPIO /sys/class/gpio filesystem.
> >> >
> >> > I created a simple script that you can find here:
> >> >
> >> > https://github.com/flongo82/raspberry_virtualization/blob/
> master/launch_virtual_rasp.sh
> >> >
> >> > A first issue I'm dealing with is that when using lxc exec to add the
> >> > ubuntu
> >> > user to the gpio groups it says that the ubuntu user does not exist.
> >> > But, if
> >> > I login into the container the user is actually there but, of course,
> it
> >> > is
> >> > not part of the gpio group given that the command has failed.
> >> >
> >> > This is the output of the script:
> >> >
> >> > Creating virtual rasp test!
> >> > Creating test
> >> > Starting test
> >> > Adding group `gpio' (GID 1000) ...
> >> > Done.
> >> > usermod: user 'ubuntu' does not exist
> >> > Device gpio added to test
> >> > Device devices added to test
> >> >
> >> > Any idea why this is happening? Is it possible that I need to wait a
> >> > while
> >> > before issuing this kind of lxc exec command after creating the
> >> > container?
> >>
> >> You can look into the image at /var/lib/lxd/images/
> >> and you will verify that the "ubuntu" account is not preinstalled in the
> >> image.
> >> In there you can see that there exist cloud-init templates that do
> things
> >> like creating users. My quick look did not show which template creates
> >> the "ubuntu" user,
> >> so have a better look in there.
> >> "cloud-init" runs after the container is created, therefore it makes
> >> sense is the "ubuntu" account
> >> is not available exactly after the exit for "lxc launch".
> >>
> >> Simos
> >>
> >> >
> >> > I'm using LXD version 2.12 on top of a
> >> > ubuntu-16.04-preinstalled-server-armhf+raspi3.img.xz image.
> >> >
> >> > Thanks,
> >> > Francesco
> >> >
> >> > --
> >> >
> >> > ------------------------------------------------------------
> ------------------
> >> > Dr. Francesco Longo, PhD
> >> > Assistant Professor
> >> > Dipartimento  di Ingegneria
> >> > Università degli Studi di Messina
> >> > address: Contrada di Dio (S. Agata), 98166, Messina, Italy
> >> > email: flongo at unime.it
> >> > phone: +39 090 3977335 --- fax: +39 090 3977471
> >> >
> >> > ------------------------------------------------------------
> ------------------
> >> >
> >> > _______________________________________________
> >> > lxc-users mailing list
> >> > lxc-users at lists.linuxcontainers.org
> >> > http://lists.linuxcontainers.org/listinfo/lxc-users
> >> _______________________________________________
> >> lxc-users mailing list
> >> lxc-users at lists.linuxcontainers.org
> >> http://lists.linuxcontainers.org/listinfo/lxc-users
> >
> >
> >
> >
> > --
> > ------------------------------------------------------------
> ------------------
> > Dr. Francesco Longo, PhD
> > Assistant Professor
> > Dipartimento  di Ingegneria
> > Università degli Studi di Messina
> > address: Contrada di Dio (S. Agata), 98166, Messina, Italy
> > email: flongo at unime.it
> > phone: +39 090 3977335 --- fax: +39 090 3977471
> > ------------------------------------------------------------
> ------------------
> >
> > _______________________________________________
> > lxc-users mailing list
> > lxc-users at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-users
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>



-- 
-------------------------------------------------------------------------------------------------
Dr. Francesco Longo, PhD

Assistant Professor @ Department of Engineering, University of Messina
address: Contrada di Dio, S. Agata - 98166, Messina, Italy
email: flongo at unime.it
web: mdslab.unime.it/flongo
phone: +39 090 3977335 --- fax: +39 090 3977471

Software Engineer @ SmartMe.io s.r.l.
address: Via Osservatorio, 1 - 98121, Messina, Italy
email: francesco at smartme.io
web: smartme.io
VAT number: 03457040834
-------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170331/c19d5a4d/attachment-0001.html>


More information about the lxc-users mailing list