Merge pull request #1633 from antmicro/fix-hostcheck

Fix hostcheck
This commit is contained in:
litghost 2021-03-25 17:58:05 -07:00 committed by GitHub
commit ff1509bc89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 78 additions and 15 deletions

View File

@ -11,21 +11,84 @@ set -e
echo
echo "========================================"
echo "Check storage"
echo "Waiting for storage"
echo "----------------------------------------"
set -x +e
mount | grep /tmpfs
MOUNT_RET=$?
set +x -e
if [[ $MOUNT_RET != 0 ]] ; then
echo "----------------------------------------"
echo "Error: No storage is mounted on /tmpfs."
echo "----------------------------------------"
STORAGE_CHECK_ATTEMPTS=1
while true; do
# Check that tmpfs has been mounted correctly.
set -x +e
mount | grep /tmpfs
MOUNT_RET=$?
set +x -e
if [[ $MOUNT_RET == 0 ]] ; then
break;
else
echo "----------------------------------------"
echo "Error: No storage is mounted on /tmpfs."
echo "----------------------------------------"
echo ""
fi
echo "========================================"
echo "Dmesg dump"
echo "----------------------------------------"
dmesg
# Dump debugging information.
echo "========================================"
echo "Mount output"
echo "----------------------------------------"
mount
exit $MOUNT_RET
fi
echo "========================================"
echo "Dmesg dump"
echo "----------------------------------------"
dmesg
echo "========================================"
echo "Partition information"
echo "----------------------------------------"
echo ""
echo "partprobe"
echo "----------------------------------------"
partprobe -s
echo ""
echo "cat /proc/partitions"
echo "----------------------------------------"
cat /proc/partitions
echo ""
echo "cat /etc/fstab"
echo "----------------------------------------"
cat /etc/fstab
echo ""
echo "cat /etc/mtab"
echo "----------------------------------------"
cat /etc/mtab
echo ""
echo "lsblk"
echo "----------------------------------------"
lsblk --list --output 'NAME,KNAME,FSTYPE,MOUNTPOINT,LABEL,UUID,PARTTYPE,PARTLABEL,PARTUUID'
echo ""
echo "sfdisk"
echo "----------------------------------------"
sudo sfdisk --list
echo ""
echo "systemctl | grep mount"
echo "----------------------------------------"
systemctl | grep mount
echo ""
echo "systemctl | grep dev"
echo "----------------------------------------"
systemctl | grep dev
# Fail if we have waited to long.
if [[ $STORAGE_CHECK_ATTEMPTS -gt 10 ]]; then
echo "=============================="
echo " ERROR: Storage check timeout"
echo "=============================="
exit $MOUNT_RET
else
STORAGE_CHECK_ATTEMPTS=$(( $STORAGE_CHECK_ATTEMPTS + 1 ))
fi
# Wait for a bit before rechecking.
SLEEP_FOR=$(( STORAGE_CHECK_ATTEMPTS * 10 ))
echo ""
echo "Sleeping for $SLEEP_FOR seconds before trying again..."
sleep $SLEEP_FOR
done