Welcome to the new Linux Foundation Forum!

Chapter 2 - Lab: Container Login

Robson EstevesRobson 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

  • nkharenkhare 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:-

     

    [email protected]:~# debootstrap --arch=amd64 stable ~/DebianJessie

    [email protected]:~# chroot ~/DebianJessie/ /bin/bash

    [email protected]:/# passwd

    Enter new UNIX password:

    Retype new UNIX password:

    passwd: password updated successfully

     

    [email protected]:~# 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

  • nkharenkhare 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:-

     

    [email protected]:~# debootstrap --arch=amd64 stable ~/DebianJessie

    [email protected]:~# chroot ~/DebianJessie/ /bin/bash

    [email protected]:/# passwd

    Enter new UNIX password:

    Retype new UNIX password:

    passwd: password updated successfully

     

    [email protected]:~# 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 EstevesRobson Esteves Posts: 20
    edited May 2017

    Done and works fine! Thanks again Neependra.

    BR

    Robson

Sign In or Register to comment.