lvm.conf activation/auto_activation_volume_list not honored, VG is always activated at startup

Bug #1922295 reported by Fabian
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lvm2 (Ubuntu)
New
Undecided
Unassigned

Bug Description

On a freshly installed Ubuntu 20.04 LTS (raw minimal installation) with LVM on LUKS using https://help.ubuntu.com/community/Full_Disk_Encryption_Howto_2019 as a basis

/dev/sda2 => luks encrypted with LVM
 VG named "ubuntu" and LVM tag "ubuntu_vg"
 LV /boot named boot and LVM tag "ubuntu_vg,boot"
 LV /root named root with LVM tag "ubuntu_vg,root"
 LV /home named home with LVM tag "ubuntu_vg,home"
 LV /swap named swap with LVM tag "ubuntu_vg,swap"
/dev/sda3 => LVM VG named "tools" VG and two LVs

The tools VG and related LVs are always activated at startup despite the settings in /etc/lvm/lvm.conf.

According to lvm2-activation-generator

The lvm2-activation-generator is called by systemd(1) on boot to
       generate systemd units at runtime to activate LVM Logical Volumes
       (LVs) when global/event_activation=0 is set in lvm.conf(5).
       These units use vgchange -aay to activate LVs.
(vgchange -aay that honors the activation/auto_activation_volume_list setting)

With the following settings in lvm.conf:

/etc/lvm/lvm.conf:
global/event_activation
event_activation = 0
activation/auto_activation_volume_list
auto_activation_volume_list = [ "ubuntu", "@ubuntu_vg" ]
activation/volume_list
volume_list = [ "ubuntu", "@ubuntu_vg" ]

>> tools VG/LV is activated at startup => KO
even with journalctl log line: lvm[PID]: pvscan[PID] VG tools skip autoactivation
lvm.conf settings are working because
- Can be deactivated with vgchange -an tools
- Can't be reactivated with vgchange -ay tools due to tools VG/Tags not listed in volume_list

/etc/lvm/lvm.conf:
global/event_activation
event_activation = 0
activation/auto_activation_volume_list
auto_activation_volume_list = [ "ubuntu", "@ubuntu_vg" ]
activation/auto_activation_volume_list
#auto_activation_volume_list = [ "ubuntu", "@ubuntu_vg" ]

>> tools VG/LV is activated at startup => KO
even with journalctl log line : lvm[PID]: pvscan[PID] VG tools skip autoactivation
lvm.conf settings are working because
- Can be deactivated with vgchange -an tools
- Can be reactivated due to activation/volume_list is commented

/etc/lvm/lvm.conf:
global/event_activation
event_activation = 0
global/global_filter
global_filter = [ "r|.*sda3|" ]
activation/auto_activation_volume_list
auto_activation_volume_list = [ "ubuntu", "@ubuntu_vg" ]

>> tools VG/LV is activated at startup => KO
even if vgs do not show the tools VG due to the global/global_filter settings.
lvm.conf settings are working because
Can't be deactivated with vgchange -an tools due to the global/global_filter

/etc/lvm/lvm.conf:

global/event_activation
event_activation = 0
activation/auto_activation_volume_list
auto_activation_volume_list = [ ]

>> tools VG/LV is activated at startup => KO
even with an empty auto_activation_volume_list [ ] which disable any auto activation.

A process or script bypass and does not honor the activation/auto_activation_volume_list, global/global_filter and global/event_activation settings in lvm.conf at startup and activate all available VG/LV without any trace in boot log.
Any new VG/LV is always activated during startup even if these VG/LV are not related to the running system and configured to be not auto activated.

Regards

Fabian (moocan2112)
description: updated
Fabian (moocan2112)
description: updated
description: updated
Revision history for this message
Fabian (moocan2112) wrote :

Hello,

° According to man pages in:
lvm2_2.03.07-1ubuntu1_amd64 -> Ubuntu 20.04 LTS
lvm2_2.03.07-1ubuntu3_amd64 -> Ubuntu 20.10

The lvm2-activation-generator is called by systemd(1) on boot to generate systemd units at
runtime to activate LVM Logical Volumes (LVs) when global/event_activation=0 is set in
lvm.conf(5). These units use vgchange -ay to activate LVs.

If event_activation=1, the lvm2-activation-generator exits immediately without generating
any systemd units, and LVM fully relies on event-based activation to activate LVs. In
this case, event-generated pvscan --cache -aay commands activate LVs.

° According to man pages in:
lvm2_2.03.11-2ubuntu4_amd64 -> Ubuntu 21.04

The lvm2-activation-generator is called by systemd(1) on boot to generate systemd units at
runtime to activate LVM Logical Volumes (LVs) when global/event_activation=0 is set in
lvm.conf(5). These units use vgchange -aay to activate LVs.

If event_activation=1, the lvm2-activation-generator exits immediately without generating
any systemd units, and LVM fully relies on event-based activation to activate LVs. In
this case, event-generated pvscan --cache -aay commands activate LVs.

So in Ubuntu 20.04 & Ubuntu 20.10 "These units use vgchange -ay to activate LVs."
and not "vgchange -aay" as in Ubuntu 21.04.

"vgchange -ay" does not honor lvm.conf activation/auto_activation_volume_list setting.
it activates everything regardless of lvm.conf settings.

Regards

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.