...
+++ This bug was initially created as a clone of Bug #2040456 +++ Description of problem: The approach to duplicate VGIDs has been that it is not possible or not allowed, so the behavior has been undefined. The actual result was unpredictable and/or broken, and generally unhelpful. LVM would not recognize the situation of duplicate vgids and would plow ahead in various undefined ways. Improve this by recognizing the problem, displaying the VGs that exist, and printing a warning to fix the problem. This allows users to recognize what the problem is, and gives them a good chance of fixing it. Using LVM with duplicate VGIDs still remains invalid and largely undefined, so the bar is quite low on the behavior to expect in that state. But, the goal is to inform users of what has happened, and ideally allow lvm to work sufficiently well to run vgchange -u to fix the problem. It's possible to create this condition without too much difficulty by cloning PVs, followed by an incomplete attempt at making the two VGs unique (vgrename and pvchange -u, but missing vgchange -u.) Problem reported upstream: https://listman.redhat.com/archives/linux-lvm/2021-December/msg00003.html vgcreate test /dev/loop0 Physical volume "/dev/loop0" successfully created. Volume group "test" successfully created dd if=/dev/loop0 of=/dev/loop1 bs=1M count=1 1+0 records in 1+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.16556 s, 6.3 MB/s losetup -d /dev/loop0 vgs VG #PV #LV #SN Attr VSize VFree test 1 0 0 wz-n 60.00m 60.00m vgrename test test2 Volume group "test" successfully renamed to "test2" pvchange -u /dev/loop1 Physical volume "/dev/loop1" changed 1 physical volume changed / 0 physical volumes not changed losetup -f loop0 Now two different VGs have duplicate VGIDs. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: — Additional comment from David Teigland on 2022-01-13 17:45:45 UTC — wrong component from failed menu selection — Additional comment from David Teigland on 2022-01-13 17:53:46 UTC — several upstream commits related to this: https://sourceware.org/git/?p=lvm2.git;a=commit;h=5e428d22d9647a294eba65852078947df5ade48f https://sourceware.org/git/?p=lvm2.git;a=commit;h=cb798ee1c102aadde93965a894c5aa59d4e76e4a https://sourceware.org/git/?p=lvm2.git;a=commit;h=18f451e09e943eb3d51f8394f6fe8967e1e9f565 https://sourceware.org/git/?p=lvm2.git;a=commit;h=0c80ea88477b3511562036748d3bf837bf7b3e8b Follow the steps above, then: pvs WARNING: fix duplicate VGID MUH5vj-Uee4-Zv5y-LKOy-OoVw-oM3W-Vy2s2Y for VGs test2 and test (see vgchange -u). WARNING: lookup found duplicate VGID MUH5vjUee4Zv5yLKOyOoVwoM3WVy2s2Y for VGs test2 and test. WARNING: lookup found duplicate VGID MUH5vjUee4Zv5yLKOyOoVwoM3WVy2s2Y for VGs test2 and test. WARNING: lookup found duplicate VGID MUH5vjUee4Zv5yLKOyOoVwoM3WVy2s2Y for VGs test2 and test. WARNING: lookup found duplicate VGID MUH5vjUee4Zv5yLKOyOoVwoM3WVy2s2Y for VGs test2 and test. PV VG Fmt Attr PSize PFree /dev/loop0 test lvm2 a-- 60.00m 60.00m /dev/loop1 test2 lvm2 a-- 60.00m 60.00m vgs -o+uuid WARNING: fix duplicate VGID MUH5vj-Uee4-Zv5y-LKOy-OoVw-oM3W-Vy2s2Y for VGs test2 and test (see vgchange -u). WARNING: lookup found duplicate VGID MUH5vjUee4Zv5yLKOyOoVwoM3WVy2s2Y for VGs test2 and test. WARNING: lookup found duplicate VGID MUH5vjUee4Zv5yLKOyOoVwoM3WVy2s2Y for VGs test2 and test. WARNING: lookup found duplicate VGID MUH5vjUee4Zv5yLKOyOoVwoM3WVy2s2Y for VGs test2 and test. WARNING: lookup found duplicate VGID MUH5vjUee4Zv5yLKOyOoVwoM3WVy2s2Y for VGs test2 and test. VG #PV #LV #SN Attr VSize VFree VG UUID test 1 0 0 wz-n 60.00m 60.00m MUH5vj-Uee4-Zv5y-LKOy-OoVw-oM3W-Vy2s2Y test2 1 0 0 wz-n 60.00m 60.00m MUH5vj-Uee4-Zv5y-LKOy-OoVw-oM3W-Vy2s2Y vgchange -u test2 Volume group "test2" successfully changed vgs -o+uuid VG #PV #LV #SN Attr VSize VFree VG UUID rhel_null-04 1 3 0 wz-n <464.76g 0 84FXwS-b5do-BcUt-Eekf-MzYC-XWns-RaaT1J test 1 0 0 wz-n 60.00m 60.00m MUH5vj-Uee4-Zv5y-LKOy-OoVw-oM3W-Vy2s2Y test2 1 0 0 wz-n 60.00m 60.00m R9LYEk-43Wc-zpyr-6IZR-7EyR-unVq-EI2vmU — Additional comment from RHEL Program Management on 2022-02-02 07:27:51 UTC — DevMissed The Current Deadline for this BZ has passed. Please discuss with your PO & QE Contact and revise the Current Deadline in one of the following ways: 1. Update the Devel Target Milestone (DTM) to when you think the work will be ready for verification. 2. Set a Custom Deadline Type and Date to when you think the work will be ready for verification. 3. Update the Internal Target Milestone (ITM) according to QE guidance. In the absence of 1 and 2 above, the Current Deadline is automatically set to 6 days before the ITM date. Note that BZs that miss their due date by more than 2 weeks will automatically lose their ITM and thus their release+. Resetting ITM will cause release+ to be restored. More details about deadline management are available at https://one.redhat.com/rhel-developer-guide/#proc_using-deadlines-to-prioritize-work_assembly_development — Additional comment from Corey Marthaler on 2022-02-14 16:57:03 UTC — Adding QA ack for 9.0. The steps listed to reproduce this seem straight forward. — Additional comment from Corey Marthaler on 2022-02-16 16:19:15 UTC — Please provide the devel results for verification once this fix is built. The QA scenario differs a bit from the results shown above, although we are attempting this with scsi devices and not loop devices. kernel-5.14.0-54.kpq0.el9 BUILT: Fri Feb 4 12:29:07 PM CST 2022 lvm2-2.03.15-0.1.20211115git4a1f617.el9 BUILT: Tue Feb 8 02:56:52 PM CST 2022 lvm2-libs-2.03.15-0.1.20211115git4a1f617.el9 BUILT: Tue Feb 8 02:56:52 PM CST 2022 SCENARIO - duplicate_vgids_using_loopback_device: Test devicesfile addition and deletion using odd loopback devices, then remove the backing file (bug 1969408) adding entry to the devices file for /dev/sde1 creating PV on hayes-03 using device /dev/sde1 pvcreate --yes -ff /dev/sde1 Physical volume "/dev/sde1" successfully created. creating VG on hayes-03 using PV(s) /dev/sde1 vgcreate df /dev/sde1 Volume group "df" successfully created Disabling devicesfile on hayes-03 Setting use_devicesfile to disable PV /dev/sde1 VG df lvm2 [446.62 GiB / 446.62 GiB free] Total: 1 [446.62 GiB] / in use: 1 [446.62 GiB] / in no VG: 0 [0 ] Copying header from /dev/sde1 to /dev/sdc1 on hayes-03 1+0 records in 1+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00890941 s, 118 MB/s Disabling device sde on hayes-03 'echo offline > /sys/block/sde/device/state' VG #PV #LV #SN Attr VSize VFree df 1 0 0 wz-n 446.62g 446.62g Renaming df to df_2 vgrename --yes df df_2 Volume group "df" successfully renamed to "df_2" Generating a new PV uuid for /dev/sde1 pvchange -u /dev/sde1 Enabling device sde on hayes-03 'echo running > /sys/block/sde/device/state' WARNING: Not using device /dev/sde1 for PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O. WARNING: PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O prefers device /dev/sdc1 because device name matches previous. PV VG Fmt Attr PSize PFree /dev/sdc1 df_2 lvm2 a-- 446.62g 446.62g Generating a new VG uuid for df_2 vgchange -u df_2 WARNING: Not using device /dev/sde1 for PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O. WARNING: PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O prefers device /dev/sdc1 because device name matches previous. Cannot update volume group df_2 with duplicate PV devices. unable to change uuids due to duplicate PV devices uuid alteration failed for df_2 Generating a new VG uuid for df vgchange -u df WARNING: Not using device /dev/sde1 for PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O. WARNING: PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O prefers device /dev/sdc1 because device name matches previous. Volume group "df" not found Cannot process volume group df uuid alteration failed for df_2 [root@hayes-03 ~]# pvscan WARNING: Not using device /dev/sde1 for PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O. WARNING: PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O prefers device /dev/sdc1 because device name matches previous. PV /dev/sdc1 VG df_2 lvm2 [446.62 GiB / 446.62 GiB free] Total: 1 [446.62 GiB] / in use: 1 [446.62 GiB] / in no VG: 0 [0 ] [root@hayes-03 ~]# vgs -o+uuid WARNING: Not using device /dev/sde1 for PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O. WARNING: PV HyyUvb-sQPp-3Vjw-EEsV-xgnq-WEuX-pCfS0O prefers device /dev/sdc1 because device name matches previous. VG #PV #LV #SN Attr VSize VFree VG UUID df_2 1 0 0 wz-n 446.62g 446.62g xpM1Wg-B1im-ztCf-SGBu-x6Py-FDYU-mwLBzw — Additional comment from David Teigland on 2022-02-16 17:38:41 UTC — Here's how I'd try to do an equivalent with scsi devs (not actually tried this). The devices file should just be disabled for this test to make it simpler. vgcreate test /dev/sda dd if=/dev/sda of=/dev/sdb bs=1M count=1 echo offline /dev/sda vgrename test test2 pvchange -u /dev/sdb echo online /dev/sda At this point there are two vgs (test on sda and test2 on sdb) with duplicate vgids. without the fix: lvm commands will have mixed up output and errors lvm commands may or may not be able to fix the problem with the fix: lvm commands should report warnings about duplicate vgs and display the two vgs properly vgchange -u <vgname> can be used to correct the problem by changing the vgid on either vg — Additional comment from Corey Marthaler on 2022-07-21 18:50:48 UTC — Marking Verified:Tested in the latest rpms. kernel-5.14.0-130.el9 BUILT: Fri Jul 15 07:31:56 AM CDT 2022 lvm2-2.03.16-2.el9 BUILT: Thu Jul 14 11:45:18 AM CDT 2022 lvm2-libs-2.03.16-2.el9 BUILT: Thu Jul 14 11:45:18 AM CDT 2022 SCENARIO - duplicate_vg_uuids_with_devicesfile_disabled: Test how LVM reacts to PVs having the same pv and vg uuids while devicesfile is disabled (bug 2040456) adding entry to the devices file for /dev/sdn1 creating PV on hayes-03 using device /dev/sdn1 pvcreate --yes -ff /dev/sdn1 Physical volume "/dev/sdn1" successfully created. creating VG on hayes-03 using PV(s) /dev/sdn1 vgcreate df /dev/sdn1 Volume group "df" successfully created Disabling devicesfile on hayes-03 Setting use_devicesfile to disable PV /dev/sdn1 VG df lvm2 [<1.82 TiB / <1.82 TiB free] Total: 1 [<1.82 TiB] / in use: 1 [<1.82 TiB] / in no VG: 0 [0 ] Copying header from /dev/sdn1 to /dev/sdm1 on hayes-03 1+0 records in 1+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0651065 s, 16.1 MB/s Re-scanning lvm PVs (pvscan --cache) pvscan[4348] PV /dev/sdn1 online. Disabling device sdn on hayes-03 'echo offline > /sys/block/sdn/device/state' VG #PV #LV #SN Attr VSize VFree df 1 0 0 wz-n <1.82t <1.82t Renaming df to df_2 vgrename --yes df df_2 Volume group "df" successfully renamed to "df_2" Generating a new PV uuid for /dev/sdm1 pvchange -u /dev/sdm1 Enabling device sdn on hayes-03 'echo running > /sys/block/sdn/device/state' WARNING: fix duplicate VGID cC9Or7-8fhy-V64N-spKL-y7QU-IhtC-KULXUH for VGs df and df_2 (see vgchange -u). WARNING: lookup found duplicate VGID cC9Or78fhyV64NspKLy7QUIhtCKULXUH for VGs df and df_2. WARNING: lookup found duplicate VGID cC9Or78fhyV64NspKLy7QUIhtCKULXUH for VGs df and df_2. WARNING: lookup found duplicate VGID cC9Or78fhyV64NspKLy7QUIhtCKULXUH for VGs df and df_2. WARNING: lookup found duplicate VGID cC9Or78fhyV64NspKLy7QUIhtCKULXUH for VGs df and df_2. Generating a new VG uuid for df_2 vgchange -u df_2 Volume group "df_2" successfully changed Generating a new VG uuid for df vgchange -u df Volume group "df" successfully changed PV VG Fmt Attr PSize PFree /dev/sdm1 df_2 lvm2 a-- <1.82t <1.82t /dev/sdn1 df lvm2 a-- <1.82t <1.82t removing vg df_2 from hayes-03 Volume group "df_2" successfully removed Labels on physical volume "/dev/sdm1" successfully wiped. Volume group "df" successfully removed Enabling devicesfile on hayes-03 Setting use_devicesfile to enable removing pv /dev/sdn1 on hayes-03 Labels on physical volume "/dev/sdn1" successfully wiped. removing entry from the devices file for /dev/sdn1 — Additional comment from errata-xmlrpc on 2022-07-27 13:18:40 UTC — This bug has been added to advisory RHBA-2022:97329 by Marian Csontos (mcsontos@redhat.com) — Additional comment from errata-xmlrpc on 2022-07-27 13:19:31 UTC — Bug report changed to ON_QA status by Errata System. A QE request has been submitted for advisory RHBA-2022:97329-01 https://errata.devel.redhat.com/advisory/97329
Done