scVENUS / PeekabooAV-Installer

This repository provides scripts and configuration files to install, update and test a Peekaboo installation
GNU General Public License v3.0
7 stars 9 forks source link

apt-get dist-upgrade croaks when upgrading grub #54

Closed Jack28 closed 4 years ago

Jack28 commented 4 years ago

apt-get dist-upgrade run from the script croaks when upgrading grub because it spawns a dialog asking for the device to reinstall grub to. Maybe we should add an option to the installer to run apt-get commands fully silent.

   peekaboo: Preparing to unpack .../22-grub2-common_2.02-2ubuntu8.9_amd64.deb ...
    peekaboo: Package configuration┌──────────────────────────┤ Configuring grub-pc ├──────────────────────────┐│││ The GRUB boot loader was previously installed to a disk that is no││ longer present, or whose unique identifier has changed for some reason.   ││ It is important to make sure that the installed GRUB core image stays in  ││ sync with GRUB modules and grub.cfg. Please check again to make sure││ that GRUB is written to the appropriate boot devices.││││ If you're unsure which drive is designated as boot drive by your BIOS,    ││ it is often a good idea to install GRUB to all of them.││││ Note: it is possible to install GRUB to partition boot records as well,   ││ and some appropriate partitions are offered here. However, this forces    ││ GRUB to use the blocklist mechanism, which makes it less reliable, and    ││ therefore is not recommended.││││<Ok>│││└───────────────────────────────────────────────────────────────────────────┘
    peekaboo: Preparing to unpack .../25-libldap-common_2.4.45+dfsg-1ubuntu1.1_all.deb ...

Originally posted by @michaelweiser in https://github.com/scVENUS/PeekabooAV-Installer/pull/22

Jack28 commented 4 years ago

DEBIAN_FRONTEND=noninteractive could do the trick

Jack28 commented 4 years ago

I successfully tested with

diff --git a/PeekabooAV-install.sh b/PeekabooAV-install.sh
index badf195..e6b7ab8 100755
--- a/PeekabooAV-install.sh
+++ b/PeekabooAV-install.sh
@@ -206,7 +206,8 @@ if ! apt-add-repository multiverse ; then
 fi

 # Upgrade system
-if ! apt-get dist-upgrade -y ; then
+export DEBIAN_FRONTEND=noninteractive
+if ! apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade -y ; then
        echo "ERROR: the command 'apt-get dist-upgrade' failed. Please fix manually" >&2
        exit 1
 fi

@michaelweiser what do you think?

michaelweiser commented 4 years ago

Yep, done that in another project similarly, IIRC. ansible obviously does something similar as well. We could switch it off permanently system-wide somewhere in /etc/apt but we don't actually want to but only suppress it for our own installation and leave whatever the system admin configured intact for them. So sounds good to me.