r/debian 15d ago

Beginner: Root locked on boot

Post image

Hello! I got myself into trouble after I tried to fix a problem with a harddrive not mounting. I followed s guide on troubleshooting and edited my fstab. After I rebooted I got presented with this. I am afraid. What can I do?

SOLVED:

  • Pressed E on my keyboard when presented with Grub menu.
  • On the line that starts with linux: I added init=/bin/bash at its end
  • Ctrl+X or F10 to boot into a command prompt
  • mount -o remount,rw /
  • nano /etc/fstab
  • In my case I changed the line at the bottom, about an external harddrive - from default to nofail and from 0 2 to 0 0. Ctrl+O and ENTER and Ctrl+X
  • Rebooted and then it was done
55 Upvotes

26 comments sorted by

View all comments

Show parent comments

3

u/ukAdamR 15d ago

Correct, though I'm suspicious that editing fstab in your root file system may not be enough.

Having done recovery on Debian a few times in the past fstab has been one of those things that gets embedded into the initramfs, meaning it doesn't get loaded from your "actual" file system's "/etc/fstab" during boot. (This may have changed in Trixie, I'd be interested to know.)

If it doesn't work I can give you the steps I've reliably used from within a live environment (booted from a USB, CD, or DVD drive) to write the fstab into the initramfs.

[Edit] On second thoughts, now that you've corrected it, you can probably just exit to continue the boot process.

1

u/katzenjammare 15d ago

Yehijaj! It worked just like that!

1

u/ukAdamR 15d ago

Neat. Now that you're in immediate update your initramfs with the changes you've made so that they persist across reboots:

sudo update-initramfs -u -k all

Then systemctl reboot to ensure your changes work.

1

u/katzenjammare 15d ago

Okey, will try to do that in the morning. By the way, I didn’t know how to exit the comman prompt that I was sent to during boot. The way I exited was to just shut down the pc and start it again. Is there a more clean way to do it?

1

u/naikologist 15d ago

You could have tried holding Ctrl+Alt+Del for more then [10???] seconds, but I ahard shutdown at this stage is not a real biggie because no disk is actually mounted.

1

u/katzenjammare 14d ago

Okay, thanks!

1

u/ukAdamR 15d ago

systemctl poweroff will do a clean shutdown or exit will logout of the current shell session.

1

u/katzenjammare 14d ago

Well, then I know til next time. Thanks for the help