|
| 1 | +--- |
| 2 | +title: Downgrading to Older Versions |
| 3 | +hide_title: true |
| 4 | +description: How to downgrade your Mina node from versions above 3.3.0 to 3.3.0 or below by converting on-disk state, avoiding a full rebootstrap. |
| 5 | +keywords: |
| 6 | + - mina downgrade |
| 7 | + - mina storage converter |
| 8 | + - node operators |
| 9 | + - version rollback |
| 10 | + - mina-rocksdb-scanner |
| 11 | + - rebootstrap |
| 12 | + - on-disk state |
| 13 | +--- |
| 14 | + |
| 15 | +# Downgrading to Older Versions |
| 16 | + |
| 17 | +If you are running a Mina node on a version above 3.3.0 and need to roll back to 3.3.0 or below, you can convert the on-disk state in place using `mina-storage-converter`. This avoids a full rebootstrap from a remote S3 ledger bucket, which can save significant time. |
| 18 | + |
| 19 | +## Debian/Ubuntu |
| 20 | + |
| 21 | +### 1. Stop the Mina daemon |
| 22 | + |
| 23 | +Ensure your Mina node is fully shut down before proceeding: |
| 24 | + |
| 25 | +```sh |
| 26 | +mina client stop daemon |
| 27 | +``` |
| 28 | + |
| 29 | +Or however you normally stop your node process. Verify it is no longer running before continuing. |
| 30 | + |
| 31 | +### 2. Install storage toolbox packages |
| 32 | + |
| 33 | +Install the required toolbox packages that provide `mina-storage-converter` and the RocksDB scanners: |
| 34 | + |
| 35 | +```sh |
| 36 | +sudo apt-get install -y mina-daemon-storage-toolbox mina-daemon-recovery-storage-toolbox |
| 37 | +``` |
| 38 | + |
| 39 | +### 3. Convert on-disk state |
| 40 | + |
| 41 | +Run `mina-storage-converter` to convert the local database to the format expected by the older version. |
| 42 | + |
| 43 | +```sh |
| 44 | +mina-storage-converter \ |
| 45 | + --node-dir ${NODE_DIR} \ |
| 46 | + --current-scanner /usr/lib/mina/storage/*/${SOURCE_VERSION}/mina-rocksdb-scanner \ |
| 47 | + --stable-scanner /usr/lib/mina/storage/*/${TARGET_VERSION}/mina-rocksdb-scanner |
| 48 | +``` |
| 49 | + |
| 50 | +Where: |
| 51 | + |
| 52 | +- `NODE_DIR` is the path to your node's config directory. This is usually `~/.mina-config` if you haven't set it explicitly. |
| 53 | +- `SOURCE_VERSION` is the version you are downgrading from. |
| 54 | +- `TARGET_VERSION` is the version you are downgrading to (e.g. `3.3.0`). |
| 55 | + |
| 56 | +The `*` wildcard lets bash resolve the RocksDB version directory automatically, so you don't need to know which RocksDB version is bundled with each Mina release. |
| 57 | + |
| 58 | +The tool will prompt for confirmation before making changes. |
| 59 | + |
| 60 | +### 4. Install the target version |
| 61 | + |
| 62 | +Install the older Mina package. For example, to install 3.3.0: |
| 63 | + |
| 64 | +```sh |
| 65 | +sudo apt-get install --allow-downgrades -y mina-mainnet=3.3.0 |
| 66 | +``` |
| 67 | + |
| 68 | +### 5. Start the Mina daemon |
| 69 | + |
| 70 | +Start your node as usual: |
| 71 | + |
| 72 | +```sh |
| 73 | +mina daemon ${YOUR_EXTRA_DAEMON_ARGS_HERE} |
| 74 | +``` |
| 75 | + |
| 76 | +Your node should resume from the converted local state without needing to rebootstrap. |
| 77 | + |
| 78 | +## Docker |
| 79 | + |
| 80 | +On-disk state conversion is only possible if your `mina-config` directory is persisted as a volume outside the container (e.g. via `--mount "type=bind,source=$(pwd)/.mina-config,dst=/root/.mina-config"`). |
| 81 | + |
| 82 | +:::caution |
| 83 | + |
| 84 | +If your `mina-config` is not persisted outside of the container, there is no way to convert the on-disk state. You will need to rebootstrap from scratch after switching to the older image. |
| 85 | + |
| 86 | +::: |
| 87 | + |
| 88 | +Since the Docker image is a Debian/Ubuntu environment with the Mina Debian package installed, you can run the same conversion steps inside the container. The default `NODE_DIR` inside the container is `/root/.mina-config`. |
| 89 | + |
| 90 | +### 1. Stop the running container |
| 91 | + |
| 92 | +Assume your mina daemon container is running with name `mina-node` |
| 93 | + |
| 94 | +```sh |
| 95 | +docker stop mina-node |
| 96 | +``` |
| 97 | + |
| 98 | +### 2. Install toolbox packages and run the converter |
| 99 | + |
| 100 | +Use the current (newer) image to install the toolbox packages and run the conversion against your mounted `mina-config` volume: |
| 101 | + |
| 102 | +```sh |
| 103 | +docker run -it --rm \ |
| 104 | + --entrypoint bash \ |
| 105 | + --mount "type=bind,source=$(pwd)/.mina-config,dst=/root/.mina-config" \ |
| 106 | + minaprotocol/mina-daemon:${SOURCE_VERSION}-bullseye-mainnet \ |
| 107 | + -c "apt-get update && apt-get install -y mina-daemon-storage-toolbox mina-daemon-recovery-storage-toolbox && mina-storage-converter --node-dir /root/.mina-config --current-scanner /usr/lib/mina/storage/*/${SOURCE_VERSION}/mina-rocksdb-scanner --stable-scanner /usr/lib/mina/storage/*/${TARGET_VERSION}/mina-rocksdb-scanner" |
| 108 | +``` |
| 109 | + |
| 110 | +### 3. Start a new container with the target version |
| 111 | + |
| 112 | +Remove the old container and start with the target image: |
| 113 | + |
| 114 | +```sh |
| 115 | +docker rm mina-node |
| 116 | + |
| 117 | +docker run --name mina-node -d \ |
| 118 | + -p 8302:8302 \ |
| 119 | + --restart=always \ |
| 120 | + --mount "type=bind,source=$(pwd)/.mina-config,dst=/root/.mina-config" \ |
| 121 | + minaprotocol/mina-daemon:${TARGET_VERSION}-bullseye-mainnet \ |
| 122 | + daemon ${YOUR_EXTRA_DAEMON_ARGS_HERE} |
| 123 | +``` |
| 124 | + |
| 125 | +Your node should resume from the converted local state without needing to rebootstrap. |
0 commit comments