FreeBSD 13 x86 64bit no longer boots after recent updates

Hi,

I had a FreeBSD 13 x86 64 (amd64 architecture) server running and working fine with a ZFS mirrored setup with two disks.
ada0 and ada1 in zfs mirror.

Two days ago I applied the latest FreeBSD updates using the freebsd-fetch and freebsd install commands.
I have done this lots of times and never had an issue until now.
My server no longer boots.

Here is what I see if I try to boot from ada0 and ada1

ada0 has no output just a cursor flashes on boot on the screen and nothing happens !
ada1 has this output
------ 8< -----
/boot/config:
FreeBSD/x86 boot
Default: bootpool
boot:
\
Can't find

FreeBSD/x86 boot
Default: bootpool:
boot:
------ 8< -----

I have two ZFS pools, bootpool and zroot as per the attached screen shots.
Created a FreeBSD 13 Release USB rescue disk and booted the server.

Run these commands to try to fix the boot code but I still can not boot the server from either disk.
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

When I do a zpool import -o altroot=/tmp bootpool
I can access and see the files.

Lost now on how to fix this, thanks for your help !
 

Attachments

  • IMG_2F6B175192A6-1.jpeg
    IMG_2F6B175192A6-1.jpeg
    754.2 KB · Views: 96
  • IMG_94EC0B050E9C-1.jpeg
    IMG_94EC0B050E9C-1.jpeg
    655 KB · Views: 105
  • IMG_79262CED0200-1.jpeg
    IMG_79262CED0200-1.jpeg
    550.3 KB · Views: 101
  • IMG_D86F42BBC3B1-1.jpeg
    IMG_D86F42BBC3B1-1.jpeg
    564.5 KB · Views: 90
freebsd-update(8) doesn't update your boot code, you always have to do this yourself. So the update had nothing to do with it, you just noticed it because you had to reboot after the update.

Run these commands to try to fix the boot code but I still can not boot the server from either disk.
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1
Those commands look fine, IF you use CSM boot and freebsd-boot is the first partition (index 1). If you have an EFI booting system then those commands are going to break things. It's also possible you have an install that can EFI boot and CSM boot. You will need to verify the partitions on the disk, post the output from gpart show.
 
Thanks SirDice !
So one thing I need to add is, I do not remember seeing the nice FreeBSD boot options when my server boots so how do I reinstall the bootcode ?
Can you please take a look at the screenshots, I think it has the information you just asked.
What does CSM boot stands for ?
 
I do not remember seeing the nice FreeBSD boot options when my server boots so how do I reinstall the bootcode ?
Those boot options (the "beasty" menu) are done by loader(8), your system is stuck before loading loader(8).
Can you please take a look at the screenshots, I think it has the information you just asked.
Yes, and as you can tell from the output, partition 1 is your efi partition. So pay attention when writing gptzfsboot(8), it has to go to your freebsd-boot partition. The freebsd-boot is index 2 in your case. You probably also want to rewrite the efi bootcode. The efi partition is a FAT32 filesystem, you can mount that with mount_msdosfs(8). Then copy /boot/loader.efi to EFI/BOOT/BOOTx64.efi (actual capitalization doesn't matter, FAT32 is case-insensitive) of that filesystem.
 
I recomend to reinstall evrything from the begining. Seems like it is problem with bad disk sectors. Change the disks
 
Thank you SirDice !

I see, so I was overwriting the wrong slice(slice 1 in my case) ?
So based on your last post should it be ?

1) Install into the 2nd index the GPT bootcode for ZFS on both disks.

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada1

2) fix the EFI
 
You destroyed your EFI partitions. You need to reformat them and copy loader.efi:

newfs_msdos /dev/ada0p1
mount -t msdosfs /dev/ada0p1 /mnt
mkdir -p /mnt/efi/boot
cp /boot/loader.efi /mnt/efi/boot/bootx64.efi
umount /mnt

And the same for ada1p1.

Your EFI partitions are only 800 KiB sized (is it a very old installation?). I hope there will be enough room for loader.efi and the file system. Normally, you should have 200 MiB partitions. If not now, you will have to start a new FreeBSD installation from scratch (you can also just use BIOS booting).
 
Your EFI partitions are only 800 KiB sized (is it a very old installation?). I hope there will be enough room for loader.efi and the file system. Normally, you should have 200 MiB partitions. If not now, you will have to start a new FreeBSD installation from scratch (you can also just use BIOS booting).
Good call. If it's too small for loader.efi to fit you can copy boot1.efi to EFI/BOOT/BOOTx64.efi instead.
 
Success ! ;-)
Thank you for your help SirDice and Emrion

OK so indeed I was blindly following some manuals when infact my efi partition is on index 1 and my FreeBSD boot lives on index 2 of my drives.
loader.efi is 875K so used boot1.efi 112K to copy it to the efi partition(slice).
The hard drives are healthy and both zpool are online.

Emrion, yes this is an older install, from 2016 off the FreeBSD CD at the time.


gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada1

# the default is /EFI/BOOT/BOOTX64.EFI says man uefi
cp /boot/boot1.efi /mnt/EFI/BOOT/BOOTX64.EFI


I do not know if the EFI files are case sensitive or not being an msdos filesystem but went with capital names.

Thanks again guys, have a great day !!
 
EFI files aren't case sensitive.

Concerning your EFI partitions (we speak of slice only for a MBR scheme), it's ok now, but keep in mind that boot1.efi "has been deprecated and will be removed from a future release".

See boot1.efi(8).

So, a reinstallation is inevitable, soon or late.
 
As a user with both a freebsd-boot 512K and an efi partition 1M, which works despite my not knowing which one is imperitive[1], I wish this stuff was better documented.
[1] indeed, which one was booted off of even now. [ off-topic, no ZFS boot currently in use ]
 
As a user with both a freebsd-boot 512K and an efi partition 1M, which works despite my not knowing which one is imperitive[1], I wish this stuff was better documented.
[1] indeed, which one was booted off of even now. [ off-topic, no ZFS boot currently in use ]
sysctl machdep.bootmethod

It's a good idea to select both booting capabilities at installation time. If one dies, you can switch to the other (BIOS settings).
 
I wish this stuff was better documented.
The part of boot1.efi being deprecated was documented when 13.0 was released. As far as if the documentation could be better, sure. The one thing that is always a problem on pretty much all open source projects, is documentation. That part is also always welcome for additional help, you don't even need to be a programmer.
 
Back
Top