You are not logged in.

#1 2016-06-22 03:37:10

ronjouch
Member
From: Montreal, QC
Registered: 2014-09-18
Posts: 32
Website

grub-mkconfig fails on a simple non-EFI setup

Hi.

I'm trying to regenerate my grub.cfg following /etc/default/grub modifications, and it fails although it's a dead simple (non-EFI) usual setup.

First, here's my partition layout:

~ sudo parted -l
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  215GB   215GB   primary  ntfs            boot
 2      215GB   805GB   591GB   primary  ntfs
 3      805GB   822GB   17.2GB  primary  linux-swap(v1)
 4      822GB   1024GB  202GB   primary  ext4

Here's my fstab:

# <file system>                              <dir>  <type>   <options>                <dump> <pass>

# /dev/sda1 LABEL=win
UUID=D88477E58477C512                        /win   ntfs-3g  defaults                 0      0

# /dev/sda2 LABEL=data 
UUID=F08C73108C72D118                        /data  ntfs-3g  defaults                 0      0

# /dev/sda3 swap
UUID=16e50a2d-01e8-4c51-a4bd-3e8a336b95e6    none   swap     defaults                 0      0

# /dev/sda4  LABEL=nux  
UUID=a14d03cf-9a35-43bc-bf56-1b4d105bda80    /      ext4     rw,noatime,data=ordered  0      1

And here's my /etc/default/grub, which is close or identical to the stock one:

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISABLE_SUBMENU=y
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="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 Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# 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 `vbeinfo'
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"

#GRUB_SAVEDEFAULT="true"

1. grub-install-ing works:

~ sudo grub-install --recheck --target=i386-pc /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.

2. ... but grub-mkconfig fails with a No such file or directory error, but without a hint of which file/dir was not found:

~ sudo grub-mkconfig -o /boot/grub/grub.cfg            
Generating grub configuration file ...
Found Intel Microcode image
Found linux image: /boot/vmlinuz-linux-lts
Found initrd image: /boot/initramfs-linux-lts.img
Found fallback initramfs image: /boot/initramfs-linux-lts-fallback.img
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initramfs image: /boot/initramfs-linux-fallback.img
error: No such file or directory

    2.1. stracing to search for the culprit file didn't help me. Does it?

[root@t ronj]# strace grub-mkconfig -o /boot/grub/grub.cfg
...
Found linux image: /boot/vmlinuz-linux-lts
Found initrd image: /boot/initramfs-linux-lts.img
Found fallback initramfs image: /boot/initramfs-linux-lts-fallback.img
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initramfs image: /boot/initramfs-linux-fallback.img
[{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 5939
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f7ffbca3310}, {0x43be90, [], SA_RESTORER, 0x7f7ffbca3310}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5939, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
wait4(-1, 0x7ffde5ccae10, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[]})                 = 0
write(1, "### END /etc/grub.d/10_linux ###"..., 33) = 33
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
stat("/etc/grub.d/15_ostree", {st_mode=S_IFREG|0755, st_size=1615, ...}) = 0
faccessat(AT_FDCWD, "/etc/grub.d/15_ostree", X_OK) = 0
write(1, "\n", 1)                       = 1
write(1, "### BEGIN /etc/grub.d/15_ostree "..., 36) = 36
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f7ffc8b09d0) = 6285
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x43be90, [], SA_RESTORER, 0x7f7ffbca3310}, {SIG_DFL, [], SA_RESTORER, 0x7f7ffbca3310}, 8) = 0
wait4(-1, error: No such file or directory
[{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 6285
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f7ffbca3310}, {0x43be90, [], SA_RESTORER, 0x7f7ffbca3310}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=6285, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
wait4(-1, 0x7ffde5ccae10, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[]})                 = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(1)                           = ?
+++ exited with 1 +++

3. Also, note that trying to grub-probe fails with an error message looking incomplete/cropped ("dev" ? I'm asking about "/dev/sda"):

~ sudo grub-probe /dev/sda
grub-probe: error: failed to get canonical path of `dev'.

This error message is close to something mentioned in the wiki:

wiki wrote:

If you are trying to run grub-mkconfig in a chroot or systemd-nspawn container, you might notice that it does not work, complaining that grub-probe cannot get the "canonical path of /dev/sdaX"

... but it's not exactly the same (I'm not being told about a device, just "dev"), and I'm neither in a chroot nor in a nspawn container.

What's wrong? I have no doubt the problem here is between the keyboard and the chair ^^, facepalms welcome...

Thanks for your help.

Last edited by ronjouch (2016-06-22 11:30:06)

Offline

#2 2016-06-22 04:00:02

JohnBobSmith
Member
From: Canada
Registered: 2014-11-29
Posts: 804

Re: grub-mkconfig fails on a simple non-EFI setup

Why are partitions 1 and 2 NTFS file-systems??? Other than that, since /boot is on a separate partition, make sure /boot is mounted correctly. That would explain why the grub-mkconfig cannot find the /boot/grub/grub.cfg if /boot not mounted in the first place smile

Last edited by JohnBobSmith (2016-06-22 04:01:24)


I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.

Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...

Offline

#3 2016-06-22 11:32:24

ronjouch
Member
From: Montreal, QC
Registered: 2014-09-18
Posts: 32
Website

Re: grub-mkconfig fails on a simple non-EFI setup

- Partitions 1 and 2 are NTFS filesystems because this is a multiboot machine. #1 contains a windows installation, and #2 contains data shared across Windows and Linux (using ntfs-3g, which works fine).

- /boot is not on a separate partition. #3 is swap and #4 is ext4, mounted as /. I edited my original post to include my fstab. Here are the contents of /boot:

~ ls -la /boot            
total 52816
drwxr-xr-x  4 root root     4096 Jun 21 23:02 .
drwxr-xr-x 19 root root     4096 Jun 20 22:29 ..
drwxr-xr-x  6 root root     4096 Jun 21 23:27 grub
-rw-r--r--  1 root root 18697120 Jun 21 23:02 initramfs-linux-fallback.img
-rw-r--r--  1 root root  3659183 Jun 21 23:02 initramfs-linux.img
-rw-r--r--  1 root root 18475754 Jun 20 23:02 initramfs-linux-lts-fallback.img
-rw-r--r--  1 root root  3649414 Jun 20 23:02 initramfs-linux-lts.img
-rw-r--r--  1 root root   692736 Jan 18 12:37 intel-ucode.img
drwxr-xr-x  2 root root     4096 Apr 22 16:02 syslinux
-rw-r--r--  1 root root  4517872 Jun  8 02:42 vmlinuz-linux
-rw-r--r--  1 root root  4364160 Jun  8 10:46 vmlinuz-linux-lts

- Additional precision: this system boots fine, I got it bootable when running grub-install / grub-prober / grub-mkconfig during initial installation from a USB drive using the 20160601 ISO, and everything worked fine at that time. It's now that I run these commands from the running system that I'm running into trouble.

Last edited by ronjouch (2016-06-22 11:38:31)

Offline

Board footer

Powered by FluxBB