Welcome to the Linux Foundation Forum!

Lab 3.3 - systemd-nspawn - login to container

Lab 3.3 goes through the process of debootstrapping a container and booting it. However, the explanations stop short at how to actually login and use that container.

Searching the WWW I found the answer. Before running systemd-nspawn -bD ~/DebianContainer/, run the following:

[email protected]:~# systemd-nspawn -D ~/DebianContainer/
Spawning container DebianContainer on /root/DebianContainer.
Press ^] three times within 1s to kill container.
Host and machine ids are equal (a006ae0037b045dd8276dd6252395133): refusing to link journals
[email protected]:~# passwd
New password: 
Retype new password: 
passwd: password updated successfully
[email protected]:~# exit
Container DebianContainer exited successfully.
[email protected]:~# systemd-nspawn -b -D ~/DebianContainer/

It's very simple, but without it the entire exercise is like travelling to Ghiza (Egypt) and not seeing the pyramids.


  • Hi @heiko_s,

    Thanks for your feedback. This is an elegant method indeed.
    You can also hack your way into the container by editing root entry in the /root/DebianContainer/etc/passwd file.


  • heiko_sheiko_s Posts: 99

    Thanks Chris!

Sign In or Register to comment.