Bug#884283: lvm2 prerm ought to check if root is on lvm

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Bug#884283: lvm2 prerm ought to check if root is on lvm

Ian Jackson-11
Package: lvm2
Version: 2.02.111-2.2+deb8u1

A few weeks ago, I asked apt to remove dmeventd and it removed lvm2 as
a consequence.  Failing to observe that lvm2 was in the list of other
things to be removed was user error on my part.

However, it would have been nice if lvm2's prerm had observed that my
root was on lvm, and that removal of lvm2 was probably inadvisable.

(As it happens, I noticed before I next rebooted when a cron job
failed.  So I was able to reinstall lvm2 before anything really
annoying happened.)

Information that the lvm2 prerm could have used include:

root@mariner:~# grep root /etc/fstab
/dev/mapper/vg--mariner2-lv--root /               ext4    errors=remount-ro 0       1
root@mariner:~# dmsetup table | grep lv--root
vg--mariner2-lv--root: 0 39059456 linear 254:0 2048
root@mariner:~# mount | grep 'on / '
/dev/mapper/vg--mariner2-lv--root on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
root@mariner:~# stat --format %D /
root@mariner:~# stat -L --format '%t %T %N' /dev/mapper/* 2>/dev/null | grep 'fe 3 '
fe 3 ‘/dev/mapper/vg--mariner2-lv--root’
root@mariner:~# lvm lvs | grep lv-root
  lv-root      vg-mariner2 -wi-ao----  18.62g                                                      

Even though this is an enhancement request, I am filing this bug
report at normal severity because of the possible inconvenience caused
by this kind of error.

It would probably be worth making a similar check for /usr (which
might, of course, not be a mount point).