-
-
Save yongqli/6d43ff1cac81737a936df73190fc1a20 to your computer and use it in GitHub Desktop.
Revisions
-
yongqli revised this gist
Jun 7, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,7 +76,7 @@ for alias in $($BB_BIN --list-long); do fi done for alias in "bin/usleep"; do alias="${alias#/}" # Remove (and then re-add) all the hardlinks added by busybox-initramfs echo -n " ${alias##*/}" -
yongqli revised this gist
Jun 7, 2018 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,6 +76,14 @@ for alias in $($BB_BIN --list-long); do fi done for alias in "ulong"; do alias="${alias#/}" # Remove (and then re-add) all the hardlinks added by busybox-initramfs echo -n " ${alias##*/}" rm -f "$DESTDIR/$alias" ln "$DESTDIR/bin/busybox" "$DESTDIR/$alias" done # To get a trailing new line echo -
Hamy revised this gist
May 7, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,8 +12,8 @@ # This file should be placed in /etc/initramfs-tools/hooks/ and have +x flag set # after that you need to rebuild the initramfs with 'update-initramfs -u' # Users reported the solution working on at least: # Ubuntu 17.04, 17.10, 18.04 # Also note that this does not replace busybox-initramfs package. # The package must be present, this hook just fixes what's broken. -
Hamy revised this gist
Sep 1, 2017 . 1 changed file with 15 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,31 +1,24 @@ #!/bin/sh # This hook is for fixing busybox-initramfs issue while unlocking a luks # encrypted rootfs. The problem is that the included busybox version # is stripped down to the point that it breaks cryptroot-unlock script: # https://bugs.launchpad.net/ubuntu/+source/busybox/+bug/1651818 # This is a non-aggressive fix based on the original busybox-initramfs hook # until the bug is fixed. # busybox or busybox-static package must be present for this to work # This file should be placed in /etc/initramfs-tools/hooks/ and have +x flag set # after that you need to rebuild the initramfs with 'update-initramfs -u' # This is only tested in Ubuntu Server 17.04 . May or may not work in other # Ubuntu/Debian releases. # Also note that this does not replace busybox-initramfs package. # The package must be present, this hook just fixes what's broken. # Hamy - www.hamy.io set -e @@ -46,8 +39,8 @@ BB_BIN_ORG=$DESTDIR/bin/busybox [ -x $BB_BIN_ORG ] || exit 0 # The one we want to replace it with [ -x /bin/busybox ] || exit 0 BB_BIN=/bin/busybox # Ensure the original busybox lacks extended options # and the soon-to-be-replaced-by one does not @@ -64,6 +57,8 @@ BB_BIN_ORG_IND=$(stat --format=%i $BB_BIN_ORG) rm -f $BB_BIN_ORG copy_exec $BB_BIN /bin/busybox echo -n "Fixing busybox-initramfs for:" for alias in $($BB_BIN --list-long); do alias="${alias#/}" case "$alias" in @@ -74,11 +69,13 @@ for alias in $($BB_BIN --list-long); do esac # Remove (and then re-add) all the hardlinks added by busybox-initramfs if [ -e "$DESTDIR/$alias" ] && [ $(stat --format=%i "$DESTDIR/$alias") -eq $BB_BIN_ORG_IND ]; then echo -n " ${alias##*/}" rm -f "$DESTDIR/$alias" ln "$DESTDIR/bin/busybox" "$DESTDIR/$alias" fi done # To get a trailing new line echo -
Hamy revised this gist
Jun 11, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,8 +46,8 @@ BB_BIN_ORG=$DESTDIR/bin/busybox [ -x $BB_BIN_ORG ] || exit 0 # The one we want to replace it with BB_BIN=/bin/busybox [ -x $BB_BIN ] || exit 0 # Ensure the original busybox lacks extended options # and the soon-to-be-replaced-by one does not -
Hamy revised this gist
Jun 10, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Empty file. -
HRomie created this gist
Jun 10, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,84 @@ #!/bin/sh # This hook is for fixing busybox-initramfs issue while unlocking a luks # encrypted root. The problem is that the included busybox version # is stripped down to the point that it breaks cryptroot-unlock script: # https://bugs.launchpad.net/ubuntu/+source/busybox/+bug/1651818 # This is a non-aggressive fix based on the original busybox-initramfs hook # until the said bug is fixed. # busybox or busybox-static package must be present for this to work # This file should be placed in /etc/initramfs-tools/hooks/ , have +x flag set # and should only be writable by root. # Then rebuild the initramfs with 'update-initramfs -u' # This is only tested in Ubuntu Server 17.04 . May or may not work with other # Ubuntu/Debian releases. # Also note that this does not replace busybox-initramfs package. # The package must be present. This hook just fixes what's broken. # The workaround can be reverted by simply deleting the file # and rebuilding initramfs # More info: # https://hamy.io/blog/remote-unlocking-of-luks-encrypted-root-in-ubuntu-debian/ # Hamy - https://hamy.io set -e case "${1:-}" in prereqs) echo ""; exit 0;; esac [ n = "$BUSYBOX" ] && exit 0 [ -r /usr/share/initramfs-tools/hook-functions ] || exit 0 . /usr/share/initramfs-tools/hook-functions # Testing the presence of busybox-initramfs hook [ -x /usr/share/initramfs-tools/hooks/zz-busybox-initramfs ] || exit 0 # The original busybox binary added by busybox-initramfs BB_BIN_ORG=$DESTDIR/bin/busybox [ -x $BB_BIN_ORG ] || exit 0 # The one we want to replace it with [ -x /bin/busybox ] || exit 0 BB_BIN=/bin/busybox # Ensure the original busybox lacks extended options # and the soon-to-be-replaced-by one does not if $BB_BIN_ORG ps -eo pid,args >/dev/null 2>&1; then exit 0 elif ! $BB_BIN ps -eo pid,args >/dev/null 2>&1; then exit 0 fi # Get the inode number of busybox-initramfs binary BB_BIN_ORG_IND=$(stat --format=%i $BB_BIN_ORG) # Replace the binary rm -f $BB_BIN_ORG copy_exec $BB_BIN /bin/busybox for alias in $($BB_BIN --list-long); do alias="${alias#/}" case "$alias" in # strip leading /usr, we don't use it usr/*) alias="${alias#usr/}" ;; */*) ;; *) alias="bin/$alias" ;; # make it into /bin esac # Remove (and then re-add) all the hardlinks added by busybox-initramfs name="${alias##*/}" if [ -e "$DESTDIR/$alias" ] && [ $(stat --format=%i "$DESTDIR/$alias") -eq $BB_BIN_ORG_IND ]; then [ "${verbose}" = "y" ] && echo "Fixing busybox-initramfs for $alias" || true rm -f "$DESTDIR/$alias" ln "$DESTDIR/bin/busybox" "$DESTDIR/$alias" fi done