Skip to content

Instantly share code, notes, and snippets.

@bse666
Last active March 15, 2025 00:27
Show Gist options
  • Save bse666/3ac975bad65d320d0d19f840241d1384 to your computer and use it in GitHub Desktop.
Save bse666/3ac975bad65d320d0d19f840241d1384 to your computer and use it in GitHub Desktop.
upgrade Ubuntu without interaction
# https://askubuntu.com/questions/250733/can-i-do-a-silent-or-unattended-release-upgrade
# The following command upgrades to the new stable release without prompts:
do-release-upgrade -f DistUpgradeViewNonInteractive
# The following command upgrades to the current development release without prompts:
do-release-upgrade -d -f DistUpgradeViewNonInteractive
# Really Unattended
## --force-confdef: ask dpkg to decide alone when it can and prompt otherwise.
## --force-confold: do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix.
# create file /etc/apt/apt.conf.d/local
Dpkg::Options { "--force-confdef"; "--force-confold"; }
@robozb
Copy link

robozb commented Feb 21, 2025

I'm sorry, but there are some prompts with the aboves

@bse666
Copy link
Author

bse666 commented Mar 2, 2025

Yes, i also ran into that recently.
The newer Ubuntu Versions have this "issue" with the default Config overwrites.
Older Versions could run this unattended.
But i found a solution.
You have to make it out for yourself if you want to test this.
I would make backups of etc. before Upgrade to test this out.

@davidcam-nwse
Copy link

davidcam-nwse commented Mar 12, 2025

This solution worked for me to upgrade Ubuntu 20.04 to 22.04, so thanks a log @bse666 !

# Really Unattended
## --force-confdef: ask dpkg to decide alone when it can and prompt otherwise. 
## --force-confold: do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix. 

# create file /etc/apt/apt.conf.d/local     <<< here's the key!
Dpkg::Options { "--force-confdef"; "--force-confold"; }

I've also read that the non-interactive frontend becoming interactive was considered a bug and was fixed on Ubuntu 21.10 packages according to this (pay attention to comment #5) issue in Canonical's Launchpad, so I'm guessing here that I don't expect this solution to be required anymore upgrading from Ubuntu 22 onwards, but haven't checked (not my case)

As mentioned, for my specific case Ubuntu 20 to 22 your solution worked and do-release-upgrade -f DistUpgradeViewNonInteractive worked as expected (non-interactively) after creating this file on the system with the exact line that you mentioned on your post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment