From f563d9c8afab817a34d7ac329c24ff8df9c69a40 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 26 Sep 2019 23:28:16 +0200 Subject: [PATCH] v6.26 + DietPi-Software | Docker: Prevent install if kernel version got upgraded and old version overwritten or purged. In this case, where /lib/modules/$(uname -r) is missing, certain Docker service start tasks fail, which makes the APT call fail, leading to follow up errors during dietpi-software run. The user must first reboot to load the new kernel. This is mostly an issue on RPi, where kernel packages are not versioned, thus regular "apt-get upgrade" includes kernel upgrades and those overwrite/purge the old kernel module files. --- dietpi/dietpi-software | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index e7c8bcbfae..6e6d59750a 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -171,7 +171,7 @@ _EOF_ fi # If encryption has not yet been done, do it now! - elif GLOBAL_PW=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=' /DietPi/dietpi.txt | sed 's/^[^=]*=//'); then + elif GLOBAL_PW=$(sed -n '/^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt); then G_CONFIG_INJECT 'AUTO_SETUP_GLOBAL_PASSWORD=' 'AUTO_SETUP_GLOBAL_PASSWORD=Password has been encrypted and secured on rootFS' /DietPi/dietpi.txt openssl enc -e -a -md sha256 -aes-256-cbc $pbkdf2 -salt -pass pass:'DietPiRocks!' -out /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin <<< $GLOBAL_PW @@ -2199,6 +2199,16 @@ DietPi-Software will decrypt and use it for software installs. You can change it #------------------------------------------------------------------------- # Pre-req software, for items that do NOT have their own array aSOFTWARE_REQUIRES_SOFTWARENAME + # Prevent Docker install if kernel has just been upgraded and old one overwritten/purged: https://github.com/MichaIng/DietPi/issues/3126 + if [[ ${aSOFTWARE_INSTALL_STATE[162]} == 1 && ! -d /lib/modules/$(uname -r) ]]; then + + G_WHIP_MSG '[WARNING] Docker install will be deselected\n +It seems that your kernel version has just been upgraded. The mismatch between loaded and installed kernel versions would cause a failure during Docker install.\n +Please reselect Docker from dietpi-software after next reboot.' + aSOFTWARE_INSTALL_STATE[162]=0 + + fi + # Nextcloud extensions # - Nextcloud Talk software_id=114 @@ -5679,10 +5689,9 @@ If you want to update ${aSOFTWARE_NAME[$software_id]}, please use it's internal Banner_Installing + # Offical installer INSTALL_URL_ADDRESS='https://get.docker.com' G_CHECK_URL "$INSTALL_URL_ADDRESS" - - # Offical Docker installer wget "$INSTALL_URL_ADDRESS" -O DockerInstall.sh chmod +x DockerInstall.sh G_ERROR_HANDLER_COMMAND='./DockerInstall.sh' @@ -5691,6 +5700,7 @@ If you want to update ${aSOFTWARE_NAME[$software_id]}, please use it's internal do ./DockerInstall.sh + G_ERROR_HANDLER_EXITCODE=$? G_ERROR_HANDLER done