You are not logged in.

#1 2023-05-31 06:57:56

Ralf
Member
From: Ruhrgebiet
Registered: 2013-03-15
Posts: 56

systemd-nspawn booting Alpine Linux fails

Hi,

I wonder if it is possible to boot Alpine Linux by systemd-nspawn.
The Alpine user mailing list can't help with this.

• root@archlinux /home/rocketmouse 
# systemd-nspawn -bqD /mnt/m1.alpine

   OpenRC 0.47.1 is starting up Linux 6.3.5-arch1-1 (x86_64) [SYSTEMD-NSPAWN]

 * /proc is already mounted
 * /run/openrc: creating directory
 * /run/lock: creating directory
 * /run/lock: correcting owner
 * Caching service dependencies ...                           [ ok ]
 * Loading hardware drivers ...                               [ ok ]
 * Creating user login records ...                            [ ok ]
 * Setting hostname ...                                       [ ok ]
 * Setting keymap ...
loadkmap: can't open console                                  [ !! ]
 * ERROR: loadkmap failed to start
 * Loading modules ...                                        [ ok ]
 * Starting networking ...
 *   lo ...                                                   [ ok ]
 *   eth0 ...
ip: ioctl 0x8913 failed: No such device
udhcpc: ioctl 0x8933 failed: No such device
ifup: failed to change interface eth0 state to 'up'           [ !! ]
 * Starting busybox syslog ...                                [ ok ]
 * Setting keymap ...
loadkmap: can't open console                                  [ !! ]
 * ERROR: loadkmap failed to start
 * Starting busybox acpid ...                                 [ ok ]
 * Starting busybox crond ...                                 [ ok ]
can't open /dev/tty1: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty5: No such file or directory
can't open /dev/tty6: No such file or directory
can't open /dev/tty1: No such file or directory
[snip]
can't open /dev/tty6: No such file or directory
can't open /dev/tty1: No such file or directory
[snip]
can't open /dev/tty6: No such file or directory
can't open /dev/tty1: No such file or directory
[snip]

It's caught in an endless "can't open /dev/tty" loop.
Any ideas?

Regards,
Ralf

Offline

#2 2023-05-31 08:53:56

-thc
Member
Registered: 2017-03-15
Posts: 775

Re: systemd-nspawn booting Alpine Linux fails

Well - on the one hand you try to use systemd

Arch Wiki wrote:

Note: systemd-nspawn requires that the operating system in the container uses systemd init (has it running as PID 1) and systemd-nspawn is installed in the container. These requirements can be satisfied by making sure the systemd-container package is installed on the container system. The systemd-container package depends on dbus, which is not installed by default. Make sure the dbus or dbus-broker package is installed on the container system.

and Alpine uses OpenRC. It shouldn't work this way - by design.

Offline

#3 2023-05-31 09:00:40

Ralf
Member
From: Ruhrgebiet
Registered: 2013-03-15
Posts: 56

Re: systemd-nspawn booting Alpine Linux fails

Thank you,

so I'll stay with pure chroot without steroids.

Regards,
Ralf

Offline

#4 2025-01-21 12:49:36

dongdigua
Member
Registered: 2024-07-27
Posts: 3

Re: systemd-nspawn booting Alpine Linux fails

Actually, you can do it.
In your log the openrc can't open `/dev/tty`, just comment out the lines in `/etc/inittab` and add this line

console::respawn:/sbin/getty 38400 console

And here it is:

                                                                                                                                     
   OpenRC 0.55.1 is starting up Linux 6.12.9-zen1-1-zen (x86_64)                                                                                   
                                                                                                                                                   
 * /proc is already mounted                                                                                                                        
 * /run/openrc: creating directory                                                                                                                 
 * /run/lock: creating directory                                                                                                                   
 * /run/lock: correcting owner                                                                                                                     
 * Caching service dependencies ...                                                                                                                
Service 'hwdrivers' needs non existent service 'dev'                                                                                               
Service 'machine-id' needs non existent service 'dev'                                                                                        [ ok ]
                                                                                                                                                   
Welcome to Alpine Linux 3.21                                                                                                                       
Kernel 6.12.9-zen1-1-zen on an x86_64 (/dev/console)          

Offline

Board footer

Powered by FluxBB