You are not logged in.

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

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

Grub-mkconfig takes a long time to complete with LVM snapshots

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.

Last edited by SuperBoby (2020-03-30 16:34:20)

Offline

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

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

Re: Grub-mkconfig takes a long time to complete with LVM snapshots

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: 14

Re: Grub-mkconfig takes a long time to complete with LVM snapshots

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: 4,645

Re: Grub-mkconfig takes a long time to complete with LVM snapshots

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.)


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

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

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

Re: Grub-mkconfig takes a long time to complete with LVM snapshots

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

#6 2020-03-29 13:48:13

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

Re: Grub-mkconfig takes a long time to complete with LVM snapshots

Search for GRUB_OS_PROBER_SKIP_LIST on the internet, it is used in /etc/grub.d/30_os-prober and set in /etc/defaults/grub.

Maybe you can filter the snapshots with that.

Offline

#7 2020-03-30 16:32:32

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

Re: Grub-mkconfig takes a long time to complete with LVM snapshots

Hi Gosi, unfortunately, that does not work. I passed it the UUID of my root volume (which is the same for all its snapshots according to lsblk -f) :

$ lsblk -f
NAME                                     FSTYPE      FSVER    LABEL         UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                                                               
├─sda1                                   ext4        1.0      ARCHLINUXBOOT 9b326569-529e-4ee3-991b-a2501610879e    749,9M    16% /boot
└─sda2                                   LVM2_member LVM2 001               xn0q6d-OxaB-WRY9-Cj0B-e0mh-VcUs-JzfT17                
  ├─vgarchlinux-linux--swap              swap        1        LINUXSWAP     0c3aea5e-db45-42e0-95b2-c60c1328b159                  [SWAP]
  ├─vgarchlinux-archlinux--home          ext4        1.0      ARCHLINUXHOME 5189925d-d963-4569-922c-28271e29d8d6       45G     3% /home
  ├─vgarchlinux-archlinux--root-real                                                                                              
  │ ├─vgarchlinux-archlinux--root        ext4        1.0      ARCHLINUXROOT 28c63991-699b-4ce6-89ca-415bcce27e4f     11,2G    37% /
  │ └─vgarchlinux-root--snapshot--test   ext4        1.0      ARCHLINUXROOT 28c63991-699b-4ce6-89ca-415bcce27e4f                  
  └─vgarchlinux-root--snapshot--test-cow                                                                                          
    └─vgarchlinux-root--snapshot--test   ext4        1.0      ARCHLINUXROOT 28c63991-699b-4ce6-89ca-415bcce27e4f                  
sr0
$ cat /etc/default/grub
# GRUB boot loader configuration

GRUB_DEFAULT=saved
GRUB_TIMEOUT=0
GRUB_RECORDFAIL_TIMEOUT=3
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash vt.global_cursor_default=0 loglevel=3 rd.systemd.show_status=false rd.udev.log-priority=3 resume=UUID=0c3aea5e-db45-42e0-95b2-c60c1328b159"
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

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
GRUB_HIDDEN_TIMEOUT=3
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT_STYLE=hidden
GRUB_FORCE_HIDDEN_MENU="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"

# Uncomment to make GRUB remember the last selection. This requires to
# set 'GRUB_DEFAULT=saved' above.
GRUB_SAVEDEFAULT="true"


GRUB_OS_PROBER_SKIP_LIST="28c63991-699b-4ce6-89ca-415bcce27e4f"

Offline

#8 2020-03-30 20:58:24

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

Re: Grub-mkconfig takes a long time to complete with LVM snapshots

Then I suggest another partition or even better another disk to store the snapshots so grub can't find them.

Offline

#9 2020-03-30 22:43:31

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

Re: Grub-mkconfig takes a long time to complete with LVM snapshots

Well, that would be disappointing to resort to that, as it works perfectly fine on Ubuntu... I'll try to research it some more

Offline

Board footer

Powered by FluxBB