MikeL's FreeBSD Broken boot

[20230629]
Continuing on from yesterday - I was able to get the second VD to come back.
I rebooted and hit "R" to enter PERC and created a new VD with the smae specs as it had been established on the old machine - raid 5, all 3 disks, default stripe size etc.. Then, when given the option to initialize, I chose not to. When I boot back up, I was able to mount it, and the previous dir structure is intact.

[20230628]
FreeBSD12.4
I just moved a complete raid 5 set, two virtual disks of 3 drives each from a Dell R710 to a Dell R730. The second virtual drive did not make it through when I did the "f" to import foreign config, the 3 disks simply appeared as "unconfigured".

This left me in the same position as below, at the primitive sh prompt with no system - most importantly, no 'vi' in /bin. I knew that all I needed to do was comment out the second virtual disk mount line in /etc/fstab, but there was no editor.

Fortunately, there is a 'vi' in the /rescue directory, which allowed me to make the changes as described below.


[20221228]
I just typoed in my rc.conf and had to go through this mess to get back to a running system. I was able to copy the emacs "~" file back into place, and reboot and all was well. But I'm tired of bumping into this, I want a tester app. I'm pretty sure I'll be able to train myself to run it when I make changes. Maybe I can find a way to build it into shutdown -- I'll have to look into that later.

Anyways - dirt simple /etc/rc.conf checker:
cd into your local bin directory, and create the following:
    echo sysrc -a>rccheck
    chmod 755 rccheck
If you prefer a simple y/n, you could do:
    echo 'sysrc -a >& /dev/null' > rccheck
    echo 'echo $?'>>rccheck (must use apostrophe, not quote) -- 1 means error, zero is success


[20210517]
I just replaced my second drive with a larger one. It's actually RAID config, but this should not matter. Bottom line is that I forgot to modify /etc/fstab and remove the 2nd drive entry before doing the replacement. The system now boots to "mountroot" - badness.
First is to get to the disk: ufs:mfid0s1
Now you should be able to modify /etc/fstab and comment out that 2nd disk line. You may have to play some games as below to get a writable filesystem. I could not seem to get 'vi', so I tried using 'ex'. All this achieved was to nuke (delete) my fstab file. Very, very badness.
Next boot you get to a command prompt and are unable to do anything. You cannot change the drive to writable as the mount command will puke due to missing fstab. The only fix is configure a memstick image and boot that, then mount the drive manually, and fix the file.
Unfortunately for me, there was something else fucked up ('libdev6.so' missing or some such), and simply putting a new fstab into place did not fix it. In the end I had to boot to command shell, 'newfs' each partition on the drive, then reinstall the OS from the memory key.
Everything on the base drive (/, /usr, /var) was lost to a blank install. It took several days of messing around and googling just to get to this point. All this because I simply forgot to comment out the fstab entry for the 2nd disk.
[20200427]
Ok, you've fucked up a boot config file, and the system won't start enough to get in. This can happen by: Here's how to recover.
  1. Reboot/power cycle if necessary.
  2. When you get to the FreeBSD beastie screen, hit ESC.
  3. At the "OK" prompt, boot to "single user" mode.
    boot -s
  4. When prompted, hit Enter to start /bin/sh.
  5. If filesystem was not shut down nicely, we need to fix it. We only need to worry about the root filesystem at this time.
    fsck -y /
  6. Update root filesystem to read/write mode from read-only.
    mount -u /
  7. You can now 'cd' to the affected directory, and fix the problem. If you use 'emacs' as I do, simply 'mv' the broken file out, and 'mv' the emacs backup file (same filename with trailing tilda '~') into place.
  8. You'll need to start over with a full reboot.
    reboot

Copyright © 1995-2024 Mike Lempriere (running on host bayanus)