0

Origanally I have posted this question on stackoverflow, due to the fact it is the wrong forum. I'm asking the question again here with some extra information I have gathered.

I'm looking into creating a script in bash for automating my update-u^grade process for all my virtual machiens as a homelabber.

I'm a developer but currently not have that good knowledge of bash:

My current script is pretty simple:

#!/bin/sh

apt update -y
apt upgrade -y
apt autoremove -y

After some answers on the stackoverflow and some research on this forum I missed the DEBIAN_FRONTEND=noninteractive part So i tested with this command: sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y but still witouth good results.

The problem i'm facing is that all my virtual machines have the sh config file edited with a /etc/issue.net included since this is a standard security practice founded on every information I could gather. Due to the fact that this file has been edited, while upgradeing the ssh-server package it asks what I want to do? Default it will take the local edited version but it requires the user to PRESS ENTER When trying the command above I still had to PRESS ENTER, however after the upgrade was done I discovered in the terminal NEEDRESTART DEBIAN_FRONTEND=noninteractive service.

So first: Is it possible after env variable change it need a restart to take affect? Due to the fact that the ssh package does not always have an upgrade available is there something I can do to test this?

And/or as last question Does the env variable not change the effect for the user input? I haven't tested my script on cron tab to see if it's is working or not due to the fact again that there is not always an upgrade available.

terminal

muru
  • 193,181
  • 53
  • 473
  • 722
  • 1
    Specifically see [this answer](https://askubuntu.com/a/832648/1066942) on how to configure `unattended-upgrade` for different scenarios. – Artur Meinild Aug 16 '23 at 11:05
  • 1
    Does this answer your question? [How can I automate a "conffile" prompt in unattended upgrades?](https://askubuntu.com/questions/921162/how-can-i-automate-a-conffile-prompt-in-unattended-upgrades) – muru Aug 16 '23 at 11:40
  • And also: [What happens with changed config files when unattended-upgrades runs?](https://askubuntu.com/q/1237366/158442) – muru Aug 16 '23 at 11:41

0 Answers0