Ubuntu OS Upgrade Guide (20.04 to 22.04 to 24.04)
1. Prerequisites
Python version: 3.12.X
Rdaf CLI version: 1.4.0
RDAF Infra Tags: 1.0.3
RDAF Platform/Worker/App tags: 8.0.0
Important
Internet should be available on all nodes.
2. Preparation Steps
-
Always take VM-level snapshots in vCenter for all the VMs.
-
Always choose default options when prompted during upgrade.
-
Each VM upgrade is approximately 1.5 hours.
3. Upgrade Order
-
APP/Platform VMs
-
Worker VMs
-
Infra VMs
-
Registry VM
-
Gateway VMs
4. Upgrade Process
4.1 Upgrade Ubuntu 20.04 to 22.04
Step 1. Take a backup of sysctl.conf & sudoers file.
rdauser@aiaperf-worker-10853:~$ cp /etc/sysctl.conf /home/rdauser/
rdauser@aiaperf-worker-10853:~$ sudo cp /etc/sudoers /home/rdauser
Step 2. Verify UBUNTU Version
- To verify current ubuntu version use the following command.
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
Step 3. System Upgrade
To Update the package lists and upgrade all packages to their latest available versions please use the below given command.
Step 4. Update Docker Configuration
- Before making any changes, back up the current Docker configuration file
Note
Once the daemon.json file has been modified or updated, there is no need to repeat the process.
- Edit the Docker configuration file using a text editor using this command.
- Replace the content with the following configuration given below.
{
"tls": true,
"tlscacert": "/etc/tlscerts/ca/ca.pem",
"fixed-cidr-v6": "fdc6:ef49:83db::/64",
"ip6tables": true,
"exec-opts": [
"native.cgroupdriver=cgroupfs"
],
"tlsverify": true,
"default-cgroupns-mode": "host",
"storage-driver": "overlay2",
"hosts": [
"unix:///var/run/docker.sock",
"tcp://0.0.0.0:2376"
],
"tlskey": "/etc/tlscerts/server/server.key",
"ipv6": true,
"debug": false,
"tlscert": "/etc/tlscerts/server/server.pem",
"userland-proxy": false,
"experimental": true,
"live-restore": true
}
Step 5. Edit Docker Service Configuration
- Edit the Docker service file to apply necessary custom configurations, then follow with the command.
- Comment out the existing ExecStart line.
- Add the following new ExecStart line.
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
Step 6. Reload & Restart Docker Service
Reload the systemd manager configuration and restart the Docker service.
Note
When stopping services on the infrastructure VM, ensure you first stop the MariaDB services using docker stop -t 120 <container_ID>, followed by stopping all other services.
Step 7. Stop All Docker Containers
- Run the following command to stop all running containers on this VM.
Each line represents a container ID that has been successfully stopped.
- Restart the system using the below given command
Step 8. Start Docker Containers After Reboot
- Once the VM is back online, start all previously stopped containers using the command.
- Each line represents a container that has been successfully started.
4.2 Ubuntu Upgrade
Important
This applies exclusively to the REGISTRY VM.
- Before upgrading the OS on the Registrry VM, Ensure the Python symlink is correctly set by running the following commands.
Note
This step is mandatory to avoid Python-related issues during the OS upgrade.
Step 1. Perform Distribution Upgrade
Step 2. Update Docker Config
- Open and edit the Docker service configuration file using the vi editor.
- Comment out the following line in the file.
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
Step 3 Reload and Restart Docker Service
- To apply configuration changes and restart the Docker service, run the following command.
Note
When shutting down services on the infrastructure VM, first stop the MariaDB service using the command given below, and then proceed to stop all other services.
- To stop all running and stopped Docker containers on this VM, execute
- First, restart the VM using the following command
- Once the VM has restarted, start all Docker containers using the following command
- To verify current ubuntu version use the following command
4.3 Upgrade Ubuntu 22.04 to 24.04
Step 1. Use the below command to Update your system packages.
Step 2. Perform Distribution Upgrade- To upgrade ubuntu from 22.04 to 24.04 please use the command given below.
Step 3. Update Docker Config
- To update Docker configuration, edit the service file.
- Comment out the following line in the file
- Add the following new ExecStart line.
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
Step 4 Reload and Restart Docker Service
- To reload and restart the Docker service use the following command.
Step 5. Stop All Docker Containers
- To stop all running containers on this VM use the following command.
- To restart the VM use the following command
Step 6. Start Docker Containers After Reboot
- After the VM boots up, start all containers.
- To verify current ubuntu version use the following command.
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble
5. Post-Upgrade Steps on Registry VM Only
- Remove the deadsnakes PPA
- Clean and update package lists
- Remove existing Python3 using the command given below.
- Install specific Python 3.12 standard library.
- Use the following command to install required tools.
- Configure pip to break system packages
- Install the specific rdafcli package
6. Post-Upgrade Validation
- Run the following commands to verify the system
7. UI Validation
Log in to the UI and verify the following.
-
Alerts
-
Incidents
-
Dashboards
-
PStreams
8. Troubleshooting
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
- Run the following command to create a symbolic link and resolve the Issue.