You are not logged in.
Hello,
I'm facing an issue while trying to add a windows entry to GRUB on my arch linux installation. i have followed the steps outlined in the arch wiki and various online resources, but the "menuentry" command seems to be unrecognized, leading to a "command not found" error.
I'm using grub2, and i've updated grub using `grub-mkconfig -o /boot/grub/grub.cfg`
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part
sdb 8:16 0 931.5G 0 disk
├─sdb1 8:17 0 16M 0 part
└─sdb2 8:18 0 931.5G 0 part
sdc 8:32 0 465.8G 0 disk
└─sdc1 8:33 0 465.8G 0 part
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part
└─nvme0n1p2 259:2 0 238G 0 part /
Arch is installed in /dev/nvme0n1
Windows is in /dev/sdb
Could you help please?
Thanks
Last edited by grubtrauma (2024-01-24 00:43:26)
Offline
Wouldn't os-prober be enough for you? https://wiki.archlinux.org/title/GRUB#D … ng_systems
Can you confirm you actually have one-and-only EFI System Partition?
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part
sdb 8:16 0 931.5G 0 disk
├─sdb1 8:17 0 16M 0 part
└─sdb2 8:18 0 931.5G 0 part
sdc 8:32 0 465.8G 0 disk
└─sdc1 8:33 0 465.8G 0 part
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part ###<<< is this the only ESP?
└─nvme0n1p2 259:2 0 238G 0 part /
Last edited by d.ALT (2024-01-23 20:33:34)
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
i did install os-prober and run sudo os-prober then tried to update again grub config with
sudo grub-mkconfig -o /boot/grub/grub.cfg
Yes, i can confirm, it's the only ESP.
Last edited by grubtrauma (2024-01-23 20:54:38)
Offline
Looks like Windows is installed in non-UEFI mode but Arch is a UEFI system. UEFI GRUB cannot chainload a non-UEFI system.
In more detail:
i have followed the steps outlined in the arch wiki
Which steps would those be? Please share the full, exact commands and/or configuration files used.
the "menuentry" command seems to be unrecognized, leading to a "command not found"
Please explain the full context of this rather vague statement. Where do you see that error message? What are you doing to induce it?
Also share the full content of /boot/grub/grub.cfg along with the output of
# parted --list
Thanks.
Offline
# cat /boot/grub/grub.cfg
# cat /etc/default/grub
# cat /etc/grub.d/40_custom
# cat /etc/grub.d/41_custom
Please also show us the contents of your EFI System Partition, eg.:
# ls -R /boot ###in case /dev/nvme0n1p1 is actually mounted on /boot
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
Looks like Windows is installed in non-UEFI mode but Arch is a UEFI system. UEFI GRUB cannot chainload a non-UEFI system.
In more detail:
grubtrauma wrote:i have followed the steps outlined in the arch wiki
Which steps would those be? Please share the full, exact commands and/or configuration files used.
grubtrauma wrote:the "menuentry" command seems to be unrecognized, leading to a "command not found"
Please explain the full context of this rather vague statement. Where do you see that error message? What are you doing to induce it?
Also share the full content of /boot/grub/grub.cfg along with the output of
# parted --list
Thanks.
I meant steps in the official wiki to install grub.
The context of menuentry is i tried to add manually an entry for windows in /etc/default/grub then regenerate the grub config.
menuentry "Windows" {
insmod part_gpt
insmod fat
set root='hd0,gpt1
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
Here's the output of parted
parted --list
Model: ATA TOSHIBA
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 1000GB 1000GB ntfs Basic data partition msftdata
Model: ATA Samsung SSD
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 17.8MB 16.8MB Microsoft reserved partition msftres, no_automount
2 17.8MB 1000GB 1000GB ntfs Basic data partition msftdata
Model: ATA Samsung SSD
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 500GB 500GB ext4
Model: WDC PC (nvme)
Disk /dev/nvme0n1: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 boot, esp
2 538MB 256GB 256GB ext4
Offline
cat /boot/grub/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_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 4a
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=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 4a
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID= rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/amd-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-4a' {
menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-4a' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 4a
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID= rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/amd-ucode.img /boot/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-4a' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID= rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/amd-ucode.img /boot/initramfs-linux-fallback.img
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/15_ostree ###
### END /etc/grub.d/15_ostree ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/25_bli ###
if [ "$grub_platform" = "efi" ]; then
insmod bli
fi
### END /etc/grub.d/25_bli ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/30_uefi-firmware ###
if [ "$grub_platform" = "efi" ]; then
fwsetup --is-supported
if [ "$?" = 0 ]; then
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
fi
fi
### END /etc/grub.d/30_uefi-firmware ###
### BEGIN /etc/grub.d/40_custom ###
# 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/40_custom ###
### BEGIN /etc/grub.d/41_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/41_custom ###
cat /etc/default/grub
# GRUB boot loader configuration
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"
GRUB_CMDLINE_LINUX=""
# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y
# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=menu
# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console
# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `videoinfo'
GRUB_GFXMODE=auto
# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep
# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true
# Uncomment and set to the desired menu colors. Used by normal and wallpaper
# modes only. Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"
# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"
# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT=true
# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y
# Probing for other operating systems is disabled for security reasons. Read
# documentation on GRUB_DISABLE_OS_PROBER, if still want to enable this
# functionality install os-prober and uncomment to detect and include other
# operating systems.
GRUB_DISABLE_OS_PROBER=false
cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# 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.
cat /etc/grub.d/41_custom
#!/bin/sh
cat <<EOF
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
EOF
Last edited by grubtrauma (2024-01-24 00:17:48)
Offline
I meant steps in the official wiki to install grub.
Once more: please share the exact commands used.
The context of menuentry is i tried to add manually an entry for windows in /etc/default/grub then regenerate the grub config.
menuentry "Windows" { insmod part_gpt insmod fat set root='hd0,gpt1 chainloader /EFI/Microsoft/Boot/bootmgfw.efi }
'hd0,gpt1' is unlikely to work as an identifier for /dev/nvme0n1p1 and adding a menuentry to /etc/default/grub will not result in a menu in the GRUB boot screen.
You should probably use something like this instead of your "set root" line (replace $uuid with the actual filesystem UUID of the EFI system partition):
search --fs-uuid --set=root $uuid
Then place the menuentry stanza in /boot/grub/custom.cfg, you won't need to regenerate grub.cfg for that file to be added. It will probably work without the insmod lines, GRUB is very good at autoloading modules.
But first check if bootmgfw.efi is actually present on the ESP:
# mount /dev/nvme0n1p1 /mnt
$ find /mnt -name 'bootmgfw.efi'
^ If the second command doesn't produce any output then there is no Windows bootloader on the ESP.
Did you create /dev/nvme0n1p1 yourself? Did you format it?
Offline
The context of menuentry is i tried to add manually an entry for windows in /etc/default/grub then regenerate the grub config.
menuentry "Windows" { insmod part_gpt insmod fat set root='hd0,gpt1 chainloader /EFI/Microsoft/Boot/bootmgfw.efi }
https://wiki.archlinux.org/title/GRUB#W … I/GPT_mode
Anyway, that manual entry has to be added into /etc/grub.d/40_custom.
Also, how it's gonna end set root='hd0,gpt1 if:
Model: ATA TOSHIBA 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 1000GB 1000GB ntfs Basic data partition msftdata
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
Once more: please share the exact commands used.
During installation i did this:
pacman -S grub efibootmgr
mkdir /boot/efi
mount /dev/nvmen0p1 /boot/efi
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi
and
grub-mkconfig -o /boot/grub/grub.cfg
Did you create /dev/nvme0n1p1 yourself? Did you format it?
Yes, i created it today and format it, i had an arch install in the same nvme and did a fresh install, so there is no Windows bootloader on the ESP.
I had windows before in the grub menu before doing a fresh install of Arch. And the windows USB that i used for the installation of windows 10 was created in UEFI mode.
Last edited by grubtrauma (2024-01-23 22:45:42)
Offline
Anyway, that manual entry has to be added into /etc/grub.d/40_custom
I tried to add it there but it command wasn't recognized.
Also, how it's gonna end set root='hd0,gpt1 if:......
I don't know, i was searching for help and trying different things to solve my problem. I'm not an expert, that's why i came to the official forum.
Thanks for helping, i appreciate.
Offline
pacman -S grub efibootmgr mkdir /boot/efi mount /dev/sda1 /boot/efi grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi and grub-mkconfig -o /boot/grub/grub.cfg
Hope you won't f*k'd up your whole Windows' installation: GRUB should've simply put in there its .efi, nothing more...
Are aware you mounted into Linux's /boot/efi your 1TiB NTFS partition?
ESP has to be mounted on nvme0n1p1 (like you've already told us). What's the matter with sda1???
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
I apologize for the typo in my previous message it's mount /dev/nvmen0p1 /boot/efi
Last edited by grubtrauma (2024-01-23 22:47:34)
Offline
# ls -R /boot/efi
# mount
# lsblk -f
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
ls -R /boot/efi
/boot/efi:
mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=8113280k,nr_inodes=2028320,mode=755,inode64)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
/dev/nvme0n1p2 on / type ext4 (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=37,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=12782)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,nosuid,nodev,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,nr_inodes=1048576,inode64)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
systemd-1 on /efi type autofs (rw,relatime,fd=53,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=13536)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1628428k,nr_inodes=407107,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sdb2 on /run/media/user/ type ntfs3 (rw,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,uhelper=udisks2)
lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
└─sda1 ntfs
sdb
├─sdb1
└─sdb2 ntfs 643.2G 31% /run/media/user/
sdc
└─sdc1 ext4 1.0
nvme0n1
├─nvme0n1p1 vfat FAT32
└─nvme0n1p2 ext4 1.0 203.1G 8% /
Last edited by grubtrauma (2024-01-24 00:16:23)
Offline
<EDIT>
# mount /dev/nvme0n1p1 /boot/efi
# ls -R /boot/efi
</EDIT>
Yes, i created it today and format it, i had an arch install in the same nvme and did a fresh install, so there is no Windows bootloader on the ESP.
I had windows before in the grub menu before doing a fresh install of Arch. And the windows USB that i used for the installation of windows 10 was created in UEFI mode.
Please, better elaborate on that...
A.
If you created today, after a Windows installation, then yes, /boot/efi is now emptied from the Windows' EFI BootManager files.
You've lost the chances to boot into Windows, now: you'll have to again boot Windows' USB and perform a recover/re-installation of its BootManager files. After that, you then will lose GRUB. Boot into an ArchLinux's Live USB and fix missing GRUB by reinstalling it (ask here if in doubts and, also, please carefully re-read ArchWIKI GRUB's page).
B.
But, on the contrary, you're also saying that you had Windows before in the GRUB (which distro's GRUB?): how?
I don't see any others ESP candidates...
C.
Was during Windows' installation that the ESP at nvme0n1p1 has been first created?
Last edited by d.ALT (2024-01-23 23:25:13)
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
Well, I said I had windows and arch linux in dual boot.
I decided today to do a fresh arch install. I lost access to windows entry in the grub.
I booted with the windows USB => Repair Your Computer => I clicked on the first option at the top left, I don't remember exactly, it was something 'repair boot'
Windows booted but i lost access to GRUB, so i did a reboot and went to the bios, and booted from the nvme where Arch is installed.
logged in Arch and did again:
os-prober => Found windows!
grub-mkconfig -o /boot/grub/grub.cfg
Restarted and my problem was solved.
Last edited by grubtrauma (2024-01-24 00:43:38)
Offline