You are not logged in.

#1 2017-07-27 22:04:27

bootzin
Member
Registered: 2016-11-02
Posts: 28

grub-install problems

So, this is yet another grub problem
TL;DR: grub-install outputs the following error:

grub-install: error: /usr/lib/grub/x86-64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.

even though the file exists

To begin things with, I had Windows installed on my new computer, but I wanted to use linux, so I went on windows and shrinked it's partition and installed Kali Linux on a part of the remaining memory. I had problems with the bootloader and after quite some effort managed to get it working (I don't remember how, I believe it was a mix of update-grub and boot-repair). That went just fine for about 3 months.

Then, yesterday I tried to install a microcontroller driver (CH340) on my kali machine, and admitedly fiddled around with "make" a little bit more than I should, and did not managed to install the driver. I then logged off the kali machine and went to the windows machine and tried to install the driver there, where it was successful and then I turned off my computer. The next time I turned it on, however, it got stuck on the computer logo screen (Although it allowed me to access the BIOS). I then tried to fiddle with the boot order and when I tried to boot windows first (via windows boot, i.e. not grub) it worked, but trying to boot into the linux machine always got the computer stuck (Not even exchanging any data with the prcessor). So I thought it was probably a problem in the boot and tried every way I could think of to get the boot to work, but all to no avail. So, after much frustration, I decided to try to install Arch in the remainder of my disk. The instalation process went quite smooth, until I tried to get grub to work

As I said, when I couldn't boot into my machine I tried to install grub again, but I got the following error message:

grub-install: error: /usr/lib/grub/x86-64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.

Back then I didn't try to solve this because I thought there might be another way to get it to work, but now, as I try to install Arch I'm getting precisely the same message. I tried going to the boot partition and formatting it, wiping it clean, but that didn't work. I also tried to go the x86-64-efi folder and the "modinfo.sh" file was actually there, and was not empty.

Some important info:
1. I have an uefi system, because my efivars folder is not empty
2. I actually had 2 boot partitions, one that came with windows when it was installed and the one I created when installing Kali (512MiB). This is the same partition I'm trying to use for Arch.
3. When using a live usb I managed to figure that both the root and home partitions of kali are working just fine, and all my data is still there
4. This is the command I ran (and a few variations, including --force):

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck

5. When I tried running update-grub on the live cd (mounted into the appropriate partition) it actually gave me an output, even though grub-install failed, now that I'm installing Arch it says "command not found"

Any idea on how can I fix this?

Last edited by bootzin (2017-07-27 22:09:20)

Offline

#2 2017-07-27 22:42:00

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: grub-install problems

bootzin wrote:

2. I actually had 2 boot partitions, one that came with windows when it was installed and the one I created when installing Kali (512MiB). This is the same partition I'm trying to use for Arch.

This was a mistake. You should only have 1 EFI partition per drive. One of the major plus factors of UEFI is that all of the bootlooaders can coexist on the same partition.

5. When I tried running update-grub on the live cd (mounted into the appropriate partition) it actually gave me an output, even though grub-install failed, now that I'm installing Arch it says "command not found"

You must have been using a different Live CD, the update-grub command has never existed on Arch (the equivelant would be grub-mkconfig -o /boot/grub/grub.cfg).


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2017-07-27 23:17:25

bootzin
Member
Registered: 2016-11-02
Posts: 28

Re: grub-install problems

slithery wrote:

This was a mistake. You should only have 1 EFI partition per drive. One of the major plus factors of UEFI is that all of the bootlooaders can coexist on the same partition.

Hmm, I see.. But then, was I supposed to delete the windows boot? I created another partition because windows boot only has 260MiB and most guides I've read suggested a minimum of 512MiB, so I thought it wasn't a good idea to use that one, but I didn't delete it either because I didn't see any harm on leaving it there... Anyhow, should I try to delete it now and create a new boot?

You must have been using a different Live CD, the update-grub command has never existed on Arch (the equivelant would be grub-mkconfig -o /boot/grub/grub.cfg).

You're right, I forgot to say I was using the Kali live USB

EDIT: Funny enough, I just tried running simply

grub-install /dev/sda 

and it returned me "cannot find EFI directory", to which I tried adding "--efi-directory=/boot" and it returned
"/boot doesn't look like an EFI partition" even though "fdisk -l" returns it as an EFI System sad

I'll try to reformat the partition and post the results for you

Last edited by bootzin (2017-07-27 23:22:58)

Offline

#4 2017-07-28 06:25:12

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: grub-install problems

bootzin wrote:

was I supposed to delete the windows boot?

No, do not delete the Windows-generated EFI system partition, you will break your Windows system if you do this.

The pre-existing ESP should be shared between Arch & Windows with both systems using the same partition.

should I try to delete it now and create a new boot?

No, you will break your Windows box.

I'll try to reformat the partition and post the results for you

Oh dear  hmm

You will need to repair your Windows system now...

As you seem to be having problems with GRUB, you could try systemd-boot instead, it is included in the base system and is simpler than GRUB (with less to go wrong):

https://wiki.archlinux.org/index.php/Systemd-boot

If you want to stick with GRUB then you need to detail the exact steps taken from the moment you loaded the ISO image so that we can spot the mistakes.

The output of the following commands are always useful when troubleshooting UEFI booting problems:

# parted --list
# efibootmgr -v

Use a pastebin client to post the results here.

https://wiki.archlinux.org/index.php/Li … in_clients

Offline

#5 2017-07-28 14:55:47

bootzin
Member
Registered: 2016-11-02
Posts: 28

Re: grub-install problems

Head_on_a_Stick wrote:

No, do not delete the Windows-generated EFI system partition, you will break your Windows system if you do this.

The pre-existing ESP should be shared between Arch & Windows with both systems using the same partition.

Even though that ESP had only 260Mb? Nvm, I just figured out that the actual minimum value for a boot partition (FAT32) is 256Mb, 512 is just a recommended value

Oh dear  hmm

You will need to repair your Windows system now...

Thankfully, I waited for a reply before doing anything, so no real harm here (phew). I did reformat the boot partition I was using before though (the one I created), but it didn't help either.

As you seem to be having problems with GRUB, you could try systemd-boot instead, it is included in the base system and is simpler than GRUB (with less to go wrong):

I think I'll give it a try, GRUB has a lot of extra features, but I don't think I use most of them anyway. I do want to try to repair GRUB a little bit more though.

The output of the following commands are always useful when troubleshooting UEFI booting problems:

# parted --list
# efibootmgr -v

Use a pastebin client to post the results here.

Here are the results of those commands (Ran outside arch-chroot /mnt) :
https://ptpb.pw/q9UB

EDIT:
Alright, so I solved one problem, but got another
I realized I hadn't reboot my system after remaking the ESP, so I rebooted, remounted and tried installing grub again with

grub-install /dev/sda --efi-directory=/boot --bootloader-id=arch_grub --recheck 

and it actually worked, the instalation went smooth and without any issues

I then configured grub with grub-mkconfig -o /boot/grub/grub.cfg and it also didn't report any errors. Then I exit and rebooted my system and when I got into the grub bootloader it was just a plain command line with some grub info and the line grub> _ awaiting for some input.

I have absolutely no idea on how to proceed, any ideas?

I have tried to go back to Arch live usb and reinstall grub with os-prober, but it got me back to the same screen. Here is my grub.cfg https://ptpb.pw/7uGE

EDIT2:
Running these commands on the grub shell managed to get me into Arch

set root=(hd0,10)
insmod linux
linux /boot/vmlinuz-linux root=/dev/sda10
initrd /boot/initramfs-linux.img
boot

I'll now try to update grub.cfg from there and see if it works

EDIT3:
Aaaand, it didn't work hmm

EDIT4:
Alright, so I now managed to boot into Kali linux and use update-grub/grub install from there, it has found every os installed in my machine, I've uploaded the grub.cfg generated by it here ptpb.pw/KOEJ. I then reboot and managed to enter grub screen without any real problems, and I could log into Kali and Windows normally from there. Problem is, when I tried to log into Arch it got an error and told me

error: file 'vmlinuz-linux' not found.
error: you need to load the kernel first

Even though I had logged into arch before using that vmlinuz-linux file

Last edited by bootzin (2017-07-28 18:23:28)

Offline

#6 2017-07-28 19:44:06

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: grub-install problems

bootzin wrote:

Running these commands on the grub shell managed to get me into Arch

set root=(hd0,10)
insmod linux
linux /boot/vmlinuz-linux root=/dev/sda10
initrd /boot/initramfs-linux.img
boot

If that worked then your kernel image is on /dev/sda10 rather than the EFI system partition.

GRUB can handle this but it is not what is advised in the ArchWiki and it certainly won't work if you tell `grub-install` that /boot is mounted to the ESP when it isn't.

As I mentioned previously:

I wrote:

you need to detail the exact steps taken from the moment you loaded the ISO image

I have no idea what you actually did during the installation process; more specifically, I don't know how (or when) you mounted the ESP.

Please provide the exact commands that you used to install the system and confirm the relevant mountpoints.

grub.cfg generated by it here ptpb.pw/KOEJ

That is looking for the Arch kernel on /dev/sda6 (the new ESP) and it isn't there, apparently.

So you must have failed to mount the ESP to /boot (/mnt/boot from the ISO) before running `pacstrap`

Confirm this by using:

# mount /dev/sda6 /mnt
find /mnt

You can get Arch booting by adding a stanza to /etc/grub.d/40_custom (in Kali) containing the working parameters:

menuentry 'Arch' {
    set root=(hd0,10)
    linux /boot/vmlinuz-linux root=/dev/sda10 rw
    initrd /boot/initramfs-linux.img
}

Then use `update-grub` from Kali to make the new entry.

But really you should mount the (Windows) ESP to /boot and re-install the linux package and also re-run `grub-install`, this will place all of the needed files on the correct location and should allow the Kali GRUB entry to boot (after updating the configuration).

Last edited by Head_on_a_Stick (2017-07-28 19:45:10)

Offline

#7 2017-07-29 22:21:15

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

Re: grub-install problems

There is as stated above only 1 ESP per drive and normally per system. That partition should be 256-512MB, formatted as FAT32 and it should have the ESP and boot flags set though often boot loaders and managers ignore that. For simplicity sake I recommend using /boot as the mount point for this ESP. Since the kernel package files are installed to /boot this will put them on the ESP, at its root so to speak. Even if you have multiple distros all putting their kernels on the ESP you'll be OK unless they use the same kernel names. The only time I've run into that was installing arch and a child distro that used the same kernel names.

When installing or repairing an arch instance on UEFI, boot the iso, when you get to mounting the partitions mount your new root at /mnt and your ESP at /mnt/boot. Then use arch-chroot to cause your environment to be using those partitions for your root and ESP. Do this and there shouldn't be such confusion and that is why Head_on_a_stick wanted your exact steps. It doesn't look like this was clear to you.

Multi-booting is a good way to end up learning a lot about the ESP. You'll learn what I've already described and what files and folders are on it. Arch lets us see how the ESP works because we manually put kernels, boot managers and boot loaders on it, and manually configure them as needed. Other distros do a good job of hiding all that and that keeps people from doing much learning.


Simple and Open

Offline

Board footer

Powered by FluxBB