[gentoo-user] How to set up drive with many Linux distros?

2024-02-22 Thread Grant Edwards
For many years, I've used a hard drive on which I have 8-10 Linux
distros installed -- each in a separate (single) partition.

There is also a single swap partition (used by all of the different
Linux installations).

There is also a small partition devoted only to the "master" instance
of Grub that lives in the MBR and the space between the MBR and the
first partition (the drive uses a DOS disklabel). That master instance
of Grub has a menu which contains entries which "chainload" each of
the other partitions.

For many years, this worked great. All of the various distro
installers offered the option of installing the bootloader in the MBR
(e.g. /dev/sda) or in a partition (e.g /dev/sdaN).  I would tell the
installer to install the bootloader in the root partition, and
everything "just worked".

However, the choice to install bootloaders in partitions instead of
the MBR has been removed from most (all?) of the common installers.
This forces me to jump through hoops when installing a new Linux
distro:

 1. Back up the MBR and gap between the MBR and the first partition.

 2. Let the installer install it's bootloader (seems it's always grub
these days) in the MBR.

 3. Boot into the newly installed Linux.

 4. Manually install grub in the root partition (e.g. /dev/sdaN) using
the --force option to tell grub to use blocklists to find it's
files.

 5. Find those grub files and lock them so they can't be moved.

 6. Restore the MBR/gap backup from step 1.

It seems like there should be a better way to do this.  One might hope
that UEFI offers a solution to this problem. Google has found me
others asking the same question but no real answers.

Is there an easier way to do this?

--
Grant






[gentoo-user] Re: How to set up drive with many Linux distros?

2024-02-22 Thread Grant Edwards
On 2024-02-22, Wol  wrote:
> On 22/02/2024 19:17, Grant Edwards wrote:
>
>> However, the choice to install bootloaders in partitions instead of
>> the MBR has been removed from most (all?) of the common installers.
>> This forces me to jump through hoops when installing a new Linux
>> distro:
>
> File a bug!

LOL, good one! As if a normal person filing a bug with RedHat or
Ubuntu actually accomplishes anything.  I'll tell them to make systemd
optional while I'm at it.

> If that's true, it basically borks any sort of dual boot, unusual disk 
> layout, whatever.

Yep, it does. The answer from  is:

   You should really just (shut up and) install 's (obviously
   superior) bootloader in the MBR.  It will auto-detect (some of) the
   other already installed (obviously inferior) OSes, and will add
   (some subset of) them to the boot menu that will (sometimes) allow
   you to boot them (maybe -- if you kneel, bow your head and ask
   nicely).

> Last time I installed SUSE, it trashed my boot totally because it
> didn't recognise my disk stack, failed to load necessary drivers,
> and worse trashed my gentoo boot too...
>
> Cue one big rescue job to get the system up and working again. At
> least it was only the boot that was trashed.

I've been reading up on UEFI, and it doesn't seem to be any
better. People complain about distro's stomping on each other's files
in the ESP partiton and multiple distro's using the same name in the
boot slots stored in NVM. And then the boot choice order changes
(though it may not be apparent to the naked eye) when one of the
distros decides to update/reinstall its boot stuff.

--
Grant






Re: [gentoo-user] Re: How to set up drive with many Linux distros?

2024-02-22 Thread Wol

On 22/02/2024 21:45, Grant Edwards wrote:

I've been reading up on UEFI, and it doesn't seem to be any
better. People complain about distro's stomping on each other's files
in the ESP partiton and multiple distro's using the same name in the
boot slots stored in NVM. And then the boot choice order changes
(though it may not be apparent to the naked eye) when one of the
distros decides to update/reinstall its boot stuff.


At least if you use UEFI *as* your bootloader, then that won't happen. 
That assumes you're using UEFI, though!


In which case, 's bootloader doesn't get a look-in.

As for "'s obviously superior bootloader", well  
is using the exact same boot-loader, and when IT installs, how is it 
going to be able to boot  if it can't call 's boot 
loader because it's just trashed it by overwriting it?


To me, you seem to be describing the *default* installer setup, that's 
been there for ever. Last I installed SUSE, iirc I had to specify 
"advanced bootloader installation", most of who's options I didn't even 
understand!, but it did do what I told it to (apart from not recognising 
my weird disk stack!).


If you can find, and understand!, that advanced options, I think you'll 
find you can do what you want.


Cheers,
Wol



Re: [gentoo-user] How to set up drive with many Linux distros?

2024-02-22 Thread Wol

On 22/02/2024 19:17, Grant Edwards wrote:

However, the choice to install bootloaders in partitions instead of
the MBR has been removed from most (all?) of the common installers.
This forces me to jump through hoops when installing a new Linux
distro:


File a bug!

If that's true, it basically borks any sort of dual boot, unusual disk 
layout, whatever.


Last time I installed SUSE, it trashed my boot totally because it didn't 
recognise my disk stack, failed to load necessary drivers, and worse 
trashed my gentoo boot too ...


Cue one big rescue job to get the system up and working again. At least 
it was only the boot that was trashed.


Cheers,
Wol



[gentoo-user] Re: How to set up drive with many Linux distros?

2024-02-22 Thread Grant Edwards
On 2024-02-22, Wol  wrote:
> On 22/02/2024 21:45, Grant Edwards wrote:
>> I've been reading up on UEFI, and it doesn't seem to be any
>> better. People complain about distro's stomping on each other's files
>> in the ESP partiton and multiple distro's using the same name in the
>> boot slots stored in NVM. And then the boot choice order changes
>> (though it may not be apparent to the naked eye) when one of the
>> distros decides to update/reinstall its boot stuff.
>
> At least if you use UEFI *as* your bootloader, then that won't
> happen.  That assumes you're using UEFI, though!

According to what I've read UEFI isn't a bootloader. It's a boot
manager which can load and run EFI bootloaders (of which there can be
multiple installed).

> In which case, 's bootloader doesn't get a look-in.

Yes, AFAICT, it does (sometimes?). When you install  under
UEFI it installs EFI bootloader files (either kernels wrapped in EFI
bootloader executables or the grub EFI bootloader) in the EFI Systgem
Partition (ESP), and then adds one or more entries in the EFI NVM that
points to those files (or something like that).  The Linux UEFI
systems I have all still use grub2 (which gets written to the ESP).

It's entirely possible for one distro to overwrite files in the ESP
that belong to other distros. I've read multiple complaints about
exactly that when trying to do multi-boot with UEFI. In practice it's
just like the fight over who owns the MBR and the DOS disklable gap.

One recipe I read about for doing what I wanted to do with UEFI
involved installing a Linux distro (didn't really matter which), then
installing rEFInd. After that, some manual renaming and deleting of
the files in the ESP was required. Then he started installing various
distros. After each distro installation, the author had to re-install
rEFInd, and after many of them he had to manually remove or rename
files in the ESP (or adjust the rEFInd config file).

And in the end, he ended up with multiple menu entries (for different
installations) that had identical names.

It was more complicated and difficult than my current scheme.

> As for "'s obviously superior bootloader", well  
> is using the exact same boot-loader, and when IT installs, how is it 
> going to be able to boot  if it can't call 's boot 
> loader because it's just trashed it by overwriting it?

In my experience, 's bootloader does not boot other
installations by calling other bootloaders. It does so by rummaging
through all of the other partitions looking for kernel images, intird
files, grub.cfg files, etc.  It then adds menu entries to the config
file for 's bootloader which, when selected, directly load the
kernel image and initrd from those other partitions. Sometimes, it
works -- at least until those other installations get updated without
the knowlege of the distro that currently "owns" the MBR's bootloader
config. Then it stops working until you tell that bootloader to re-do
it's rummaging about routine.

> To me, you seem to be describing the *default* installer setup, that's 
> been there for ever. Last I installed SUSE, iirc I had to specify 
> "advanced bootloader installation", most of who's options I didn't even 
> understand!, but it did do what I told it to (apart from not recognising 
> my weird disk stack!).

So SuSe still allows you to install grub to a partition instead of
MBR? That's encouraging. RH and Ubuntu used to allow that, but AFAIK,
now they do not.

> If you can find, and understand!, that advanced options, I think
> you'll find you can do what you want.

I'd welcome pointers to where those advanced options are in the RH and
Ubunutu installers -- I've searched everywhere I can think of. Various
things Google has found lead me to believe that they no longer support
installing grub in a partition.

I guess I'll stick with my current setup.

Or perhaps I'll switch from a DOS disklabel to a GPT disklabel.
Instead of backing up and restoring the MBR and the gap, I would
backup and restore the MBR and the BIOS boot partition. And I could
use UUIDs and partition labels.







Re: [gentoo-user] Re: How to set up drive with many Linux distros?

2024-02-22 Thread Wojciech Kuzyszyn
Hello!

I guess most (all) of the distro's you are talking about use GRUB (or
at least they allow to do it). If that's true, I'm pretty sure you can
happily let them overwrite the GRUB in MBR as many times as they want,
since it's the same (or just probably minor version differences)
bootloader. Just make a copy of /boot/grub/grub.cfg and make sure it's
the same on every partition. Or, even better, if that's possible right
now, make a common /boot partition and after installing the new distro
just merge the (probably new) /boot/grub/grub.cfg with your old one.

I really think that *should* work!

Take care,
ks. Wojciech Kuzyszyn


pgp2uRUfi6EGx.pgp
Description: Podpis cyfrowy OpenPGP