Btw, there is always an easy way without need to take care of cabal, ghc, building process is.
You can just download binaries that were compiled for you: https://hydra.iohk.io/build/6012561
Replace the old ones and you save yourself a couple of hours of work and stress.
Here is a short instruction on how to update 1.26.1 to 1.26.2 by compiling new binaries.
Do it step by step, no not just copy and paste the whole text because at some point sudo may ask for a password:
# BACKUP PREVIOUS REPO AND GET 1.26.2
cd $HOME/git
mv cardano-node cardano-node-1.26.1
git clone https://github.com/input-output-hk/cardano-node.git
cd cardano-node
git fetch --all --recurse-submodules --tags
git checkout tags/1.26.2
# CONFIGURE BUILD OPTIONS
cabal configure -O0 -w ghc-8.10.4
echo -e “package cardano-crypto-praos\n flags: -external-libsodium-vrf” > cabal.project.local
cabal build cardano-node cardano-cli
# STOP THE NODE
sudo systemctl stop cardano-node
# REPLACE BINARIES
sudo cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-cli") /usr/local/bin/cardano-cli
sudo cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-node") /usr/local/bin/cardano-node
# MAKE SURE THE VERSION IS 1.26.2
cardano-node version
cardano-cli version
# GET THE LATEST NODE_BUILD_NUM AND mainnet.config.json
cd $NODE_HOME
export NODE_BUILD_NUM=$(curl https://hydra.iohk.io/job/Cardano/iohk-nix/cardano-deployment/latest-finished/download/1/index.html | grep -e "build" | sed 's/.*build\/\([0-9]*\)\/download.*/\1/g')
sed -i $HOME/.bashrc \
-e "s/export NODE_BUILD_NUM=[0-9]\+/export NODE_BUILD_NUM=${NODE_BUILD_NUM}/g"
source $HOME/.bashrc
wget -N https://hydra.iohk.io/build/${NODE_BUILD_NUM}/download/1/${NODE_CONFIG}-config.json
sed -i ${NODE_CONFIG}-config.json \
-e "s/TraceBlockFetchDecisions\": false/TraceBlockFetchDecisions\": true/g"
# START THE NODE
sudo systemctl start cardano-node
Here is a new update from 1.26.2 to the latest 1.27.0 for Coincashew installs.
As always I recommend running separate code block/steps one by one as I separate them in comments. Copying and pasting is not a good idea because at some points your system will ask for the password at sudo command.
# BACKUP PREVIOUS REPO AND GET 1.27.0
cd $HOME/git
mv cardano-node cardano-node-1.26.2
git clone https://github.com/input-output-hk/cardano-node.git
cd cardano-node
git fetch --all --recurse-submodules --tags
git checkout tags/1.27.0
# CONFIGURE BUILD OPTIONS
cabal update
cabal configure -O0 -w ghc-8.10.4
echo -e "package cardano-crypto-praos\n flags: -external-libsodium-vrf" > cabal.project.local
cabal build cardano-node cardano-cli
# STOP THE NODE
sudo systemctl stop cardano-node
# REPLACE BINARIES
sudo cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-cli") /usr/local/bin/cardano-cli
sudo cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-node") /usr/local/bin/cardano-node
# MAKE SURE THE VERSION IS 1.27.0
cardano-node version
cardano-cli version
# GET THE LATEST NODE_BUILD_NUM AND mainnet.config.json
cd $NODE_HOME
export NODE_BUILD_NUM=$(curl https://hydra.iohk.io/job/Cardano/iohk-nix/cardano-deployment/latest-finished/download/1/index.html | grep -e "build" | sed 's/.*build\/\([0-9]*\)\/download.*/\1/g')
sed -i $HOME/.bashrc \
-e "s/export NODE_BUILD_NUM=[0-9]\+/export NODE_BUILD_NUM=${NODE_BUILD_NUM}/g"
source $HOME/.bashrc
wget -N https://hydra.iohk.io/build/${NODE_BUILD_NUM}/download/1/${NODE_CONFIG}-config.json
sed -i ${NODE_CONFIG}-config.json \
-e "s/TraceBlockFetchDecisions\": false/TraceBlockFetchDecisions\": true/g"
# START THE NODE
sudo systemctl start cardano-node
I have updated all my relays and BP with those commands. All running smooth.