How to upgrade Ubuntu 18 LTS in stackscript.

I have a stackscript to update Ubuntu, create some users with keys, setup mysql, nginx etc. The problem is, apt-get upgrade -y fails because it asks for keyboard (twice), then asks what to do with existing GRUB file (need to keep current one), then it asks which disk the boot loader was installed on (always shows /dev/sda, /dev/sdb, then /dev/sda again (which is strange). First one seems to work. Does anyone have a script to do this non-interactively in a stack script?

Any ideas for automating this? The other option is to do the upgrade manually after the install, but this tends to break our nginx and mysql installations.

1 Reply

hello @skyfall
Try this:

sudo DEBIAN_FRONTEND=noninteractive
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

OR

just put sudo DEBIAN_FRONTEND=noninteractive before your apt-get upgrade -y line

this would use the default answer for any questions a package might ask.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct