RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1543186 - RFE: boom could check if --rootlv or --root-device exist
Summary: RFE: boom could check if --rootlv or --root-device exist
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.5
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: LVM and device-mapper development team
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-07 23:10 UTC by Corey Marthaler
Modified: 2021-09-03 12:39 UTC (History)
9 users (show)

Fixed In Version: lvm2-2.02.177-3.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 15:23:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0853 0 None None None 2018-04-10 15:24:41 UTC

Description Corey Marthaler 2018-02-07 23:10:09 UTC
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

Comment 3 Bryn M. Reeves 2018-02-08 10:17:20 UTC
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.

Comment 5 Bryn M. Reeves 2018-02-08 13:14:38 UTC
Fixed upstream:

commit 9498317c32f63fa5bf19a6bcb039051c5db213e5
Author: Bryn M. Reeves <bmr>
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>

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

Comment 8 Corey Marthaler 2018-02-14 23:21:19 UTC
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

Comment 11 errata-xmlrpc 2018-04-10 15:23:49 UTC
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


Note You need to log in before you can comment on or make changes to this bug.