#1963 Issue closed: Specific mandatrory programs get not added to REQUIRED_PROGS

Labels: enhancement, bug, fixed / solved / done

jsmeix opened issue at 2018-11-14 09:14:

  • ReaR version ("/usr/sbin/rear -V"):
    Current GitHub master code

  • Description of the issue (ideally so that others can reproduce it):

Excerpt from
https://github.com/rear/rear/issues/892#issuecomment-438585716

We need to improve that specific scripts which result
that specific programs will be called in the recovery system
must add those programs to REQUIRED_PROGS.

For example I have an ext4 root filesystem and did

# mv /usr/sbin/mkfs /usr/sbin/mkfs.away
# mv /usr/sbin/mkfs.ext4 /usr/sbin/mkfs.ext4.away

But "rear -D mkrescue" did not error out (nor show any kind of message)
regardless that without mkfs and/or mkfs.ext4 in the recovery system
the ext4 root filesystem cannot be recreated:

# find /tmp/rear.2VRqe2odrvdlsPY/rootfs | grep mkfs

/tmp/rear.2VRqe2odrvdlsPY/rootfs/bin/mkfs.ext2
/tmp/rear.2VRqe2odrvdlsPY/rootfs/bin/mkfs.jfs
/tmp/rear.2VRqe2odrvdlsPY/rootfs/bin/mkfs.ext3
/tmp/rear.2VRqe2odrvdlsPY/rootfs/bin/mkfs.reiserfs
/tmp/rear.2VRqe2odrvdlsPY/rootfs/bin/mkfs.vfat
/tmp/rear.2VRqe2odrvdlsPY/rootfs/bin/mkfs.btrfs
/tmp/rear.2VRqe2odrvdlsPY/rootfs/bin/mkfs.xfs

# grep ext4 /tmp/rear.2VRqe2odrvdlsPY/rootfs/.../disklayout.conf

fs /dev/sda2 / ext4 uuid=aed8d81b-29bf-405e-9049-29a6c0e702d3 ...

Ironically several useless mkfs.* tools are in the recovery system here
except those that are actually required (mkfs and perhaps also mkfs.ext4).

  • Workaround, if any:

Usually things work by chance because those tools are in PROGS
and normally exist on the original system so that they get copied
into the recovery system but there is nothing in ReaR to ensure that.

Accordingly the usual "workaround" is to have a system where
"all the usual stuff" is installed.

But on a "production" system (server or desktop does not matter
with "production" I mean a system that is in a "ready to use" state)
there is no need to have low-level tools like mkfs* installed.

Strictly speaking tools like parted and mkfs* are only needed
within the installation system that installs the target system
but when the installation was completed no such tools are
needed on the "ready to use" (target) system.

It is a different issue that ReaR cannot be used on systems
where tools like parted and mkfs* are not installed,
cf. https://github.com/rear/rear/issues/755

This issue here is that ReaR does not error out when it is used
on systems where mandatory tools for recreation are not installed.

jsmeix commented at 2018-11-16 12:29:

With https://github.com/rear/rear/pull/1964 merged
this issue should be at least initially sufficiently fixed.

The current main intent is to let "rear mkrescue/mkbackup" error out
when a specific required program to recreate the disk layout
is not included in the recovery system.

To let "rear mkrescue/mkbackup" error out in such cases it should be
(hopefully) reasonably sufficient to only specify primarily needed
programs to recreate the disk layout but not whatever other files
like config files or helper scripts and so on because the assumption is
that when a primarily needed program is installed on the original system
all its associated stuff is also installed (e.g. via RPM package dependencies).
I.e. the assumption is the installation of the original system is consistent
(ReaR won't work when the original system is already broken).

Details:

The following specific required programs are added to REQUIRED_PROGS
depending on the actually used component keywords in disklayout.conf cf.
https://raw.githubusercontent.com/rear/rear/master/doc/user-guide/06-layout-configuration.adoc

The component keywords disk or part
require parted and partprobe
(via 200_partition_layout.sh)

The component keyword raid
requires mdadm
(via 210_raid_layout.sh)

The component keywords lvmdev or lvmgrp or lvmvol
require lvm
(via 220_lvm_layout.sh)

The component keyword fs
requires mkfs
and additionally depending on the used filesystem
mkfs.ext2 mkfs.ext3 mkfs.ext4 plus mke2fs and tune2fs or tune4fs
mkfs.vfat
mkfs.xfs plus xfs_admin
mkfs.reiserfs plus reiserfstune
mkfs.btrfs plus btrfs
(via 230_filesystem_layout.sh)

The component keyword swap
requires mkswap
(via 240_swaps_layout.sh)

The component keyword drbd
requires drbdadm
(via 250_drbd_layout.sh)

The component keyword crypt
requires cryptsetup
(via 260_crypt_layout.sh)

The component keywords logicaldrive or smartarray
require hpacucli or hpssacli or ssacli
(via 270_hpraid_layout.sh)

The component keyword multipath
requires multipath
(via 280_multipath_layout.sh)


[Export of Github issue for rear/rear.]