7. Updating a node

📡
1. How to perform an update

From time to time, there will be new versions of Tezos. Follow Tezos Foundation on twitter and the Official Tezos Gitlab to ensure you don't miss any important releases.
Tip: When picking some downtime for maintenance like updating your node, choose a time where your baker has a longer break until next baking or next endorsing.
To update with ~/tezos as the current binaries directory, copy the whole Tezos directory to a new place so that you have a backup and can also leave the current processes running.
1
cd
2
git clone https://gitlab.com/tezos/tezos tezos2
Copied!
Tezos Version 8.0 aka Edo requires the installation of the Rust framework and zcash params. Install with the following.
1
wget https://sh.rustup.rs/rustup-init.sh
2
chmod +x rustup-init.sh
3
./rustup-init.sh --profile minimal --default-toolchain 1.44.0 -y
4
5
source $HOME/.cargo/env
6
7
wget https://raw.githubusercontent.com/zcash/zcash/master/zcutil/fetch-params.sh
8
chmod +x fetch-params.sh
9
./fetch-params.sh
Copied!
Change to the new directory and rebuild the latest binaries. Run the following command to pull and build the latest Tezos binaries.
1
cd ~/tezos2
2
git checkout latest-release
3
make build-deps && eval $(opam env) && make
Copied!
Stop your node by Ctrl-C. If you stop your node first, then baker, accuser and endorser will automatically stop. Or, if you're using auto-start scripts with systemd, use the command sudo systemctl stop tezos-node.service
The following commands will quickly switch-over to your newly built Tezos binaries while keeping the old directory for backup.
1
cd
2
mv tezos/ tezos-old/
3
mv tezos2/ tezos/
Copied!
Now restart your node, baker, endorser, and accuser processes.

🧷
2. Handling updates with new protocols

Tezos performs regular on-chain governance by election. These elections progress through four stages and can conclude with a protocol upgrade which results in a new set of binaries. This is what makes Tezos self-amending.
When a new protocol is successfully promoted and scheduled to occur at a later date, you run both the current protocol and future protocol binaries.
For example, you would expect to run 7 binaries
./tezos-node
./tezos-endorser-006
./tezos-baker-006
./tezos-accuser-006
./tezos-endorser-007
./tezos-baker-007
./tezos-accuser-007
After the future protocol"007"activates on a later date, you can stop the previous binaries. In this example, you would stop all the006 binaries.

3. Update auto-start and monitoring systemctl configs

First, stop all tezos services and ensure the services are truly stopped.
1
sudo systemctl stop tezos-node.service
2
sudo systemctl status 'tezos-*.service'
Copied!
You need to update the binaries names for the ExecStart variable. The path must reflect the new binaries.
The files to update are:
  • /etc/systemd/system/tezos-node.service
  • /etc/systemd/system/tezos-endorser.service
  • /etc/systemd/system/tezos-baker.service
  • /etc/systemd/system/tezos-accuser.service
1
#Example, change "tezos-endorser-006-PsCARTHA"
2
ExecStart = /home/replaceUsername/tezos-endorser-006-PsCARTHA run ledger_mybaker
Copied!
Typically you only need to update 3 filenames: the endorser, baker, and accuser filename.
Now reload the new config with the following command:
1
systemctl --user daemon-reload
Copied!
And restart services,
1
sudo systemctl reload-or-restart tezos-node.service
Copied!
Verify the node, baker, endorser, accuser processes are all running.
1
sudo systemctl status 'tezos-*.service'
Copied!

🤯
4. In case of problems

🛣
4.1 Forked off

Forget to update your node and now your node is stuck on an old chain?
Run this command to resume validating blocks.
1
./tezos-admin-client unmark all invalid blocks
Copied!

📂
4.2 Roll back to previous version from backup

Following the above guide, you can simply restore the old Tezos directory.
Then try the update procedure again.
1
mv tezos/ tezos-rolled-back/
2
mv tezos-old/ tezos/
Copied!

🤖
4.3 Last resort: Rebuild from source code

Follow the steps in section 2. Getting and building Tezos from source