You are not logged in.

#1 2025-03-20 04:59:36

Vlazm
Member
Registered: 2025-01-27
Posts: 18

[SOLVED] grub-mkconfig fails to create configuration file

Hi, all

To be fair this one is completely on me. I was preparing new SD card for my raspberry pi, and although I went out of my way to ensure that I was modifying boot directory of the SD card and not my system, I... well...
Apparently it didn't stopped me from overwriting my system's grub installation.

Only found out this after I rebooted the system. Took me few minutes to realize what I have done.

After booting via my spare archlinux installation USB drive and quickly backing up most important files I tried to reinstall grub.

Before anything, I mounted my system

mount /dev/nvme0n1p3 /mnt
mount /dev/nvme0n1p1 /mnt/boot
swapon /dev/nvme0n1p2 

Also made sure everything was in order with lsblk

After that I ran

arch-chroot /mnt

My next step was to delete everything left over from raspberry pi installation

rm -rf /boot/*

Then I tried to get grub up and running with

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

and

grub-mkconfig -o /boot/grub/grub.cfg

Now, the grub-install command runs fine, with output

Installing for x86_64-efi platform.
Installation finished. No error reported.

However when I try to run grub-mkconfig I always get the same error

Generating grub configuration file ...
/usr/bin/grub-probe: error: failed to get canonical path of ` /boot/grub/unicode.pf2' .
No path or device specified.
Usage: grub-probe [OPTION...] [OPTION]... [PATHIDEVICE]
Try 'grub-probe --help' or 'grub-probe --usage' for more information.

The grub-probe seems to be missing  unicode.pf2 file, which I found in /boot/grub/fonts directory

So what should I do now?
I don't really have any ideas besides just moving the unicode file into /boot/grub directory, and I don't think this is a really good idea.

Any sort of help or advice would be appreciated smile

My grub version:

grub 2:2.12.r226.g56ccc5ed-1

Last edited by Vlazm (2025-03-20 17:00:20)

Offline

#2 2025-03-20 05:17:15

mackin_cheese
Member
Registered: 2025-01-07
Posts: 435

Re: [SOLVED] grub-mkconfig fails to create configuration file

this forum is for archlinux only, not for any of it's derivatives. Arch Linux ARM is a derivative

Offline

#3 2025-03-20 05:35:52

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

I am using archlinux, was just installing arm system for raspberry pi through my main arch system

Offline

#4 2025-03-20 07:29:56

cryptearth
Member
Registered: 2024-02-03
Posts: 1,395

Re: [SOLVED] grub-mkconfig fails to create configuration file

Offline

#5 2025-03-20 07:58:35

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

To clarify: I was only dealing with arm system when trying to install os for raspberry pi. In the process I've messed up my arch x86_64 installation by overwriting files in my /boot directory. I only ask for help with getting my main arch x86_64 system back because when trying myself I ran into some issues with grub-mkconfig . As I take it from forum rules my post is fine since arm system is 1) not installed on my PC and 2) was not really the issue.
The reason I think that this is the case is because I could've deleted files in /boot directory myself (without trying to install arm os on an external SD card) and this would most likely lead to the same result.

I am sorry for any confusion my original post may have caused

Offline

#6 2025-03-20 08:01:39

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: [SOLVED] grub-mkconfig fails to create configuration file

I am presuming you used arch-chroot after mounting the partitions and before deleting anything or running the GRUB commands.

A very similar GRUB error is referenced here so check /etc/default/grub{,.d/*}.


Jin, Jîyan, Azadî

Offline

#7 2025-03-20 08:33:33

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

Thanks for the reply! I looked through the forum post and checked my grub default configuration file at /etc/default/grub
Unfortunately the issue was not the same as mentioned in the post, two lines were not merged together.

As I said in my main post, I was able to find unicode.pf2 file in the /boot/grub/fonts/ directory (not in the /boot/grub/) and I tried editing the file to match the actual file path. It kinda worked, although the os prober  didn't ran properly and grub didn't detect any systems.

Here's the output of grub-mkconfig with GRUB_FONT option made to match the unicode.pf2 real location:

Generating grub configuration file ...
Warning: os-prober will not be executed to detect other bootable partitions.
Its output will be used to detect bootable  binaries on them and create new boot entries.
grub-probe: error: cannot find a GRUB drive for /dev/sda1.    Check your device.map.
Adding boot menu entry for UEFI Frimware Settings ...
done

Also /dev/sda is just a USB with archlinux installation medium
My system is on nvme0n1 drive

Offline

#8 2025-03-20 08:51:54

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: [SOLVED] grub-mkconfig fails to create configuration file

Let's check the actual path mentioned in the message:

grep -f -R '/boot/grub/unicode.pf2' /etc/default

Jin, Jîyan, Azadî

Offline

#9 2025-03-20 08:57:54

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

Sorry, I don't know if it is supposed to be this way, but running this in arch-chroot spits out a message

grep: -R: No such file or directory 

Offline

#10 2025-03-20 09:37:47

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

Here's my grub default configuration at /etc/default/grub

Since I'm booting from USB stick I couldn't really copy and paste it here, so I had to use image to text software on my phone. It is a little faulty so there might be some typos.

# GRUB boot loader configuration

GRUB_DEFAULT="0"
GRUB_TIMEOUT="5"
#GRUB_DISTRIBUTOR="Arch"
GRUB_DISTRIBUTOR=$(lsb_release -i -s 2> /dev/null ll echo "Arch Linux")
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 devíces
#GRUB_ENABLE_CRYPTODISK="y"

# Set to 'countdoun' 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="3840x2400"

# Uncomment to allou 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/>xx" 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.
expor t GRUB_COLOR_NORMAL="white/black"
export GRUB_COLOR_HIGHLIGHT="white/black"

# Uncomment one of them for the gfx deslred, a image background or a gfxtheme
#GRUB_BACKGROUND="/boot/grub/pirate_flag.png"
#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"
GRUB_FONT="/boot/grub/unicode.pf2"

Offline

#11 2025-03-20 14:53:14

mackin_cheese
Member
Registered: 2025-01-07
Posts: 435

Re: [SOLVED] grub-mkconfig fails to create configuration file

You never answered on whether you actually arch-chrooted into the system or not after mounting your drives

Offline

#12 2025-03-20 14:58:51

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

Yes, I ran arch-chroot /mnt after mounting necessary partitions
My fault, thought I had it in the original post.

Offline

#13 2025-03-20 15:53:07

seth
Member
Registered: 2012-09-03
Posts: 62,901

Re: [SOLVED] grub-mkconfig fails to create configuration file

GRUB_FONT="/boot/grub/unicode.pf2"

So why is that line to a bogus path there?
Remove/comment/fix that?

Offline

#14 2025-03-20 16:01:11

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

Yea, changing it to correct path, moving unicode.pf2 to /boot/grub/ or commenting the line allows grub-mkconfig to run, but the config it produces does not include any os options

The output of the grub-mkvonfig with "fixed" font path is as follows

Generating grub configuration file ...
Warning: os-prober will not be executed to detect other bootable partitions.
Its output will be used to detect bootable  binaries on them and create new boot entries.
grub-probe: error: cannot find a GRUB drive for /dev/sda1.    Check your device.map.
Adding boot menu entry for UEFI Frimware Settings ...
done

Offline

#15 2025-03-20 16:18:18

seth
Member
Registered: 2012-09-03
Posts: 62,901

Re: [SOLVED] grub-mkconfig fails to create configuration file

/dev/sda1 is gonna be the install iso, right?

(lsblk -f; grub-mkconfig) | curl -F 'file=@-' 0x0.st

Offline

#16 2025-03-20 16:30:29

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

Yes, the sda is the USB stick with installation medium, and the main system is on nvme0n1 (/dev/nvme0n1p3 for root, /dev/nvme0n1 for boot and /dev/nvme0n1p2 for swap)

The output for your command is

Generating grub configuration file ...
Warning: os-prober will not be executed to detect other bookable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
http://0x0.st/814E.txt

Also the link it spits out at the end contains file ...

NAME        FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0                                              
sda                                                
├─sda1                                             
└─sda2                                             
nvme0n1                                            
├─nvme0n1p1                         1005.1M     2% /boot
├─nvme0n1p2                                        [SWAP]
├─nvme0n1p3                            2.2G    93% /
├─nvme0n1p4                                        
├─nvme0n1p5                                        
├─nvme0n1p6                                        
└─nvme0n1p7                                        
#
# 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
}

set menu_color_normal=white/black
set menu_color_highlight=white/black

insmod part_gpt
insmod fat
search --no-floppy --fs-uuid --set=root 93B9-7E0D
if loadfont /grub/unicode.pf2 ; then
  set gfxmode=3840x2400
  load_video
  insmod gfxterm
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/06_grub-customizer_menu_color_helper ###
### END /etc/grub.d/06_grub-customizer_menu_color_helper ###

### BEGIN /etc/grub.d/10_linux ###

### END /etc/grub.d/10_linux ###

### 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 ###

What kind of dark magic is this??

Offline

#17 2025-03-20 16:49:55

seth
Member
Registered: 2012-09-03
Posts: 62,901

Re: [SOLVED] grub-mkconfig fails to create configuration file

Welcome to the pro show.
You wiped /boot - did you reinstall the kernel afterwards?

If not, pacman -S linux, then re-run grub-mkconfig

Offline

#18 2025-03-20 16:59:35

Vlazm
Member
Registered: 2025-01-27
Posts: 18

Re: [SOLVED] grub-mkconfig fails to create configuration file

Oh hell yeah, feels good to be back. Thanks for the help smile

Reinstalling the linux kernel solved the issue, marking the discussion as solved

Offline

Board footer

Powered by FluxBB