Merge branch 'findroot-fixes' into 'main'

Fix findroot issues #340 and #342

See merge request systemrescue/systemrescue-sources!293
This commit is contained in:
Gerd v. Egidy 2023-09-25 20:34:15 +00:00
commit 592d5e0869
2 changed files with 19 additions and 6 deletions

View file

@ -4,6 +4,8 @@ SystemRescue ChangeLog
------------------------------------------------------------------------------
10.03 (YYYY-MM-DD):
------------------------------------------------------------------------------
* Fix findroot loop when the password to any encrypted device is unknown (#342)
* Fix using findroot when /sbin/init is an absolute symlink (#340)
* Added sleuthkit (Tools for raw file system inspection) (#349)
* Added timeshift (snapshot-based backup solution) (#350)

View file

@ -17,12 +17,15 @@ run_hook() {
if cryptsetup isLuks ${curdev} >/dev/null 2>&1
then
echo "A passphrase is required to access device ${curdev}:"
local cryptname="${curdev##*/}"
local cryptname="luks-${curdev##*/}"
local cryptargs=""
while ! eval cryptsetup open --type luks ${curdev} ${cryptname} ${cryptargs}
do
sleep 2;
done
if ! cryptsetup open --type luks ${curdev} ${cryptname} ${cryptargs}; then
if ! cryptsetup open --type luks ${curdev} ${cryptname} ${cryptargs}; then
# each cryptsetup call offers 3 tries to enter a valid password
# all 6 failed failed, so continue with the next device
continue
fi
fi
if [ ! -e "/dev/mapper/${cryptname}" ]
then
err "Password succeeded but ${cryptname} creation failed, aborting..."
@ -45,7 +48,15 @@ run_hook() {
echo "Checking for ${init} on device ${curdev} ..."
if mount -r ${curdev} ${newroot} 2>/dev/null
then
if test -x ${newroot}/${init}
# check if /sbin is a symlink and if it is absolute or relative
if test -L "${newroot}/sbin" && readlink "${newroot}/sbin" | grep -q "^/"
then
echo "Absolute /sbin symlink on device ${curdev}"
echo "This usrmerge layout is currently not supported by findroot."
umount ${newroot}
continue
fi
if test -x ${newroot}/${init} || test -L ${newroot}/${init}
then
echo "Found ${init} on device ${curdev}"
rootcount=$((rootcount + 1))