WORKING SOLUTION
================

After encountering this problem, I developed a very simple solution:


nano /usr/sbin/grub-probe-overlay

-----[BEGIN]--------------------------------------------------------------
#!/bin/sh

ARGS=

for ARG in $@; do
        if [ "${ARG%%[!/]*}" = "/" ]; then

                OPTIONS=

                if FSTYPE=$( findmnt -n -o FSTYPE "$ARG" ); then
                        if [ "$FSTYPE" = "overlay" ]; then
                                OPTIONS=$(findmnt -n -o OPTIONS "$ARG")
                        fi
                elif FSTYPE=$( findmnt -n -o FSTYPE / ); then
                        if [ "$FSTYPE" = "overlay" ]; then
                                OPTIONS=$(findmnt -n -o OPTIONS /)
                        fi
                fi

                if LOWERDIR=$(echo "$OPTIONS" | grep -m 1 -oP 
'lowerdir=\K[^,]+'); then
#                       echo "[DEBUG] Overlay filesystem detected \${ARG} --> 
\${LOWERDIR}\${ARG%*/}" 1>&2
                        ARG="${LOWERDIR}${ARG%*/}"
                fi
        fi
        ARGS="$ARGS $ARG"
done

grub-probe-default $ARGS

exit $?
-----[END]----------------------------------------------------------------


mv /usr/sbin/grub-probe /usr/sbin/grub-probe-default

ln -s /usr/sbin/grub-probe-overlay /usr/sbin/grub-probe


OPTIONAL STEP:
==============

apt-mark hold grub-pc

NOTE: package name can also be "grub-efi-amd64" or "grub-efi-ia32" or
something else, depending on what you use

PROS
====
- works perfectly with overlay filesystem
- shows a general solution (maybe someone can use it to fix the grub-probe 
source code)
- no patching of grub scripts required (some people tried patches as solution, 
but grub-probe is used in many grub scripts --> patching nightmare)

CONS
====
- grub-probe must be renamed (for this reason, I recommend that you set the 
status of your grub package to "hold")

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1247905

Title:
  update-grub fails in the face of overlayroot

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1247905/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to