[SOLVED] Can I change Legacy boot drive to UEFI?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Catsbark
Level 3
Level 3
Posts: 193
Joined: Sat Jan 14, 2017 11:53 pm

[SOLVED] Can I change Legacy boot drive to UEFI?

Post by Catsbark »

...without tearing down my entire installation and starting from scratch?

My laptop arrived with Windows 10 on a conventional spinning HDD. I added a new, blank SSD and installed LM 19.x onto it, later upgrading in place to LM 20.x. Somehow the SSD is only bootable with Legacy boot. I've had trouble getting LM to consistently boot with the AMDGPU video driver (it often starts with the VESA driver), and in a topic on that problem (Startup issue followed by random freezes) SMG suggested the the Legacy boot might be part of the problem.

The drive is configured with Master Boot Record partitioning. Is there a way to install EFI without erasing everything and starting over?

Code: Select all

john@Dell:~$ inxi -Fcx
System:
  Host: Dell Kernel: 5.11.0-38-generic x86_64 bits: 64 compiler: N/A 
  Desktop: Xfce 4.16.0 Distro: Linux Mint 20.2 Uma base: Ubuntu 20.04 focal 
Machine:
  Type: Laptop System: Dell product: Inspiron 5575 v: 1.3.3 
  serial: <superuser/root required> 
  Mobo: Dell model: 0M0Y6P v: X01 serial: <superuser/root required> 
  UEFI [Legacy]: Dell v: 1.3.3 date: 10/31/2019 
Battery:
  ID-1: BAT1 charge: 39.1 Wh condition: 39.1/42.0 Wh (93%) 
  model: SDI 0x4D,0x38,0x35,0x34,0x00,0x00,0x00D8 status: Full 
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M525 
  charge: 5% (should be ignored) status: Discharging 
CPU:
  Topology: Quad Core model: AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx 
  bits: 64 type: MT MCP arch: Zen L2 cache: 2048 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm 
  bogomips: 31941 
  Speed: 1371 MHz min/max: 1600/2000 MHz Core speeds (MHz): 1: 1328 2: 1350 
  3: 1369 4: 1422 5: 1522 6: 1526 7: 1398 8: 1369 
Graphics:
  Device-1: AMD Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] 
  vendor: Dell driver: amdgpu v: kernel bus ID: 04:00.0 
  Display: x11 server: X.Org 1.20.11 driver: amdgpu 
  resolution: 1920x1080~60Hz 
  OpenGL: renderer: AMD Radeon Vega 8 Graphics (RAVEN DRM 3.40.0 
  5.11.0-38-generic LLVM 12.0.0) 
  v: 4.6 Mesa 21.0.3 direct render: Yes 
Audio:
  Device-1: AMD Raven/Raven2/Fenghuang HDMI/DP Audio vendor: Dell 
  driver: snd_hda_intel v: kernel bus ID: 04:00.1 
  Device-2: AMD Family 17h HD Audio vendor: Dell driver: snd_hda_intel 
  v: kernel bus ID: 04:00.6 
  Sound Server: ALSA v: k5.11.0-38-generic 
Network:
  Device-1: Realtek RTL810xE PCI Express Fast Ethernet vendor: Dell 
  driver: r8169 v: kernel port: 2000 bus ID: 02:00.0 
  IF: enp2s0 state: down mac: 54:bf:64:1e:28:5c 
  Device-2: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter 
  vendor: Dell driver: ath10k_pci v: kernel port: 2000 bus ID: 03:00.0 
  IF: wlp3s0 state: up mac: 90:32:4b:8e:2f:9f 
  Device-3: Qualcomm Atheros type: USB driver: btusb bus ID: 3-2.4:6 
Drives:
  Local Storage: total: 1.44 TiB used: 237.27 GiB (16.1%) 
  ID-1: /dev/nvme0n1 vendor: Crucial model: CT500P1SSD8 size: 465.76 GiB 
  ID-2: /dev/sda vendor: Seagate model: ST1000LM035-1RK172 size: 931.51 GiB 
  ID-3: /dev/sdb type: USB model: Initio 0M9AT00 size: 74.53 GiB 
Partition:
  ID-1: / size: 456.50 GiB used: 236.82 GiB (51.9%) fs: ext4 dev: /dev/dm-0 
  ID-2: swap-1 size: 976.0 MiB used: 452.0 MiB (46.3%) fs: swap 
  dev: /dev/dm-1 
Sensors:
  System Temperatures: cpu: 62.9 C mobo: N/A gpu: amdgpu temp: 62 C 
  Fan Speeds (RPM): fan-1: 2500 
Info:
  Processes: 291 Uptime: 23h 00m Memory: 7.42 GiB used: 2.49 GiB (33.6%) 
  Init: systemd runlevel: 5 Compilers: gcc: 9.3.0 Shell: bash v: 5.0.17 
  inxi: 3.0.38
Thanks in advance for any assistance.
Catsbark
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Catsbark
Dell Inspiron 15; AMD Ryzen 5; LM 20.3 Cinnamon
"A learning experience is one of those things that says, 'You know that thing you just did? Don't do that." - Douglas Adams
User avatar
AndyMH
Level 21
Level 21
Posts: 13757
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can I change Legacy boot drive to UEFI?

Post by AndyMH »

No
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Catsbark
Level 3
Level 3
Posts: 193
Joined: Sat Jan 14, 2017 11:53 pm

Re: Can I change Legacy boot drive to UEFI?

Post by Catsbark »

Thank you for your concise reply. I guess the simplest thing to do is to back up what I must and re-install Linux. Is there anything besides /Home that I need to copy?
Catsbark
Dell Inspiron 15; AMD Ryzen 5; LM 20.3 Cinnamon
"A learning experience is one of those things that says, 'You know that thing you just did? Don't do that." - Douglas Adams
User avatar
AndyMH
Level 21
Level 21
Posts: 13757
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can I change Legacy boot drive to UEFI?

Post by AndyMH »

Somehow the SSD is only bootable with Legacy boot.
There is nothing wrong with legacy boot, all my laptops boot legacy and the desktop is UEFI only because it won't boot legacy off an NVME drive. But if you want to change...

Mint installs in the mode your mint install stick boots in. You can check, once booted, with efibootmgr. If you get this:

Code: Select all

andy@T432 ~ $ efibootmgr
EFI variables are not supported on this system.
it's booted in legacy mode, anything else is UEFI.

If you can sort out BIOS so you boot the stick in UEFI mode, run gparted and create a new partition table on your SSD - you want GPT not msdos. You can select 'erase and install' to install mint, or if you want you can pre-partition the drive with gparted. As a minimum you need:
  • an EFI partition - size 100MB, format FAT32 and set the flags esp & boot. This is where the bootloader, grub, lives for UEFI boot.
  • a single ext4 partition using the rest of the drive.
You would then install with 'something else' and tell the installer to use the partition you created for /. The screen after selecting 'something else' shows your drives and partitions, click on the ext4 partition you created and click the change button, you get a pop up where there is a drop down where you tell mint what to use it for.

Either way, once installed, copy back the backup you made of home.

In response to your original question - things you could try, but no guarantees, I've not tried them:
  • Timeshift - take a snapshot of your system to an ext4 partition on another drive. In settings:
Screenshot from 2021-11-23 00-23-20.png
enable all files in home (do not do this for normal snapshots - bad practice, use something else for home like backintime).

Then install mint as above, run timeshift and restore the snapshot you just took. BUT, on the bootloader options:
Screenshot from 2021-11-23 00-28-16.png
Screenshot from 2021-11-23 00-28-16.png (18.78 KiB) Viewed 5626 times
DISABLE the two checkboxes for grub. That way it might leave grub unchanged and it might boot after the restore.

OR
boot your mint install stick and run gparted.
  • with gparted shrink your / partition by a bit more than 100MB.
  • with gparted copy your / partition to another drive - it will need unallocated space equal or greater than the size of your / partition.
  • with gparted, create a GPT partition table on your SSD and create an EFI partition as above (that is why you needed to shrink your / partition - to make the space).
  • with gparted, copy your / partition back onto your SSD.
  • run boot-repair (there is a copy on the mint install stick for LM20, don't think it's in the iso for LM19). It might offer to re-install grub on your SSD.
  • if that fails you can install grub manually from a terminal, don't have the commands to hand, it's more complicated with UEFI than legacy.
Can you see why I said NO first time around?
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
AndyMH
Level 21
Level 21
Posts: 13757
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can I change Legacy boot drive to UEFI?

Post by AndyMH »

Having thought about it, the timeshift restore will not work - timeshift will overwrite the existing fstab, so the UUID entries in there will point at non-existent partitions. Easy to fix, but something else that would have to be done manually.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Catsbark
Level 3
Level 3
Posts: 193
Joined: Sat Jan 14, 2017 11:53 pm

Re: Can I change Legacy boot drive to UEFI?

Post by Catsbark »

AndyMH, thanks for your detailed comments.
More and more it looks like a fresh installation is in my future. Since Legacy boot is highly suspect in my startup issues, and Kernel 5.11 is strongly indicated for making my video driver stable and avoiding freezes, I think this might be my process:
  1. Back up my /home directory (What's the best way? Will a simple copy to another drive do the trick? If not, what's the best tool to use?) Is there anything else I should back up?
  • Use a fresh flash drive to boot, and verify that it's running from UEFI
  • Install LM 20.2 XFCE (I really prefer the XFCE GUI) from the flash drive and verify that it's running from UEFI
  • Upgrade the kernel to 5.11
  • Restore my /home directory from the backup
  • Cross my fingers
Do you have any suggestions? Have I left out anything, or put things in the wrong order?
(I can't figure out how to make the ordered list markup work right.)
Catsbark
Dell Inspiron 15; AMD Ryzen 5; LM 20.3 Cinnamon
"A learning experience is one of those things that says, 'You know that thing you just did? Don't do that." - Douglas Adams
User avatar
AndyMH
Level 21
Level 21
Posts: 13757
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can I change Legacy boot drive to UEFI?

Post by AndyMH »

Yes to all of them, fresh install is what I would do.

Backup home - a simple copy will do, but get in the habit. I use timeshift to look after the system and backintime to look after home*. Save the snapshots from both to an ext4 partition on another drive. Under the hood, they are both using rsync. First time you run them they copy everything, so takes a while, thereafter only what has changed/new, so quick. Each snapshot is complete - where there is no change they use hardlinks to point at the original file (=no additional drive space in the snapshot). With backintime you can restore individual folders/files or the complete snapshot. You will find it in software manager.

XFCE is a personal choice, you have more than enough horsepower to run cinnamon.

/dev/dm-0 - do you have an encrypted install or LVM? Not a fan, adds a layer complexity and if things go wrong can make it impossible to recover.

You might think about taking an image backup of the drive before you start. That way if things go pear shaped you can restore the image to get a working system back. I recommend foxclone (but then I developed it :) ), an alternative is rescuezilla. You can download a comprehensive user guide for foxclone.

* I've got an internal/removable 2TB HDD in all my PCs used only for backup, timeshift/backintime run daily automatically, periodically I take an image backup with foxclone.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Catsbark
Level 3
Level 3
Posts: 193
Joined: Sat Jan 14, 2017 11:53 pm

Re: Can I change Legacy boot drive to UEFI?

Post by Catsbark »

I made a backup of my /home directory and booted from the LM 2.x USB stick. The installer default was to install onto the Windows HDD (it identified Windows Boot Manager, which exists only on the HDD), so I chose "Other." Installer would not install to the SSD, saying that the partition table could not be changed (or something like that; writing from memory here). Do I need to use Gparted to repartition and reformat the SSD before I can do a new UEFI installation?
Catsbark
Dell Inspiron 15; AMD Ryzen 5; LM 20.3 Cinnamon
"A learning experience is one of those things that says, 'You know that thing you just did? Don't do that." - Douglas Adams
User avatar
AndyMH
Level 21
Level 21
Posts: 13757
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can I change Legacy boot drive to UEFI?

Post by AndyMH »

First, check you are booting the mint install stick in UEFI mode with efibootmgr. To install in UEFI mode, you need to boot the install stick in UEFI mode. Post the output.

Also post the output from sudo parted --list, that will tell me how your drives/partitions are set up and if you need to reformat it.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Catsbark
Level 3
Level 3
Posts: 193
Joined: Sat Jan 14, 2017 11:53 pm

Re: Can I change Legacy boot drive to UEFI?

Post by Catsbark »

Here are the command results:

Code: Select all

john@Dell:~$ sudo parted --list
[sudo] password for john:       
Model: ATA ST1000LM035-1RK1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                          Flags
 1      1049kB  683MB   682MB   fat32        EFI system partition          boot, esp
 2      683MB   817MB   134MB                Microsoft reserved partition  msftres
 3      817MB   987GB   986GB   ntfs         Basic data partition          msftdata
 4      987GB   988GB   610MB   ntfs                                       hidden, diag
 5      988GB   999GB   11.5GB  ntfs                                       hidden, diag
 6      999GB   1000GB  1143MB  ntfs                                       hidden, diag


Model: Seagate BUP Slim SL (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1000GB  1000GB  primary  ntfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/mint--vg-swap_1: 1023MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system     Flags
 1      0.00B  1023MB  1023MB  linux-swap(v1)


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/mint--vg-root: 499GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0.00B  499GB  499GB  ext4


Model: CT500P1SSD8 (nvme)
Disk /dev/nvme0n1: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  500GB  500GB  primary               boot, lvm


The CT500P1SSD8 (nvme) is my SSD.

Executed from LM20.2 USB stick:

Code: Select all

mint@mint:~$ efibootmgr
Timeout: 0 seconds
BootOrder: 0003,0005,0004,0000,0006,0001,0002
Boot0000* Network
Boot0001* Onboard NIC (IPV4) 
Boot0002* Onboard NIC (IPV6) 
Boot0003* Hard Drive
Boot0004* CD/DVD/CD-RW Drive
Boot0005* USB Storage Device
Boot0006* Windows Boot Manager
mint@mint:~$ 
Added quirk: When I try to boot from the USB stick, after selecting Linux Mint 20.2 in the Grub (?) menu, sometimes the screen blanks and stays blank until I lose patience and power cycle the system. Other times the screen blanks briefly, displays a few text messages quickly, and then the LM logo. When this happens, the system continues to boot into the GUI and all's right with the world. Any thoughts about this? Should I re-download the ISO and rewrite the USB stick?
Catsbark
Dell Inspiron 15; AMD Ryzen 5; LM 20.3 Cinnamon
"A learning experience is one of those things that says, 'You know that thing you just did? Don't do that." - Douglas Adams
Catsbark
Level 3
Level 3
Posts: 193
Joined: Sat Jan 14, 2017 11:53 pm

Re: Can I change Legacy boot drive to UEFI?

Post by Catsbark »

After posting the above, I bethought me that my USB stick is LM 20.2 XFCE, which has the 5.4 kernel that was part of my original problem with the AMDGPU driver. Now my quandry is: install XFCE which I prefer but will give me some problems until I update the kernel to 5.11, or install Cinnamon which I like less, but will use the 5.11 kernel from the get-go. If I install Cinnamon, will I encounter any problems when I restore my /home backup? How easy would it be to switch from Cinnamon to XFCE after the fact and would I need to choose XFCE every time I reboot?

There is so much I don't yet know. Thanks again for all your help.
Catsbark
Dell Inspiron 15; AMD Ryzen 5; LM 20.3 Cinnamon
"A learning experience is one of those things that says, 'You know that thing you just did? Don't do that." - Douglas Adams
User avatar
AndyMH
Level 21
Level 21
Posts: 13757
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can I change Legacy boot drive to UEFI?

Post by AndyMH »

The added quirk - can't help, could be the speed of the stick (slow) or a video driver issue.

Your mint install stick boots in UEFI mode - so good, but your current linux drive has a legacy partition table, bad.

Code: Select all

Model: CT500P1SSD8 (nvme)
Disk /dev/nvme0n1: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos  <<<<<<<<<< legacy partition table
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  500GB  500GB  primary               boot, lvm
You will need to use gparted on your mint install stick to put a gpt partition table on the drive (you can use a legacy partition table for UEFI but gpt is better). This will wipe the drive. In gparted device > create partition table (make sure you select the right drive, a drop down top right).

Next - I assume you want the linux nvme drive to be able to boot independently of your win drive. There is a bug in the installer - it will put grub, the bootloader, in the first EFI partition it finds (and ignore what you tell it to do) which will be your win drive. There are two fixes for this:
  • the simplest, disconnect your win drive before you install mint on the nvme drive.
  • if that is difficult, again using gparted on your mint install stick, disable the esp & boot flags on your EFI partition (sda1) on your win drive. Right click on the partition and 'manage flags', re-enable them after you have installed mint.
Installing mint - you can select the 'erase and install' option, making sure you select nvme0n1 as the drive to install to. It will create an EFI partition for the bootloader and a single ext4 partition using the rest of the drive for /. Or...

You can install with the 'something else' option, which is what I always do. If you do this, partition the drive before install using gparted. You need to create:
  • an EFI partition - size 100MB, format fat32 and set the flags esp and boot.
  • for the simplest install - a single ext4 partition for / using the rest of the drive, or
  • two ext4 partitions, one for / and another for /home. With this setup, / needs to be about 40GB and the rest of the drive for the /home partition*.
When you install, the screen after selecting 'something else' shows you all your drives and partitions, click on the partition you created for / and click the change button. Tell the installer to reformat it and use it for / (it's on a dropdown menu). If you created a separate partition for /home, repeat but tell it to use it for /home. At the bottom of the screen is a drop down asking where to put the bootloader, tell it nvme0n1 (you specify the drive, not a partition).

Strongly recommend you don't use LVM, you are adding a layer of complexity you don't really need.

If you want a grub menu on boot giving you the choice of mint or win, after you have booted into mint, open a terminal and sudo update-grub. It should find win and next time you boot give you the choice.


* the advantage - when you come to do a fresh install in the future, e.g. LM20 to LM21 (not LM20.2 to LM20.3, that's just an upgrade), you can install with something else tell the installer to reuse your / partition for / and reformat it, and reuse your /home partition for /home and NOT reformat it (still wise to have a backup).
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
AndyMH
Level 21
Level 21
Posts: 13757
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can I change Legacy boot drive to UEFI?

Post by AndyMH »

Cross posted and just seen your post

If xfce is what you prefer, then install that and then update to the later kernel (and it is only the 'edge' edition of cinnamon that has the later kernel). Yes you can have more than one desktop environment installed but generally not recommended, and there may be problems with the config files (I've never done it, cinnamon user from the get-go).
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Catsbark
Level 3
Level 3
Posts: 193
Joined: Sat Jan 14, 2017 11:53 pm

Re: [SOLVED] Can I change Legacy boot drive to UEFI?

Post by Catsbark »

Wrap Up

I followed the instructions from AndyMH. I re-partitioned my SSD and installed LM20.2 Cinnamon-Edge, so now I'm booting with UEFI, running kernel 5.13, and the AMDGPU driver loads every time and seems to be stable - no freezes. So all the issues from my original post have been resolved.

I still prefer the look and feel of Xfce, but I'll get used to Cinnamon soon and then I'll be fine.

AndyMH, thanks for all your help and your clear instructions.

Catsbark
Catsbark
Dell Inspiron 15; AMD Ryzen 5; LM 20.3 Cinnamon
"A learning experience is one of those things that says, 'You know that thing you just did? Don't do that." - Douglas Adams
User avatar
SMG
Level 25
Level 25
Posts: 31988
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [SOLVED] Can I change Legacy boot drive to UEFI?

Post by SMG »

Catsbark wrote: Fri Dec 03, 2021 3:46 pm so now I'm booting with UEFI, running kernel 5.13, and the AMDGPU driver loads every time and seems to be stable - no freezes. So all the issues from my original post have been resolved.
Great to hear this is now working consistently for you. :D
Image
A woman typing on a laptop with LM20.3 Cinnamon.
Locked

Return to “Installation & Boot”