Logo
Color-Of-Code
  Home   All tags   Terms and Conditions

Ubuntu Remote Upgrade

January 22, 2023

Ubuntu Remote Release Upgrade

Introduction

Running a remote release upgrade can be dangerous, VPN, SSH can be updated or break during the upgrade process and leave a not bootable system as a result... This post shows how to mitigate the risks.

NOTE that this may also require to have alternative ports accessible (like port 1022) over the network, which might be blocked due to security policies applied at the network level.

Proxy settings

  • /etc/apt/apt.conf
Acquire::http::Proxy "http://<proxy_addr>:<proxy_port>/";
Acquire::https::Proxy "http://<proxy_addr>:<proxy_port>/";
  • snap
sudo snap set system proxy.http="http://<proxy_addr>:<proxy_port>"
sudo snap set system proxy.https="http://<proxy_addr>:<proxy_port>"

Preparation

Screen

Make sure screen is installed. This will enable to run the upgrade inside an encapsulated environment that can survive network disconnects.

sudo apt install screen

Upgrader tool

Make sure these packages are installed and up to date

sudo apt install update-manager-core
sudo apt install ubuntu-release-upgrader-core

Ensure the settings are correct:

sudo nano /etc/update-manager/release-upgrades
# set prompting behavior for for the release upgrader as lts.

Update system to latest state

sudo snap refresh
sudo apt update
sudo apt upgrade

Upgrade

sudo do-release-upgrade -d

The upgrade process also starts an alternative ssh server running at port 1022, beside automatically running within a screen session (if screen is installed)

Reconnect (if needed)

# list screen sessions
sudo screen -list
# reattach to a screen session:
sudo screen -d -r root/2953.ubuntu-release-upgrade-screen-window