Hard drive with GPT detected but not booting on Thinkpad.

Wanted to try out a Thinkpad but it won't somehow boot from a HDD with FreeBSD on it (that runs perfectly fine on another laptop).

The hard drive in question has gptboot on the boot partition showing under gparted on Ubuntu (guessing that matters).

Note: HDD has geli encryption (not sure if it matters much) - Worked fine on original laptop. The Thinkpad boots fine from a Ubuntu USB stick or a windows hard drive in same slot as current HDD.

How can this be fixed? Is this some kind of GPT issue?
 
Ok this is weird - when I try had a FreeBSD USB stick attached while trying to boot, it gave me GELI password input option for the hard disk (which it wasn't showing earlier when I had the Ubuntu stick in the USB port)

I must be missing something very basic - just can't figure out how to go about this 🤔
 
I'd think that GELI matters here. I'd suggest learning more about it, and devise a troubleshooting procedure to eliminate GELI as a culprit. As in:

Original laptop is machine A.
Thinkpad is machine B.

HDD with GELI boots fine in A, but not B.

On machine B, you tried a FreeBSD boot stick, and got prompted for the GELI password.

This suggests to me that you may need to look in the BIOS of machine B, and make sure the HDD is visible to it. Basically, the BIOS is probably not seeing the gpt boot partition as the first option to try. The BIOS is probably trying something else first. My thinking goes, if the BIOS is set up correctly, you should be prompted for the GELI password when booting off the HDD, rather than the stick.
 
After booting the FreeBSD USB installer, drop to "Shell", enter gpart show and sysctl machdep.bootmethod, post output please.

If the laptop is in a environment with a DHCP server, you can send the output to a pastebin text storage site.

Find the network interface with ifconfig (i.e. re0), execute to asigne an IP dhclient re0, then gpart show ; sysctl machdep.bootmethod | nc termbin.com 9999, post URL.
 
Original laptop is machine A.
Thinkpad is machine B.

HDD with GELI boots fine in A, but not B.
Ok - let's stick to this terminology.
On machine B, you tried a FreeBSD boot stick, and got prompted for the GELI password.
Correct - was almost by accident that I tried it.
This suggests to me that you may need to look in the BIOS of machine B, and make sure the HDD is visible to it. Basically, the BIOS is probably not seeing the gpt boot partition as the first option to try.
So basically machine B (Thinkpad) is showing the hard disk when I try to boot it without any usb attached - but its being shown under a "Boot Menu" (not very familiar with Thinkpads)

When I select the boot menu option for the hard disk - it simply comes back to the same again.
The BIOS is probably trying something else first
Seems you might be correct - the above "Boot Menu" shows a "Windows Boot Manager" above the hard disk listed. Please see image.

UPDATE: Trying to change the boot order and placing the hard disk before "Windows Boot Manager" did not help either.
 

Attachments

  • IMG20230319181801.jpg
    IMG20230319181801.jpg
    306.7 KB · Views: 53
After booting the FreeBSD USB installer, drop to "Shell", enter gpart show and sysctl machdep.bootmethod, post output please.
The machine doesn't have internet - going to be a pain to configure it.

Please check image below for gpart output - it's showing the hard drive I wish to boot from , below is the bootable usb

The output of sysctl machdep.bootmethod is BIOS
 

Attachments

  • IMG20230319182424.jpg
    IMG20230319182424.jpg
    245.6 KB · Views: 60
The BIOS says UEFI BIOS Version 🤔 - although under "Startup" in the BIOS "Boot" has "UEFI/Legacy" set to "Both"
 
I suspected here the ESP missing ("efi" partition with loader.efi(8) inside) on the FreeBSD disk (there is one on the installation media).

If there are problems with BIOS "Boot" has "UEFI/Legacy" set to "Both" you could install FreeBSD when the machine is in UEFI mode only and boot only UEFI.

If that interferes with Windows, choose during the installation in BIOS legacy mode at the "ZFS Configuration" dialog "Partition Scheme GPT (BIOS+UEFI)".

Or if you don't want to install again, you could delete "freebsd-swap", create a 260 MB "efi" partition, create a MSDOS file system on it, copy loader.efi, and gpart add freebsd-swap. But installing from scratch again is more practical.
 
I suspected here the ESP missing ("efi" partition with loader.efi(8) inside) on the FreeBSD disk (there is one on the installation media).

If there are problems with BIOS "Boot" has "UEFI/Legacy" set to "Both" you could install FreeBSD when the machine is in UEFI mode only and boot only UEFI.

If that interferes with Windows, choose during the installation in BIOS legacy mode at the "ZFS Configuration" dialog "Partition Scheme GPT (BIOS+UEFI)".

Or if you don't want to install again, you could delete "freebsd-swap", create a 260 MB "efi" partition, create a MSDOS file system on it, copy loader.efi, and gpart add freebsd-swap. But installing from scratch again is more practical.
Just to clarify - there is no windows hard disk/boot that is present or that I wish to do. I simply need to boot from the hard drive ( with FreeBSD installed already)..

Also, I don't have a spare hard to install again/backup.

Does that make the resolution any easier to attempt?
 
IDK if it helps, but on my new P14s I could boot only from a ZFS FreeBSD installation. UFS simply won't boot, irrespective of BIOS configuration or the partition layout choice.
 
IDK if it helps, but on my new P14s I could boot only from a ZFS FreeBSD installation. UFS simply won't boot, irrespective of BIOS configuration or the partition layout choice.
Thanks - this hard drive is a ZFS.

Yea it's a pain trying to get this to work. Wish it was easier.

Also something weird I noticed - I'm able to boot from a bootable FreeBSD usb (it also boots from a bootable Ubuntu) But if I try the same port with the hard drive with FreeBSD installed it won't boot. Wonder what makes that happen 🤔
 
Just to clarify - there is no windows hard disk/boot that is present
A misunderstanding on my part.

Wonder what makes that happen
As I said before, I suspect the missing ESP ("efi" partition) with the FreeBSD efi loader. There is one on the USB stick, none on the FreeBSD HDD. See gpart image in post # 6.
Ok this is weird - when I try had a FreeBSD USB stick attached while trying to boot, it gave me GELI password input option for the hard disk (which it wasn't showing earlier when I had the Ubuntu stick in the USB port)

The BIOS says UEFI BIOS Version 🤔 - although under "Startup" in the BIOS "Boot" has "UEFI/Legacy" set to "Both"
Isn't there in BIOS/UEFI a setting to switch to "Legacy" only and not "Both"?

If there is not, and it looks like the cause is the missing ESP ("efi" partition), then it's quite easy to add one. By deleting the swap partition, adding a ESP, including the FreeBSD efi loader, and adding a new swap partition.
 
You might try using machine A to install the FreeBSD bootloader (instead of the Windows bootloader) on that HDD. Bootloaders live in the first few sectors of the HDD, it takes either knowing gpart very well, or using a special utility (Can't remember the name off the top of my head)...

Also, when you boot using a stick, you get a 'live environment' that is copied from the stick into RAM. That 'live environment' can see your HDD, but the HDD is not booted. When you try to mount the HDD for reading or writing, a Linux environment will do nothing, but a FreeBSD-based environment will prompt for the GELI password just to mount that HDD.
 
As I said before, I suspect the missing ESP ("efi" partition) with the FreeBSD efi loader. There is one on the USB stick, none on the FreeBSD HDD. See gpart image in post # 6.
I'm curious how does it just go "missing"? In the sense that the given hard drive boots perfectly fine on machine A but not B - if something was "missing"/corrupted - wouldn't it stop working on both?
Isn't there in BIOS/UEFI a setting to switch to "Legacy" only and not "Both"?
I did try switching it to Legacy only... Didn't work.... Maybe I should try switching to UEFI only as well?
If there is not, and it looks like the cause is the missing ESP ("efi" partition), then it's quite easy to add one. By deleting the swap partition, adding a ESP, including the FreeBSD efi loader, and adding a new swap partition.
Gets a little nervous to do these things - any guides to attempt this? Was hoping for an easier fix.
Also, when you boot using a stick, you get a 'live environment' that is copied from the stick into RAM. That 'live environment' can see your HDD, but the HDD is not booted. When you try to mount the HDD for reading or writing, a Linux environment will do nothing, but a FreeBSD-based environment will prompt for the GELI password just to mount that HDD.
Ah ok - didn't know that about FreeBSD environment designed to look for GELI - is it simply because Linux doesn't have GELI integration as much?
 
i have a hp box that wont boot from gpt partitions without efi
so you have the choice of mbr or efi+gpt
Which one do you suggest? Preferably easier+ compatibility (with machine A as well - in which it currently runs... Is there no universal compatibility?)

Also how do I go about doing it and what precautions?

Seems like there aren't any other options I can avail of.
 
What make and model is 'machine A'?

Is it SETUP for BIOS or UEFI?

At what point in bootup did it ask for GELI passphrase?

~~~

What model Thinkpad is machine B?

Why would it offer 'Windows Boot Manager' if the disk had no Windows?

I've had Thinkpads T23, X200 and T430s, but have seen nothing like that.

Mosf peculiar.
 
I'm curious how does it just go "missing"? In the sense that the given hard drive boots perfectly fine on machine A but not B - if something was "missing"/corrupted - wouldn't it stop working on both?
The answer is quite simple.

On the other laptop FreeBSD was installed on a "Legacy" BIOS machine (or set to legacy BIOS). The FreeBSD installers predefined ZFS configuration partition scheme for a legacy BIOS machine is "GPT (BIOS)" (no "efi" partition and no FreeBSD EFI loader).

On a UEFI machine the predefined partition scheme is "GPT (BIOS+UEFI)" (with efi partition and FreeBSD EFI loader).

Apropos, the partition scheme can be selected by the user cycling through the options during the ZFS configuration (pressing Space or Enter key).

The HDD is booting on the legacy BIOS machine because it doesn't need a EFI loader. Whereas on the other laptop a EFI loader is needed.

To clarify the matter, here some images.

ZFS configuration on a "Legacy" BIOS machine (see highlighted option):

legacy-bios.png

ZFS configuration on a UEFI machine:

uefi.png

I did try switching it to Legacy only... Didn't work.... Maybe I should try switching to UEFI only as well?
Switching to UEFI only won't work without a EFI loader.
 
you have the choice of mbr or efi+gpt
Which one do you suggest? Preferably easier+ compatibility (with machine A as well - in which it currently runs...
A MBR would require a installation from scratch. There is no way to change a GPT partition table to an MBR partition table without losing the data or backing up and restoring it after.

EFI+GPT would require deleting the swap partition and adding a "efi" partition.
Is there no universal compatibility?)
Sure. Have both boot loader installed, UEFI and BIOS.
 
If there is not, and it looks like the cause is the missing ESP ("efi" partition), then it's quite easy to add one. By deleting the swap partition, adding a ESP, including the FreeBSD efi loader, and adding a new swap partition.
Gets a little nervous to do these things - any guides to attempt this? Was hoping for an easier fix.
The fix is easy as it can be.

As far as a backup of the partition table is available and the tutorial is followed to the letter, the risk is minimal.

In the following steps make sure to delete the correct partition. freebsd-swap, not freebsd-zfs.

Backup the partition table before proceeding creating a ESP.

Boot the FreeBSD installation media (same FreeBSD version as the installed system), drop to "Shell", plug in a spare USB stick, mount it, execute
Code:
 # gpart backup ada0 > /mnt/fbsd-part.txt
 # umount /mnt
Unplug the USB.


Proceed with creating the ESP, execute
Code:
 # gpart show ada0

(if the gpart image you posted is the correct one, then delete partition "2 freebsd-swap")

 # gpart delete -i 2 ada0

Here a size 260 MB efi partition is added

 # gpart add -t efi -a 4k -s 260m -b 2048 -l efiboot0 ada0
 # gpart add -t freebsd-swap -l swap0 ada0

 # newfs_msdos -c1 -F 32 /dev/ada0p2
 # mount_msdosfs /dev/ada0p2 /mnt
 # mkdir -p /mnt/efi/boot
 # mkdir /mnt/efi/freebsd

 # cp /boot/loader.efi /mnt/efi/boot/bootx64.efi
 # cp /boot/loader.efi /mnt/efi/freebsd
poweroff(8) system, unplug FreeBSD installer. Boot system. Now a GELI prompt should appear.

After in multi-user mode and logged in, edit /etc/fstab, change swap device name (/dev/ada0p4 or /dev/gpt/swap0). If swap is encrypted /dev/ada0p4.eli or /dev/gpt/swap0.eli:
Code:
 # swapoff -a
edit /etc/fstab
Code:
 # swapon -a
 
Boot the FreeBSD installation media (same FreeBSD version as the installed system), drop to "Shell", plug in a spare USB stick, mount it, execute
Code:
# gpart backup ada0 > /mnt/fbsd-part.txt
# umount /mnt
Unplug the USB.
Thanks a lot, this is incredibly helpful - I have backed up via gpart on a spare USB stick as suggested- however I have a few questions:
1) Am I correct in understanding that this method with EFI+ GPT solution doesn't require backup of the entire disk?
2) You mentioned 260 mb with EFI -however the hard drive I'm trying to get to boot has only 512 bytes + 1 mb space in the beginning - will this solution cause issues with data loss/corruption on the same drive since we are trying to fit in more than the space available? Or am I missing something?

Meanwhile, I happened to also try (after backing up) thia solution with lenovofix attribute being applied - it ran successfully but it didn't help the issue. Another thing I noticed with UEFI first boot option enabled - the fonts somewhat loaded differently with bootable USB plugged (MBR ran with EFI in gpart) in and asking for GELI password ( not sure if this is significant but felt like something in the right direction, although a dead end I think) Post in thread 'lenovofix' https://forums.freebsd.org/threads/lenovofix.79449/post-500959
 
Ok sorry please disregard my last post - followed your instructions T-Daemon and it's booting into the slim login manager!

Thank you so much! 🙏

Now I just need to figure out how to choose between different login options - other laptop used to cycle between them using F1 key but the Thinkpad doesn't let me cycle using F1 🤔

PS: If I were to plug this back into the other original laptop - will it still boot?
 
Now I just need to figure out how to choose between different login options - other laptop used to cycle between them using F1 key but the Thinkpad doesn't let me cycle using F1
You didn't mention which model your ThinkPad is. I have a E15. It has on the Esc key also "FnLock", which is activated pressing Fn + Esc.

This locks the Fn[0-9] keys to multimedia keys, microphone, brightness, etc. See if this is the case on your model.

PS: If I were to plug this back into the other original laptop - will it still boot?
Sure. The first boot loader (freebsd-boot) wasn't touched in the ESP creating procedure.
 
Uh oh - seems like it booted only one time properly. When I tried to boot it gives me the errors in the images below 👇

I did not do anything else except boot it once - thought it was fixed but apparently not.

What do I do at this mountroot prompt?

PS: I was unable to do the swap step in fstab ....from earlier..... Now it won't let me get in in single user mode too
 

Attachments

  • IMG20230321143803_1.jpg
    IMG20230321143803_1.jpg
    337.2 KB · Views: 46
  • IMG20230321144251.jpg
    IMG20230321144251.jpg
    330.6 KB · Views: 35
The system looks like a 12.0 version.
Code:
Mounting from zfs:backuppool/ROOT/12.0-p11
12.0 is End of Life since December 11, 2018 and unsupported.

Here in forums, normally, it's not accepted to give support on EoL versions. But on rare occasion we give, especially when it looks like a hardware issue.

The messages in the first image looks like a disk hardware problem.

When booting the installer media did you noticed similar error messages? If you don't know, plug it in, boot it up and look for it. Drop to "Shell", execute dmesg | less.

Did you make sure the disk has been attached to it's interface properly when moved over from the other laptop?

Open the machine and check the disk connection. Eventually remove the disk and re-attach it carefully.

Make sure to touch something metallic, grounded before touching the internal components, to discharge yourself from a eventuall electrical charge.
 
Back
Top