Debian Buster terminal autologin

6,288

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
Share:
6,288

Related videos on Youtube

schrodingerscatcuriosity
Author by

schrodingerscatcuriosity

Musician at heart, working as technician, GNU/Linux enthusiast since a couple of years.

Updated on September 18, 2022

Comments

  • schrodingerscatcuriosity
    schrodingerscatcuriosity almost 2 years

    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 [email protected] 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.

    • JdeBP
      JdeBP over 4 years
      Does this answer your question? How do you configure autologin in Debian Jessie?
    • schrodingerscatcuriosity
      schrodingerscatcuriosity over 4 years
      @JdeBP The problem in my case is that I can't run systemctl, wich gives me the error I posted in the question.
    • John Hawthorne
      John Hawthorne over 4 years
      How are you repacking the live OS? It doesn't sound like you are using this, but the live-build package is for building custom live images. It's easy enough to use and you don't have to unpack anything.