2

I have an old (Linux 2.4.20) Debian server where I forgot the root password. When I try to enter single user mode then some init script never exits. It used the LILO boot loader. I want to change the root password and therefore I tried booting to single user mode. But when I try and boot to single user mode the system won't boot all the way. It stops when trying to run a custom init shell script. It says executing....

Can you please advice me what I can do? I want to change to root password in single user mode but now I don't dare to reboot it because Crtl+Alt+Delete doesn't work for reboot during boot.

5
  • 3
    How you try to enter in single mode? init=/bin/sh? Jul 11, 2017 at 8:49
  • @AlexanderT No. At LILO boot loader I typed linux single. Then the boot process hanged. Jul 11, 2017 at 8:51
  • 2
    Try to boot with "linux init=/bin/sh" as @AlexanderT suggests.
    – NStorm
    Jul 11, 2017 at 13:03
  • 1
    @NStorm you could try bash instead of sh. Jul 11, 2017 at 13:20
  • It worked. I'm in. I could change the password. Thanks guys! Jul 11, 2017 at 13:23

1 Answer 1

5

I'd boot via a live distro such as Debian Live or Knoppix, ensure you have access to local drives, gain root privilege using su - or sudo -s, depending on distro.

Mount the / partition and change root's password this way:

mkdir /mnt/youroot
mount /dev/youroot /mnt/youroot
chroot /mnt/youroot /bin/bash
passwd root
exit 
umount /mnt/youroot

Reboot (remove live distro from cd/usb).

And that's it!

Edit #1: After your edit I'm assuming that you are using a remote KVM, and you can't just walk at the server and pull the cable, and so you have very few options. I'd just try Crtl+Alt+F2 (3,4,...12), Crtl+C, Crtl+Z, to check if I can get a prompt.

Check out the user manual for the KVM you are using because you should probably be able to issue a soft/hard reboot right from the remote console.

If you are still stuck at boot and can't reboot in any way you'll have to ask your hosting/provider to issue an hard reboot.

2
  • Thanks for the answer. Actually I can walk at the server. I have physical access to the server. I'm going to try what you say tomorrow. Today I don't have a LiveCD and the xSeries 345 can't boot from USB. I think it could be done if I make a LiveCD and boot with it and then issue your instructions. Jul 11, 2017 at 12:55
  • Some hosting providers offers a way to netboot a live system.
    – kasperd
    Jul 16, 2017 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .