#2542 Issue closed: rear mountonly fails in LVM on top of LUKS environment

Labels: waiting for info, support / question, no-issue-activity

jk-10 opened issue at 2020-12-12 22:29:

Fill in the following items before submitting a new issue
(quick response is not guaranteed with free support):

  • ReaR version ("/usr/sbin/rear -V"):
    Relax-and-Recover 2.6-git.4230.80821448.master / 2020-12-10

  • OS version ("cat /etc/os-release" or "lsb_release -a" or "cat /etc/rear/os.conf"):

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal
  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
# site.conf
REQUIRED_PROGS+=('tree' 'mc' 'lynx')

# Copy as is, ~/bin2/borg is standalone version, page 16
COPY_AS_IS+=("/home/jk/bin" "/home/jk/Documents/system" "/home/jk/bin2/borg")

# Trusted file owners, page 17
TRUSTED_FILE_OWNERS+=( 'jk' )

# Clone users, groups, page 18
CLONE_USERS+=( 'jk' )
CLONE_GROUPS+=( 'jk' )

# Access rescue system with ssh / password, page 19
SSH_ROOT_PASSWORD='TestEnv'

# Keep build dir for checking build contents, page 19
KEEP_BUILD_DIR="yes"

# Time synchronisation, could be NTP, CHRONY, NTPDATE, RDATE or empty: page 20
TIMESYNC=NTP

# Borg backup, page 23
#COPY_AS_IS_BORG=( 'borg' )

# Only include VG, page 32
ONLY_INCLUDE_VG=( "vg0" )

# Autoexclude filesystems
AUTOEXCLUDE_PATH=( /media /mnt /home/jk )

# GRUB rescue, page 34
GRUB_RESCUE=y

# local.conf
# This file etc/rear/local.conf is intended for the user's
# manual configuration of Relax-and-Recover (ReaR).
# For configuration through packages and other automated means
# we recommend a separated file named site.conf next to this file
# and leave local.conf as is (ReaR upstream will never ship a site.conf).
# The default OUTPUT=ISO creates the ReaR rescue medium as ISO image.
# You need to specify your particular backup and restore method for your data
# as the default BACKUP=REQUESTRESTORE does not really do that (see "man rear").
# Configuration variables are documented in /usr/share/rear/conf/default.conf
# and the examples in /usr/share/rear/conf/examples/ can be used as templates.
# ReaR reads the configuration files via the bash builtin command 'source'
# so bash syntax like VARIABLE="value" (no spaces at '=') is mandatory.
# Because 'source' executes the content as bash scripts you can run commands
# within your configuration files, in particular commands to set different
# configuration values depending on certain conditions as you need like
# CONDITION_COMMAND && VARIABLE="special_value" || VARIABLE="usual_value"
# but that means CONDITION_COMMAND gets always executed when 'rear' is run
# so ensure nothing can go wrong if you run commands in configuration files.
  • Hardware (PC or PowerNV BareMetal or ARM) or virtual machine (KVM guest or PoverVM LPAR): VirtualBox VM Version 6.1.16 r140961
inxi -Fxz
System:    Kernel: 5.4.0-58-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: MATE 1.24.0 
           Distro: Ubuntu 20.04.1 LTS (Focal Fossa) 
Machine:   Type: Virtualbox System: innotek product: VirtualBox v: 1.2 serial: N/A 
           Mobo: Oracle model: VirtualBox v: 1.2 serial: N/A BIOS: innotek v: VirtualBox date: 12/01/2006 
CPU:       Topology: Quad Core model: Intel Pentium Silver J5005 bits: 64 type: MCP arch: Goldmont Plus rev: 1 
           L2 cache: 4096 KiB 
           flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 bogomips: 11977 
           Speed: 1497 MHz min/max: N/A Core speeds (MHz): 1: 1497 2: 1497 3: 1497 4: 1497 
Graphics:  Device-1: InnoTek Systemberatung VirtualBox Graphics Adapter vendor: VMware driver: vboxvideo v: kernel 
           bus ID: 00:02.0 
           Display: server: X.Org 1.20.8 driver: modesetting unloaded: fbdev,vesa resolution: 1584x1081~60Hz 
           OpenGL: renderer: llvmpipe (LLVM 10.0.0 128 bits) v: 3.3 Mesa 20.0.8 direct render: Yes 
Audio:     Device-1: Intel 82801AA AC97 Audio vendor: Dell driver: snd_intel8x0 v: kernel bus ID: 00:05.0 
           Sound Server: ALSA v: k5.4.0-58-generic 
Network:   Device-1: Intel 82540EM Gigabit Ethernet driver: e1000 v: 7.3.21-k8-NAPI port: d020 bus ID: 00:03.0 
           IF: enp0s3 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           Device-2: Intel 82371AB/EB/MB PIIX4 ACPI type: network bridge driver: piix4_smbus v: N/A port: d200 bus ID: 00:07.0 
Drives:    Local Storage: total: 30.00 GiB used: 14.31 GiB (47.7%) 
           ID-1: /dev/sda vendor: VirtualBox model: VBOX HARDDISK size: 30.00 GiB 
Partition: ID-1: / size: 19.56 GiB used: 13.59 GiB (69.5%) fs: ext4 dev: /dev/dm-1 
           ID-2: /boot size: 968.3 MiB used: 741.3 MiB (76.6%) fs: ext4 dev: /dev/sda2 
Sensors:   Message: No sensors data was found. Is sensors configured? 
Info:      Processes: 230 Uptime: 1h 55m Memory: 3.84 GiB used: 1.23 GiB (32.1%) Init: systemd runlevel: 5 Compilers: 
           gcc: 9.3.0 Shell: bash v: 5.0.17 inxi: 3.0.38
  • System architecture (x86 compatible or PPC64/PPC64LE or what exact ARM device):
    x86 compatible

  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):
    UEFI, GRUB

  • Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):
    local disk,

  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINT" or "lsblk" as makeshift):

lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINT
NAME                       KNAME      PKNAME    TRAN   TYPE  FSTYPE       SIZE MOUNTPOINT
/dev/loop0                 /dev/loop0                  loop  squashfs      55M /snap/core18/1880
/dev/loop1                 /dev/loop1                  loop  squashfs    55.4M /snap/core18/1932
/dev/loop2                 /dev/loop2                  loop  squashfs    71.3M /snap/lxd/16099
/dev/loop3                 /dev/loop3                  loop  squashfs    31.1M /snap/snapd/10492
/dev/loop4                 /dev/loop4                  loop  squashfs    67.8M /snap/lxd/18150
/dev/loop5                 /dev/loop5                  loop  squashfs      31M /snap/snapd/9721
/dev/sda                   /dev/sda             sata   disk                30G 
|-/dev/sda1                /dev/sda1  /dev/sda         part                 1M 
|-/dev/sda2                /dev/sda2  /dev/sda         part  ext4        1000M /boot
`-/dev/sda3                /dev/sda3  /dev/sda         part  crypto_LUKS   29G 
  `-/dev/mapper/dm_crypt-0 /dev/dm-0  /dev/sda3        crypt LVM2_member   29G 
    `-/dev/mapper/vg0-lv0  /dev/dm-1  /dev/dm-0        lvm   ext4          20G /
/dev/sr0                   /dev/sr0             ata    rom               1024M
  • Description of the issue (ideally so that others can reproduce it):

  • Run rear -D mkrescue (log file attached)

  • Boot to ReaR rescue system
  • Login to rescue system
  • Run lsblk on rescue system
RESCUE u20mate-luks-lvm-rear:~ # lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   30G  0 disk 
|-sda1   8:1    0    1M  0 part 
|-sda2   8:2    0 1000M  0 part 
`-sda3   8:3    0   29G  0 part 
sr0     11:0    1 1024M  0 rom
  1. Run rear -D mountonly
    and select "abort" when the command fails. (log file attached)
RESCUE u20mate-luks-lvm-rear:~ # rear -D mountonly
Relax-and-Recover 2.6-git.4230.80821448.master / 2020-12-10
Running rear mountonly (PID 1003 date 2020-12-12 22:20:43)
Using log file: /var/log/rear/rear-u20mate-luks-lvm-rear.log
Running workflow mountonly within the ReaR rescue/recovery system
Comparing disks
Device sda has expected (same) size 32212254720 bytes (will be used for 'mountonly')
Disk configuration looks identical
UserInput -I DISK_LAYOUT_PROCEED_RECOVERY needed in /usr/share/rear/layout/prep-for-mount/default/250_compare_disks.sh line 148
Proceed with 'mountonly' (yes) otherwise manual disk layout configuration is enforced
(default 'yes' timeout 30 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: No choices - result is 'yes'
User confirmed to proceed with 'mountonly'
Marking component '/dev/sda' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/sda1' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/sda2' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/sda3' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/mapper/dm_crypt-0' as done in /var/lib/rear/layout/disktodo.conf
Marking component 'pv:/dev/mapper/dm_crypt-0' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/vg0' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/mapper/vg0-lv0' as done in /var/lib/rear/layout/disktodo.conf
Marking component 'fs:/' as done in /var/lib/rear/layout/disktodo.conf
Marking component 'fs:/boot' as done in /var/lib/rear/layout/disktodo.conf
Start target system mount.
Opening LUKS volume dm_crypt-0 on /dev/sda3
Enter the password for LUKS volume dm_crypt-0 (for 'cryptsetup luksOpen' on /dev/sda3):
Enter passphrase for /dev/sda3: 
Mounting filesystem /
UserInput -I LAYOUT_CODE_RUN needed in /usr/share/rear/layout/do-mount/default/200_run_layout_code.sh line 127
The disk layout recreation script failed
1) Rerun disk recreation script (/var/lib/rear/layout/diskrestore.sh)
2) View 'rear mountonly' log file (/var/log/rear/rear-u20mate-luks-lvm-rear.log)
3) Edit disk recreation script (/var/lib/rear/layout/diskrestore.sh)
4) View original disk space usage (/var/lib/rear/layout/config/df.txt)
5) Use Relax-and-Recover shell and return back to here
6) Abort 'rear mountonly'
(default '1' timeout 300 seconds)
6
UserInput: Valid choice number result 'Abort 'rear mountonly''
ERROR: User chose to abort 'rear mountonly' in /usr/share/rear/layout/do-mount/default/200_run_layout_code.sh
Some latest log messages since the last called script 200_run_layout_code.sh:
  2020-12-12 22:21:06.981510446 4) View original disk space usage (/var/lib/rear/layout/config/df.txt)
  2020-12-12 22:21:06.984218724 5) Use Relax-and-Recover shell and return back to here
  2020-12-12 22:21:06.987119428 6) Abort 'rear mountonly'
  2020-12-12 22:21:06.989966053 (default '1' timeout 300 seconds)
  2020-12-12 22:21:28.328892018 UserInput: 'read' got as user input '6'
  2020-12-12 22:21:28.336936164 UserInput: Valid choice number result 'Abort 'rear mountonly''
  2020-12-12 22:21:28.342455614 Error detected during restore.
  2020-12-12 22:21:28.346460818 Restoring saved original /var/lib/rear/layout/disklayout.conf
Aborting due to an error, check /var/log/rear/rear-u20mate-luks-lvm-rear.log for details
Exiting rear mountonly (PID 1003) and its descendant processes ...
Running exit tasks
You should also rm -Rf /tmp/rear.9baWVYWMfvxE08L
Terminated
RESCUE u20mate-luks-lvm-rear:~ # echo $?
143
  1. Run lsblk on rescue system
RESCUE u20mate-luks-lvm-rear:~ # lsblk
NAME           MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda              8:0    0   30G  0 disk  
|-sda1           8:1    0    1M  0 part  
|-sda2           8:2    0 1000M  0 part  
`-sda3           8:3    0   29G  0 part  
  `-dm_crypt-0 253:0    0   29G  0 crypt 
sr0             11:0    1 1024M  0 rom

So program opens LUKS device but fails to open and mount vg0-lv0 device. Compare with the original storage layout.

  • Workaround, if any:
    None found.

  • Attachments, as applicable ("rear -D mkrescue/mkbackup/recover" debug log files):

rear-u20mate-luks-lvm-disklayout.conf.txt
rear-u20mate-luks-lvm-rear-mkrescue.log
rear-u20mate-luks-lvm-rear-mountonly.log

gdha commented at 2021-01-08 11:27:

@jk-10 Does the same behavior happens when you run a recover? Looks like that during the mountonly no vgcreate was executed.

github-actions commented at 2021-03-10 02:13:

Stale issue message

jsmeix commented at 2021-04-08 08:49:

According to
https://github.com/rear/rear/pull/2269
it was tested with "LVM Logical Volumes and a LUKS-encrypted filesystem"
but perhaps not with LVM on top of LUKS.

layout/prep-for-mount/default/540_generate_device_code.sh contains

if create_component "vgchange" "rear" ; then
    lvm vgchange -a y >/dev/null
    component_created "vgchange" "rear"
fi
...
        do_mount_device "$willdodev" "$willdotype"

and lib/layout-functions.sh contains

do_mount_device() {
...
    # This can be used a.o. to decrypt a LUKS device
    echo "# Open $device ($type)" >> "$LAYOUT_CODE"
    if type -t open_$type >/dev/null ; then
        open_$type "$device"
    fi

so something is done for LVM and for LUKS
but from plain looking at those code parts (I did not test it)
this is perhaps not sufficient for LVM on top of LUKS
because what is done for LVM happens before what is done for LUKS.


[Export of Github issue for rear/rear.]