LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Boot failure following loss of BIOS settings (https://www.linuxquestions.org/questions/linux-software-2/boot-failure-following-loss-of-bios-settings-4175695083/)

gumb 05-13-2021 11:07 AM

Boot failure following loss of BIOS settings
 
Just went away for a week and switched off the PC tower with the button on the PSU at the back, only to now switch it back on and see the BIOS is back to defaults because the battery's run down. I restored all the BIOS settings to what I'm pretty sure are as before, but my AV Linux install no longer boots. It gets past GRUB and seems to recognise the root partition which is housed on the second disk (sdb1), going through the initial start-up steps, but then won't recognize /home at sda3, and another data partition - 'av_media' - on the second disk (sdb2) and hangs. There's a FAILED message for a File System Check, followed by
Code:

[DEPEND] Dependency failed for /home.
[DEPEND] Dependency failed for /home/av_media.
[DEPEND] Dependency failed for Local File Systems.
[DEPEND] Dependency failed for home-media.automount.

It then says I'm in emergency mode and must give root password for maintenance. I don't know where this emergency system is running from but trying to list directories only shows 'root', so I mounted root (sdb1) and did a chroot to it. I can see all my files, and can also mount home (sda3) and see that too.

Looking up some instructions online I ran
Code:

blkid | grep -v loop
and can see the UUID strings of all partitions match those in fstab.

This old PC has an ancient WinXP install on the first disk (sda1) which still boots without issue. I wonder if a boot flag has become corrupted or lost on one disk or the other. I put in a Partition Magic live CD but from there I'm unable to mount the problem partitions. Nothing happens. I don't know enough about fdisk and parted from the CLI to see if there's anything useful I can do there. I looked at their help files but I'm stumped.

I'm hoping somebody recognizes this as a known problem that can occur after a loss of BIOS, with an easy fix!

elgrandeperro 05-13-2021 01:06 PM

You should be able to boot to single user mode, not rescue mode. That way you don't have to chroot.

I don't think it is a BIOS problem, I think it is not being booted in a long time. You said you mounted the filesystems, did you fsck them? I'd first fsck them, then check the fstab to make sure they are set up correctly, then issue like "mount /home" instead of the specific mount to see if it will read and mount it.

Check that the sixth fstab field is set to 2, not 0 for these filesystems so they are fsck'ed.

jefro 05-13-2021 04:00 PM

Wonder if somehow the device order is messed up causing the naming to be wrong. Usually on newer stuff that won't happen.

I'd boot to some live media of similar or exact distro to run file checks if you don't want to play with rescue mode.

mrmazda 05-13-2021 11:16 PM

Emergency mode operation is provided by the initrd.

The BIOS probably has nothing to do with this, except maybe if you neglected to set the BIOS clock before exiting setup.

Apparently pulling the plug before your time off caused corruption that cannot be automatically corrected. In emergency mode you can't expect mounting of all filesystems, especially corrupted ones. What you can do from within emergency mode in this case, because / is mounted, is to run fsck manually on your /home and /av_media filesystems. If success, then next boot should be back to normal.

openSUSE defaults to btrfs on /, which needs its repair to be made via btrfs check --repair.

gumb 05-14-2021 02:24 AM

Well, colour me befuddled. I tried to run
Code:

fsck.ext4 /dev/sda3
and got a message saying unable to run fsck, partition is in use. So I did
Code:

umount /mnt/home
(that's where I'd mounted it)
but still got the message saying it was in use. Too tired to look at it any more last night I just typed exit thinking I'd shutdown, only for the console to go away and the regular graphical login screen to appear. After logging in those drives are mounted, and at first things seem normal, but I just fired up GParted and can see the following:
Code:

Partition  File System  Mount Point
/dev/sda1  ntfs
/dev/sda2  linux-swap
/dev/sda3  ext4          /home,/mnt
/dev/sdb1  ext4          /,/mnt
/dev/sdb2  ext4          /home/av_media

So sda3 and sdb1 are seemingly mounted twice including at /mnt (with home at /mnt, not /mnt/home like I specified on the command line), the others are as normal.

Other than rebooting I don't know how to get back to a point where I could run fsck on the home and media partitions. Is there anything else I should look at whilst I'm in the GUI? Note that it was the automatic fsck at boot which was showing the FAILED message whereafter it dumped me in emergency mode. I've never run fsck manually before and don't really understand any of the options. Is it usually safe to let it automatically fix errors or do I risk losing data?

fatmac 05-14-2021 03:19 AM

Directories can be mounted over previous mounts, which is what appears to be happening.

If you can, find out what is mounting those two directories under /mnt.

Edit: If you mounted those directories, unmount them & see what happens.

elgrandeperro 05-14-2021 11:44 AM

Gparted might be reading the "last mounted" field in the filesystem itself as well as fstab. That is why there are 2 reported paths.

I do fsck only in single user mode. The directories should not be mounted at all when you start. Check via mount command.

I'd trust mount command, even there are cases where it can be fooled (mtab corrupted).

Do fsck by path, and check if it checks the right device, "fsck /home" not fsck /dev/sda3. I'd still check your fstab to make sure the sixth field and mount points are right.

gumb 05-14-2021 12:42 PM

[SOLVED] Boot failure following loss of BIOS settings
 
I rebooted and got the same errors so logged in at the prompt as root, then ran fsck on /dev/sda3 (home). That reported a few inode errors so I took the suggested action and auto-corrected them. Then a slew of other errors appeared, mostly in Firefox cache files. After confirming the correction of a dozen individually, I could see I was going to be there all night so typed 'a' to auto-confirm and saw a couple of hundred scroll by. Running fsck on the other drives said there were no errors.

After all that, rebooted and it reached the GUI as normal. This is not my main machine, it's a lumbering old device I'm having to keep around until I figure out some way to replace some processes so I don't think there'll be any major damage. It's just another prompt for me to get on with sorting it out because that drive on sda is ancient and probably starting to fail.

Thanks for all the replies.

elgrandeperro 05-14-2021 05:38 PM

I still think fstab might be wrong. Linux will manage this itself and should go into fsck and fail or run by itself. Check the sixth field of the entries, should be non-zero (I think it is often 2).

mrmazda 05-14-2021 07:03 PM

Linux is the name of the kernel. The kernel never writes to fstab. It only mounts filesystems as /etc/fstab directs. A distro's installation system will write an initial one, but the admin must make edits to it whenever /etc/fstab content has somehow become inappropriate.

elgrandeperro 05-15-2021 10:00 AM

I mistyped, I meant it manages whether to fsck on boot, not the fstab itself. If fsck is required, it SHOULD do it for all known filesystems in fstab unless you disable it via field six. And fsck will just run (on boot) if
a filesystem has not fscked given a time value in the superblock or the filesystem was not unmounted cleanly.


All times are GMT -5. The time now is 06:12 AM.