Manjaro Difference between revisions of "Preserve Manjaro Bootloader"

Difference between revisions of "Preserve Manjaro Bootloader"

From Manjaro
imported>Cscs
(Created page with "__TOC__ = Introduction = This is not to get back or to restore your Manjaro bootloader. To restore your Manjaro bootloader, see [https://wiki.manjaro.org/index.php?title=Res...")
 
(Improve translation tags.)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
__TOC__
__TOC__


 
<translate>
= Introduction =
= Introduction = <!--T:1-->
This is not to get back or to restore your Manjaro bootloader. To restore your Manjaro bootloader, see [https://wiki.manjaro.org/index.php?title=Restore_the_GRUB_Bootloader this].
This is not to get back or to restore your Manjaro bootloader. To restore your Manjaro bootloader, see [https://wiki.manjaro.org/index.php?title=Restore_the_GRUB_Bootloader this].


<!--T:2-->
This is to prevent your working Manjaro bootloader being overridden by other OS bootloaders. This can happen when the other OS updates its grub (not update-grub). And due to Manjaro's implementation of intel-ucode, other OS bootloader cannot boot Manjaro OS, hence this tutorial.
This is to prevent your working Manjaro bootloader being overridden by other OS bootloaders. This can happen when the other OS updates its grub (not update-grub). And due to Manjaro's implementation of intel-ucode, other OS bootloader cannot boot Manjaro OS, hence this tutorial.


= Bios-legacy systems =
= Bios-legacy systems = <!--T:3-->
Boot up all other linux OS and at their terminals, do
Boot up all other linux OS and at their terminals, do


  sudo grub-install --force /dev/sdxy
  <!--T:4-->
{{UserCmd|command=sudo grub-install --force /dev/sdxy}}


where /dev/sdxy is the other OS partition. Note some OS's need command 'grub2-install'. If need further elaboration, see [https://forum.manjaro.org/t/kernel-panic-not-syncing-vfs-unable-to-mount-root-fs-on/21226/7?u=gohlip here].
<!--T:5-->
where /dev/sdxy is the other OS partition. Note some OS's need command 'grub2-install'.  


<!--T:6-->
When installing a new linux OS, at their installer, always select "installing bootloader to partition". We can also choose not to install bootloader, but selecting 'to partition' (Manjaro calls this 'to system') is good enough and is preferable to have a bootloader installed at every OS.
When installing a new linux OS, at their installer, always select "installing bootloader to partition". We can also choose not to install bootloader, but selecting 'to partition' (Manjaro calls this 'to system') is good enough and is preferable to have a bootloader installed at every OS.


<!--T:7-->
If you choose to uninstall Manjaro later on, remember to make the other OS bootloader as default before uninstalling.
If you choose to uninstall Manjaro later on, remember to make the other OS bootloader as default before uninstalling.


= UEFI systems =
= UEFI systems = <!--T:8-->
At any linux OS terminal, see output of
At any linux OS terminal, see output of


  efibootmgr
  <!--T:9-->
{{UserCmd|command=efibootmgr}}


It will give an output like this:
<!--T:10-->
It will give an output like this:</translate>
{{UserCmdOutput|command=efibootmgr|result=
<pre>
  BootCurrent: 0001
  BootCurrent: 0001
  Timeout: 1 seconds
  Timeout: 1 seconds
Line 32: Line 42:
  Boot0005* Hard Drive
  Boot0005* Hard Drive
  Boot0008* Systemd Boot Manager
  Boot0008* Systemd Boot Manager
</pre>
}}
<translate>


<!--T:11-->
Make sure Manjaro bootorder is at the beginning as above: "BootOrder: 0001,0002,0004,0005,0008"
Make sure Manjaro bootorder is at the beginning as above: "BootOrder: 0001,0002,0004,0005,0008"
If it is not, reorder such that it is, like this:
If it is not, reorder such that it is, like this:


  sudo efibootmgr -o 0001,0002,0004,0005,0008
  <!--T:12-->
{{UserCmd|command=sudo efibootmgr -o 0001,0002,0004,0005,0008}}


<!--T:13-->
Whenever we install another OS, it will be at the top of that bootorder; and we will need to reorder such that Manjaro is again at the top. And we can do that at that install livecd media itself. If we forget, we can do it after installation at any OS. For UEFI, we can still select Manjaro to boot at boot-setup (one of F8 ~ F12).
Whenever we install another OS, it will be at the top of that bootorder; and we will need to reorder such that Manjaro is again at the top. And we can do that at that install livecd media itself. If we forget, we can do it after installation at any OS. For UEFI, we can still select Manjaro to boot at boot-setup (one of F8 ~ F12).


<!--T:14-->
That alone should be sufficient for most UEFI systems.  
That alone should be sufficient for most UEFI systems.  
However in some situations (and reported in some topics here), it is not (possibly due to firmware issues). The above steps do not ensure that Manjaro bootorder will be booted up. In these cases, one extra command is required.
However in some situations (and reported in some topics here), it is not (possibly due to firmware issues). The above steps do not ensure that Manjaro bootorder will be booted up. In these cases, one extra command is required.


  sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/boot/bootx64.efi
  <!--T:15-->
{{UserCmd|command=sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/boot/bootx64.efi}}


<!--T:16-->
Or, if done at livecd (or another OS) and mounted / partition to /mnt and /boot/efi partition to /mnt/boot/efi
Or, if done at livecd (or another OS) and mounted / partition to /mnt and /boot/efi partition to /mnt/boot/efi


  sudo cp /mnt/boot/grub/x86_64-efi/core.efi /mnt/boot/efi/EFI/boot/bootx64.efi
  <!--T:17-->
{{UserCmd|command=sudo cp /mnt/boot/grub/x86_64-efi/core.efi /mnt/boot/efi/EFI/boot/bootx64.efi}}


<!--T:18-->
Copying /boot/efi/EFI/Manjaro/grubx64.efi instead of /boot/grub/x86_64-efi/core.efi can also accomplish the same thing because /boot/efi/EFI/Manjaro/grubx64.efi is itself a copy of /boot/grub/x86_64-efi/core.efi
Copying /boot/efi/EFI/Manjaro/grubx64.efi instead of /boot/grub/x86_64-efi/core.efi can also accomplish the same thing because /boot/efi/EFI/Manjaro/grubx64.efi is itself a copy of /boot/grub/x86_64-efi/core.efi


<!--T:19-->
So doing this is also an alternative.
So doing this is also an alternative.


  sudo cp /boot/efi/EFI/Manjaro/grubx64.efi /boot/efi/EFI/boot/bootx64.efi
  <!--T:20-->
{{UserCmd|command=sudo cp /boot/efi/EFI/Manjaro/grubx64.efi /boot/efi/EFI/boot/bootx64.efi}}


<!--T:21-->
Doing this extra command where the extra command is not needed does not seem to harm the system.
Doing this extra command where the extra command is not needed does not seem to harm the system.


= A fallback alternative =
= A fallback alternative = <!--T:22-->
(Both bios-legacy and uefi)
(Both bios-legacy and uefi)


<!--T:23-->
We can despite our efforts, still use the other OS grub to boot Manjaro, and might come in useful, particularly if the above methods seems daunting. Or if we are stuck not being able to get to Manjaro bootloader.
We can despite our efforts, still use the other OS grub to boot Manjaro, and might come in useful, particularly if the above methods seems daunting. Or if we are stuck not being able to get to Manjaro bootloader.


<!--T:24-->
At the other OS grub 2 system, create a custom.cfg file
At the other OS grub 2 system, create a custom.cfg file


sudo touch /boot/grub/custom.cfg
<!--T:25-->
{{UserCmd|command=sudo touch /boot/grub/custom.cfg}}


<!--T:26-->
Some OS's like Suse, Fedora, Mageia uses directory in /boot/grub2 not /boot/grub, so do so accordingly.
Some OS's like Suse, Fedora, Mageia uses directory in /boot/grub2 not /boot/grub, so do so accordingly.
Then add the following in the newly created custom.cfg. No need to update-grub or change /etc/default/grub and will stand (persist) grub-installs or update-grubs. And of course persists to any new Manjaro kernel. Note this entry/entries will not be shown in their grub.cfg.
Then add the following in the newly created custom.cfg. No need to update-grub or change /etc/default/grub and will stand (persist) grub-installs or update-grubs. And of course persists to any new Manjaro kernel. Note this entry/entries will not be shown in their grub.cfg.


  menuentry "Manjaro - configfile "  {
</translate>
  <!--T:27-->
{{File|file=/boot/grub/custom.cfg|content=
<pre>
menuentry "Manjaro - configfile "  {
     insmod part_gpt
     insmod part_gpt
     part part_msdos
     part part_msdos
Line 76: Line 108:
     configfile /boot/grub/grub.cfg
     configfile /boot/grub/grub.cfg
  }
  }
</pre>
}}
<translate>
<!--T:28-->
btrfs will need additional tweaks (rootflag=subvolume=@)
</translate>


btrfs will need additional tweeks (rootflag=subvolume=@)
[[Category:Contents Page{{#translation:}}]]

Latest revision as of 12:09, 22 May 2024

Other languages:
English • ‎Türkçe • ‎русский

Introduction

This is not to get back or to restore your Manjaro bootloader. To restore your Manjaro bootloader, see this.

This is to prevent your working Manjaro bootloader being overridden by other OS bootloaders. This can happen when the other OS updates its grub (not update-grub). And due to Manjaro's implementation of intel-ucode, other OS bootloader cannot boot Manjaro OS, hence this tutorial.

Bios-legacy systems

Boot up all other linux OS and at their terminals, do

user $ sudo grub-install --force /dev/sdxy COPY TO CLIPBOARD


where /dev/sdxy is the other OS partition. Note some OS's need command 'grub2-install'.

When installing a new linux OS, at their installer, always select "installing bootloader to partition". We can also choose not to install bootloader, but selecting 'to partition' (Manjaro calls this 'to system') is good enough and is preferable to have a bootloader installed at every OS.

If you choose to uninstall Manjaro later on, remember to make the other OS bootloader as default before uninstalling.

UEFI systems

At any linux OS terminal, see output of

user $ efibootmgr COPY TO CLIPBOARD


It will give an output like this:


$ efibootmgr

 BootCurrent: 0001
 Timeout: 1 seconds
 BootOrder: 0001,0002,0004,0005,0008
 Boot0001* manjaro
 Boot0002* ubuntu
 Boot0004* UEFI: WDC WD10PURX
 Boot0005* Hard Drive
 Boot0008* Systemd Boot Manager
 


Make sure Manjaro bootorder is at the beginning as above: "BootOrder: 0001,0002,0004,0005,0008" If it is not, reorder such that it is, like this:

user $ sudo efibootmgr -o 0001,0002,0004,0005,0008 COPY TO CLIPBOARD


Whenever we install another OS, it will be at the top of that bootorder; and we will need to reorder such that Manjaro is again at the top. And we can do that at that install livecd media itself. If we forget, we can do it after installation at any OS. For UEFI, we can still select Manjaro to boot at boot-setup (one of F8 ~ F12).

That alone should be sufficient for most UEFI systems. However in some situations (and reported in some topics here), it is not (possibly due to firmware issues). The above steps do not ensure that Manjaro bootorder will be booted up. In these cases, one extra command is required.

user $ sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/boot/bootx64.efi COPY TO CLIPBOARD


Or, if done at livecd (or another OS) and mounted / partition to /mnt and /boot/efi partition to /mnt/boot/efi

user $ sudo cp /mnt/boot/grub/x86_64-efi/core.efi /mnt/boot/efi/EFI/boot/bootx64.efi COPY TO CLIPBOARD


Copying /boot/efi/EFI/Manjaro/grubx64.efi instead of /boot/grub/x86_64-efi/core.efi can also accomplish the same thing because /boot/efi/EFI/Manjaro/grubx64.efi is itself a copy of /boot/grub/x86_64-efi/core.efi

So doing this is also an alternative.

user $ sudo cp /boot/efi/EFI/Manjaro/grubx64.efi /boot/efi/EFI/boot/bootx64.efi COPY TO CLIPBOARD


Doing this extra command where the extra command is not needed does not seem to harm the system.

A fallback alternative

(Both bios-legacy and uefi)

We can despite our efforts, still use the other OS grub to boot Manjaro, and might come in useful, particularly if the above methods seems daunting. Or if we are stuck not being able to get to Manjaro bootloader.

At the other OS grub 2 system, create a custom.cfg file

user $ sudo touch /boot/grub/custom.cfg COPY TO CLIPBOARD


Some OS's like Suse, Fedora, Mageia uses directory in /boot/grub2 not /boot/grub, so do so accordingly. Then add the following in the newly created custom.cfg. No need to update-grub or change /etc/default/grub and will stand (persist) grub-installs or update-grubs. And of course persists to any new Manjaro kernel. Note this entry/entries will not be shown in their grub.cfg.

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

btrfs will need additional tweaks (rootflag=subvolume=@)

Cookies help us deliver our services. By using our services, you agree to our use of cookies.