[SOLVED] GRUB2 - What does it mean error: "invalid filename?"
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
GRUB2 - What does it mean error: "invalid filename?"
Hi,
I installed Gentoo amd-64 (without grub), in a external hard drive, on a computer running arch.
When I try to boot it from the grub menu, I get a "error: invalid filename" message.
I had to extensively modify the grub.cfg file, as it originally was pointing to the arch disk instead of the gentoo one. I changed UUID's for the root partition of gentoo as well as the disk and device numbering. I also changed the kernel name, as grub was expecting "vmlinuz-linux", and what I found on the gentoo intalation, (in /usr/src/linux-4.9.95-gentoo), is called "vmlinux".
I also added the complete path to the "vmlinux" file, as grub wasn't finding it.
Now, when I try to boot I get the aforementioned error message.
Any help in understanding what the error means and how I should proceed would be very helpful.
Below goes my partition list and the contents of grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos4'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos4' --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 0c169834-97a0-4dc0-9b71-28987366e636
else
search --no-floppy --fs-uuid --set=root 0c169834-97a0-4dc0-9b71-28987366e636
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=15
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=15
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/01_grub-customizer_menu_color_helper ###
### END /etc/grub.d/01_grub-customizer_menu_color_helper ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0c169834-97a0-4dc0-9b71-28987366e636' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-0c169834-97a0-4dc0-9b71-28987366e636' {
menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-0c169834-97a0-4dc0-9b71-28987366e636' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-0c169834-97a0-4dc0-9b71-28987366e636' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux-fallback.img
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/40_custom_proxy ###
menuentry "Gentoo/Linux (on /dev/sdc4)" --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-eacee572-c583-4995-ac17-7dcf50e1d96f' {
insmod part_msdos
insmod ext2
set root='hd1,msdos4'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@1,msdos4' --hint-bios=hd0,msdos1 --hint-efi=hd1,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root eacee572-c583-4995-ac17-7dcf50e1d96f
fi
linux root/run/media/miguel/eacee572-c583-4995-ac17-7dcf50e1d96f/usr/src/linux-4.9.95-gentoo/vmlinux root=UUID=eacee572-c583-4995-ac17-7dcf50e1d96f rw quiet
initrd /initramfs-linux.img
rootdelay=20
}
### END /etc/grub.d/40_custom_proxy ###
### BEGIN /etc/grub.d/41_os-prober_proxy ###
### END /etc/grub.d/41_os-prober_proxy ###
### BEGIN /etc/grub.d/42_os-prober_proxy ###
submenu "Advanced options for Gentoo/Linux (on /dev/sdc4)"{
menuentry "Arch Linux (on /dev/sdc4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-linux--eacee572-c583-4995-ac17-7dcf50e1d96f' {
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec
fi
linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet
initrd /initramfs-linux.img
}
menuentry "Arch Linux, with Linux linux (on /dev/sdc4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-linux--eacee572-c583-4995-ac17-7dcf50e1d96f' {
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec
fi
linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet
initrd /initramfs-linux.img
}
menuentry "Arch Linux, with Linux linux (fallback initramfs) (on /dev/sdc4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-linux--eacee572-c583-4995-ac17-7dcf50e1d96f' {
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec
fi
linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet
initrd /initramfs-linux-fallback.img
}
}
### END /etc/grub.d/42_os-prober_proxy ###
### BEGIN /etc/grub.d/43_custom_proxy ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/43_custom_proxy ###
### BEGIN /etc/grub.d/44_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/44_custom ###
When the kernel has finished compiling, copy the kernel image to /boot/. This is handled by the make install command:
root #make install
This will copy the kernel image into /boot/ together with the System.map file and the kernel configuration file.
The kernel you compiled should be in /boot. so either it will be on /dev/sdc2 if your boot paritition was mounted to /boot when this was done, or it will be in /boot on sdc4 if the boot partition wasn't mounted when this was run. or some other partition if the wrong partition was mounted to /boot
Last edited by colorpurple21859; 04-29-2018 at 07:40 AM.
You have a Legacy/MBR system, so which bootloader is in the MBR of the primary drive, Gentoo, Arch?
If you installed the Gentoo Grub to the partition and Arch was in charge, the simplest solution would be to boot Arch and run grub-mkconfig.
If the Gentoo bootloader was the primary, you would have run the command from Gentoo.
When you boot now, are you able to boot Arch and have the error with Gentoo?
In the grub.cfg you posted, there is only one entry I see for Gentoo and I seriously doubt you have the correct kernel line entry, the line beginning with 'linux',
Quote:
linux root/run/media/miguel/...
I don't use Arch or Gentoo but I can't imagine either would put the kernel in the /media/user directory!
The Gentoo entry also shows it on (hd1,4) which is sdb4 and your partition info above shows only sda and sdc. Do you have a flash drive attached?
The primary drive is arch. I didn't installed grub for Gentoo as I wanted to use the grub I already had from Arch.
I can boot Arch with no problems.
Yes, that line was wrong, as I was confused to where the kernel was. I finally found it correctly, in the boot partition, at /run/media/miguel/12b85879-d500-4d38-a683-e8a91a036206/kernel-genkernel-x86_64-4.9.95-gentoo
Quote:
The Gentoo entry also shows it on (hd1,4) which is sdb4 and your partition info above shows only sda and sdc
. I thought (hd1,4) corresponded with /dev/sdc4. Am I wrong?
with a external drive in a usb port on some systems grub will make the usb as hd0 and the internal drive as hd1. I have a laptop that does this when a flash drive is inserted in a usb port when powering up.
The hd1,4, hd0,3, used in Grub change. If you have 3 hard drives plugged in and you have a partition sdc4, in Grub it should be hd2,4. Drives counted from zero, partitions from one. Boot a flash drive, on the flash drive it will likely show itself as sda.
Quote:
I finally found it correctly, in the boot partition, at /run/media/miguel/12b85879-d500-4d38-a683-e8a91a036206/kernel-genkernel-x86_64-4.9.95-gentoo
I don't doubt that you see it there when looking at it from Arch but I doubt if you will see it there if you boot Gentoo.
So your linux line entry for the Gentoo menuentry from Arch now shows:
Quote:
/boot//kernel-genkernel-x86_64-4.9.95-gentoo
So back to the question, after installing and setting up Gentoo with no Grub, why did you not simply reboot ARch and run grub-mkconfig to Add Gentoo?
Quote:
I just confirmed in grub, through the UUID, that hd1/msdos4 is indeed /dev/sdc4.
And how did you do that, by checking the UUID in the menuentry for Gentoo, the one that does NOT boot?
I did run grub-mkconfig, in fact I did it several times. But when I do the gentoo menu entry points the search for the boot and root partitions of the arch disk. In fact the entry for gentoo advanced options are the same from arch. As in, under advanced options for gentoo, I have " arch linux (o /dev/sdc4)
Arch linux, with linux linux ( on /ddv/sdc4)
Arch linux, with linux linux ( fallback initramfs) ( in /dev/ sdc4).
So everything that grub-mkconfig generates points to arch, and that is the reason I am trying to manually alter grub.cfg.
I confirmed it was the correct partiton by doing ls in the (hd1,msdos4) partiton, and seeing its uuid. Then I went to blkid and checked the uuids.
Try this: before selecting gentoo at the grub menu hit e to edit the gentoo menu, change the set root= line to set root=(hd0,2) and clear out everything else between it and the linux line.
Thank you for the suggestion, I will try that, but, just to be sure I understood what you are saying, hd0,2 is Arch's boot partition. Do you want me to point to it?
Your grub.cfg entry looks a little odd. If you look at the UUID entries for Arch, you will notice two different UUIDs, one for the / (sda4?) and one for the /boot partition (sda2). If you then look at the Gentoo entry, the UUID entries are all the same. THe partitions you have on both drives are the same in number and size. Do you have a /boot partition on the Gentoo disk? IS there anything in it, kernel (vmlinuz file)?
Quote:
But when I do the gentoo menu entry points the search for the boot and root partitions of the arch disk
Based on the above, you would need to manually change the UUID for each in the Gentoo entry and all the UUID entries for Gentoo should not be the same, as they are.
One possibility the numbering might be off is if you used a flash drive to install and still had it attached when you re-booted to Arch and ran grub-mkconfig.
Quote:
I confirmed it was the correct partiton by doing ls in the (hd1,msdos4) partiton, and seeing its uuid. Then I went to blkid and checked the uuids.
Doing ls in the (hd1,msdos) partition? Explain that as you have indicated that is the root filesystem of Gentoo which you cannot boot.
Probably would have been simpler to install Grub to the MBR of the external drive, boot Arch From its drive and Gentoo from its drive.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
Manual changes to grub.cfg are lost when you run update-grub, grub-install and grub-mkconfig. You can't hack grub2 that way. You have to edit the scripts in /etc/grub.d.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.