#3247 Issue open: How to setup ReaR for Fedora-Cloud-Base-Generic.x86_64-40-VERSION.qcow2

Labels: documentation, ReaR Project

jsmeix opened issue at 2024-06-13 07:00:

This issue is meant as documentation
how to setup ReaR for a Fedora 40 Cloud Base Image.

jsmeix commented at 2024-06-13 07:01:

How to setup a Fedora 40 Cloud Base Image
so that it can be normally used when it runs
in a KVM/QEMU virtual machine:

I am using here
Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
from
https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/
cf.
https://github.com/rear/rear/pull/3175#issuecomment-2163125075

I downloaded

https://mirror.23m.com/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2

I can run that directly in a KVM/QEMU virtual machine.

But that image has login for 'root' disabled in etc/passwd - cf.
https://github.com/rear/rear/pull/3175#issuecomment-2163180550

So I needed to change etc/passwd to no password for 'root'
manually in that image by mounting
Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
directly - cf.
https://github.com/rear/rear/pull/3175#issuecomment-2163264761

# modprobe nbd max_part=8

# qemu-nbd --connect=/dev/nbd0 Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2

# fdisk /dev/nbd0 -l
Disk /dev/nbd0: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: EDB052F7-644C-490E-807C-FAD7E596DB80
Device        Start      End Sectors  Size Type
/dev/nbd0p1    2048     6143    4096    2M BIOS boot
/dev/nbd0p2    6144   210943  204800  100M EFI System
/dev/nbd0p3  210944  2258943 2048000 1000M Linux extended boot
/dev/nbd0p4 2258944 10485726 8226783  3.9G Linux root (x86-64)

# mkdir fedora40mp

# mount /dev/nbd0p4 fedora40mp

# cd fedora40mp

# ls -l
total 0
drwxr-xr-x. 1 root root   0 Jan 24 01:00 home
drwxrwxr-x. 1 root root 212 Apr 15 00:56 root
drwxr-xr-x. 1 root root 170 Jun 12 16:33 var

# ls -l root
total 24
...
drwxr-xr-x. 1 root root 2610 Jun 12 16:33 etc
...

# vi root/etc/passwd
...

# head root/etc/passwd
root::0:0:Super User:/root:/bin/bash
...

# cd

# umount /dev/nbd0p4

# qemu-nbd --disconnect /dev/nbd0
/dev/nbd0 disconnected

# rmmod nbd

and umounted the image and disabled nbd again.

Now I can log in as root when I run that
Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
in a KVM/QEMU virtual machine.

To be able to log in via 'ssh' I had to add
a normal user 'tux' with a (non empty) password
then I can log in as 'tux' via 'ssh' and finally
I can do 'su -' to become 'root' (via 'ssh').

jsmeix commented at 2024-06-13 07:24:

How to setup a Fedora 40 Cloud Base Image
that can already be normally used in a KVM/QEMU VM
so that the ReaR upstream master code can be used:

A lot of programs are missing which need to be installed - cf.
https://github.com/rear/rear/pull/3239#issuecomment-2154680294
which points to
https://github.com/rear/rear/blob/1ec0559b3fc43e69a0a52feeb3f5fe615e7c7241/tools/run-in-docker#L85-L94

To get the ReaR upstream master code 'git' is needed

# yum --nogpgcheck install git
...

# git clone https://github.com/rear/rear.git
Cloning into 'rear'...
...

# mv rear rear.github.master

# cd rear.github.master

# vi etc/rear/local.conf
...

# cat etc/rear/local.conf

OUTPUT=ISO
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"
BACKUP_URL=nfs://192.168.178.66/nfs
SSH_ROOT_PASSWORD='rear'
USE_DHCLIENT="yes"
PROGRESS_MODE="plain"
PROGRESS_WAIT_SECONDS="5"
MODULES=( loaded_modules )
FIRMWARE_FILES=( no )

ReaR needs several more programs to be installed:

# usr/sbin/rear -D mkrescue
...
ERROR: Cannot find required programs: bc strings

# yum --nogpgcheck install bc
...

# yum --nogpgcheck install binutils
...

# usr/sbin/rear -D mkrescue
...
ERROR: Mount command 'mount -v -t nfs -o nfsvers=3,nolock 192.168.178.66:/nfs /var/tmp/rear.cppMwUz5FMgLJlv/outputfs' failed.
Some latest log messages since the last called script 060_mount_NETFS_path.sh:
...
  mount: /var/tmp/rear.cppMwUz5FMgLJlv/outputfs: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.

# yum search --all mount.nfs
...
nfs-utils.x86_64 ...

# yum --nogpgcheck install nfs-utils
...

# usr/sbin/rear -D mkrescue
...
ERROR: Could not find program to make ISO9660 filesystem. Install 'xorrisofs', 'mkisofs', 'genisoimage' or 'ebiso' or specify ISO_MKISOFS_BIN (currently '')

# yum search --all xorrisofs
No matches found.

# yum search --all xorriso
...
xorriso.x86_64 ...

# yum --nogpgcheck install xorriso
...

# usr/sbin/rear -D mkrescue
...
ERROR: Could not find 'isolinux.bin' (ISO_ISOLINUX_BIN='')

# yum search --all isolinux
...
syslinux.x86_64 ...

# yum --nogpgcheck install syslinux
...

# usr/sbin/rear -D mkrescue
...
Exiting rear mkrescue (PID 6819) and its descendant processes ...

Now also "rear mkbackup" works
(using BACKUP=NETFS with 'tar')

# usr/sbin/rear -D mkbackup
...
Archived 336 MiB in 41 seconds [avg 8410 KiB/sec]
Exiting rear mkbackup (PID 78087) and its descendant processes ...

lzaoral commented at 2024-06-13 07:36:

@jsmeix If you want to install all necessary packages, just install the official rear Fedora package and then remove it while keeping the dependencies:

$ dnf install rear
...
$ dnf remove --noautoremove rear
...

jsmeix commented at 2024-06-13 08:04:

@lzaoral
thank you for the tip how to do it more easily.
This is certainly the better way for users.

But I (as ReaR developer) wanted to experience myself
what is missing and - even more important - when ReaR
does not Error out when something essential is missing.
I guess I will experience some currently hidden cases
where ReaR blindly proceeds regardless that something
essential is missing which needs to be fixed in ReaR.
So I do want to install only what ReaR itself requires
as mandatorily needed (via an Error exit).

lzaoral commented at 2024-06-13 09:14:

@jsmeix Understood! And thank you, this reminded me of the following Fedora downstream patch that should be upstreamed: https://src.fedoraproject.org/rpms/rear/blob/rawhide/f/rear-bz1492177-warning.patch

I'll create a PR next week.

Obsolete, see: https://github.com/rear/rear/issues/3247#issuecomment-2173025613

jsmeix commented at 2024-06-13 09:14:

Because a Fedora 40 Cloud Base Image
uses btrfs subvolumes

# findmnt -a -o TARGET,SOURCE -t btrfs
TARGET  SOURCE
/       /dev/vda4[/root]
|-/home /dev/vda4[/home]
`-/var  /dev/vda4[/var]

and because
https://github.com/rear/rear/pull/3175
is not yet merged into ReaR GitHub master code
those btrfs subvolumes which are not mounted at '/'
need to be explicitly included in the backup via

BACKUP_PROG_INCLUDE+=( /home /var )

so that "rear mkbackup" makes a complete backup.

Here my current var/lib/rear/layout/disklayout.conf

# Disk layout dated 20240613090414 (YYYYmmddHHMMSS)
# NAME        KNAME      PKNAME   TRAN   TYPE FSTYPE LABEL   SIZE MOUNTPOINT UUID                                 WWN
# /dev/zram0  /dev/zram0                 disk                1.9G [SWAP]                                          
# /dev/vda    /dev/vda            virtio disk                  5G                                                 
# |-/dev/vda1 /dev/vda1  /dev/vda virtio part                  2M                                                 
# |-/dev/vda2 /dev/vda2  /dev/vda virtio part vfat   EFI     100M /boot/efi  F011-3319                            
# |-/dev/vda3 /dev/vda3  /dev/vda virtio part ext4   BOOT   1000M /boot      0c1e380a-7f1b-4e86-8fa0-629d10202a44 
# `-/dev/vda4 /dev/vda4  /dev/vda virtio part btrfs  fedora  3.9G /var       8424dfd0-f878-4302-8ee5-b2ec6e5eb868 
# Disk /dev/vda
# Format: disk <devname> <size(bytes)> <partition label type>
disk /dev/vda 5368709120 gpt
# Partitions on /dev/vda
# Format: part <device> <partition size(bytes)> <partition start(bytes)> <partition type|name> <flags> /dev/<partition>
part /dev/vda 2097152 1048576 p.legacy bios_grub /dev/vda1
part /dev/vda 104857600 3145728 p.UEFI boot,esp /dev/vda2
part /dev/vda 1048576000 108003328 p.lxboot none /dev/vda3
part /dev/vda 4212112896 1156579328 p.lxroot none /dev/vda4
# Filesystems (only ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs are supported).
# Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] [<attributes>]
fs /dev/vda2 /boot/efi vfat uuid=F011-3319 label=EFI options=rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro
fs /dev/vda3 /boot ext4 uuid=0c1e380a-7f1b-4e86-8fa0-629d10202a44 label=BOOT blocksize=4096 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=16384 default_mount_options=user_xattr,acl options=rw,relatime,seclabel
fs /dev/vda4 / btrfs uuid=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 label='fedora' options=rw,relatime,compress=zstd:1,discard=async,space_cache=v2,subvolid=256,subvol=/root
# Btrfs default subvolume for /dev/vda4 at /
# Format: btrfsdefaultsubvol <device> <mountpoint> <btrfs_subvolume_ID> <btrfs_subvolume_path>
btrfsdefaultsubvol /dev/vda4 / 5 /
# Btrfs normal subvolumes for /dev/vda4 at /
# Format: btrfsnormalsubvol <device> <mountpoint> <btrfs_subvolume_ID> <btrfs_subvolume_path>
btrfsnormalsubvol /dev/vda4 / 256 root
btrfsnormalsubvol /dev/vda4 / 257 home
btrfsnormalsubvol /dev/vda4 / 258 var
# All mounted btrfs subvolumes (including mounted btrfs default subvolumes and mounted btrfs snapshot subvolumes).
# Determined by the findmnt command that shows the mounted btrfs_subvolume_path.
# Format: btrfsmountedsubvol <device> <subvolume_mountpoint> <mount_options> <btrfs_subvolume_path>
btrfsmountedsubvol /dev/vda4 / rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=256,subvol=/root root
btrfsmountedsubvol /dev/vda4 /home rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=257,subvol=/home home
btrfsmountedsubvol /dev/vda4 /var rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=258,subvol=/var var
# Mounted btrfs subvolumes that have the 'no copy on write' attribute set.
# Format: btrfsnocopyonwrite <btrfs_subvolume_path>
# Swap partitions or swap files
# Format: swap <filename> uuid=<uuid> label=<label>
swap /dev/zram0 uuid=34f07c61-f520-4968-b3a8-1942852989da label=zram0

Here my current disk partitioning:

# parted -s /dev/vda unit GiB print
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 5.00GiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start    End      Size     File system  Name      Flags
 1      0.00GiB  0.00GiB  0.00GiB               p.legacy  bios_grub
 2      0.00GiB  0.10GiB  0.10GiB  fat16        p.UEFI    boot, esp
 3      0.10GiB  1.08GiB  0.98GiB  ext4         p.lxboot  bls_boot
 4      1.08GiB  5.00GiB  3.92GiB  btrfs        p.lxroot

# parted -s /dev/vda unit B print
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 5368709120B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start        End          Size         File system  Name      Flags
 1      1048576B     3145727B     2097152B                  p.legacy  bios_grub
 2      3145728B     108003327B   104857600B   fat16        p.UEFI    boot, esp
 3      108003328B   1156579327B  1048576000B  ext4         p.lxboot  bls_boot
 4      1156579328B  5368692223B  4212112896B  btrfs        p.lxroot

Here lsblk, findmnt, btrfs subvolumes, ... - cf.
https://github.com/rear/rear/pull/3175#issuecomment-2163308619

# lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,PARTLABEL,SIZE,MOUNTPOINTS

NAME        KNAME      PKNAME   TRAN   TYPE FSTYPE LABEL  PARTLABEL  SIZE MOUNTPOINTS
/dev/zram0  /dev/zram0                 disk                          1.9G [SWAP]
/dev/vda    /dev/vda            virtio disk                            5G 
|-/dev/vda1 /dev/vda1  /dev/vda virtio part               p.legacy     2M 
|-/dev/vda2 /dev/vda2  /dev/vda virtio part vfat   EFI    p.UEFI     100M /boot/efi
|-/dev/vda3 /dev/vda3  /dev/vda virtio part ext4   BOOT   p.lxboot  1000M /boot
`-/dev/vda4 /dev/vda4  /dev/vda virtio part btrfs  fedora p.lxroot   3.9G /var
                                                                          /home
                                                                          /

# findmnt -at btrfs

TARGET  SOURCE           FSTYPE OPTIONS
/       /dev/vda4[/root] btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=256,subvol=/root
|-/home /dev/vda4[/home] btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=257,subvol=/home
`-/var  /dev/vda4[/var]  btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=258,subvol=/var

# btrfs subvolume list -a /

ID 256 gen 167 top level 5 path <FS_TREE>/root
ID 257 gen 112 top level 5 path <FS_TREE>/home
ID 258 gen 169 top level 5 path <FS_TREE>/var

# cat /etc/fstab

UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 / btrfs compress=zstd:1,defaults,subvol=root 0 1
UUID=0c1e380a-7f1b-4e86-8fa0-629d10202a44 /boot ext4 defaults 0 0
UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 /home btrfs compress=zstd:1,subvol=home 0 0
UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 /var btrfs compress=zstd:1,subvol=var 0 0
UUID=F011-3319 /boot/efi vfat defaults,umask=0077,shortname=winnt 0 0

# cat /proc/cmdline

BOOT_IMAGE=(hd0,gpt3)/vmlinuz-6.8.5-301.fc40.x86_64 no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 root=UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 rootflags=subvol=root

I think I better take a good breakfast now
before I try out how "rear recover" behaves with that...
;-)

jsmeix commented at 2024-06-13 10:50:

I booted the ReaR ISO on a second KVM/QEMU VM
with identical virtual disk /dev/vda size 5.0 GiB.

I did not get the ReaR recovery system startup messages
which indicates an issue with the kernel command line
'console' option setting.

I could log in as 'root' via 'ssh' as specified

SSH_ROOT_PASSWORD='rear'
USE_DHCLIENT="yes"

which means the needed RPM packages for that
were already installed in the
Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
image.

In the ReaR recovery system I have

RESCUE linux:~ # parted -s /dev/vda unit GiB print
Error: /dev/vda: unrecognised disk label
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 5.00GiB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

# lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,PARTLABEL,SIZE,MOUNTPOINTS
NAME     KNAME    PKNAME TRAN   TYPE FSTYPE  LABEL    PARTLABEL SIZE MOUNTPOINTS
/dev/sr0 /dev/sr0        sata   rom  iso9660 REAR-ISO            70M 
/dev/vda /dev/vda        virtio disk                              5G

as expected for a new empty (virtual) disk.

My very first try of "rear recover":

I enforce MIGRATION_MODE to make "rear recover" stop
in particular after the disk layout was recreated
so that I could have a look (via the ReaR shell)
what disk layout was actually recreated.

RESCUE linux:~ # export MIGRATION_MODE='true'

RESCUE linux:~ # rear -D recover
Relax-and-Recover 2.7 / Git
Running rear recover (PID 678 date 2024-06-13 10:31:58)
Command line options: /bin/rear -D recover
Using log file: /var/log/rear/rear-linux.log
Using build area: /var/tmp/rear.i4ZOCgcblM0Wkq0
Setting TMPDIR to '/var/tmp' (was unset when ReaR was launched)
Running 'init' stage ======================
Running workflow recover within the ReaR rescue/recovery system
Running 'setup' stage ======================
Setting dmesg level 6
Running 'verify' stage ======================
Starting required daemons for NFS: RPC portmapper (portmap or rpcbind) and rpc.statd if available.
Started RPC portmapper 'rpcbind'.
RPC portmapper 'rpcbind' available.
Started rpc.statd.
RPC status rpc.statd available.
Using backup archive '/var/tmp/rear.i4ZOCgcblM0Wkq0/outputfs/linux/backup.tar.gz'
Will do driver migration (recreating initramfs/initrd)
Calculating backup archive size
Backup archive size is 428M     /var/tmp/rear.i4ZOCgcblM0Wkq0/outputfs/linux/backup.tar.gz (compressed)
Running 'layout/prepare' stage ======================
Enforced manual disk layout configuration (MIGRATION_MODE is 'true')
Using /dev/vda (same name and same size 5368709120) for recreating /dev/vda
Current disk mapping table (source => target):
  /dev/vda => /dev/vda

UserInput -I LAYOUT_MIGRATION_CONFIRM_MAPPINGS needed in /usr/share/rear/layout/prepare/default/300_map_disks.sh line 334
Confirm or edit the disk mapping
1) Confirm disk mapping and continue 'rear recover'
2) Confirm identical disk mapping and proceed without manual configuration
3) Edit disk mapping (/var/lib/rear/layout/disk_mappings)
4) Use Relax-and-Recover shell and return back to here
5) Abort 'rear recover'
(default '1' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Confirm disk mapping and continue 'rear recover''
User confirmed disk mapping
Disabling excluded components in /var/lib/rear/layout/disklayout.conf
Applied disk layout mappings to /var/lib/rear/layout/disklayout.conf
Applied disk layout mappings to /var/lib/rear/layout/config/df.txt
Applied disk layout mappings to /etc/rear/rescue.conf
Trying to automatically resize last partition when disk size changed
Examining gpt device /dev/vda to automatically resize its last active partition
Skipping /dev/vda (size of new device same as size of old device)
UserInput -I LAYOUT_FILE_CONFIRMATION needed in /usr/share/rear/layout/prepare/default/500_confirm_layout_file.sh line 26
Confirm or edit the disk layout file
1) Confirm disk layout and continue 'rear recover'
2) Edit disk layout (/var/lib/rear/layout/disklayout.conf)
3) View disk layout (/var/lib/rear/layout/disklayout.conf)
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 recover'
(default '1' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Confirm disk layout and continue 'rear recover''
User confirmed disk layout file
Marking component '/dev/vda' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/vda1' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/vda2' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/vda3' as done in /var/lib/rear/layout/disktodo.conf
Marking component '/dev/vda4' as done in /var/lib/rear/layout/disktodo.conf
Fallback SLES-like btrfs subvolumes setup for /dev/vda4 on / (no match in BTRFS_SUBVOLUME_GENERIC_SETUP or BTRFS_SUBVOLUME_SLES_SETUP)
Marking component 'fs:/' as done in /var/lib/rear/layout/disktodo.conf
Marking component 'btrfsmountedsubvol:/' as done in /var/lib/rear/layout/disktodo.conf
Marking component 'fs:/boot' as done in /var/lib/rear/layout/disktodo.conf
Marking component 'fs:/boot/efi' as done in /var/lib/rear/layout/disktodo.conf
Marking component 'btrfsmountedsubvol:/home' as done in /var/lib/rear/layout/disktodo.conf
Marking component 'btrfsmountedsubvol:/var' as done in /var/lib/rear/layout/disktodo.conf
No code has been generated to recreate swap:/dev/zram0 (swap)
To recreate swap:/dev/zram0 (swap) manually add code to /var/lib/rear/layout/diskrestore.sh or abort
UserInput -I ADD_CODE_TO_RECREATE_MISSING_SWAPDEVZRAM0SWAP needed in /usr/share/rear/layout/prepare/default/600_show_unprocessed.sh line 33
Manually add code that recreates swap:/dev/zram0 (swap)
1) View /var/lib/rear/layout/diskrestore.sh
2) Edit /var/lib/rear/layout/diskrestore.sh
3) Go to Relax-and-Recover shell
4) Continue 'rear recover'
5) Abort 'rear recover'
(default '4' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Continue 'rear recover''
Running 'layout/recreate' stage ======================
UserInput -I LAYOUT_CODE_CONFIRMATION needed in /usr/share/rear/layout/recreate/default/100_confirm_layout_code.sh line 26
Confirm or edit the disk recreation script
1) Confirm disk recreation script and continue 'rear recover'
2) Edit disk recreation script (/var/lib/rear/layout/diskrestore.sh)
3) View 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 recover'
(default '1' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Confirm disk recreation script and continue 'rear recover''
User confirmed disk recreation script
Disks to be completely overwritten and recreated by /var/lib/rear/layout/diskrestore.sh:
  /dev/vda 
Determining disks to be wiped ...
UserInput -I WIPE_DISKS_CONFIRMATION needed in /usr/share/rear/layout/recreate/default/120_confirm_wipedisk_disks.sh line 168
Disks to be wiped: /dev/vda 
1) Confirm disks to be wiped and continue 'rear recover'
2) Skip wiping disks and continue 'rear recover'
3) Use Relax-and-Recover shell and return back to here
4) Abort 'rear recover'
(default '1' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Confirm disks to be wiped and continue 'rear recover''
User confirmed disks to be wiped
Wiping child devices of /dev/vda in reverse ordering: /dev/vda 
Wiped first 16777216 bytes of /dev/vda
Wiped last 16777216 bytes of /dev/vda
Start system layout restoration.
Disk '/dev/vda': creating 'gpt' partition table
Disk '/dev/vda': creating partition number 1 with name ''p.legacy''
Disk '/dev/vda': creating partition number 2 with name ''p.UEFI''
Disk '/dev/vda': creating partition number 3 with name ''p.lxboot''
Disk '/dev/vda': creating partition number 4 with name ''p.lxroot''
Creating filesystem of type btrfs with mount point / on /dev/vda4.
Mounting filesystem /
Creating filesystem of type ext4 with mount point /boot on /dev/vda3.
Mounting filesystem /boot
Creating filesystem of type vfat with mount point /boot/efi on /dev/vda2.
Mounting filesystem /boot/efi
Disk layout created.
Recreated storage layout:
NAME        KNAME     TRAN   TYPE FSTYPE  LABEL     SIZE MOUNTPOINTS
/dev/sr0    /dev/sr0  sata   rom  iso9660 REAR-ISO   70M 
/dev/vda    /dev/vda  virtio disk                     5G 
|-/dev/vda1 /dev/vda1 virtio part                     2M 
|-/dev/vda2 /dev/vda2 virtio part                   100M /mnt/local/boot/efi
|-/dev/vda3 /dev/vda3 virtio part ext4    BOOT     1000M /mnt/local/boot
`-/dev/vda4 /dev/vda4 virtio part btrfs   fedora    3.9G /mnt/local/var
                                                         /mnt/local/home
                                                         /mnt/local
UserInput -I LAYOUT_MIGRATED_CONFIRMATION needed in /usr/share/rear/layout/recreate/default/200_run_layout_code.sh line 168
Confirm the recreated disk layout or go back one step
1) Confirm recreated disk layout and continue 'rear recover'
2) Go back one step to redo disk layout recreation
3) Use Relax-and-Recover shell and return back to here
4) Abort 'rear recover'
(default '1' timeout 300 seconds)
3
UserInput: Valid choice number result 'Use Relax-and-Recover shell and return back to here'

rear> lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,PARTLABEL,SIZE,MOUNTPOINTS
NAME        KNAME     PKNAME   TRAN   TYPE FSTYPE  LABEL    PARTLABEL  SIZE MOUNTPOINTS
/dev/sr0    /dev/sr0           sata   rom  iso9660 REAR-ISO             70M 
/dev/vda    /dev/vda           virtio disk                               5G 
|-/dev/vda1 /dev/vda1 /dev/vda virtio part                  p.legacy     2M 
|-/dev/vda2 /dev/vda2 /dev/vda virtio part                  p.UEFI     100M /mnt/local/boot/efi
|-/dev/vda3 /dev/vda3 /dev/vda virtio part ext4    BOOT     p.lxboot  1000M /mnt/local/boot
`-/dev/vda4 /dev/vda4 /dev/vda virtio part btrfs   fedora   p.lxroot   3.9G /mnt/local/var
                                                                            /mnt/local/home
                                                                            /mnt/local

rear> findmnt -at btrfs           
TARGET            SOURCE           FSTYPE OPTIONS
/mnt/local        /dev/vda4[/root] btrfs  rw,relatime,compress=zstd:1,discard=async,space_cache=v2,subvolid=256,subvol=/root
|-/mnt/local/home /dev/vda4[/home] btrfs  rw,relatime,compress=zstd:1,discard=async,space_cache=v2,subvolid=257,subvol=/home
`-/mnt/local/var  /dev/vda4[/var]  btrfs  rw,relatime,compress=zstd:1,discard=async,space_cache=v2,subvolid=258,subvol=/var

rear> btrfs subvolume list -a /mnt/local
ID 256 gen 10 top level 5 path <FS_TREE>/root
ID 257 gen 8 top level 5 path <FS_TREE>/home
ID 258 gen 8 top level 5 path <FS_TREE>/var

rear> exit
Are you sure you want to exit the Relax-and-Recover shell ? y
exit
UserInput -I LAYOUT_MIGRATED_CONFIRMATION needed in /usr/share/rear/layout/recreate/default/200_run_layout_code.sh line 168
1) Confirm recreated disk layout and continue 'rear recover'
2) Go back one step to redo disk layout recreation
3) Use Relax-and-Recover shell and return back to here
4) Abort 'rear recover'
(default '1' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Confirm recreated disk layout and continue 'rear recover''
User confirmed recreated disk layout
Running 'restore' stage ======================
Restoring from '/var/tmp/rear.i4ZOCgcblM0Wkq0/outputfs/linux/backup.tar.gz' (restore log in /var/lib/rear/restore/recover.backup.tar.gz.678.restore.log) ...
Backup restore program 'tar' started in subshell (PID=4843)
Restored 325 MiB [avg. 66611 KiB/sec] 
Restored 635 MiB [avg. 65025 KiB/sec] 
Restored 895 MiB [avg. 61135 KiB/sec] 
OK
Restored 1028 MiB in 20 seconds [avg. 52656 KiB/sec]
Restoring finished (verify backup restore log messages in /var/lib/rear/restore/recover.backup.tar.gz.678.restore.log)
Created SELinux /mnt/local/.autorelabel file : after reboot SELinux will relabel all files
Recreating directories (with permissions) from /var/lib/rear/recovery/directories_permissions_owner_group
Running 'finalize' stage ======================
Checking if certain restored files are consistent with the recreated system
See /var/lib/rear/layout/config/files.md5sum what files are checked
UserInput -I RESTORED_FILES_CONFIRMATION needed in /usr/share/rear/finalize/default/520_confirm_finalize.sh line 41
Confirm restored config files are OK or adapt them as needed
1) Confirm it is OK to recreate initrd and reinstall bootloader and continue 'rear recover'
2) Edit restored etc/fstab (/mnt/local/etc/fstab)
3) View restored etc/fstab (/mnt/local/etc/fstab)
4) Use Relax-and-Recover shell and return back to here
5) Abort 'rear recover'
(default '1' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Confirm it is OK to recreate initrd and reinstall bootloader and continue 'rear recover''
User confirmed restored files
Running dracut...
Updated initrd with new drivers for kernel 6.8.5-301.fc40.x86_64.
Installing GRUB2 boot loader...
Determining where to install GRUB2 (no GRUB2_INSTALL_DEVICES specified)
Found possible boot disk /dev/vda - installing GRUB2 there
Running 'wrapup' stage ======================
Finished 'recover'. The target system is mounted at '/mnt/local'.
Exiting rear recover (PID 678) and its descendant processes ...
Running exit tasks
To remove the build area you may use (with caution): rm -Rf --one-file-system /var/tmp/rear.i4ZOCgcblM0Wkq0

RESCUE linux:~ # cat /mnt/local/etc/fstab
UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 / btrfs compress=zstd:1,defaults,subvol=root 0 1
UUID=0c1e380a-7f1b-4e86-8fa0-629d10202a44 /boot ext4 defaults 0 0
UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 /home btrfs compress=zstd:1,subvol=home 0 0
UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 /var btrfs compress=zstd:1,subvol=var 0 0
UUID=F011-3319 /boot/efi vfat defaults,umask=0077,shortname=winnt 0 0

RESCUE linux:~ # lsblk -ipo NAME,KNAME,SIZE,UUID,MOUNTPOINTS
NAME        KNAME      SIZE UUID                                 MOUNTPOINTS
/dev/sr0    /dev/sr0    70M 2024-06-13-09-04-48-00               
/dev/vda    /dev/vda     5G                                      
|-/dev/vda1 /dev/vda1    2M                                      
|-/dev/vda2 /dev/vda2  100M F011-3319                            /mnt/local/boot/efi
|-/dev/vda3 /dev/vda3 1000M 0c1e380a-7f1b-4e86-8fa0-629d10202a44 /mnt/local/boot
`-/dev/vda4 /dev/vda4  3.9G 8424dfd0-f878-4302-8ee5-b2ec6e5eb868 /mnt/local/var
                                                                 /mnt/local/home
                                                                 /mnt/local

So far - at least at first glance - things look good.

Regarding the missing ReaR recovery system startup messages
which indicates an issue with the kernel command line
'console' option setting:

RESCUE linux:~ # cat /proc/cmdline 
BOOT_IMAGE=kernel initrd=initrd.cgz root=/dev/ram0 vga=normal rw  selinux=0 net.ifnames=0 console=tty1 console=ttyS0,115200n8

so

USE_SERIAL_CONSOLE='no'

should help to get ReaR recovery system startup messages.

jsmeix commented at 2024-06-13 11:07:

In the recreated system I did 'poweroff'
but it did not do a real poweroff.
Instead it looks as if it did a 'reboot'
because I got the VM's firmware boot menu
(I set up my VMs always with boot menu
so that I can select the boot disk)
and then I got GRUB
and I saw the kernel boot messages
until there were no further kernel boot messages
(perhaps again a 'console' kernel command line issue)
BUT then
it suddenly rebooted again, i.e. I got again
my VM's firmware boot menu and then GRUB.

I did a hard "power" switch off of the VM.

Then with a real poweroff it booted the recreated system
and I can log in via 'ssh' as on the original system.

Now I have in the poweroff-rebooted recreated system:

# parted -s /dev/vda unit B print
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 5368709120B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start        End          Size         File system  Name      Flags
 1      1048576B     3145727B     2097152B                  p.legacy  bios_grub
 2      3145728B     108003327B   104857600B   fat16        p.UEFI    boot, esp
 3      108003328B   1156579327B  1048576000B  ext4         p.lxboot
 4      1156579328B  5368692223B  4212112896B  btrfs        p.lxroot

# lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,PARTLABEL,SIZE,MOUNTPOINTS
NAME        KNAME      PKNAME   TRAN   TYPE FSTYPE LABEL  PARTLABEL  SIZE MOUNTPOINTS
/dev/sr0    /dev/sr0            sata   rom                             2K 
/dev/zram0  /dev/zram0                 disk                          1.9G [SWAP]
/dev/vda    /dev/vda            virtio disk                            5G 
|-/dev/vda1 /dev/vda1  /dev/vda virtio part               p.legacy     2M 
|-/dev/vda2 /dev/vda2  /dev/vda virtio part vfat   EFI    p.UEFI     100M /boot/efi
|-/dev/vda3 /dev/vda3  /dev/vda virtio part ext4   BOOT   p.lxboot  1000M /boot
`-/dev/vda4 /dev/vda4  /dev/vda virtio part btrfs  fedora p.lxroot   3.9G /var
                                                                          /home
                                                                          /

# findmnt -at btrfs
TARGET  SOURCE           FSTYPE OPTIONS
/       /dev/vda4[/root] btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=256,subvol=/root
|-/home /dev/vda4[/home] btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=257,subvol=/home
`-/var  /dev/vda4[/var]  btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=258,subvol=/var

# btrfs subvolume list -a /
ID 256 gen 29 top level 5 path <FS_TREE>/root
ID 257 gen 22 top level 5 path <FS_TREE>/home
ID 258 gen 28 top level 5 path <FS_TREE>/var

# cat /etc/fstab
UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 / btrfs compress=zstd:1,defaults,subvol=root 0 1
UUID=0c1e380a-7f1b-4e86-8fa0-629d10202a44 /boot ext4 defaults 0 0
UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 /home btrfs compress=zstd:1,subvol=home 0 0
UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 /var btrfs compress=zstd:1,subvol=var 0 0
UUID=F011-3319 /boot/efi vfat defaults,umask=0077,shortname=winnt 0 0

# cat /proc/cmdline
BOOT_IMAGE=(hd0,gpt3)/vmlinuz-6.8.5-301.fc40.x86_64 root=UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 ro rootflags=subvol=root no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 rootflags=subvol=root

# mount -t btrfs -o subvolid=0 /dev/vda4 btrfsroot

# ls -l btrfsroot
total 0
drwxr-xr-x. 1 root root   6 Jun 12 15:11 home
drwxrwxr-x. 1 root root 212 Jun 13 10:52 root
drwxr-xr-x. 1 root root 170 Jun 12 14:33 var

# findmnt -at btrfs
TARGET            SOURCE           FSTYPE OPTIONS
/                 /dev/vda4[/root] btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=256,subvol=/root
|-/home           /dev/vda4[/home] btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=257,subvol=/home
|-/var            /dev/vda4[/var]  btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=258,subvol=/var
`-/root/btrfsroot /dev/vda4        btrfs  rw,relatime,seclabel,compress=zstd:1,discard=async,space_cache=v2,subvolid=5,subvol=/

So - at least for now at first glance - all looks good
in the with real poweroff rebooted recreated system.

In the with real poweroff rebooted recreated system
I did 'poweroff' and that worked as it should
i.e. the VM powered off.

jsmeix commented at 2024-06-13 11:41:

Regarding the kernel command line 'console' option settings:

On the original system
i.e. in Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2

# find / /boot -xdev -type f | xargs grep 'console=.*115200' 2>/dev/null | grep -v 'rear.github.master'

/etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 rootflags=subvol=root"

/etc/kernel/cmdline:
root=UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 ro rootflags=subvol=root  no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 rootflags=subvol=root

/etc/sysconfig/bootloader:
DEFAULT_APPEND="no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 root=UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 rootflags=subvol=root"
FAILSAFE_APPEND="no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 root=UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 rootflags=subvol=root ide=nodma apm=off noresume edd=off nomodeset 3 rootflags=subvol=root"

/config.bootoptions:
no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 root=UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 rootflags=subvol=root

/boot/grub2/grub.cfg:
  set kernelopts="root=UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 ro rootflags=subvol=root  no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 rootflags=subvol=root"
/boot/loader/entries/b7be3f04d1af4fec81d4d27c7e1a64a0-6.8.5-301.fc40.x86_64.conf:options no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 root=UUID=8424dfd0-f878-4302-8ee5-b2ec6e5eb868 rootflags=subvol=root

so

console=tty1 console=ttyS0,115200n8

appears at several places.

@lzaoral @pcahyna
what is "the right way" in Fedora 40 how to
specifiy a different kernel command line
and properly re-setup the whole booting stuff
with that new different kernel command line?

lzaoral commented at 2024-06-13 11:52:

@jsmeix The recommended way to make permanent changes to kernel cmdline with GRUB2 in Fedora is to use the grubby tool: https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader/#sec-Making_Persistent_Changes_to_a_GRUB_2_Menu_Using_the_grubby_Tool

lzaoral commented at 2024-06-17 10:42:

Please, ignore https://github.com/rear/rear/issues/3247#issuecomment-2165085282. ReaR already has that a more general check for this issue (the downstream one only adds a suggestion to install a particular package.)

pcahyna commented at 2024-06-18 16:16:

@jsmeix

BUT then
it suddenly rebooted again, i.e. I got again
my VM's firmware boot menu and then GRUB.

This was probably due to SELinux relabeling (the system reboots automatically after relabeling is done).

jsmeix commented at 2024-06-19 06:03:

@pcahyna
thank you for your explanation what may have caused
that unexpected automated reboot.
Perhaps there was a message somewhere about SELinux
and the automated reboot - but at least it was not
sufficiently obvious for me - perhaps I missed it?
At least I noticed nothing that informed me
about the reason for the automated reboot.

pcahyna commented at 2024-06-19 11:24:

the relabel and reboot process is quick, so maybe you missed it? I recommend using serial console if you don't already, enables you to keep the messages that on a VGA screen would scroll into oblivion or get erased.

jsmeix commented at 2024-06-19 12:44:

Most likely I didn't pay attention to the messages
because I didn't expect something special to happen
so I was surprised by the unexpected automated reboot.

FWIW:
In ReaR we have at several places some reasonable timeout
to avoid that user information scrolls away too fast
or gets erased when the screen content gets replaced
e.g. during recovery system startup several 'sleep' in
https://github.com/rear/rear/blob/master/usr/share/rear/skel/default/etc/scripts/system-setup
and also during boot for GRUB at
https://github.com/rear/rear/blob/master/usr/share/rear/lib/bootloader-functions.sh#L766


[Export of Github issue for rear/rear.]