Solved Upgrading boot code prior to upgrade to 14.0-RELEASE

When upgrading to 13.2-RELEASE I ran into an issue after a restart. I found out that I hadn't upgraded the bootcode prior to the OS upgrade. I fixed it using a usb stick and I don't remember what else (gpart bootcode or something like that, will have to check if I still have the irc logs) Well, I don't want to ran into the same problems once again so I've been trying to understand the necesary steps to upgrade the bootcode properly.

This are how are the mirrored disks are partitioned.
Code:
uname -r ; gpart show -p
13.2-RELEASE-p4
=>        40  3907029088    da0  GPT  (1.8T)
          40      409600  da0p1  efi  (200M)
      409640        1024  da0p2  freebsd-boot  (512K)
      410664         984         - free -  (492K)
      411648    16777216  da0p3  freebsd-swap  (8.0G)
    17188864  3889840128  da0p4  freebsd-zfs  (1.8T)
  3907028992         136         - free -  (68K)

=>        40  3907029088    da1  GPT  (1.8T)
          40      409600  da1p1  efi  (200M)
      409640        1024  da1p2  freebsd-boot  (512K)
      410664         984         - free -  (492K)
      411648    16777216  da1p3  freebsd-swap  (8.0G)
    17188864  3889840128  da1p4  freebsd-zfs  (1.8T)
  3907028992         136         - free -  (68K)

These are the mounted datasets:

[freebsd:~ $]> zfs mount
zroot/ROOT/default              /
zroot/ROOT/default/adc1         /usr/jails/jails-data/adc1-data
zroot/ROOT/default/mailrelay    /usr/jails/jails-data/mailrelay-data
zroot/ROOT/default/smbshare     /usr/jails/jails-data/smbshare-data
zroot/ROOT/default/sync         /usr/jails/jails-data/sync-data
zroot/ROOT/default/ubuntu2      /usr/jails/vm/ubuntu2
zssd                            /zssd
zroot/tmp                       /tmp
zroot/var/log                   /var/log
zroot/var/mail                  /var/mail
zroot                           /zroot
zroot/usr/src                   /usr/src
zroot/var/audit                 /var/audit
zroot/var/crash                 /var/crash
zroot/var/tmp                   /var/tmp
zroot/usr/home                  /usr/home
zroot/usr/ports                 /usr/ports

When I try to copy the bootx64.efi as per Update of the bootcodes for a GPT scheme I get an error "invalid argument".

CODE][freebsd:~ $]> sudo mount -t msdosfs /dev/da0p1 /mnt ; sudo file -s /dev/da0p1
mount_msdosfs: /dev/da0p1: Invalid argument
/dev/da0p1: data[/CODE]

If my EFI partitions don't have a MSDOS filesystem, what are they? How could it be that I can still reboot and start the OS?
I'm still booting BIOS (?)
Code:
[freebsd:~ $]>  sysctl machdep.bootmethod
machdep.bootmethod: BIOS
o_O

Anyone with exprience with Dell servers?
idrac8-select_boot.jpg


So first I should upgrade the EFI files and then set the server to boot in UEFI mode?

Docs read prior to this post:
 
Since I was booting in BIOS and the EFI partition couldn't be mounted I formated the partition and copied the loader.efi file.
Code:
[freebsd:~ $]> sudo newfs_msdos -F 32 -c 1 /dev/da0p1
Password:
Sorry, try again.
Password:
/dev/da0p1: 403266 sectors in 403266 FAT32 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=409600 FATsecs=3151 RootCluster=2 FSInfo=1 Backup=2

[freebsd:/mnt $]> sudo mkdir -p /mnt/EFI/BOOT
[freebsd:/mnt $]> sudo cp /boot/loader.efi /mnt/EFI/BOOT
[freebsd:/mnt $]> cd /EFI/BOOT
cd: /EFI/BOOT: No such file or directory
[freebsd:/mnt $]> cd EFI/BOOT
[freebsd:/mnt/EFI/BOOT $]> ls -al
total 890
drwxr-xr-x  1 root  wheel     512 Nov 16 19:54 .
drwxr-xr-x  1 root  wheel     512 Nov 16 19:54 ..
-rwxr-xr-x  1 root  wheel  909824 Nov 16 19:54 loader.efi
[freebsd:/mnt/EFI/BOOT $]> sudo mv loader.efi BOOTx64.efi
 
You code excerpt doesn't show if you actually mounted /dev/da0p1 to /mnt.
Yes it seems I forgot to copy that line.
I could mount it and copied the loader.efi file. That should be it isn't it? Here are the commands for the EFI partition in the 2nd. disk.
Code:
[freebsd:~ $]> sudo newfs_msdos -F 32 -c 1 /dev/da1p1
Password:
/dev/da1p1: 403266 sectors in 403266 FAT32 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=409600 FATsecs=3151 RootCluster=2 FSInfo=1 Backup=2
[freebsd:~ $]> mount -t msdosfs /dev/da1p1 /mnt
mount_msdosfs: /dev/da1p1: Operation not permitted
[freebsd:~ $]> sudo mount -t msdosfs /dev/da1p1 /mnt
[freebsd:~ $]> sudo mkdir -p /mnt/EFI/BOOT
[freebsd:~ $]> sudo cp /boot/loader.efi /mnt/EFI/BOOT/BOOTx64.EFI
[freebsd:~ $]> umount /mnt
umount: unmount of /mnt failed: Operation not permitted
[freebsd:~ $]> sudo umount /mnt
 
Yes, definitely make sure you actually mount it. Also, just copy the file with the right name, then you don't have to rename it, i.e. sudo cp /boot/loader.efi /mnt/EFI/BOOT/BOOTx64.efi

Note that capitalization doesn't matter for the FAT filesystem, so bootx64.efi, BoOtx64.eFi or BOOTx64.efi are all fine.
 
Yes, definitely make sure you actually mount it. Also, just copy the file with the right name, then you don't have to rename it, i.e. sudo cp /boot/loader.efi /mnt/EFI/BOOT/BOOTx64.efi

Note that capitalization doesn't matter for the FAT filesystem, so bootx64.efi, BoOtx64.eFi or BOOTx64.efi are all fine.
Ok then, I will change the boot to UEFI in idrac and hope for the best. ;)
Maybe better try it tomorrow at work and not remotely late at night as it is right now.
 
You may need copy /boot/loader.efi to the ESP (EFI system partition) with the corresponding locations which you can find via 'efibootmgr -v'

In my case I had to copy /boot/loader.efi to /boot/efi/efi/freebsd/loader.efi where /boot/efi is the UEFI mounted partition. I also copied /boot/loader.efi to //EFI/BOOT/BOOTx64.efi (the path from UEFI's perspective) to /boot/efi/efi/boot/bootx64.efi since bootx64.efi is a UEFI default.
 
  • Thanks
Reactions: s2r
Back
Top