[GhostBSD] Missing boot loader - boot on zfs & bios-boot

Hi,

this is a crosspost from the GhostBSD forum, I didn't get an answer there.

I had a working GhostBSD installation, but suddenly I'm getting "Missing boot loader".

So I put the current ISO of GhostBSD MATE 64-bit on an USB stick and booted from it.

My disk configuration:
Code:
ghostbsd@ghostbsd:~ % gpart show
=>       34  976773101  ada0  GPT  (466G)
         34          6        - free -  (3.0K)
         40       2048     1  bios-boot  (1.0M)
       2088  960043008     2  freebsd-zfs  (458G)
  960045096   16723968     3  freebsd-swap  (8.0G)
  976769064       4071        - free -  (2.0M)

=>        34  7814037101  ada1  GPT  (3.6T)
          34        2014        - free -  (1.0M)
        2048  7814033408     1  freebsd-ufs  (3.6T)
  7814035456        1679        - free -  (840K)

=>        40  5860533088  ada2  GPT  (2.7T)
          40  5860533080     1  freebsd-zfs  (2.7T)
  5860533120           8        - free -  (4.0K)

=>      64  30282881  da0  GPT  (14G)
        64      1552    1  ms-basic-data  (776K)
      1616      5760    2  efi  (2.8M)
      7376   4903580    3  ms-basic-data  (2.3G)
   4910956  25371989       - free -  (12G)

=>  63  5697  da0p2  MBR  (2.8M)
    63  5697         - free -  (2.8M)

=>      64  30282881  iso9660/GhostBSD  GPT  (14G)
        64      1552                 1  ms-basic-data  (776K)
      1616      5760                 2  efi  (2.8M)
      7376   4903580                 3  ms-basic-data  (2.3G)
   4910956  25371989                    - free -  (12G)

=>  63  5697  gpt/EFI%20boot%20partition  MBR  (2.8M)
    63  5697                              - free -  (2.8M)

=>  63  5697  iso9660/GhostBSDp2  MBR  (2.8M)
    63  5697                      - free -  (2.8M)
It is a rather old computer with no UEFI, so I think the partition bios-boot is right, although I read everywhere that there should be a freebsd-boot partition.
Then I did:
Code:
ghostbsd@ghostbsd:~ % sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
partcode written to ada0p1
bootcode written to ada0
But it didn't change anything. I still can't boot my system.

So where is my boot loader gone? And how do I get it back?
 
Some more information:

The zfs pool tank had an error:
Code:
ghostbsd@ghostbsd:~ % sudo zpool import tank
   pool: tank
     id: 16879225985101678740
  state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
   the '-f' flag.
   see: http://illumos.org/msg/ZFS-8000-EY
config:

   tank        ONLINE
     ada0p2    ONLINE
I cleared that error with ghostbsd@ghostbsd:~ % sudo zpool clear tank, but I still can't boot my system.

Recently I upgraded the pool tank to v28. I thought I had restarted the computer successfully afterwards, but maybe not.

What I did right before the computer didn't start anymore: I deleted a directory on the ufs disk accidently. No big deal, but I thought this would be a good opportunity to test if I could undelete this directory. I attached the disk with a usb sata adapter to a Win10 notebook, but used the power supply from the main computer. I started the computer, so the disk would get power - from this moment on I got the message "Missing boot loader".

I still get access to all disks with the live usb stick, everything seems alright, except GhostBSD won't boot :'‑(

So really thanks for any advice what I could try...
 
But it didn't change anything. I still can't boot my system.

I'd bet gpart bootcode assumes a freebsd-boot partition, and looking at your gpart show, it seems you're missing it, from gpart(8):
Both types of bootstrap code are used to boot from the GUID Partition Ta-
ble. First, a protective MBR is embedded into the first disk sector from
the /boot/pmbr image. It searches through the GPTfor a freebsd-boot
partition (see the PARTITION TYPES section) and runs the next bootstrap
stage fromit. The freebsd-boot partition should be smaller than 545 KB.
It can be located either before or after other FreeBSD partitions on the
disk. There are two variants of bootstrapcode to write to this parti-
tion: /boot/gptboot and /boot/gptzfsboot.

/boot/gptzfsboot is used to boot from ZFS. It searches through the GPT
for freebsd-zfs partitions, tryingto detect ZFS pools. After allpools
are detected, /boot/zfsloader is started from the first one found.

Perhaps you had overlooked that sentence when searching for a fix?

However, you have bios-boot partition instead:

Code:
=>       34  976773101  ada0  GPT  (466G)
         34          6        - free -  (3.0K)
         40       2048     1  bios-boot  (1.0M)
       2088  960043008     2  freebsd-zfs  (458G)
  960045096   16723968     3  freebsd-swap  (8.0G)
  976769064       4071        - free -  (2.0M)

Does GhostBSD use GRUB2, rEFInd or a custom bootloader? In that case, you should refer again to their wiki/forums and that's exactly why FreeBSD forks are officially unsupported here (if they weren't different, they wouldn't be forks): PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivative. If you were on Grub or rEFInd, you should be able to restore the boot loader by reinstalling it (ex grub-install.....), and using the same OS entry you should already have on your system. I myself only used Grub with FreeBSD on UFS2 once, but can provide that menuentry anyway. If GhostBSD uses a custom bootloader, you shall subsequently return the question to them again. Hopefully there's also some mailing list, or IRC where you should get a proper answer.

Obviously, you can also install FreeBSD bootloader, by deleting the bios-boot partition, creating a freebsd-boot one on freed space, and embed the boostrap code once again like you did above, but I expect in that way you'd lose support from GhostBSD devs/mods in turn.

The zfs pool tank had an error

Despite I'm still new to ZFS, I'm quite confident that's not an error: if you're importing it from a live CD,should be normal. Append the -f flang like suggested (and possibly the -R one to set an alternate root directory for the pool on a custom mountpoint), then mount zroot/ROOT/default and the other zfs filesystem you need to a mount point with write permissions on volatile memory (under /tmp)
 
I'd bet gpart bootcode assumes a freebsd-boot partition, and looking at your gpart show, it seems you're missing it, from gpart(8):
Perhaps you had overlooked that sentence when searching for a fix?
However, you have bios-boot partition instead:
Indeed I overread that whole part. My configuration "no efi + gpt + zfs" seems to be quiet unsual. The manpage of gptboot also only talks about freedbsd-ufs and freebsd-bios. But if the partition bios-boot isn't supported by the tools - why is it there?
Does GhostBSD use GRUB2, rEFInd or a custom bootloader?
In my case it was GRUB2. But that is strage again: I have the file /boot/grub/grub.cfg, but none of the grub tools in /usr/local/sbin/ or the file /usr/local/etc/default/grub. On the live usb stick all this exist.
Obviously, you can also install FreeBSD bootloader, by deleting the bios-boot partition, creating a freebsd-boot one on freed space, and embed the boostrap code once again like you did above, but I expect in that way you'd lose support from GhostBSD devs/mods in turn.
Well I just installed GhostBSD into a VMWare image and there I have a partition freebsd-boot and all the grub tools. But on my computer I started with GhostBSD 10.3 and upgraded to 11.1 some time ago, so this may be the cause of some of my problems.
 
I can confirm that the warning message you got from the ZFS pool is most definitely not an error, and using zpool clear is therefor ill advised. Sensucht94 is fully right: # zpool import -fR /mnt tank.

But if the partition bios-boot isn't supported by the tools - why is it there?
Well, because something put it there. But that something wouldn't be a FreeBSD installer. See, this is why these topics are offtopic here. We pretend to know FreeBSD but that doesn't include every other derivative because those usually do things completely "different". For all I know the other installer put it there (maybe it set the wrong partition type?) or maybe this is just the way this BSD variant likes to work.

Assuming that this is actually some kind of valid (hybrid) boot slice then I foresee other issues. See also gpart(8); freebsd-boot shouldn't be larger than 545kb. This partition is 1Mb. It might be possible that this hybrid OS has a solution for that (I obviously have no idea), but with FreeBSD this size could cause problems.
 
I've just installed GhostBSD 11.1 to a spare disk and there I have a partition freebsd-boot. So my disk configuration doesn't seem to have anything to do with GhostBSD, but is somewhat special for my installation.
 
Back
Top