Skip to content

Commit

Permalink
docs: Guide for validators to upgrade Ubuntu dist
Browse files Browse the repository at this point in the history
  • Loading branch information
filipdjokic committed Oct 24, 2024
1 parent 79e2786 commit 1066e95
Show file tree
Hide file tree
Showing 2 changed files with 224 additions and 0 deletions.
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* [Network-wide Software Upgrades](docs/upgrades/README.md)
* [Upgrade to v0.6.x](docs/upgrades/v0.6-upgrade.md)
* [Creating a software upgrade proposal](docs/upgrades/propose-software-upgrade.md)
* [Upgrade to v2.0.2](docs/upgrades/v2.0.2-upgrade.md)

## 🧑‍💻 Developing on cheqd

Expand Down
223 changes: 223 additions & 0 deletions docs/upgrades/v2.0.2-upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
# Guide for operators to upgrade to the latest Ubuntu LTS distribution

## Background

Ubuntu's [standard support for](https://ubuntu.com/about/release-cycle) [**Ubuntu 20.04 LTS**](https://ubuntu.com/about/release-cycle) [("Long Term Support") version ends in April 2025](https://ubuntu.com/about/release-cycle). Ubuntu 20.04 LTS is currently the default Linux operating system used to build and run the binaries for our cheqd-node. To ensure continued stability and security, we need to upgrade to the latest Long-Term Support (LTS) version, `Ubuntu 24.04`.

Additionally, to ensure compatibility with Ubuntu 24.04, you'll need to upgrade to `cheqd-noded v2.0.2`. This upgrade will address any existing security vulnerabilities and ensure that we are running on the most up-to-date software and distribution, providing a secure and reliable environment.

Please follow the guide to transition both the operating system and our node software smoothly.

## **Prerequisites**

* Backup critical data (e.g., keys, config files).
* Be prepared for the **expected downtime** of your node (approx 1 hour)
* Ensure all **dependencies** **and software running on your node** (except cheqd-node) support the latest Ubuntu LTS.

## **Step 1: Prepare the Current System**

1. Stop and disable the **cheqd-cosmovisor.service** :
`sudo systemctl stop cheqd-cosmovisor.service && sudo systemctl disable cheqd-cosmovisor.service`

2. Update sources list and upgrade existing packages:
`sudo apt update && sudo apt upgrade -y`

3. You'll probably need to restart your server after this step (you'll see the message if you run the do-release-upgrade command):
`sudo shutdown -r now`

## Step 2: Upgrade to the Ubuntu 22.04

1. Trigger **distribution** **upgrade**
`sudo do-release-upgrade`

2. During the process, you'll be prompted for a lot of answers, here are the most important ones:

```plain
Reading cache
Checking package manager
Continue running under SSH?
This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.
If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?
Continue [yN]
```

Feel free to **continue over ssh**, since this shouldn't cause any issues for most of the cloud providers.

```plain
No valid mirror found
While scanning your repository information no mirror entry for the
upgrade was found. This can happen if you run an internal mirror or
if the mirror information is out of date.
Do you want to rewrite your 'sources.list' file anyway? If you choose
'Yes' here it will update all 'jammy' to 'noble' entries.
If you select 'No' the upgrade will cancel.
Continue [yN]
```

This is required, so **continue**.

```plain
Do you want to start the upgrade?
1 installed package is no longer supported by Canonical. You can
still get support from the community.
50 packages are going to be removed. 135 new packages are going to be
installed. 587 packages are going to be upgraded.
You have to download a total of 1,030 M. This download will take
about 3 minutes with a 40Mbit connection and about 27 minutes with a
5Mbit connection.
Fetching and installing the upgrade can take several hours. Once the
download has finished, the process cannot be canceled.
Continue [yN] Details [d]
```

After you agree with this, the actual upgrade process will **start**.

There will be some configuration changes and you'll probably be asked if you want to install a new version of certain software (see the screenshots and examples below). In most cases, it is completely fine to overwrite configuration changes, but be cautious if you have some custom configurations, since these actions will overwrite them:

![screenshot](https://t6600954.p.clickup-attachments.com/t6600954/7a854836-24cb-42e0-81fa-ec4e6c8294c4/Screenshot%20from%202024-10-22%2014-14-41.png)

```plain
Configuration file '/etc/systemd/timesyncd.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** timesyncd.conf (Y/I/N/O/D/Z) [default=N] ?
Configuration file '/etc/sudoers'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** sudoers (Y/I/N/O/D/Z) [default=N] ?
```

After that, you'll be asked if you want to **remove obsolete packages**. It's always a good idea to check details (by pressing `d` ), especially if you have other software running on your node. In our case, we **agreed** to remove unused packages:

```css
Remove obsolete packages?


84 packages are going to be removed.

Continue [yN] Details [d]
```

Finally, you'll be asked to **restart your system** to apply the changes. Your server should automatically reboot, but it's good to check with your cloud provider documentation and make sure this action won't cause any data loss.

```plain
System upgrade is complete.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN]
```

It's probable that SSH fingerprint is going to change after the upgrade, so you won't be able to ssh to your server immediately. To resolve that, you'll need to run the following command on your localhost:

`ssh-keygen -R <host>`

1. Check the distribution version:

`sudo lsb_release -a`

After you ssh again, you can check your distribution version, which should match Ubuntu 22.04 LTS if the upgrade was performed successfully.

## Step 3: Upgrade to Ubuntu 24.04 LTS

1. Trigger another distribution **upgrade**:
`sudo do-release-upgrade`

2. The remaining steps should be the same as in Step 2, although you won't be asked the same questions as in the first upgrade.

3. Note that it's possible that you won't be able to proceed with this due to some package incompatibility:

```plain
Calculating the changes

Calculating the changes

Could not calculate the upgrade

An unresolvable problem occurred while calculating the upgrade.

The package 'postgresql-client-15' is marked for removal but it is in
the removal deny list.

If none of this applies, then please report this bug using the
command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal. If
you want to investigate this yourself the log files in
'/var/log/dist-upgrade' will contain details about the upgrade.
Specifically, look at 'main.log' and 'apt.log'.

Restoring original system state
```

On one of our nodes, it was the `postgres-client-15`.

We resolved this issue by removing this package and installing it again after a successful upgrade:

`sudo apt purge postgres-client-15`

1. After you complete the upgrade and restart your node again, you should ssh to your server again and check the distribution version. If everything was successful, you should get output like this:

```plain
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble
```

## Step 4: Upgrade cheqd-node to v2.0.2

1. Download the latest version of the interactive installer:
`wget https://raw.githubusercontent.com/cheqd/cheqd-node/main/installer/installer.py`

2. Run the installer:
`python3 installer.py`

3. Select the first option **UPGRADE existing installation** and proceed by choosing the **v2.0.2** version from the list.

4. For the remaining questions, answer based on your previous setup and complete the binary upgrade.

5. Check the version of your cheqd-node - `cheqd-noded version`

6. Re-enable **cheqd-cosmovisor**.**service** and **start** your node:
`sudo systemctl enable cheqd-cosmovisor.service && sudo systemctl start cheqd-cosmovisor.service`

## Step 5: Confirm your node caught up with the network

The final step would be to make sure that your node is up and running and that it managed to sync with the network.

Run `cheqd-noded status` and check for `"catching_up":false` and also check if the `latest_block_height` and `latest_block_time` looks good to you.

0 comments on commit 1066e95

Please sign in to comment.