-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mkfs: avoid blockdev failing to re-read partition table #275
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -302,12 +302,12 @@ | |
fi | ||
done | ||
|
||
[ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a >/dev/null 2>&1 || true | ||
Check warning on line 305 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
|
||
# ugly, but make sure we really don't leave anything (/proc /proc and | ||
# /dev /dev are intended, trying to work around timing issues, see #657023) | ||
for ARG in /run/udev /sys /proc /proc /dev/pts /dev/pts /dev /dev ; do | ||
[ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true | ||
Check warning on line 310 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
umount "$MNTPOINT"/$ARG >/dev/null 2>&1 || true | ||
done | ||
|
||
|
@@ -821,7 +821,7 @@ | |
prompt_for_release() | ||
{ | ||
[ -n "$RELEASE" ] && DEFAULT_RELEASE="$RELEASE" || DEFAULT_RELEASE='bullseye' | ||
RELEASE="$(dialog --stdout --title "${PN}" --default-item $DEFAULT_RELEASE --menu \ | ||
Check warning on line 824 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
"Please enter the Debian release you would like to use for installation:" \ | ||
0 50 8 \ | ||
buster Debian/10 \ | ||
|
@@ -873,7 +873,7 @@ | |
{ | ||
[ -n "$ISO" ] && DEFAULT_MIRROR='local' || DEFAULT_MIRROR='net' | ||
|
||
CHOOSE_MIRROR=$(dialog --stdout --title "$PN" --default-item $DEFAULT_MIRROR \ | ||
Check warning on line 876 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
--menu "Where do you want to install from?" 0 0 0 \ | ||
net "install via network (downloading from mirror)" \ | ||
local "install from local directory/mirror" | ||
|
@@ -883,13 +883,13 @@ | |
[ -n "$MIRROR" ] || MIRROR='http://deb.debian.org/debian' | ||
MIRROR="$(dialog --stdout --title "${PN}" --inputbox \ | ||
"Please enter Debian mirror you would like to use for installing packages." \ | ||
0 0 $MIRROR)" || bailout | ||
Check warning on line 886 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
|
||
else # CHOOSE_MIRROR == local | ||
[ -n "$ISO" ] || ISO='/mnt/mirror' | ||
ISO="$(dialog --stdout --title "${PN}" --inputbox \ | ||
"Please enter directory name you would like to use for installing packages." \ | ||
0 0 $ISO)" || bailout | ||
Check warning on line 892 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
fi | ||
} | ||
# }}} | ||
|
@@ -1372,10 +1372,28 @@ | |
# if we deploy to /dev/sdX# then let's see if /dev/sdX exists | ||
local main_device="${TARGET%%[0-9]*}" | ||
# sanity check to not try to e.g. access /dev/loop if we get /dev/loop0 | ||
if [ -f "/sys/block/$(basename "${main_device}")/$(basename "${TARGET}")/dev" ] ; then | ||
blockdev --rereadpt "$main_device" | ||
else | ||
if ! [ -f "/sys/block/$(basename "${main_device}")/$(basename "${TARGET}")/dev" ] ; then | ||
einfo "No underlying block device for $TARGET identified, skipping blockdev --rereadpt." | ||
else | ||
udevadm settle | ||
# ensure we give blockdev up to 30 seconds/retries | ||
local timeout=30 | ||
local success=0 | ||
while [ "$timeout" -gt 0 ] ; do | ||
((timeout--)) | ||
if blockdev --rereadpt "${main_device}" ; then | ||
success=1 | ||
break | ||
else | ||
ewarn "Failed to reread partition table of ${main_device} [${timeout} retries left]" | ||
sleep 1 | ||
fi | ||
done | ||
|
||
if [ "${success}" = "0" ] ; then | ||
eerror "Error: failed to reread partition table, giving up." | ||
bailout 1 | ||
fi | ||
fi | ||
fi | ||
# give the system 2 seconds, otherwise we might run into | ||
|
@@ -1816,12 +1834,12 @@ | |
[ -n "$TUNE2FS" ] && echo "TUNE2FS='${TUNE2FS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" | ||
[ -n "$VMSIZE" ] && echo "VMSIZE='${VMSIZE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" | ||
|
||
cp $VERBOSE "${CONFFILES}"/chroot-script "${MNTPOINT}"/bin/chroot-script | ||
Check warning on line 1837 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
chmod 755 "${MNTPOINT}"/bin/chroot-script | ||
[ -d "$MNTPOINT"/etc/debootstrap/ ] || mkdir "$MNTPOINT"/etc/debootstrap/ | ||
|
||
# make sure we have our files for later use via chroot-script | ||
cp $VERBOSE "${CONFFILES}/config" "${MNTPOINT}"/etc/debootstrap/ | ||
Check warning on line 1842 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
# make sure we adjust the configuration variables accordingly: | ||
sed -i "s#RELEASE=.*#RELEASE=\"$RELEASE\"#" "${MNTPOINT}"/etc/debootstrap/config | ||
sed -i "s#TARGET=.*#TARGET=\"$TARGET\"#" "${MNTPOINT}"/etc/debootstrap/config | ||
|
@@ -1840,14 +1858,14 @@ | |
PACKAGES_FILE="packages-arm64" | ||
fi | ||
|
||
cp $VERBOSE "${_opt_packages:-$CONFFILES/$PACKAGES_FILE}" \ | ||
Check warning on line 1861 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
"${MNTPOINT}/etc/debootstrap/${PACKAGES_FILE}" | ||
fi | ||
|
||
# debconf preseeding: | ||
_opt_debconf=${_opt_debconf:-$CONFFILES/debconf-selections} | ||
[ -f "${_opt_debconf}" ] && [ "$DEBCONF" = 'yes' ] && \ | ||
cp $VERBOSE "${_opt_debconf}" "${MNTPOINT}"/etc/debootstrap/debconf-selections | ||
Check warning on line 1868 in grml-debootstrap GitHub Actions / shellcheck grml-debootstrap
|
||
|
||
# copy scripts that should be executed inside the chroot: | ||
_opt_chroot_scripts=${_opt_chroot_scripts:-$CONFFILES/chroot-scripts/} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, JFTR: I also tested removing the
sleep 2
line below your change and it worked for me.