You are not logged in.

#1 2017-06-25 13:50:55

Lemongrass
Member
From: Central Europe
Registered: 2017-03-03
Posts: 59

Installing Grub in dual boot with Windows (UEFI)

Hi there,

maybe this post could go to Installation subforum but I don't know for sure.

So I tried to install Arch on my machine in UEFI mode along with Windows 10. Following the Wiki, I did this:

loadkeys hu
ping -c 3 archlinux.org
timedatectl set-ntp true
mkfs.ext4 /dev/sda4
mount /dev/sda4 /mnt
mkdir /mnt/boot
mount /dev/sda2 /boot
pacstrap /mnt base
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
pacman -S base-devel sudo
ln -sf /usr/share/zoneinfo/Europe/Budapest /etc/localtime
hwclock --systohc
vi /etc/locale.gen #uncomment locale
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo "KEYMAP=hu" >> /etc/vconsole.conf
echo "Lemongrass-pc" >> /etc/hostname
pacman -S iw wpa_supplicant dialog
passwd
pacman -S intel-ucode os-prober grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Grub
grub-mkconfig -o /boot/grub/grub.cfg
exit
reboot

Then I saw my previous Fedora GRUB2 bootloader (I'm not sure it was GRUB2, but the Fedora bootloader for sure) with my previous Fedora options and Windows. (I formatted Fedora's partition, sda4). So I think I have spoiled something.

I found on the forums that if I run
grub-mkconfig -o /boot/EFI/grub/grub.cfg
instead, it will work. I tried this also, I saw GRUB, but I couldn't boot into Arch (I got a command prompt only with an error message I should have noticed - sorry).

Does anybody have an idea what I did wrong? Thank you! smile

Last edited by Lemongrass (2017-06-25 13:51:38)

Offline

#2 2017-06-25 15:52:05

Maniaxx
Member
Registered: 2014-05-14
Posts: 761

Re: Installing Grub in dual boot with Windows (UEFI)

Are you sure EFI partition is /dev/sda2? What is sda1 then?
Please post output of:

fdisk -l /dev/sda

sys2064

Offline

#3 2017-06-25 18:51:01

Lemongrass
Member
From: Central Europe
Registered: 2017-03-03
Posts: 59

Re: Installing Grub in dual boot with Windows (UEFI)

Thank you for your reply!

Here you go:

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: EE22B9EE-4437-4FBA-A527-7012884A8301

Device         Start       End   Sectors  Size Type
/dev/sda1       2048    923647    921600  450M Windows recovery environment
/dev/sda2     923648   1126399    202752   99M EFI System
/dev/sda3    1126400   1159167     32768   16M Microsoft reserved
/dev/sda4    1159168 126988287 125829120   60G Linux filesystem
/dev/sda5  126988288 546418687 419430400  200G Microsoft basic data
/dev/sda6  546418688 955363327 408944640  195G Microsoft basic data
Model: ATA WDC WD5000LPVX-7 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                          Flags
 1      1049kB  473MB   472MB   ntfs         Basic data partition          hidden, diag
 2      473MB   577MB   104MB   fat32        EFI System Partition          boot, esp
 3      577MB   593MB   16.8MB               Microsoft reserved partition  msftres
 4      593MB   65.0GB  64.4GB  ext4         Basic data partition
 5      65.0GB  280GB   215GB   ntfs         Basic data partition          msftdata
 6      280GB   489GB   209GB   ntfs         Basic data partition          msftdata


Model: TOSHIBA TransMemory-Mx (scsi)
Disk /dev/sdb: 7803MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  7803MB  7802MB  fat32        Microsoft Basic Data  msftdata

A few partitions were created by Windows. My hard drive is used in UEFI-GPT mode.

Last edited by Lemongrass (2017-06-25 21:27:15)

Offline

#4 2017-06-25 18:59:38

loqs
Member
Registered: 2014-03-06
Posts: 19,114

Re: Installing Grub in dual boot with Windows (UEFI)

mkdir /mnt/boot
mount /dev/sda2 /boot

The directory /mnt/boot was created but the ESP was mounted to /boot of the live media not /mnt/boot

Offline

#5 2017-06-25 19:06:00

dockland
Member
From: Sweden
Registered: 2015-06-06
Posts: 861

Re: Installing Grub in dual boot with Windows (UEFI)

Just a little heads up, do you have room in /dev/sda2? If you previously dualbooted it might contain Fedoras kernel(s) aswell.
Not saying this is related, but anyway, 100MB isn't that big, should have room for 3 kernels i think, but just make sure there's room.


I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.

Offline

#6 2017-06-25 19:14:38

Lemongrass
Member
From: Central Europe
Registered: 2017-03-03
Posts: 59

Re: Installing Grub in dual boot with Windows (UEFI)

@loqs: I think that's only a typoo. I'm almost completely sure I mounted that to /mnt/boot. But next time I will play even more attention to that point. Thank you!

@dockland: the ESP contained a vmlinuz-linux image after I first installed Arch. But thank you, I'll look into it. Anyways, grub didn't show any error of lack of space.
Is there a way to extend that partition? It's stuck between to Windows partitions. I'm not sure Windows will survive if I move partition borders (this is not specific to Windows, moving partitions isn't the most risk-free thing).

I don't have the time to install Arch Linux again, but when I try again, I post here.

Last edited by Lemongrass (2017-06-25 21:28:14)

Offline

#7 2017-06-25 19:20:13

loqs
Member
Registered: 2014-03-06
Posts: 19,114

Re: Installing Grub in dual boot with Windows (UEFI)

I do not think there is a need to repeat the installation steps at this stage.  If you mount the ESP from the live media what is the contents of the ESP's root directory?
Also when you try to boot the install what is the error message from grub?

Offline

#8 2017-06-26 08:34:34

Maniaxx
Member
Registered: 2014-05-14
Posts: 761

Re: Installing Grub in dual boot with Windows (UEFI)

Check bootorder with efibootmgr.


sys2064

Offline

#9 2017-06-26 17:25:58

Blasphemist
Member
From: Colorado
Registered: 2013-01-17
Posts: 160

Re: Installing Grub in dual boot with Windows (UEFI)

Remember that with UEFI, most actions installing new OS's don't overwrite what had been on the ESP. Also, installing a new OS doesn't remove previously existing boot entries in UEFI. This means that installing Arch over Fedora for example doesn't remove the Fedora boot entry in UEFI nor Grub entry's for Fedora on the ESP. You can use the efibootmgr utility to clean up the UEFI variables. See the efibootmgr man page for more info. You can manually delete files and folders from the ESP that may exist from previous installations. Do be sure to understand for sure what you are removing.


Simple and Open

Offline

#10 2017-06-30 19:30:36

Lemongrass
Member
From: Central Europe
Registered: 2017-03-03
Posts: 59

Re: Installing Grub in dual boot with Windows (UEFI)

Thank you all for your answers! smile

Today I investigated into this problem and found this:

My ESP partition consists of these folders/files:
EFI System grub initrafms-linux-fallback.img initrafms-linux.img intel-ucode.img intel-ucode.img.bak mach-kernel vmlinuz-linux

EFI containts these:
Boot Grub_Arch_Linux Microsoft fedora grub

Grub_Arch_Linux and grub in the EFI folder are identifiers that I used when I tried installing grub twice (I can chroot into the Arch partition).

I deleted both these entries from the UEFI settings (after pressing F2) trying to save space in the ESP partition. It seems it didn't work. Now I'd like to clean the ESP first, or even better, extend it before trying to install grub again from the chroot environment.

Can I delete the folders Grub_Arch_Linux, fedora and grub safely (in the folder EFI)? I also noticed that the sda3 partition (the 16 MB sized one) doesn't have a file system. I couldn't mount it to see if there is anything there.

Does anybody know if I can move that 16 MB partition created by the Windows installer (with gparted)? I would like to extend the ESP (currently it's 84% full).

I have checked the efibootmgr man page but I just didn't become brave enough to use efibootmgr after reading it.

Last edited by Lemongrass (2017-06-30 19:34:33)

Offline

#11 2017-06-30 19:56:05

loqs
Member
Registered: 2014-03-06
Posts: 19,114

Re: Installing Grub in dual boot with Windows (UEFI)

Please use a pastebin to post the output of the following

$ ls -R /mnt #assuming the ESP is mounted at /mnt
$ efibootmgr -v

It is much easier for me at least to parse a commands output than a description of a commands output.
Edit:
See the tip box to pipe console output straight to a pastebin without installing any additional software.

Last edited by loqs (2017-06-30 19:57:18)

Offline

#12 2017-07-01 12:41:39

Lemongrass
Member
From: Central Europe
Registered: 2017-03-03
Posts: 59

Re: Installing Grub in dual boot with Windows (UEFI)

Thank you loqs for your reply and your tip on pb! smile

Here they are:
ls -R boot output (ESP is on boot).
efibootmgr -v output.

Currently there's are 3 options available for me to boot in the UEFI settings: Windows, Fedora and my pendrive (if I plug it in). I deleted the Fedora bootloader once in the UEFI settings, but it got back somehow.

Last edited by Lemongrass (2017-07-01 12:44:23)

Offline

#13 2017-07-01 12:54:37

dockland
Member
From: Sweden
Registered: 2015-06-06
Posts: 861

Re: Installing Grub in dual boot with Windows (UEFI)

You can delete entries if everything is uninstalled/removed from previous linux or other OS installations, via efibootmgr -[commands]

https://www.mankier.com/8/efibootmgr


I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.

Offline

#14 2017-07-01 13:02:40

Lemongrass
Member
From: Central Europe
Registered: 2017-03-03
Posts: 59

Re: Installing Grub in dual boot with Windows (UEFI)

Thank you too, dockland. smile Can I do so even if I have deleted those boot entries in UEFI so they don't appear in efibootmgr -v? Can I just delete them wtih rm -rf?

Offline

#15 2017-07-01 13:26:34

loqs
Member
Registered: 2014-03-06
Posts: 19,114

Re: Installing Grub in dual boot with Windows (UEFI)

Boot0001* Fedora	HD(2,GPT,b079087e-3991-4d60-9ba1-91a2482616bb,0xe1800,0x31800)/File(\EFI\fedora\shim.efi)

You still have that entry.
From the root of the ESP I would suggest deleting

grub
initramfs-linux-fallback.img
initramfs-linux.img
intel-ucode.img
intel-ucode.img.bak
mach_kernel
vmlinuz-linux

Just leaving

EFI
System

The System directory I am uncertain about and the EFI directory contains the Windows EFI content.
From the EFI directory I would suggest removing

Grub_Arch_Linux
fedora
grub

Leaving

Boot
Microsoft

That should lave just the Microsoft loader and the unknown System directory.  You would then need to reinstall the kernel package and a boot loader.
I would not recommend deleting

 3      577MB   593MB   16.8MB               Microsoft reserved partition  msftres

Instead could you from Windows shrink

/dev/sda5  126988288 546418687 419430400  200G Microsoft basic data

Then move all the previous partitions so there is space available by the ESP then resize the ESP.  That can be left for after arch is successfully booting though.

Offline

#16 2017-07-12 17:35:07

Blasphemist
Member
From: Colorado
Registered: 2013-01-17
Posts: 160

Re: Installing Grub in dual boot with Windows (UEFI)

To delete the fedora boot entry shown above in logs post, use efibootmgr.

# efibootmgr -b 1 -B

logs described how to clean up the ESP, this efibootmgr command will delete the Boot0001 from the UEFI NVRAM variables. My ESP is the same size as yours and I never have trouble with it filling up. I don't keep old kernels. I've installed a whole lot of linux instances on this Satellite C55 over time. I've learned how to create, edit and delete boot entries in UEFI using efibootmgr and what creates files and folders on the ESP. When you have cleaned up the ESP as logs described above you'll have plenty of space on the ESP.


Simple and Open

Offline

Board footer

Powered by FluxBB