go-algorand
go-algorand copied to clipboard
Node Install - Err: Prompt to replace - update.sh
Problem
Installer prompts user to confirm overwrite ('replace') of '/home/user/node/update.sh' file.
User is unsure whether the file should be overwritten.
Example - Error Message - Prompt to replace
Expanding update...
Validating update...
Starting the new update script to complete the installation...
+ exec /tmp/tmp.Rd3nV65EcG/a/bin/update.sh -i -r -c stable -d /media/storage/algod/data -n -p /home/user/node
... Resuming installation from the latest update script
Current Version = 0
Backing up current binary files...
Backing up current data files from /media/storage/algod/data...
Installing new binary files...
mv: replace '/home/user/node/update.sh', overriding mode 0544 (r-xr--r--)? <--- Prompt (Error)
^----- Error
Function - Installing new binary files
function install_new_binaries() {
if [ ! -d ${UPDATESRCDIR}/bin ]; then
return 0
else
echo Installing new binary files...
ROLLBACKBIN=1
rm -rf ${BINDIR}/new
mkdir ${BINDIR}/new
cp ${UPDATESRCDIR}/bin/* ${BINDIR}/new
mv ${BINDIR}/new/* ${BINDIR}
rm -rf ${BINDIR}/new
fi
}
Problem Detail
When extracting the new version of the binaries, the 'update.sh' file must be overwritten.
The user is unsure if the file should be overwritten.
The user must manually reply 'y' ('yes') to overwrite the file.
Change the 'mv' command to 'mv -f' to prevent the prompt from appearing.
Steps to reproduce
- User executes 'update.sh' to start installation ('/update.sh -i -c stable -p ~/node -d ~/node/data -n')
- Update script obtains latest binaries
- Update script stages binaries
- **Update script prompts to approve overwrite of '/home/user/node/update.sh'
Example - Error Message - Trace
+ echo 'Backing up current data files from /media/storage/algod/data...'
Backing up current data files from /media/storage/algod/data...
+ mkdir -p /media/storage/algod/data/backup
+ BACKUPFILES='genesis.json wallet-genesis.id'
+ tar --no-recursion '--exclude=*.log' '--exclude=*.log.archive' '--exclude=*.tar.gz' -zcf /media/storage/algod/data/backup/data-v0.tar.gz -C /media/storage/algod/data genesis.json wallet-genesis.id
+ ROLLBACK=1
+ install_new_binaries
+ '[' '!' -d /tmp/tmp.MJvUMQ75e4/a/bin/../bin ']'
+ echo Installing new binary files...
Installing new binary files...
+ ROLLBACKBIN=1
+ rm -rf /home/user/node/new
+ mkdir /home/user/node/new
+ cp /tmp/tmp.MJvUMQ75e4/a/bin/../bin/COPYING /tmp/tmp.MJvUMQ75e4/a/bin/../bin/algocfg /tmp/tmp.MJvUMQ75e4/a/bin/../bin/algod /tmp/tmp.MJvUMQ75e4/a/bin/../bin/algoh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/algokey /tmp/tmp.MJvUMQ75e4/a/bin/../bin/[email protected] /tmp/tmp.MJvUMQ75e4/a/bin/../bin/carpenter /tmp/tmp.MJvUMQ75e4/a/bin/../bin/catchupsrv /tmp/tmp.MJvUMQ75e4/a/bin/../bin/ddconfig.sh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/diagcfg /tmp/tmp.MJvUMQ75e4/a/bin/../bin/find-nodes.sh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/goal /tmp/tmp.MJvUMQ75e4/a/bin/../bin/kmd /tmp/tmp.MJvUMQ75e4/a/bin/../bin/msgpacktool /tmp/tmp.MJvUMQ75e4/a/bin/../bin/node_exporter /tmp/tmp.MJvUMQ75e4/a/bin/../bin/sudoers.template /tmp/tmp.MJvUMQ75e4/a/bin/../bin/systemd-setup.sh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/tealcut /tmp/tmp.MJvUMQ75e4/a/bin/../bin/tealdbg /tmp/tmp.MJvUMQ75e4/a/bin/../bin/update.sh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/updater /home/user/node/new
+ mv /home/user/node/new/COPYING /home/user/node/new/algocfg /home/user/node/new/algod /home/user/node/new/algoh /home/user/node/new/algokey /home/user/node/new/[email protected] /home/user/node/new/carpenter /home/user/node/new/catchupsrv /home/user/node/new/ddconfig.sh /home/user/node/new/diagcfg /home/user/node/new/find-nodes.sh /home/user/node/new/goal /home/user/node/new/kmd /home/user/node/new/msgpacktool /home/user/node/new/node_exporter /home/user/node/new/sudoers.template /home/user/node/new/systemd-setup.sh /home/user/node/new/tealcut /home/user/node/new/tealdbg /home/user/node/new/update.sh /home/user/node/new/updater /home/user/node
mv: replace '/home/user/node/update.sh', overriding mode 0544 (r-xr--r--)?
Solution
Change the 'mv' command to 'mv -f' to force overwrite.
Command Reference
binPath=/tmp/tmp.eZmRFAtNnj/a/bin/
grep -n "mv.*new.*BINDIR" ${binPath}/update.sh
sed -i 's/mv ${BINDIR}\/new\/\* ${BINDIR}/mv -f ${BINDIR}\/new\/* ${BINDIR}/g' ${binPath}/update.sh
grep -n "mv.*new.*BINDIR" ${binPath}/update.sh
Execution
[~/node]: binPath=/tmp/tmp.eZmRFAtNnj/a/bin/
[~/node]: grep -n "mv.*new.*BINDIR" ${binPath}/update.sh
539: mv ${BINDIR}/new/* ${BINDIR}
[~/node]: sed -i 's/mv ${BINDIR}\/new\/\* ${BINDIR}/mv -f ${BINDIR}\/new\/* ${BINDIR}/g' ${binPath}/update.sh
[~/node]: grep -n "mv.*new.*BINDIR" ${binPath}/update.sh
539: mv -f ${BINDIR}/new/* ${BINDIR}
Example - Fixed
Current Version = 0
updater binary was installed at /media/storage/algod/updater
Latest Version = 12885426177
New version found
Checking for files matching: 'channel/stable/node_stable_linux-arm64_' in bucket algorand-releases
Update Downloaded to /tmp/tmp.eZmRFAtNnj/12885426177.tar.gz
Expanding update...
Validating update...
Starting the new update script to complete the installation...
... Resuming installation from the latest update script
Current Version = 0
Backing up current binary files...
Backing up current data files from /media/storage/algod/data...
Installing new binary files...
+ ROLLBACKBIN=1
+ rm -rf /home/user/node/new
+ mkdir /home/user/node/new
+ cp /tmp/tmp.MJvUMQ75e4/a/bin/../bin/COPYING /tmp/tmp.MJvUMQ75e4/a/bin/../bin/algocfg /tmp/tmp.MJvUMQ75e4/a/bin/../bin/algod /tmp/tmp.MJvUMQ75e4/a/bin/../bin/algoh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/algokey /tmp/tmp.MJvUMQ75e4/a/bin/../bin/[email protected] /tmp/tmp.MJvUMQ75e4/a/bin/../bin/carpenter /tmp/tmp.MJvUMQ75e4/a/bin/../bin/catchupsrv /tmp/tmp.MJvUMQ75e4/a/bin/../bin/ddconfig.sh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/diagcfg /tmp/tmp.MJvUMQ75e4/a/bin/../bin/find-nodes.sh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/goal /tmp/tmp.MJvUMQ75e4/a/bin/../bin/kmd /tmp/tmp.MJvUMQ75e4/a/bin/../bin/msgpacktool /tmp/tmp.MJvUMQ75e4/a/bin/../bin/node_exporter /tmp/tmp.MJvUMQ75e4/a/bin/../bin/sudoers.template /tmp/tmp.MJvUMQ75e4/a/bin/../bin/systemd-setup.sh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/tealcut /tmp/tmp.MJvUMQ75e4/a/bin/../bin/tealdbg /tmp/tmp.MJvUMQ75e4/a/bin/../bin/update.sh /tmp/tmp.MJvUMQ75e4/a/bin/../bin/updater /home/user/node/new
+ mv -f /home/user/node/new/COPYING /home/user/node/new/algocfg /home/user/node/new/algod /home/user/node/new/algoh /home/user/node/new/algokey /home/user/node/new/[email protected] /home/user/node/new/carpenter /home/user/node/new/catchupsrv /home/user/node/new/ddconfig.sh /home/user/node/new/diagcfg /home/user/node/new/find-nodes.sh /home/user/node/new/goal /home/user/node/new/kmd /home/user/node/new/msgpacktool /home/user/node/new/node_exporter /home/user/node/new/sudoers.template /home/user/node/new/systemd-setup.sh /home/user/node/new/tealcut /home/user/node/new/tealdbg /home/user/node/new/update.sh /home/user/node/new/updater /home/user/node
Installing new data files into /media/storage/algod/data...
Copying genesis files locally
Checking for new ledger in /media/storage/algod/data
Cannot read genesis file /media/storage/algod/data/genesis.json: open /media/storage/algod/data/genesis.json: no such file or directory
Updating genesis files for default network
New genesis ID, resetting wallets
New Ledger - restoring genesis accounts in /media/storage/algod/data
New Ledger - importing rootkeys for genesis accounts
Imported 0 keys
Applying migration fixups...
Deleting existing log files in /media/storage/algod/data
Install complete - restart node manually
Summary
Test Plan
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Codecov Report
Merging #4367 (4c6dc97) into master (d7ed271) will decrease coverage by
0.02%
. The diff coverage isn/a
.
@@ Coverage Diff @@
## master #4367 +/- ##
==========================================
- Coverage 55.28% 55.26% -0.03%
==========================================
Files 395 395
Lines 50352 50352
==========================================
- Hits 27838 27826 -12
- Misses 20119 20136 +17
+ Partials 2395 2390 -5
Impacted Files | Coverage Δ | |
---|---|---|
network/wsPeer.go | 65.47% <0.00%> (-2.47%) |
:arrow_down: |
node/node.go | 23.01% <0.00%> (-2.39%) |
:arrow_down: |
catchup/peerSelector.go | 98.95% <0.00%> (-1.05%) |
:arrow_down: |
data/transactions/verify/txn.go | 44.00% <0.00%> (-0.89%) |
:arrow_down: |
network/wsNetwork.go | 64.89% <0.00%> (-0.29%) |
:arrow_down: |
cmd/tealdbg/debugger.go | 73.49% <0.00%> (+0.80%) |
:arrow_up: |
data/abi/abi_type.go | 88.62% <0.00%> (+0.94%) |
:arrow_up: |
util/db/dbutil.go | 50.30% <0.00%> (+1.21%) |
:arrow_up: |
catchup/service.go | 70.12% <0.00%> (+1.23%) |
:arrow_up: |
ledger/tracker.go | 77.77% <0.00%> (+1.28%) |
:arrow_up: |
... and 1 more |
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
Hello Team,
This error is preventing us from performing unattended/automated installation of the Algorand Node software.
Please review and merge the change as soon as possible.
Thank you!
Hmm, is there a umask in place here that creates files read only? Can you tell us more information about the environment set up (is this alpine?)
Edit: deleted comment since it seemed the permissions were already set for 544.
does this still occur when update.sh
is 0744
instead of 0544
?
algobarb and algolucky tested it and found 744 seems to work fine. We decided to change the documentation instead of using force flag. So here's the docs change: https://github.com/algorand/docs/pull/896
Thanks for reporting this! We appreciate feedback like this, please keep it coming! 👍
We decided to opt for updating permissions from 544 to 744 on our docs instead. See this PR: https://github.com/algorand/docs/pull/896
Please reopen if there are issues after updating the permissions.
Hello Team,
I'll provide feedback once the new version is pushed to the 'releases' bucket:
http://algorand-dev-deb-repo.s3-website-us-east-1.amazonaws.com/releases/
Thanks for processing this request!
Recently I encountered another issue caused by permissions within the 'tgz' archive.
In the most recent build this was corrected.
I will continue to monitor for any further issues.
Kind regards,
- Bobby Hamilton
From: algobarb @.> Sent: Thursday, August 25, 2022 1:26 PM To: algorand/go-algorand @.> Cc: Algod Network @.>; Author @.> Subject: Re: [algorand/go-algorand] Node Install - Err: Prompt to replace - update.sh (PR #4367)
@algobarb approved this pull request.
I think this looks ok.
— Reply to this email directly, view it on GitHubhttps://github.com/algorand/go-algorand/pull/4367#pullrequestreview-1085914790, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHIIXQ4L7PCJ4POMXN6BP4TV263HHANCNFSM55ZPYRKA. You are receiving this because you authored the thread.Message ID: @.***>