Cannot ssh into server after creating systemd link

Hi guys,

following the coincashew guide for mainnet, I use a vps that I ssh into. Node was happily running and all was fine.
I then came to Chapter 7 and created the cardano-node.service according to the example. (i.e. copy paste)
After copying it to /etc/systemd/system/cardano-node.service

I wanted to “test” it.

So I rebooted.

Now I cannot ssh into the server anymore.

Does anybody have an idea for me?
1- to get in again, without going to the vps site and reset the whole thing?
2 - how this could happen? And how to solve?

I have a dummy server at home for test purposes (not running my mainnet BPN - but just an alternative test node for trail) and I wrote a similar service file. After reboot, I had huge trouble getting in again, but as it is physically located next to me, I can have direct access. (in this case I replaced the ${user} by a real username and hardlinked the WorkingDirectory instead of leaving the $NODE_HOME from the example that made the vps close me out).

Thanks a lot.

Did u changed the default ssh port 22? Perhaps in an previous step?

I use a different port yes, but that never was a problem. The problem came with the systemd file - unless the systemd file requires port 22. In that case, that would be the answer.

Nope, systemd is something else… should not affect the ssh process

on your local node… now the ssh is working or not?

I think the new ssh configurtion applied after u rebooted the server and u missed something

only for the local server. For the vps nothing.

ssh -p #### user@x.x.x.x
ssh: connect to host x.x.x.x port ####: Connection refused

hmm can u try ssh user@x.x.x.x -p XXXX ?

Delete ur user from above comment

ok, for the local one, where I hardlinked these ${user} and workingdir, this works.

For the vps still no result:
Can it be that the ${user} or $NODE_HOME are at fault? OR:
Can it be that the vps does not allow this kind of script?

Ideally I’d likethe vps to be the relay and the home server to be the BPN.

nope, it looks like the connection is refused… now do u have any other way to connect on server? Via VNC perhaps?

Will try - I’ll be back with news, positive or negative.

Ok, the answer is:
IF the links ${USER} and $NODE_HOME do not link correctly to the right destinations, the systemd link will not be able to start well:

this does not work:
sudo systemctl reload-or-restart cardano-node

and if that does not work, the vps is caught in a neverending cycle and that’s it.

When this DOES work, the whole link works.

So, don’t reboot to early before checking.

In my case the $NODE_HOME referred to another directory as I had tried to set up a node several times before succeeding.

error message:
/etc/systemd/system/cardano-node.service:12: WorkingDirectory= path is not absolute: ${NODE_HOME}

And in this very case, I had to start all over again.

1 Like

Did you enable the firewall maybe and forgot to open the new SSH port?

no, that was all good and tested. IT started when I made the service file.

  • cardano-node.service - Cardano node service
    Loaded: loaded (/etc/systemd/system/cardano-node.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sun 2021-11-07 20:50:10 UTC; 2s ago
    Process: 1978701 ExecStart=/bin/bash -c /home/user/cardano-my-node/ (code=exited, status=1/FAILURE)
    Main PID: 1978701 (code=exited, status=1/FAILURE)

And there still is an error here

journalctl -e -f -u cardano-node

Hi Alex,

thanks - that helped! Because now I know for sure that this:

/usr/local/bin/cardano-node run +RTS -N -RTS --topology ${TOPOLOGY} --database-path ${DB_PATH} --socket-path ${SOCKET_PATH} --host-addr ${HOSTADDR} --port ${PORT} --config ${CONFIG}

needs to be:

/usr/local/bin/cardano-node run +RTS -N -RTS --topology ${TOPOLOGY} --database-path ${DB_PATH} --socket-path ${SOCKET_PATH} --host-addr ${HOSTADDR} --port ${PORT} --config ${CONFIG}

apparently the server “forgets” the set $-values when using the service file.

I could leave the $-values when I manually start with ./
but when I use
sudo systemctl start cardano-node

it cannot find the $-values.

Does that make sense?

Ha - this is because I made the file with nano instead of cat

is it normal that the node needs to start syncing all over again after reboot? Does it not have all the info in the /db folder?

It’s something normal… the processes were stoped during the reload. But will not start downloading all the db again

hmm, they did - and the cpu usage is much higher now with the service link => syncing is much slower.