From abaf2a9e5b934161ee65c3f2d43ce83f90cd3883 Mon Sep 17 00:00:00 2001 From: Pete Batard <pete@akeo.ie> Date: Wed, 5 Aug 2020 00:12:40 +0100 Subject: [PATCH] Remount /cdrom read-write if it also happens to be used as /boot/efi --- fstab.d/efi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) mode change 100755 => 100644 fstab.d/efi diff --git a/fstab.d/efi b/fstab.d/efi old mode 100755 new mode 100644 index 14b6696..8fe688c --- a/fstab.d/efi +++ b/fstab.d/efi @@ -12,6 +12,15 @@ case $ARCH in ;; esac +# Resolve the device that is mounted as /cdrom +cdrom_device= +while IFS=" " read -r f1 f2 f3 f4 f5 f6 +do + if [ $f2 == "/cdrom" ]; then + cdrom_device=$f1 + fi +done < /proc/mounts + seen_efi= for dev in $DEVICES/*; do [ -d $dev ] || continue @@ -23,6 +32,13 @@ for dev in $DEVICES/*; do [ -f "$id/method" ] || continue method=$(cat $id/method) [ "$method" = efi ] || continue + # If the device we are mounting as /boot/efi also happens to + # be the /cdrom device, we must remount it read-write, else + # the mounting of /boot/efi fails. + if [ "$path" == "$cdrom_device" ]; then + log "Remounting /cdrom read-write for use as ESP" + mount -o remount,rw "$path" /cdrom + fi echo "$path" /boot/efi vfat umask=0077 0 1 seen_efi=1 done -- GitLab