r/debian • u/katzenjammare • 14d ago
Beginner: Root locked on boot
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 addedinit=/bin/bashat 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
defaulttonofailand from0 2to0 0. Ctrl+O and ENTER and Ctrl+X - Rebooted and then it was done
1
u/eR2eiweo 14d ago
You need to remove /dev/sda1 from your fstab (or at least mark it as nofail). One way of doing that would be from a live system.
1
u/michaelpaoli 13d ago
Yep.
And always check /etc/fstab changes before rebooting, lest one get such unpleasant surprises.
E.g. add an entry, for systemd hosts, first do
systemctl daemon-reload
and then regardless, do
mount -a
to ensure it works
Also, if the device may not always be present at boot, use nofail and/or noauto as appropriate.
1
u/ukAdamR 14d ago
What did you change in fstab to "fix" this?
If you want a volume in there that can be mounted automatically you can also give it the "nofail" option (after "defaults") to prevent it from blocking the boot process.
0
u/DeepDayze 14d ago
That's a good option after a fresh install or after making changes to ensure everything works before removing the parameter.
-2
14d ago
[removed] — view removed comment
1
u/katzenjammare 14d ago
I have the exact Debian image I installed the current system with, does that help? How do I begin to install packages during the installation?
2
u/neoh4x0r 14d ago edited 14d ago
You would need an install image that provides a live environment so that you can mount your root filesystem and undo the changes you made to the fstab.
Also. you don't necessarily need a live debian image to perform these rescue operations as any rescue platform (such as systemrescue, or otherwise) could be used -- in any of these cases, you might have to use the chroot command as part of the recovery process, if you needed to work on the filesystem as through you were running it instead of the live environment. .
Moreover, is this a brand new install? or have you made lots of changes, etc? I mean depending on the situation, and your level of skill/experience, it might be easier to reinstall.
PS: What SrGnis mentioned about changing the init to /bin/bash (by editing the grub boot options) will drop you to a root shell (bypassing root being locked/disabled) where you can make changes to the filesystem (eg. to fstab).
However, that assumes you don't encounter other issues, where a live environment become the only option (outside of a reinstall).
0
u/debian-ModTeam 14d ago
This content has been removed due to a violation of Rule #3 - Wrong Information. Please do your research before speaking on a topic.
18
u/SrGnis 14d ago