After installing second M2 SSD, PureOS is not booting automatically

Hello people,

I have ordered a chepest L13v2, with 128Gb SSD hard drive. Recently I have added M2 ssd and now the system does not automatically boot, I have to press ESC during boot and select the first drive (128GB). Is there a way to make 128Gb bootable without removing the second M2 hard drive and without pressing ESC every time I switch the machine on?

Thanks

The easiest way is to simply re-install grub on the M.2 drive, like this:

sudo grub-install /dev/nvme0n1 if your M.2 is a NVMe drive or
sudo grub-install /dev/sdb if your M.2 is sata drive.

But be careful, if you reformat your M.2 drive you will also lose the bootloader from it.

1 Like

Thanks @mladen for the quick answer!

Basically, my first drive is SATA SSD (with PureOS) and the second one is M.2 (I put it the spare M2 slot, PureOS detects it as /dev/sdb). My aim is to carry on loading PureOS from SATA SSD. Do I need to do sudo grub-install /dev/sda?

sudo grub-install /dev/sdb to install grub on your M.2 disk which will be booted first.

This is the point, I want to boot first from /dev/sda and not from /dev/sdb. Are you sure I need to do this command?

Coreboot (SeaBIOS) will always try to boot from the M.2 disk first, so install grub to the M.2 disk.

Yes this is the problem. His M.2 drive is sdb, but PureOS is installed on sda, which is where he wants to boot from.

I canā€™t exactly remember what I did, but I think it involved editing the fstab file which fixed this for me.

This is correct, many thanks! I am reluctant to write MBR to M.2 since I do not understand why I need to do it since I want to boot up from sda and not from sdb. Any suggestions are welcome.

As far as i understood @mladen the problem here is that that there is no option to change the order in which seabios (the coreboot payload) looks for bootloader. So when an m2 device is installed it will only search for a bootloader there and you have to manually select an other devices if nothing is present on your m.2 device.
This is far from ideal but there is nothing you can do from the OS side. And it has nothing to do with the sda and sdb naming which is given by the OS and the problem lies before the OS is loaded.

So for a solution look into seaBIOS options. Iā€™m not sure what you can do there but it might be possible to change these option if you compile your own Coreboot with custom settings. @kakaroto might have a solution for this. Or look into the coreboot thread:

Here are also some information on the topic:

Edit:
Here are detailed information about the bootorder config:
https://www.coreboot.org/SeaBIOS#Configuring_boot_order


The you should reinstall your system to the M.2 drive. Like Iā€™ve said, the easiest way is to just put the bootloader to the M.2 drive, it should boot into your system on your 2.5" drive.

Or, go to Building coreboot from source (official script) and search for instructions to change the boot order.

Thanks @mladen and @ramnasko for your help. Reinstalling system is not an option, so I will try to use a script to change the boot order. Hope I will not brick my new and shiny laptop :slight_smile:

Be careful with the coreboot stuff. These are just pointeres to possible solutions i have never tried or used. I actually never used coreboot my self. So you might wanna wait gather more informations from more experience users on this first.

I would also choose @mladen solution of a second MBR partition on the M.2 device. Its just some MB extra and i donā€™t see any big disadvantage on this solution.

What I do not understand is what is the purpose to write MBR to M.2 if I want to boot from SSD?

The advice from Mladen was such that you boot from your M.2 drive. He was suggesting that you install the MBR on that drive as a result of that.

His suggestion was probably such as it is much more difficult to recompile coreboot with the settings you want. In the future this will probably not be the case for various reasons.

However, as you can select the boot drive now on startup, you could just live with that and select the boot drive on every restart, reinstall the OS on your M.2 drive, or recompile coreboot and use the system as you prefer.

Yeah, sad it works like this but I guess I will have to live with it for now until it will be changed in the future updates of coreboot.

I would split the boot process in 3 parts. First coreboot+seabios which initilies the hardware and then look for a bootloader. Second the bootloader, which can live on any device but is unfortenetlly only automaticaly selected on m2 devices. Selecting the kernel and a initramfs from any drive via bootloader.
After step 3 nothing of the bootloader part is present in ram or anywhere. Its just a step in betwenn which handels the part which is to complex for the corebot but musst handel reading partitions and selecting kernels.

So if you install a adittional bootloader on the m.2 devices and select the pureos on the sata drive, after boot there is no difference from the case where you booted from a bootloader on the sata device.

There is no reinstling or system partition moving involved. This is why it is concidered the esiest solution.

Only down side is if you remove the m.2 device an put an other one without a bootloader on it in, you have to select the sata drive manually like you do now.

You can change the boot order with this script : Change boot order
I think the fact that seabios doesnā€™t ignore the m.2 device if it doesnā€™t find it bootable is the real bug here which needs to get fixed at some point.

Iā€™m in a similar situation. If I understand @mladenā€™s suggestion correctly, running grub-install on the secondary disk will install a MBR/GPT grub boot image there, which will point straight back at the primary disk.

So, the problem is SeaBIOS is limited and wants to boot only /dev/sdx, but the OS and boot sector is all on /dev/sdy. If you run grub-install sudo grub-install /dev/sdx (the new/secondary disk), then grub will configure a shim boot sector that points back at the /boot partition on /dev/sdy.

Is that right? Or was @mladen suggesting a full reinstall, to put the OS directly on whatever disk SeaBIOS expects?

Iā€™m reluctant to run @mladenā€™s commands for a couple reasons:

  1. Iā€™m using LUKS full disk encryption
  2. Iā€™m using Qubes OS

The Qubes dom0 is LUKS, and so is the secondary drive. The secondary drive is mounted in the Libremā€™s internal SATA slot, but I essentially use it as an external ā€œUSBā€ drive. So itā€™s just one giant LUKS partition, literally nothing else on it.

So, Iā€™m worried grub-install might overwrite my LUKS header. And/or, that Qubes dom0 needs grub-install to be run in a special/different way because itā€™s not running directly on the hardware (itā€™s running inside Xen hypervisor).

Anyone have answers to these questions?

Hello @kakaroto

I have finally tried your script and it did NOT work on Purism 13.

Here is what I have got:

Select the default order in which devices will attempt booting:
1 - Boot order: M.2 SSD disk first, 2.5" SATA disk second
2 - Boot order: 2.5" SATA disk first, M.2 SSD second

** Note: regardless of the option chosen above, you can always select
** a different boot device by pressing ā€˜ESCā€™ at boot time.
Enter your choice (default: 1): 1
change_bootorder.sh: 29: [: 1: unexpected operator
change_bootorder.sh: 37: [: 1: unexpected operator
flashrom v0.9.9-1-stable-11-d36385d-dirty on Linux 4.18.0-2-amd64 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loopā€¦ OK.
coreboot table found at 0x7aad3000.

WARNING! You seem to be running flashrom on an unsupported laptop.
Laptops, notebooks and netbooks are difficult to support and we
recommend to use the vendor flashing utility. The embedded controller
(EC) in these machines often interacts badly with flashing.
See the manpage and https://flashrom.org/Laptops for details.

If flash is shared with the EC, erase is guaranteed to brick your laptop
and write may brick your laptop.
Read and probe may irritate your EC and cause fan failure, backlight
failure and sudden poweroff.
You have been warned.

Proceeding anyway because user forced us to.
Found chipset ā€œIntel Skylake U Premiumā€.
This chipset is marked as untested. If you are using an up-to-date version
of flashrom and were (not) able to successfully update your firmware with it,
then please email a report to flashrom@flashrom.org including a verbose (-V) log.
Thank you!
Enabling flash writeā€¦ Warning: Setting Bios Control at 0xdc from 0x8b to 0x89 failed.
New value is 0x8b.
Warning: SPI Configuration Lockdown activated.
OK.
No EEPROM/flash device found.
Note: flashrom can never write if the flash chip isnā€™t found automatically.

Unable

Is there any chance to fix it?

Did you boot with iomem=relaxed boot parameter?