Is it possible to migrate Manjaro from existing legacy BIOS installation to UEFI?

Hi,

I am running Manjaro KDE (amd64; kernel 5.4) as my only bare-metal installation. The installation was made in legacy BIOS mode.

I would like to reinstall Manjaro in UEFI mode and be able to retrieve my previous OS and data so that I do not have to reinstall every single package. Is that possible somehow ?

I can rsync my current installation to an external disk. After installing Manjaro in UEFI mode, I want to reverse rsync from my backup onto my hard-disk. That in effect will ,migrate my existing installation to UEFI mode.

Thanks for any help,
Manish Jain

Hi,

here is a little guide to switch from BIOS to UEFI: UEFI - Install Guide - Manjaro

Hope it helps :wink:

yes do backup ,
if you backup all ( / and /home ) ,
you restore by grsync or timeshift

boot on USB iso manjaro
1 backup each partition
2 launch gparted format GPT and create /boot/efi ( 33 to 100Mo fat32 with flag boot & esp ),
/ and /home
3 restore back for / and /home
4 you will go in chroot for
a - update new UUID
( lsblk -fs & /etc/fstab )

redo a 2nd chroot for EFI
b - restore GRUB for EFI

for check before format GPT and restore backup that all efi is ok
open a terminal and check

inxi -Fza
sudo parted -l
sudo efibootmgr -v
test -d /sys/firmware/efi && echo efi || echo legacybios

after restore backup
get all UUID

sudo fsblk -fs 

*update /etc/fstab UUID a /boot/efi by chroot

add line for /boot/efi and update all UUID

sudo manjaro-chroot -a 
nano /etc/fstab 
exit ( end chroot )

as example , change UUID !!!

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>                           <mount point>  <type>  <options>  <dump>  <pass>
UUID=AAAA-BBBB 				  /boot/efi      vfat    defaults,noatime 0       2

*restore grub en /boot/efi ( 2nd chroot to get /boot/efi UUID with /etc/fstab )

sudo manjaro-chroot -a 
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck --verbose
update-grub
efibootmgr -v
exit ( end chroot )

then you can reboot , press F2 or F8 or F12 to go in bios ans select UEFI manjaro

1 Like

Thanks all. I succeeded in the conversion.

Difficult procedure, nice result - woo hoo Manjaro Forum :slight_smile:

This is actually super easy. Just be sure to make a backup just in case things go a bit wonky.

Requirements

  • Gparted (pacman -S gparted)
  • Grub from a live image (Manjaro or any OS)
  • 10 minutes

Instructions

  • Start by creating a 200MB FAT32 partition using Gparted wherever there is space. (You may need to shrink partitions). Flag this as ESP and BOOT then reboot your computer.

  • Make sure you insert the USB/CD you intend to boot from.

  • Now reboot your computer. This is a good time to reset bios settings and update firmware (optional). Once you are ready, change your bios from legacy/csm to UEFI. If none of these options exist, consult the internet.

  • Set your computer to boot from the live USB/CD now that you are in UEFI mode

  • Once grub shows up, type C

  • Oh no! A grub prompt! (Don’t worry! I got you covered)

  • type ls then look at the drives and partitions grub detected.

  • type ls (hdx,x)/ And look for the partition that looks like a root partition (contains home, usr, etc, dev (etc.)) (replace x with a #)

  • Once you have found that, type configfile (hdx,x)/boot/grub/grub.cfg

  • Welcome back to manjaro! If you did everything right, you should be back in your system! Now we could leave things like this but that’s tedious and annoying.

  • Login in, pull up a terminal and run sudo grub-install /dev/sda --target x86_64-efi --debug if no errors are reported, you should be able to reboot with the new grub!

  • If errors are reported, try changing /dev/sda to whatever partition you made your 200MB FAT32 partition and verify you flagged it properly!

  • You made it to the end! Hope this was helpful!

1 Like

Hi all,

Again thanks all for posting very useful tips.

I however migrated using a ‘homegrown’ approach described below. The approach worked, although there is a glitch that I want to understand why it is happening.

The way I did it was (after some trial-and-error):

  1. Using GParted CD, I repartitioned my disks as GPT, reserving /dev/sda1 (640 MB) as type efi, as well as a 40 GB partition for Linux root.

  2. Booted with my Manjaro Linux DVD and restored my Linux OS and data via rsync from USB backup to the Linux partition mounted at /mnt.

  3. While still with my Manjaro Linux DVD and my Linux root partition at /mnt, further mounted the ESP at /mnt/boot/efi and then ran:

grub-install --root-directory=/mnt --efi-directory=/mnt/boot/efi
–target=x86_64-efi --bootloader-id=Manjaro --recheck

This succeeded.

  1. Once done, I booted into Linux using Advanced Options -> fallback image for initram.

  2. Once Linux booted, I deleted the default initram, created a new one and instructed grub to use the new initram:

mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r)
update-grub

#----------#

Things work perfectly.

The only glitch in all this is that Linux for some reason limits the size of the ESP to 779 kB even though the partition is 640 MB.

df -h` says :

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 779K 522K 257K 68% /boot/efi

fdisk /dev/sda says :

Device Start End Sectors Size Type
/dev/sda1 2048 1312767 1310720 640M EFI System

What might be causing the ESP to be restricted to 779 kB despite the actual ESP partition size being 640 MB ? Am I missing something very basic or have I done something very stupid ?

Thanks for any inputs,
Manish Jain

that size EFI ( linux only )

df -Th
Sys. de fichiers Type     Taille Utilisé Dispo Uti% Monté sur
/dev/sda1        vfat       197M    275K  197M   1% /boot/efi

No. My EFI partition is 640 MB. fdisk confirms that. df however claims the size of the partition is just 779 kB (257 kB free). If I try copying any content over 257 kB onto that partition, I get disk space error.

The reason this is significant is I am trying to setup rEFInd. But I cannot install rEFInd firmware into the ESP because of this size limit issue.

can you provide

sudo parted -l

/home/bourne <<: sudo parted -l
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 672MB 671MB fat16 boot, esp
2 672MB 7115MB 6442MB
3 7115MB 41.5GB 34.4GB ext4
4 41.5GB 483GB 441GB ext4
5 483GB 500GB 17.3GB linux-swap(v1) swap

Model: Samsung SSD 970 EVO Plus 250GB (nvme)
Disk /dev/nvme0n1: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 43.0GB 42.9GB ext4
2 43.0GB 232GB 189GB ext4
3 232GB 250GB 18.1GB ext2

then what you get

df -Th

/home/bourne <<: df -Th
df: /run/user/1000/doc: Operation not permitted
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs tmpfs 7.8G 36M 7.8G 1% /dev/shm
tmpfs tmpfs 3.2G 18M 3.1G 1% /run
tmpfs tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
/dev/nvme0n1p1 ext4 40G 23G 15G 62% /
/dev/nvme0n1p2 ext4 173G 100G 65G 61% /mnt/vbox
/dev/nvme0n1p3 ext2 17G 44M 16G 1% /mnt/wall
/dev/sda3 ext4 32G 23G 6.9G 77% /mnt/rootsync
/dev/sda1 vfat 779K 522K 257K 68% /boot/efi
/dev/sda4 ext4 404G 235G 149G 62% /perm
tmpfs tmpfs 7.8G 47M 7.8G 1% /tmp
tmpfs tmpfs 1.6G 116K 1.6G 1% /run/user/1000

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