#2113 PR merged: Revive old 100_populate_dev.sh code for SLES11 (follow up of issue 2045)

Labels: bug, fixed / solved / done

jsmeix opened issue at 2019-04-09 15:06:

Dirty hack to keep things still working on SLES11:
On SLES11 it does not work to bind-mount /dev into TARGET_FS_ROOT
see https://github.com/rear/rear/issues/2045#issuecomment-481195463
because within the recovery system /dev is no mountpoint
(in a running SLES11 system 'udev' is mounted on /dev) and
within the recovery system bind-mounting of the /dev directory fails.
It seems the root cause is that within the recovery system / is no mountpoint
like in a normal running system where e.g. /dev/sda2 is mounted on /
but within the recovery system / is the plain content of ReaR's initrd
so /dev does not belong to any mountpoint and that lets bind-mount fail.
As a dirty hack to keep things still working on SLES11 we do here
the same as we did in our old finalize/default/100_populate_dev.sh

cp -fa /dev $TARGET_FS_ROOT/

cf. https://github.com/rear/rear/issues/2045#issuecomment-464737610
This hack is especially dirty because it copies device node files into TARGET_FS_ROOT
after the backup was restored (i.e. it writes files on the target system disk) and
this hack is especially sneaky because usually on the rebooted target system
something will be mounted at /dev (e.g. on SLES11 'udev' is mounted on /dev)
so that our copied device nodes on the target system disk get obscured and
hidden behind what is mounted at /dev in the normal running target system.

jsmeix commented at 2019-04-10 14:46:

With my latest commit here
https://github.com/rear/rear/pull/2113/commits/82d8d01b73f7ba65aee8c07add4178c1f21c984c
the code should work reasonably clean even for SLES11
and it works well for me on SLES11.

Now when /dev is no mountpoint (e.g. in case of SLES11)
we first mount TARGET_FS_ROOT/dev as a tmpfs and then we
copy all /dev contents from the recovery system into TARGET_FS_ROOT/dev
which makes the recovery system /dev contents available at TARGET_FS_ROOT/dev
only as long as the recovery system runs but on the rebooted target system
its original unmodified /dev contents will be there again.

This keeps what our old finalize/default/100_populate_dev.sh did
but now without dirty remainders on the user's target system disk.

If there are no objections I would like to merge it tomorrow.
Then ReaR 2.5. will again also work on SLES11.


[Export of Github issue for rear/rear.]