Grub-install for Manjaro despite Manjaro installed without bootloader?

Hi,
my system is manjaro-gnome-17.1.10-stable-x86_64.iso
Gnome Version 3.28.2
Memory 3.6 GiB
_Processor Intel® Core™ i3-2328M CPU @ 2.20GHz × 4 _
Graphics Intel® Sandybridge Mobile
OS Name Manjaro Linux
OS Type 64-bit
Disk 29.8 GB

I have Manjaro installed without bootloader because on my multiboot system Debian stretch is the main system. This works fine.

Now I would like to know whether I could install Manjaro’s grub afterwards to make it the main system, as gohlip suggested to me in
https://forum.manjaro.org/t/solved-newbie-is-installing-manjaro-without-bootloader-in-dualboot-safe/49741/6
Would it be as simple as to do
# grub-install /dev/sda
in Manjaro*? But how about /etc/default/grub? Sure this would have to modified, too, to set Manjaro as default (0) and to accomodate Debian (and Windows 10 and Ubuntu 18.04) as secondary systems.

Thank you, manjacub

P.S. *: see https://wiki.manjaro.org/index.php/Restore_the_GRUB_Bootloader

Yes. Just follow this .

2 points though (and in that link)

  1. If uefi, do the extra 2 commands in [Addition UEFI commands]
  2. If bios-legacy, when you do ‘grub-install /dev/sda’
    make sure sda is the primary drive (the mbr one). If sdb is the primary drive, do
    grub-install /dev/sdb
    If unsure, you can do all
    grub-install /dev/sda
    grub-install /dev/sdb



    grub-install /dev/sdz

But if you want to be sure, verify primary drive with one of these many commands
findmnt /
sudo parted -l
sudo blkid
lsblk -f
sudo fdisk -l

See above.

It needn’t change. Why would that be changed?

Aha! That’s where you got the drives wrong. As above, check primary drive (mbr) and do as appropriate.
Just to check, Isn’t your fstab in UUID and not ‘/dev/sdx’
And grub, it is already in uuid. Where it states set root=(hdx,y), it will be superceded by search line and that is in uuid [1]. Unless you intentionally set grub to use /dev/sdx (you can disable uuid in /etc/default/grub, but that’s only for …er, fools (cannot put it nicely, I tried).

And what (where) else would the system (not user) not define uuid so it gets the partitions (eg Debian/Windows) wrongly? Any more places?

[1] grub uuid - set root=(hdx,y), that’s to make the bios search faster instead of going through all the UUID’s in all the partitions (so we can boot faster). There’s also the ‘hint’ to make the search faster. These can be wrong (but must be valid [2]) and if the search line for uuid is correct, it will boot correctly. Long story, I can still go longer, if you wish.

[2] -need explanation? Ask. Another long story.

Further explanation - Regardless of how many drives you have, there is only one primary drive.
And that is also true regardless whether you booted up Debian, Windows or Manjaro and where these are located. I think this is where you confuse yourself.

Confucius say people who are confused should have only one drive.
Confucius also say she who use many drives, one for each OS, so not to be confusing, is going to confuse herself.

Thank you, everything went smoothly as in Debian and Ubuntu.
Manjaro grub boots now all distros (Manjaro, Windows 10, Debian Stretch, Ubuntu 18.04), depending what I set as fefault, e.g.
GRUB_DEFAULT=0 > Manjaro
GRUB_DEFAULT=3 > Debian Stretch

However, what can do if I want to make Debian again the default bootloader?
Because when I had tried in my early attempts to boot Manjaro from Debian’s bootloader menu, Manjaro crashed, because of some microcode or microkernel error (I cannot remember). The comments by some of you in
https://forum.manjaro.org/t/solved-newbie-is-installing-manjaro-without-bootloader-in-dualboot-safe/49741/4
and Links suggested refer to this matter but go mostly beyond my grasp. Is there a way for “Dummies”?

Thank you, manjacub

P.S. For your conveninece, my HDD partitions:
sda 8:0 0 465.8G 0 disk MBR BIOS Legacy
├─sda1 8:1 0 94.1G 0 part Windows 10 NTFS
├─sda2 8:2 0 85.7G 0 part Debian Stretch ext4
├─sda3 8:3 0 7.5G 0 part [SWAP]
├─sda4 8:4 0 1K 0 part extended
├─sda5 8:5 0 229.7G 0 part WinLin (Data exchange and backup), NTFS
├─sda6 8:6 0 28.3G 0 part Manjaro ext4
└─sda7 8:7 0 20.5G 0 part Ubuntu 18.04 LTS ext4

First, you’re welcome. Glad it works out.

There are several ways, actually.
For others here reading, the method/entries apply only to bios-legacy.
Here’s one way. But several entries for you to use/consider (you can use all).
There are methods/entries for UEFI, but not here.

  1. First make sure Debian is the default grub.
    At Debian terminal,
    sudo grub-install /dev/sda
    {#primary drive, as explained}
  2. At all other distro terminal {you can do this step 2 later - no hurry - just my train of thought}
    sudo grub-install --force /dev/sday
    note: /dev/sday is the partition of that distro.
    So manjaro is in sda6.
    sudo grub-install --force /dev/sda6 {at manjaro terminal}
  3. Back at Debian terminal,
    first make a custom.cfg in /boot/grub
    sudo touch /boot/grub/custom.cfg
  4. Add entries into /boot/grub/custom.cfg
    Open /boot/grub/custom.cfg {kate, gedit, leafpad…}
    Add entries
    Entries to be listed later on {yup, my train of thought}
  5. Save file after adding entries.
    No need to update-grub.
    Entries in custom.cfg will not be shown in os-prober, update-grub, or grub-mkconfig
    Will appear at bottom of grub menu when rebooted.
    Will never be changed, deleted by any OS system like grub-install or update-grub.
    Can only be changed or deleted manually by user.

The entries.
note: xxxxxxxxxxxxxxxxxxxxxxx is uuid of sda6, the manjaro partition

menuentry "Manjaro - configfile "  {
    insmod part_msdos
    insmod ext2
    search --no-floppy  --fs-uuid --set=root xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    configfile /boot/grub/grub.cfg
}


menuentry "Manjaro - multiboot "  {
    insmod part_msdos
    insmod ext2
    search --no-floppy  --fs-uuid --set=root xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    multiboot /boot/grub/i386-pc/core.img
}


menuentry "Manjaro - chainloader" {
    insmod part_msdos
    insmod ext2
    search --no-floppy  --fs-uuid --set=root xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    drivemap -s (hd0) ${root}
    chainloader +1
}

My opinion - I prefer configfile, multiboot and last chainloader.
Try not to use chainloader, can be fickle, based on your bios.
There is another entry booting up directly vmlinuz and initramfs, (my preferred actually), but I set up sym-links, you can use the actual files yourself. And change if kernel changes.
Let me know if you want to try it.

Good luck.

2 Likes

Re: intel-ucode (microcode)

The above will always have intel-ucode booted up in Manjaro.
Don’t worry about that.
If you have more questions, shoot.

Thank you, gohlip, for these detailed informations! I will have to let this settle with me, learn more about Manjaro and tackle the boot matter later. Till then, I trust, Manjaro’s bootloader will keep my multiboot safe.

Still gladly astonished about how well and friendly both Manjaro and this forum are running,

manjacub

1 Like

I cannot do this, because I have Manjaro as default grub. When I make Debian default, I cannot easily get a Manjaro terminal, because Manjaro will probably not boot,
because I have do grub-update in Debian’s terminal to be able to select the other Linuxes in the boot menu. And then Manjaro will not boot again (Error) once it has been default, as it is now.
Or do I misunderstand your instructions?

Manjaro will boot with the Manjaro entries in Debian’s custom.cfg.

Manjaro will boot with the Manjaro entries in Debian’s custom.cfg.

Understand now?

Heres’ one way that you can feel safe about it before you make Debian the default grub.

Put all these entries in Debian custom.cfg.
Do not make Debian default grub yet.

Then boot to Debian grub and then use the entries in custom.cfg.
If you are satisfied they work, you will be confident then to make Debian the default grub.

(After adding Manjaro entries to Debian’s custom.cfg)
To boot to Debian grub, at Manjaro grub menu, same thing. Go to grub prompt
grub> search --fs-uuid --set=root xxxxxxxxxxxxxxxxxxxxxxx
grub> multiboot /boot/grub/i386-pc/core.img
grub> boot

xxxxxxxxxxxxxxxxxx is the UUID of Debian’s partition this time.

You will see Debian’s grub together with the Manajro custom entries at bottom of the grub menu.
Boot these Manjaro entries.

ps: I thought it is you who wants Debian to be default grub?
None of us wants you to do that. :grinning:

@gohlip
I am partly through, can use Debian grub to load Manjaro, but I am not sure whether I did it right. This is what I did:

*** 1 ***

Heres’ one way that you can feel safe about it before you make Debian the default grub.

Put all these entries in Debian custom.cfg.
Do not make Debian default grub yet.

Then boot to Debian grub and then use the entries in custom.cfg.
If you are satisfied they work, you will be confident then to make Debian the default grub.

(After adding Manjaro entries to Debian’s custom.cfg)
To boot to Debian grub, at Manjaro grub menu, same thing. Go to grub prompt
grub> search --fs-uuid --set=root xxxxxxxxxxxxxxxxxxxxxxx
grub> multiboot /boot/grub/i386-pc/core.img
grub> boot

Ok, boots.

*** 2 ***

There are several ways, actually.
For others here reading, the method/entries apply only to bios-legacy.
Here’s one way. But several entries for you to use/consider (you can use all).
There are methods/entries for UEFI, but not here.

First make sure Debian is the default grub.
At Debian terminal,
sudo grub-install /dev/sda
{#primary drive, as explained}
At all other distro terminal {you can do this step 2 later - no hurry - just my train of thought}
sudo grub-install --force /dev/sday
note: /dev/sday is the partition of that distro.
So manjaro is in sda6.
sudo grub-install --force /dev/sda6 {at manjaro terminal}
Back at Debian terminal,
first make a custom.cfg in /boot/grub
sudo touch /boot/grub/custom.cfg
Add entries into /boot/grub/custom.cfg
Open /boot/grub/custom.cfg {kate, gedit, leafpad…}
Add entries
Entries to be listed later on {yup, my train of thought}
Save file after adding entries.
No need to update-grub.
Entries in custom.cfg will not be shown in os-prober, update-grub, or grub-mkconfig
Will appear at bottom of grub menu when rebooted.
Will never be changed, deleted by any OS system like grub-install or update-grub.
Can only be changed or deleted manually by user.

I did it only with Debian so far, left the other distros aside for now. Booting now gives me the Debian boot menu, with the cofig option at the bottom. To boot Manjaro as default, I put this config (no 7 in Debians boot menu) as 7 into Debian’s /etc/default/grub menu and update-grub.
That works, Manjaro starts as default, but there appears then first Manjaro’s /etc/default/grub menu, lasts for a few seconds and boots then correctly into Manjaro. I am still afraid to put as default = 3 in Debain’s grub (Manjaro’s position in Debian’s /etc/default/grub). Should I?

*** 3 ***
However, when I did the step

sudo grub-install --force /dev/sda6

There were warnings:

Installing for i386-pc platform.
grub-install: warning: File system `ext2' doesn't support embedding.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
Installation finished. No error reported.

Are these warnings serious? They don’t seem to affect the booting, though.

I see 2 questions. if I miss any, please rephrase.

That’s up to you. But whatever default you set, you can easily select whichever entry to want.
I normally do not bother with selecting default.

Not to me, they are not serious. Just a reminder to users if they had not set any default grub earlier, they have no bootloader to boot.
But as I said, and if it is done. it should not be a problem.

It is perfectly okay if you let Manjaro be the default grub.
Even if you have those manajro entries in Debian’s custom.cfg, it is still okay to let Manjaro be the default grub and with the added assurance that if Manjaro grub menu do not appear (for whatever reason), you can still boot up Manjaro from Debian.

Hi gohlip,

  • I keep Debian as my bootloader - which you don’t like

  • But Manjaro is my default distro - which you like - booted from “Manjaro - configfile” (Position 7 in my Debian /etc/default/grub; "Manjaro, position 3, gives Kernel panic).

Now I await how Manjaro will earn my trust. Major acid tests will be - when I will be back in my own place - how well Manjaro will handle my Huawei E173 mobile broadband USB stick and my beloved Brother DCP-135C USB printer.

Thank you very much for your patience and help,

manjacub

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.