[linux-lvm] LVM autoactivation and udev

David Teigland teigland at redhat.com
Mon Mar 21 16:44:31 UTC 2022


On Mon, Mar 21, 2022 at 04:57:09PM +0800, heming.zhao at suse.com wrote:
> ```
> Mar 10 10:27:54 Mobile-PC systemd[1]: Stopped target Local File Systems.
> Mar 10 10:27:55 Mobile-PC systemd[1]: Reached target Local File Systems.
> Mar 10 10:27:55 Mobile-PC lvm[658]:   Udev database has incomplete information about device /dev/nvme0n1.
> Mar 10 10:27:55 Mobile-PC lvm[658]:   /dev/nvme0n1: Failed to get external handle [udev].
> Mar 10 10:27:55 Mobile-PC lvm[658]:   Udev database has incomplete information about device /dev/sda.
> Mar 10 10:27:55 Mobile-PC lvm[658]:   /dev/sda: Failed to get external handle [udev].
> ```

Since vgchange --monitor runs during startup, it should also override any
udev settings to disable them, like pvscan does:

  init_obtain_device_list_from_udev(0);
  init_external_device_info_source(DEV_EXT_NONE);

(Those are the default settings we use, so we don't see this.)


> In my understand, lvm2-monitor.service does the "clean up" job, which will complete the
> monitor job for thin/mirror/others LVs, which was created during initrd phase. (because
> lvm_scan doesn't have ability to start monitoring.)
> on current lvm2-monitor.service, the dependency asks this service start as early as possible:
> ```
> After=dm-event.socket dm-event.service
> ```
> It makes monitor service start too early, and triggers libudev not ready issue.
> 
> 
> To fix above issue, we find a workaround:
> ```
> - After=dm-event.socket dm-event.service
> + After=dm-event.socket dm-event.service sysinit.target
> ```

Yes, I think starting it later would be better.  I don't know enough about
these systemd targets to comment on how well that change would work.  I've
not given much attention to lvm2-monitor, but I've also wished it would
start later.

> And maybe there is another workaround (not verify):
> ```
> -ExecStart=@SBINDIR@/lvm vgchange --monitor y
> 
> +ExecStart=@SBINDIR@/lvm vgchange --config 'devices { external_device_info_source="none" \
> obtain_device_list_from_udev=0}' --monitor y
> ```

Let's patch vgchange monitor as mentioned above.

Dave


More information about the linux-lvm mailing list