You are not logged in.

#1 2020-03-25 21:14:15

SuperBoby
Member
Registered: 2020-03-25
Posts: 3

Grub-mkconfig takes a long time to complete

Hi !

I have finally decided to try out Arch Linux yesterday : so far it's going great. I'm using a Thinkpad T410, and am trying to make it a daily driver with KDE Plasma.

I am trying to make a silent boot, fiddling with Plymouth and such, which requires to tweak GRUB as well. In the process I have to change '/etc/default/grub' and re-generate the GRUB menu file with

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

. This is what gives me trouble : the prober step takes a VERY long time, and gives the following output :

$ sudo grub-mkconfig -o /boot/grub/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux-zen
Found initrd image(s) in /boot: intel-ucode.img initramfs-linux-zen.img
Found fallback initrd image(s) in /boot: intel-ucode.img initramfs-linux-zen-fallback.img
grep: /tmp/os-prober.h05woA/raided-map: No such file or directory
grep: /tmp/os-prober.h05woA/swaps-map: No such file or directory
grep: /tmp/os-prober.h05woA/mounted-map: No such file or directory
rmdir: failed to remove '/var/lib/os-prober/mount': Device or resource busy
rmdir: failed to remove '/var/lib/os-prober/mount': Device or resource busy
grep: /tmp/os-prober.h05woA/raided-map: No such file or directory
grep: /tmp/os-prober.h05woA/swaps-map: No such file or directory
grep: /tmp/os-prober.h05woA/mounted-map: No such file or directory
rmdir: failed to remove '/var/lib/os-prober/mount': Device or resource busy
done

The file seems to be generated anyway, but I still would like to fix it.
I am using LVM, here is my partition table :

$ lsblk
NAME                                          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                                             8:0    0 238,5G  0 disk 
├─sda1                                          8:1    0     1G  0 part /boot
└─sda2                                          8:2    0   100G  0 part 
  ├─vgarchlinux-linux--swap                   254:0    0     8G  0 lvm  [SWAP]
  ├─vgarchlinux-archlinux--root-real          254:1    0    20G  0 lvm  
  │ ├─vgarchlinux-archlinux--root             254:2    0    20G  0 lvm  /
  │ ├─vgarchlinux-archlinux--root--basetext   254:4    0    20G  0 lvm  
  │ └─vgarchlinux-archlinux--root--basekde    254:6    0    20G  0 lvm  
  ├─vgarchlinux-archlinux--root--basetext-cow 254:3    0     5G  0 lvm  
  │ └─vgarchlinux-archlinux--root--basetext   254:4    0    20G  0 lvm  
  ├─vgarchlinux-archlinux--root--basekde-cow  254:5    0     5G  0 lvm  
  │ └─vgarchlinux-archlinux--root--basekde    254:6    0    20G  0 lvm  
  └─vgarchlinux-archlinux--home               254:7    0    50G  0 lvm  /home
sr0                                            11:0    1  1024M  0 rom

The "basetext" and "basekde" are snapshots of the root volume, and at this time Archlinux is the only OS on the computer.

I have searched the forums and Google, but can't find a solution that fits my case. My system is up-to-date. I have had problems before with the prober step on Ubuntu and Debian installs, but I have always found a way to fix it. This time it's a brickwall...


Thanks for your help.

Offline

#2 2020-03-26 14:58:46

Gosi
Member
From: Vienna, Austria
Registered: 2010-02-25
Posts: 59

Re: Grub-mkconfig takes a long time to complete

Probably something is blocking /var/lib/os-prober/mount.

You can find out if this is the case with lsof. See also https://bugzilla.redhat.com/show_bug.cgi?id=903906

Edit: Also try to umount manually when this message appears.

Last edited by Gosi (2020-03-26 15:01:09)

Offline

#3 2020-03-27 22:59:02

SuperBoby
Member
Registered: 2020-03-25
Posts: 3

Re: Grub-mkconfig takes a long time to complete

Hi Gosi, thanks for your answer.

I have researched this some more, including looking at your link. Here are some steps I followed :

- I unmounted /var/lib/os-prober/mount
- I re-run grub-mkconfig
- I got the following error instead at the os-prober step :

$ sudo grub-mkconfig -o /boot/grub/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux-zen
Found initrd image(s) in /boot: intel-ucode.img initramfs-linux-zen.img
Found fallback initrd image(s) in /boot: intel-ucode.img initramfs-linux-zen-fallback.img
grub-probe: error: unknown filesystem.
^C

I finally found out what makes the os-prober go nuts : it was the LVM snapshots. I have removed them, so that the new partition table is :

$ lsblk
NAME                            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                               8:0    0 238,5G  0 disk 
├─sda1                            8:1    0     1G  0 part /boot
└─sda2                            8:2    0   100G  0 part 
  ├─vgarchlinux-linux--swap     254:0    0     8G  0 lvm  [SWAP]
  ├─vgarchlinux-archlinux--root 254:2    0    20G  0 lvm  /
  └─vgarchlinux-archlinux--home 254:5    0    50G  0 lvm  /home
sr0                              11:0    1  1024M  0 rom 

And the prober runs fine.

Then, I create a new snapshot, and it goes nuts again. To make everything go back to normal, I have to kill grub-mount that is stuck on the snapshot, then unmount and delete the snapshot.

I have found this bug report describing the same issue on Debian : https://bugs.debian.org/cgi-bin/bugrepo … bug=945289

Then, I finally ended back on the Arch Linux Wiki's article on LVM which gives as a solution : "Make sure to remove snapshot volumes before generating grub.cfg."


I am quite baffled to read that, for two reasons :

- Creating an LVM snapshot is useful to me before a significant change on the system such as an update, in order to roll back if anything goes wrong. If the change in question is related to the kernel, I'll have to re-generate grub.cfg. I certainly don't want to lose my snapshot at this point !
- I have never had this problem on Ubuntu with LVM snapshots, with an identical partition table.


Is there any way I can solve this without removing existing snapshots before running grub-mkconfig, as I could do on Ubuntu ?

Offline

#4 2020-03-27 23:03:11

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 3,026

Re: Grub-mkconfig takes a long time to complete

Are you dual booting with Windows or another Linux? If not, you can disable os-prober completely. It often causes more problems than it solves.

(You really don't need it even if you are dual-booting, but especially if you are not.)

Offline

#5 2020-03-27 23:20:35

SuperBoby
Member
Registered: 2020-03-25
Posts: 3

Re: Grub-mkconfig takes a long time to complete

I'm not dual-booting at the moment, but I plan to add a Windows partition, and possibly another Linux distro.

I know that adding a chainloader in the GRUB custom scripts for Windows is pretty straightforward. But for another distro with multiple kernels, it sounds like a pain to do... Any advice on this ?

But still, I'd like to understand why it behaves like this with Arch, or why you advise against os-prober. In addition to my personal Ubuntu-on-LVM setup I talked about, at work I have done a multi-boot with 3 different Ubuntu versions, 1 Debian, 1 openSUSE and 1 CentOS, each with several different kernels, and os-prober runs fine, although a bit slow (no LVM on this one).

Offline

Board footer

Powered by FluxBB