[systemd-devel] Starting a container with machinectl vs nspawn

Yassine Chaouche a.chaouche at algerian-radio.dz
Wed Feb 19 14:11:18 UTC 2025


Le 2/18/25 à 11:53, Yassine Chaouche a écrit :
> Hello all,
> 
> I have been advised to use systemd-nspawn and machinectl in place of chroot to run services from a cloned, working remote host.

Another interresting behavior is when I start it with the UID shifting feature -U


   $ systemd-nspawn -bUM clone-messagerie


I could wait forever (well, more than 5 minutes)
and no login prompt would appear.

If I remove the -U flag,
the container boots fine and the login prompt is shown after around 30 seconds,
mainly because it is failing to start mysqld
(which has a hardcoded 30 seconds sleep value in its mysqld_safe shell script)


   root at messagerie-prep[10.10.10.20][CHROOT] ~ # systemd-analyze blame
            30.643s mysql.service
              925ms fail2ban.service
              481ms shorewall.service
              471ms amavis.service
              367ms postfix.service
              220ms apache2.service
               92ms lm-sensors.service
               76ms ntp.service
               67ms irqbalance.service
               66ms opendkim.service
               54ms glances.service
               50ms networking.service
               43ms systemd-logind.service
               38ms ssh.service
               38ms systemd-tmpfiles-clean.service
               38ms rc-local.service
               35ms fusioninventory-agent.service
               34ms console-setup.service
               34ms hddtemp.service
               33ms rsyslog.service
               26ms keyboard-setup.service
               17ms systemd-user-sessions.service
               14ms kbd.service
               10ms nfs-common.service
                7ms hdparm.service
                5ms systemd-journal-flush.service
                4ms amavisd-snmp-subagent.service
                4ms systemd-update-utmp-runlevel.service
                4ms amavis-mc.service
                3ms systemd-remount-fs.service
                3ms systemd-tmpfiles-setup.service
                3ms systemd-update-utmp.service
                3ms sys-fs-fuse-connections.mount
                3ms dev-hugepages.mount
                2ms udev-finish.service
                2ms systemd-random-seed.service
                1ms rpcbind.service
                1ms exim4.service
                1ms clamav-daemon.socket
   root at messagerie-prep[10.10.10.20][CHROOT] ~ #


Best,

-- 
yassine -- sysadm
http://about.me/ychaouche
Looking for side gigs.


More information about the systemd-devel mailing list