Bios to UEFI conversion

Hi all,

Did any one of you convert a laptop from bios to uefy successfully?
I want to do that without the whole hassle of reinstalling everything.

Mostly because of the ability to update my firmware.

I’ve read a few tuts on the web and it seems doable but there are probably a couple of difficulties.

I know I have to change mbr to gpt and add a /boot/efi.

can you please provide

inxi -Fza 
sudo parted -l

is there any other os ?

There is no other os and the partitions are simple.

Model: ATA Crucial_CT128MX1 (scsi)
Schijf /dev/sda: 128GB
Sectorgrootte (logisch/fysiek): 512B/4096B
Partitietabel: msdos
Schijfvlaggen: 

Nummer  Begin   Einde  Grootte  Type     Bestandssysteem  Vlaggen
 1      1049kB  119GB  119GB    primary  ext4
 2      119GB   128GB  8882MB   primary  linux-swap(v1)

System:
  Kernel: 5.4.115-1-lts54 x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-linux-lts54 
  root=UUID=6dcee954-bc8a-4034-86f5-189bf448289a rw intel_idle.max_cstate=1 
  intel_iommu=off resume=UUID=31fc204a-f877-4128-b63f-ac70b0d5312e 
  loglevel=3 pci=nocrs 
  Desktop: Xfce 4.16.0 tk: Gtk 3.24.24 info: xfce4-panel wm: xfwm4 vt: 7 
  dm: LightDM 1.30.0 Distro: EndeavourOS base: Arch Linux 
Machine:
  Type: Portable System: Dell product: Inspiron 15-3552 v: 4.4.0 
  serial: <filter> Chassis: type: 8 serial: <filter> 
  Mobo: Dell model: ������ v: ��� serial: <filter> UEFI-[Legacy]: Dell 
  v: 4.4.0 date: 03/06/2018 
Battery:
  ID-1: BAT0 charge: 28.3 Wh (100.0%) condition: 28.3/41.4 Wh (68.2%) 
  volts: 17.1 min: 14.8 model: PANASONIC DELL 78V9D63 type: Unknown 
  serial: <filter> status: Full 
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse serial: <filter> 
  charge: 55% (should be ignored) rechargeable: yes status: Discharging 
CPU:
  Info: Dual Core model: Intel Celeron N3050 bits: 64 type: MCP 
  arch: Airmont family: 6 model-id: 4C (76) stepping: 3 microcode: 368 
  cache: L2: 1024 KiB 
  flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 6400 
  Speed: 1829 MHz min/max: 480/2160 MHz Core speeds (MHz): 1: 647 2: 604 
  Vulnerabilities: Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds mitigation: Clear CPU buffers; SMT disabled 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass status: Not affected 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, 
  IBRS_FW, STIBP: disabled, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx 
  Integrated Graphics 
  vendor: Dell driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:22b1 
  class-ID: 0300 
  Device-2: Suyin Integrated_Webcam_HD type: USB driver: uvcvideo 
  bus-ID: 1-5:3 chip-ID: 064e:9209 class-ID: 0e02 serial: <filter> 
  Display: x11 server: X.Org 1.20.11 driver: loaded: intel 
  unloaded: fbdev,modesetting,vesa display-ID: :0.0 screens: 1 
  Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.2x8.0") 
  s-diag: 414mm (16.3") 
  Monitor-1: eDP1 res: 1366x768 hz: 60 dpi: 99 size: 350x190mm (13.8x7.5") 
  diag: 398mm (15.7") 
  Message: Unable to show advanced data. Required tool glxinfo missing. 
Audio:
  Device-1: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series 
  High Definition Audio 
  vendor: Dell driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 
  chip-ID: 8086:2284 class-ID: 0403 
  Sound Server-1: ALSA v: k5.4.115-1-lts54 running: yes 
  Sound Server-2: JACK v: 0.125.0 running: no 
  Sound Server-3: PulseAudio v: 14.2 running: yes 
Network:
  Device-1: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter 
  vendor: Dell Vostro 3470 driver: ath9k v: kernel port: f040 
  bus-ID: 01:00.0 chip-ID: 168c:0036 class-ID: 0280 
  IF: wlan0 state: up mac: <filter> 
Bluetooth:
  Device-1: Qualcomm Atheros type: USB driver: btusb v: 0.8 bus-ID: 1-2.1:11 
  chip-ID: 0cf3:e005 class-ID: e001 
  Report: bt-service: disabled note: bt-adapter can't run. 
Drives:
  Local Storage: total: 119.24 GiB used: 66.64 GiB (55.9%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/sda maj-min: 8:0 vendor: Crucial model: CT128MX100SSD1 
  size: 119.24 GiB block-size: physical: 4096 B logical: 512 B 
  speed: 6.0 Gb/s rotation: SSD serial: <filter> rev: MU03 scheme: MBR 
Partition:
  ID-1: / raw-size: 110.97 GiB size: 108.73 GiB (97.98%) 
  used: 66.62 GiB (61.3%) fs: ext4 dev: /dev/sda1 maj-min: 8:1 
Swap:
  Kernel: swappiness: 10 (default 60) cache-pressure: 100 (default) 
  ID-1: swap-1 type: partition size: 8.27 GiB used: 20.5 MiB (0.2%) 
  priority: -2 dev: /dev/sda2 maj-min: 8:2 
Sensors:
  System Temperatures: cpu: 26.0 C mobo: 45.0 C 
  Fan Speeds (RPM): cpu: 0 
Info:
  Processes: 159 Uptime: 2d 55m wakeups: 50 Memory: 3.76 GiB 
  used: 2.18 GiB (58.0%) Init: systemd v: 248 tool: systemctl Compilers: 
  gcc: 10.2.0 Packages: pacman: 1175 lib: 279 Shell: Bash v: 5.1.4 
  running-in: xfce4-terminal inxi: 3.3.03 

check all option in your UEFI

SecureBoot off
Fast Boot off
No CSM
No Legacy
all disks on AHCI

you can check in terminal

inxi -Fxza
test -d /sys/firmware/efi && echo efi || echo bios
sudo efibootmgr -v

So first , 2 ways ,

you will need to create dir /boot/efi , have UUID /boot/efi in /etc/fstab updated , then restore GRUb EFI

Okay, I think I know what to do.
Two things, do I need to backup and restore to get gpt?

It looks like I can do this without restoring a backup with gdisk…
And two, how would I generate a new fstab? Or should I copy the example given?

That would be: /dev/disk/by-partlabel/EFI-system /boot/efi vfat defaults 0 2

$ test -d /sys/firmware/efi && echo efi || echo bios
bios

$ sudo efibootmgr -v
EFI variables are not supported on this system.

for your UUID see ( before chroot )

sudo lsblk -fs

like 
# <file system>                           <mount point>  <type>  <options>  <dump>  <pass>
UUID=XXXX-YYYY 				  /boot/efi      vfat    defaults,noatime 0       2

If you only have linux installed you can in place convert an mbr EXT4 system to GPT.

You then need to create and setup a /boot/efi and redo your grub setup. This will usually be easiest if you boot from a USB drive in uefi mode then chroot into your install to reinstall grub in uefi mode.

Its more than doable, i did it on my older Dell laptop myself a while ago but exact instructions i dont have atm

Okay, but I wonder how the correct uuid will be created for /boot/efi?
So, what comes in places for xxxx-yyyy?

UUID (universally unique identifier) of your block device.

The easiest way to find out the UUIDs, in my opinion, is to run

lsblk -f

Yes, but what I mean is, will the uuid for the efi partition automatically be created?
Since I now only have these.

NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda                                                                           
├─sda1 ext4   1.0         6dcee954-bc8a-4034-86f5-189bf448289a   36,1G    62% /
└─sda2 swap   1           31fc204a-f877-4128-b63f-ac70b0d5312e                [SWAP]

you need to add one

  • reduce or drop create size swap
  • create /boot/efi 33Mo - 100Mo vfat ( fat32) with boot& esp flag
  • chroot , create dir /boot/efi , check uuid , change /etc/fstab end-chroot
  • 2nd chroot should mount / & /boot/efi , then restore grub efi
  • check with efibootmgr -v

The UUID will be created when the partition is created. The partition won’t be created for you.

A few things:

  • How are you planning to convert your disk from MBR/msdos to GPT? I know there are some tools that can do this but be aware it is a fairly risky operation.
  • There is no reason to create an EFI partition until your disk is converted to GPT.
  • What you are planning to do is both something of a pain and is risky enough that you shouldn’t do it without a backup.
  • If you have a backup, wouldn’t it be easier to erase the disk, re-install and then restore your backup?

Based on the questions you are asking above, I am a little fearful this conversion is going to more than you are ready for at this point in your Linux journey.

Thank you for your confidence Dalto.
If I’m not ready now then I will never be ready for this journey.

I started in 2008.

(Or maybe I’m too dumb…)

Sorry if I offended. It wasn’t my intention. If you feel you are ready for it then things like this make an excellent learning experience.

However, please go into it knowing what you are contemplating doing is not easy. Fundamentally, what you need to do is:

  • Update your system.
  • Make a backup.
  • Use a tool to convert your disk to GPT. After doing this it will no longer boot.
  • Boot off a Linux ISO.
  • Resize and relocate your partitions to make room for an EFI partition.
  • Create an EFI partition manually with the appropriate flags.
  • Format the EFI partition.
  • Mount your root partition.
  • create a boot/efi partition in that mounted partition.
  • Mount your EFI partition at boot/efi.
  • Chroot into that mounted system.
  • Re-install grub for efi.
  • Modify /etc/fstab with the correct UUIDs for your root and swap partitions.
  • Add an entry for your EFI partition.
  • Exit the chroot.
  • Unmount all the partitions.
  • Boot into your BIOS and select the efi as your default boot device. (This is only needed because it is probably currently set to legacy boot from a specific partition)
  • Hope everything works, if not, troubleshoot from there.

Please note, I haven’t tried the above, that is just how I would think through it. It is possible I missed steps.

I don’t think you will find a perfect tutorial where you can copy/paste commands. It will probably take some exploration and interpretation.

1 Like

Well, I followed all steps but there is one thing missing out.

$ lsblk -f
NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda                                                                         
├─sda1
│    ext4   1.0         6dcee954-bc8a-4034-86f5-189bf448289a   37,6G    60% /
├─sda2
│    swap   1           31fc204a-f877-4128-b63f-ac70b0d5312e                [SWAP]
└─sda3
     vfat   FAT32 EFI-SYSTEM
                        2A52-C405                             470,1M     0% /boot/efi

fstab:

# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=6dcee954-bc8a-4034-86f5-189bf448289a /              ext4    rw,noatime,data=ordered  0 1
UUID=31fc204a-f877-4128-b63f-ac70b0d5312e swap           swap    defaults 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
UUID=2A52-C405 				  /boot/efi      vfat    defaults,noatime 0

I regenerated grub with the usual command; sudo grub-mkconfig -o /boot/grub/grub.cfg

But it won’t boot.

You need to re-install grub, not just regenerate the config for it.

https://wiki.archlinux.org/title/GRUB#Installation_2

Be sure to boot the ISO in efi mode so you can do an efi install of grub.

Perhaps also put boot and esp flag on the EFI System Partition.

And it’s done!
It boots just fine.

I had to install grub.

3 Likes

The flags shouldn’t matter as long the type is correct.

Congrats!

1 Like

Thanks!