Red Hat Bugzilla – Bug 1543186
RFE: boom could check if --rootlv or --root-device exist
Last modified: 2018-04-10 11:24:41 EDT
Description of problem: A simple typo will cause your machine to hang on boot if the rootlv or root-device do not exist. This could be rather annoying if you machine takes a long time to boot and now requires a power cycle because you mistyped. [root@host-082 ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root rhel_host-082 -wi-ao---- <6.20g swap rhel_host-082 -wi-ao---- 820.00m origin test owi-a-s--- 100.00m snap1 test swi-a-s--- 12.00m origin 0.00 snap2 test swi-a-s--- 12.00m origin 0.00 [root@host-082 ~]# boom create --title 'System Snapshot' --root-device test/snap Created entry with boot_id e35a262: title System Snapshot machine-id 4be78ac81dac49098952215ac6624209 version 3.10.0-847.el7.x86_64 linux /vmlinuz-3.10.0-847.el7.x86_64 initrd /initramfs-3.10.0-847.el7.x86_64.img options root=test/snap ro rhgb quiet ## TYPO [root@host-082 ~]# boom create --title 'System Snapshot' --root-device test/sanp Created entry with boot_id 9a394ca: title System Snapshot machine-id 4be78ac81dac49098952215ac6624209 version 3.10.0-847.el7.x86_64 linux /vmlinuz-3.10.0-847.el7.x86_64 initrd /initramfs-3.10.0-847.el7.x86_64.img options root=test/sanp ro rhgb quiet [root@host-082 ~]# boom create --title 'System Snapshot' --rootlv " " Created entry with boot_id 0da10f1: title System Snapshot machine-id 4be78ac81dac49098952215ac6624209 version 3.10.0-847.el7.x86_64 linux /vmlinuz-3.10.0-847.el7.x86_64 initrd /initramfs-3.10.0-847.el7.x86_64.img options root=/dev/ ro rd.lvm.lv= rhgb quiet [root@host-082 ~]# boom create --title 'System Snapshot' --root-device "&&&&&&&&&&&&&" Created entry with boot_id dc76978: title System Snapshot machine-id 4be78ac81dac49098952215ac6624209 version 3.10.0-847.el7.x86_64 linux /vmlinuz-3.10.0-847.el7.x86_64 initrd /initramfs-3.10.0-847.el7.x86_64.img options root=&&&&&&&&&&&&& ro rhgb quiet Version-Release number of selected component (if applicable): 3.10.0-847.el7.x86_64 lvm2-2.02.177-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 lvm2-libs-2.02.177-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 lvm2-cluster-2.02.177-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 lvm2-lockd-2.02.177-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 lvm2-python-boom-0.8.3-2.el7 BUILT: Wed Feb 7 17:42:09 CET 2018 cmirror-2.02.177-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 device-mapper-1.02.146-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 device-mapper-libs-1.02.146-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 device-mapper-event-1.02.146-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 device-mapper-event-libs-1.02.146-2.el7 BUILT: Wed Feb 7 17:39:26 CET 2018 device-mapper-persistent-data-0.7.3-3.el7 BUILT: Tue Nov 14 12:07:18 CET 2017
I think we should make this a warning; this is partly intended, since the target LV or device may not be active (or even exist yet - it's not a use case we're promoting, but we do allow it right now). For the CLI I think we should issue a warning and prompt (or require a --force type switch). The API can accept a parameter to allow creation with non-existent root device and raise an exception otherwise.
Fixed upstream: commit 9498317c32f63fa5bf19a6bcb039051c5db213e5 Author: Bryn M. Reeves <bmr@redhat.com> Date: Thu Feb 8 12:59:00 2018 +0000 boom: default to not allow entries with invalid root device Check the provided --root-device (or result of --root-lv handling) and give an error if the path does not exist, or is not a valid block device node. Add a new kwarg to BootEntry::__init__(), 'allow_no_dev' to allow API users to disable this behaviour and enable it when the new --no-dev/--nodev command line option is given. Signed-off-by: Bryn M. Reeves <bmr@redhat.com> Passing a non-existent or non-block root device will now yield an error: # boom create --title qux2 --rootlv nosuch/dev Device '/dev/nosuch/dev' not found. Creating an entry with no valid root device requires --no-dev Also passing --nodev/--no-dev disables this: # boom create --title qux2 --nodev --rootlv nosuch/dev Created entry with boot_id 0419aa4: title qux2 machine-id 611f38fd887d41dea7eb3403b2730a76 version 4.13.13-200.fc26.x86_64 linux /vmlinuz-4.13.13-200.fc26.x86_64 initrd /initramfs-4.13.13-200.fc26.x86_64.img options BOOT_IMAGE=/vmlinuz-4.13.13-200.fc26.x86_64 root=/dev/nosuch/dev ro rd.lvm.lv=nosuch/dev rhgb quiet
Fix verified in the latest rpms. 3.10.0-848.el7.x86_64 lvm2-2.02.177-3.el7 BUILT: Wed Feb 14 06:52:14 CST 2018 lvm2-libs-2.02.177-3.el7 BUILT: Wed Feb 14 06:52:14 CST 2018 lvm2-cluster-2.02.177-3.el7 BUILT: Wed Feb 14 06:52:14 CST 2018 lvm2-lockd-2.02.177-3.el7 BUILT: Wed Feb 14 06:52:14 CST 2018 lvm2-python-boom-0.8.4-3.el7 BUILT: Wed Feb 14 07:10:51 CST 2018 [root@mckinley-03 ~]# boom create --title 'System Snapshot' --root-device test/sanp Device 'test/sanp' not found. Creating an entry with no valid root device requires --no-dev [root@mckinley-03 ~]# boom create --title 'System Snapshot' --rootlv " " Root logical volume name must be in VG/LV format. Invalid logical volume name: ' ' [root@mckinley-03 ~]# boom create --title 'System Snapshot' --rootlv "/ " / Device '/dev// ' not found. Creating an entry with no valid root device requires --no-dev [root@mckinley-03 ~]# boom create --title 'System Snapshot' --root-device "&&&&&&&&&&&&&" Device '&&&&&&&&&&&&&' not found. Creating an entry with no valid root device requires --no-dev [root@mckinley-03 ~]# boom create --title 'System Snapshot' --nodev --root-device "&&&&&&&&&&&&&" Created entry with boot_id c940d02: title System Snapshot machine-id 99c24df6ee1b4f758788b62052ae1b4b version 3.10.0-848.el7.x86_64 linux /vmlinuz-3.10.0-848.el7.x86_64 initrd /initramfs-3.10.0-848.el7.x86_64.img options root=&&&&&&&&&&&&& ro rhgb quiet [root@mckinley-03 ~]# boom create --title 'System Snapshot' --nodev --rootlv "/ " / Created entry with boot_id 174af5a: title System Snapshot machine-id 99c24df6ee1b4f758788b62052ae1b4b version 3.10.0-848.el7.x86_64 linux /vmlinuz-3.10.0-848.el7.x86_64 initrd /initramfs-3.10.0-848.el7.x86_64.img options root=/dev// ro rd.lvm.lv=/ rhgb quiet
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2018:0853