1

I'm repacking a Debian Buster Live ISO. I first unpack the filesystem.squashfs, then chroot in the unsquashed system, make my changes.

I want my ISO to autologin (terminal). I've followed this techniques, but I failed because I get the error:

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

So I can't use systemctl, which throws this error.

The answers I've found here to bypass the error say to use service instead of systemctl, which doesn't apply in my case.


Is poosible to autologin using another technique?

Is possible to get systemctl functioning inside a chroot, so I can apply above technique?


Tentative answer:

I created the file getty@tty.service under /lib/systemd/system and made a sysmlink in /etc/systemd/system/multi-user.target.wants/. The contents of the file.

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear %I 38400 linux

This got me into autologin. I'll wait for insight before answer my own question.

1 Answers1

2

Note: This may be or may be not related to your problem, but the problem I explain here will lead to the same error messages you have shown due to a missing symlink.

I am not an expert, but in Debian 10 (Buster) the default init system is systemd which means /sbin/init (/usr/sbin/init) will link to systemd.

Unfortunately there is a bug I noticed when running multiple KVM guests which causes that the symlink /sbin/init which links to /lib/systemd/systemd is removed. I don't know the reason for that, however, I suspect that org.freedesktop.systemd1 (I absolutely don't know what that is) could be the reason.

Correct Symlink

The correct output would be:

root@vpstest:~# ls -la /sbin/init
lrwxrwxrwx 1 root root 20 Jan 29 19:07 /sbin/init -> /lib/systemd/systemd

Missing Symlink

If it shows that, there may be something wrong:

root@vps1:~# ls -la /sbin/init
-rwxr-xr-x 1 root root 53016 Feb 14  2019 /sbin/init

Fix

To fix that, I just remove that file and rebuild the symbolic link:

rm /sbin/init && ln -s /lib/systemd/systemd /sbin/init

When you're using virsh you need to destroy and then start the guest:

virsh destroy vps1 && virsh start vps1