Quantcast
Channel: Debian User Forums
Viewing all articles
Browse latest Browse all 3567

Installation • Force installer to use a certain EFI partition

$
0
0
Hello, on my laptop I have an ssd with windows and another one where I want to install debian.
During manual partitioning I created a 500 MB efi partition and another one for the operating system in ext4.
When I proceed with the installation, debian uses the windows efi on the other ssd.
How do I force it to use the efi of the second ssd where only debian will be installed?
Thank you
Do it after install as the installer in my experience will ignore the second drive when you select it and clobber the windows loader if it is the first seen EFI partition. Which is what it always does with any install I have ever done with another OS on the first drive in the system, the only OS that has ever got this correct is the Manjaro installer. So as root or using sudo in front of the following commands when booted into the Debian install.

Code:

  root@9600k:~# blkid | grep /dev/nvme1/dev/nvme1n1p4: LABEL="CorsairMusic" UUID="5a6278cb-79eb-424b-a6d5-c85add3e641a" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="63732088-e879-490e-8f32-dff97ee9dd99"/dev/nvme1n1p2: LABEL="CorsairRoot" UUID="766dcfc3-a1e4-495f-86e2-570205723fef" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="74a3fd28-a39c-4a91-b015-31676217edaa"/dev/nvme1n1p5: LABEL="CorsairRtorrent" UUID="154a5472-9d98-4dbe-a50e-e929ab116065" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="5070ef3c-25b8-4360-afcf-63593012676f"/dev/nvme1n1p3: LABEL="CorsairHome" UUID="dc257f43-9b9a-4db0-bf79-7af981389d29" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="5c46783f-9051-463e-add8-fadcbe15d0f0"/dev/nvme1n1p1: SEC_TYPE="msdos" LABEL_FATBOOT="CORSAIR_EFI" LABEL="CORSAIR_EFI" UUID="F0D8-55B1" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="06c13ca4-c6b9-41b0-9ed3-756ce6282278"
Here you see an example of the blkid command which will be used to get the UUID you will need for the EFI partition you want to change it too. You can leave off the "| grep /dev/nvme1" on the command to get the listing of both drives in your system.

Code:

root@9600k:~# mkdir /tmp/efiroot@9600k:~# mount /dev/sd?? /tmp/efi
These two commands first create a directory to mount your second EFI partition for the copying of the required files and then mounts it. You replace the ?? with the actual drive letter and number of the partition you got using the blkid command. In my case I use /dev/nvme1n1p1 the NVMe drive that contains my debian install.

Code:

root@9600k:~# mkdir /tmp/efiroot@9600k:~# mount /dev/nvme1n1p1 /tmp/efiroot@9600k:~# ls -l /tmp/efitotal 4drwxr-xr-x 4 root root 4096 May 23  2023 EFIroot@9600k:~# ls -l /tmp/efi/EFI/total 8drwxr-xr-x 2 root root 4096 May 23  2023 BOOTdrwxr-xr-x 2 root root 4096 May 23  2023 debian
Here you see me do it with my debian install using its existing partition below shows the existing partition that I am currently booted from.

Code:

root@9600k:~# ls -l /boot/efi/EFI/total 8drwx------ 2 root root 4096 Apr  4 08:12 BOOTdrwx------ 2 root root 4096 Apr  4 08:12 ubuntu
As you can see the only difference is the differently named directories it will look to boot from for those files. It is the existing directories you need to copy to the /tmp/efi/ directory that was created and mounted for that purpose.

Code:

root@9600k:~# cp -Rpv /boot/efi/EFI /tmp/efi/root@9600k:~# rm -r /tmp/efi/EFI/microsoft
The actual copying of the files from existing /boot/efi/EFI to the /tmp/efi/. The R copies recursively meaning it takes all the directories under the EFI, the p preserves the permissions and v does it verbosely meaning it will list what it has done not just give no feedback as is the default showing nothing leaving you to wonder if it did anything. The second command deletes the useless microsoft directory that will be copied over as well. Now once done this.

Code:

root@9600k:~# nano /etc/fstabroot@9600k:~# reboot

These commands edit your existing fstab to replace the UUID=??????? for the existing /boot/efi with the second drive one you got earlier. This tells the system where your EFI partition is located and it will now use it every time it boots from that drive or the system is updated. The last command reboots the machine so the change will be used on next boot, you can do this graphically if doing this in a terminal window on the desktop. You will need to go into the EFI firmware and change the boot priority to list the second drive as first to boot for it to use the new settings every time or use the one time boot menu key to get a listing of the options to boot from, on my machine this is the F12 hit at the correct time during the boot process. Choose the new drive from the list as there will be at least two of them due to the old files still being on the windows drive. Once you have booted and confirmed the new partition in use you can mount the windows drive EFI partition and delete the debian directory there.

What the line in the /etc/fstab file looks like in my current booted install this is the line you want to change.

Code:

root@9600k:~# grep -i EFI /etc/fstab# /boot/efi is on /dev/nvme1n1p1 9600k machine SP NVMeUUID=FEC4-39C0  /boot/efi       vfat    umask=0077      0       1
It is the FEC4-39C0 I would need to change if I wanted different partition used. Once you edit the line in nano to put in the second drive UUID a CTRL + x key combination answering y for yes to save the buffer then enter key will have your changes saved.


Edit: and now I have thought about it the procedure to repair the clobbered boot record of windows.

https://www.dell.com/support/kbdoc/en-c ... ur-dell-pc

Once that is done you will have totally separate EFI bootloaders on each drive if you have deleted the debian directory from the windows drive.

Statistics: Posted by RedGreen925 — 2024-06-14 23:50 — Replies 1 — Views 41



Viewing all articles
Browse latest Browse all 3567

Trending Articles