BOOTLOADER Install (legacy)

Dear Forum

I have BASIC problem but can’t get it right. Have ALPINE Linux and MANJARO installed, on separate partitions. I still opt for legacy booting. My /dev/sda1 is the separate /boot partition.
So its like
sda
-sda1 boot (ext2)
-sda2 alpine linux (ext4)
-sda3 win (ntfs)
-sda4 manjaro (btrfs or ext4)
-… share and swap and so on.

I have consulted the following howtos so far:
wiki of gentoo
I tried automated grub installation with out succes:
resc-a-tux
So did it manually with “systemrescuecd”
grub-install --boot-directory=/mnt/boot (/dev/sda1 is mounted there) /dev/sda

Grub was installed. after booting I see that its version 2.04 and I am prompted by grub
grub>

So I see the /grub directory in boot. But it seems the installation has not done an os-probe and no configuration.

What’s missing?
And where do I get a COMPLETE and concise howto of grub legacy installation WITH configuration?!

Thx
B

xtra question:
Can I just tar -cpf my installation of ALPINE and MANJARO and untar it on another PC with similar CPU and GPU, but different HDD partitioning? (after adapting fstab etc)?
Can I use the same initramfs.img of my Linux versions?
→ imho it works, I tried it. BUT:

How would I reinstall grub on these other machines? I have tried so much, even the Manjaro ARCHITECT, which tells me “at least one partition has to be mounted”. But WHICH partition and where?
→ I did
sudo mount /dev/sda1 /mnt/boot
but no work…

thx

Welcome to the forum! :slight_smile:

From the looks of it ─ you’ve been too vague in your information ─ you are seeking to install GRUB on a GPT-partitioned drive, but you want it to boot in legacy BIOS mode.

In that case, you must have an unformatted partition of type bios-grub and about 2 MiB in size, and this partition must be set up with the boot flag. Without such a partition, GRUB will overwrite your first partition with its core.img code ─ the boot.img code goes into the MBR, but without a BIOS partition, GRUB will also attempt to write its core.img there, with as a result that the first partition gets overwritten. That’s what the BIOS partition is for. GRUB will then write its core.img there instead.


I wouldn’t advise it.

I wouldn’t advise that either.

thanks… but no: I looked to have my machines in LEGACY mode. is that decided in my BIOS or what?
I created my partition tables with
fdisk /dev/sda using “msdos”

Yes, it is. But if you have a /dev/sda4 partition and it is neither the last partition on that drive nor an extended partition container, then you’ve created a GPT partition table instead of an MS-DOS MBR partition table, and GPT in combination with legacy BIOS boot requires there to be a BIOS partition, as I described. You don’t need a BIOS partition if the partition table is in the MS-DOS MBR format. You also don’t need it with a UEFI boot, but then you must have an EFI system partition instead.

More information at the GRUB page at the Arch Wiki.

https://wiki.archlinux.org/index.php/GRUB

If you want to install using a GPT partition scheme - which is a requirement when the number of partitions exceed 4 - need to create a special unformatted partition using the a special partition type uid (0xef02 - human name BIOS boot partition) and target your grub installation for that partition and this is contrary to the BIOS/MBR installation in which you target your primary disk to hold the bootloader.

1 Like

Guys… it`s very funny to read you. ^^ haha
Thanks so far!
But I have no problem creating my partitions. I have 4 primary partitions and thats it. Rest is second hdd alias /dev/sdb. Sorry for giving wrong examples up there. That happened BECAUSE IT IS NOT THE POINT.

Point is:
Is the command:
grub-install --boot-directory=/mnt/boot /dev/sda
including configuration and os probing?
so… thanks aarhus for the arch wiki… that second command i was missing…
grub-mkconfig ...

Maybe not for you, but your initial explanation suggested that you had more than 4 partitions and that as such, your drive was formatted with GPT, which in combination with a legacy BIOS boot requires an extra partition, of type 0xef02, and with the bootflag set.

Always remember that the quality of the help you’ll get depends on the quality of the information you provide. :man_shrugging:

Ahem… Wrong attribution. :wink:

Aragorn :slight_smile:

1 Like

OK. Second part - because it is not done so easy…
See the Arch wiki file:

Detecting other operating systems

To have grub-mkconfig search for other installed systems and automatically add them to the menu, install the os-prober package and mount the partitions from which the other systems boot. Then re-run grub-mkconfig. .

Now for including my other linux system and Windows, there needs to be done more.
I boot with a live CD. Then I need to do a chroot, right? To one linux OS, right?
Basically: What do I need to do, in order to get all in the start menu?

  • option a) I use extlinux bootloader and do it all by hand

  • option b) I stay with grub.
    How is it done given:

    sda
    -sda1 boot (ext2)
    -sda2 alpine linux (ext4)
    -sda3 win (ntfs)
    -sda4 manjaro (btrfs or ext4)
    sdb
    -sdb1 … for swap and share partitions.

Meaning how do I mount all the Partitions needed? Do I have to?
Thanks again.

Yes, you best use the live mode of the installer CD or USB stick. You open up a terminal and issue…

sudo su -
manjaro-chroot -a

You then select the Manjaro installation. os-prober will normally be installed already. So then all you need to do is…

update-grub

Keep in mind that if you update the other GNU/Linux distributions, Manjaro’s GRUB must always be the one in control, and so you may need to repeat this step then.

You don’t have to mount all of them, but manjaro-chroot does assume that you do not have a separate /boot and/or /usr filesystem. If you do, then it’s better to do a manual chroot, but this is going to be more complicated, because then you’re going to have to manually mount /dev, /proc and /sys too before chrooting.

Thanks! Here the official Gentoo Installation Guide might come in handy!
(not allowed to post links, Point 17 “chrooting”)

SO if I wanted (because of given reasons, WITH a sep. boot partition) to, in what structure, though?

    /            = manjaro OS partition
    /mnt/win     = win OS partition (ntfs, so ntfs-3g package need to be installed; does grub-mkconfig manage this actually ?)
    /mnt/alpine  = OS partition
    /boot        = boot partition with kernels for all OS

correct?
complicated?

:wink:

Got it!

That would be very tricky, because of possible filename collisions. Every distribution is free to name its kernel images and initramfs images as it pleases, so you could end up with one distro overwriting the files belonging to another distro.

In addition, only one GRUB can be installed in the MBR, so you would need to install Alpine’s GRUB in its root partition.

My general advice is always to not engage in any special trickery or setups unless you absolutely know what you’re doing. And therefore, in this case, I advise against a common/shared /boot partition for all distributions.

thanks!

1 Like

So how do you manage a dual or triple boot?

Personally, I don’t. GNU/Linux is the only operating system I’ve been using in well over 20 years, and I only have Manjaro on this machine. :stuck_out_tongue:

However, in your case, I would propose that you keep all of your distributions separate. I wouldn’t even recommend a common /home because of potential configuration file conflicts. A common swap partition between your various distros is possible, but only if you’re not hibernating your systems.

right… and that one grub (lets say from manjaro OS) finds the other OS how?

os-prober. It scans the drive(s) for other operating systems.