Welcome to the Linux Foundation Forum!

Chapter 2 - Lab: Container Login

Robson Esteves
Robson Esteves Posts: 20
edited May 2017 in LFS253 Class Forum

Hi,

In the Lab regarding systemd-nspawn, the Debian container created presentes a login prompt. What's the user and password to login? 

Other point: I tried to create a container using a different OS: using debootstrap I deployed a Ubuntu Trusty. After that I used systemd-nspawn -bD command to create the container in this OS.

As the next step I opened a new window and access de VM and using the machinectl commands I verify the status of the container and was running.  I tried to access the container using machinectl login container name, but without sucess....

A message informing something about "a bus not present"....

In summary: how I can login the containers created using systemd-nspawn? What are the options for that?

Thanks!

Robson

Comments

  • nkhare
    nkhare Posts: 9
    edited May 2017

    Hi Robson, 

     

    The lab given in this chapter is to showcase that we can start the containers using systemd-nspawn

     

    If we would like to login, then we need to first set the password for root user or create a new user. For that can use chroot after the debootstrap step and before the systemd-nspawn step, like following:-

     

    root@ubuntu-512mb-nyc3-01:~# debootstrap --arch=amd64 stable ~/DebianJessie

    root@ubuntu-512mb-nyc3-01:~# chroot ~/DebianJessie/ /bin/bash

    root@ubuntu-512mb-nyc3-01:/# passwd

    Enter new UNIX password:

    Retype new UNIX password:

    passwd: password updated successfully

     

    root@ubuntu-512mb-nyc3-01:~# systemd-nspawn -bD ~/DebianJessie

    ...

    ...

    [  OK  ] Started Update UTMP about System Runlevel Changes.

     

    Debian GNU/Linux 8 ubuntu-512mb-nyc3-01 console

     

    ubuntu-512mb-nyc3-01 login: root

    Password:

    Linux ubuntu-512mb-nyc3-01 4.4.0-77-generic #98-Ubuntu SMP Wed Apr 26 08:34:02 UTC 2017 x86_64

     

    Hope this helps. 

     

    Thanks, 

    Neependra

  • nkhare
    nkhare Posts: 9
    edited May 2017

    Hi Robson, 

     

    The lab given in this chapter is to showcase that we can start the containers using systemd-nspawn

     

    If we would like to login, then we need to first set the password for root user or create a new user. For that can use chroot after the debootstrap step and before the systemd-nspawn step, like following:-

     

    root@ubuntu-512mb-nyc3-01:~# debootstrap --arch=amd64 stable ~/DebianJessie

    root@ubuntu-512mb-nyc3-01:~# chroot ~/DebianJessie/ /bin/bash

    root@ubuntu-512mb-nyc3-01:/# passwd

    Enter new UNIX password:

    Retype new UNIX password:

    passwd: password updated successfully

     

    root@ubuntu-512mb-nyc3-01:~# systemd-nspawn -bD ~/DebianJessie

    ...

    ...

    [  OK  ] Started Update UTMP about System Runlevel Changes.

     

    Debian GNU/Linux 8 ubuntu-512mb-nyc3-01 console

     

    ubuntu-512mb-nyc3-01 login: root

    Password:

    Linux ubuntu-512mb-nyc3-01 4.4.0-77-generic #98-Ubuntu SMP Wed Apr 26 08:34:02 UTC 2017 x86_64

     

    Hope this helps. 

     

    Thnaks, 

    Neependra

     

  • Robson Esteves
    Robson Esteves Posts: 20
    edited May 2017

    Done and works fine! Thanks again Neependra.

    BR

    Robson

Categories

Upcoming Training