Generating Keys on Air gapped machine

Hi all,

I am following the coin cashew guide.

Everything is fine to this point. I am now at: GENERATING KEYS FOR THE BP NODE

When I run this command on my air gapped machine:

sudo cardano-cli node key-gen \
    --cold-verification-key-file node.vkey \
    --cold-signing-key-file $HOME/cold-keys/node.skey \
    --operational-certificate-issue-counter node.counter

I get the following error:

/usr/local/bin/cardano-cli: 29: cannot open �
�
�: No such file
/usr/local/bin/cardano-cli: 32: Syntax error: "(" unexpected

Has anyone seen this before? Any advice?

My node version:
cardano-node 1.35.0 - linux-aarch64 - ghc-8.10
git rev 9f1d7dc163ee66410d912e48509d6a2300cfa68a

You need to take ownership of the executable after you copy it to the cold machine. Use chown to allow you to use the cli

I did that by running:

sudo chmod +x /usr/local/bin/cardano-cli

Is there something else I need to do?

Is your cardano-cli also built for ARM?

Ah!

My BP Node architecture is aarch64 and my air gapped machine architecture is x86_64…

What do I need to do in this situation? Do I build an x86_64 version - say on my mac, and then copy that over to my air-gapped machine?

Can you post a screenshot of the full terminal output?

******@******: ~$ pushd $HOME/cold-keys
~/cold-keys ~
******@******:~/cold-keys$ sudo cardano-cli node key-gen \
    --cold-verification-key-file node.vkey \
    --cold-signing-key-file $HOME/cold-keys/node.skey \
    --operational-certificate-issue-counter node.counter
[sudo] password for ******:
/usr/local/bin/cardano-cli: 29: cannot open �
�
�: No such file
/usr/local/bin/cardano-cli: 32: Syntax error: "(" unexpected
******@******:~/cold-keys$

YES:

cardano-cli 1.35.0 - linux-aarch64 - ghc-8.10
git rev 9f1d7dc163ee66410d912e48509d6a2300cfa68a

What does

stat /usr/local/bin/cardano-cli

Return

Also, why are you running with sudo? Try it without.

Without sudo, I get this error:

bash: /usr/local/bin/cardano-cli: cannot execute binary file: Exec format error

I think the issue is the different architectures I’m using…

My BP Node is running on a cloud server using aarch64.
My air gapped maching is an old dell laptop using x86_64

So am I right in thinking that cardano-cli binary created on the BP won’t work on my air-gapped machine?

stat /usr/local/bin/cardano-cli on my air gapped maching returns:

File: /usr/local/bin/cardano-cli
  Size: 267922608 	Blocks: 523296     IO Block: 4096   regular file
Device: 803h/2051d	Inode: 7340033         Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-06-29 17:26:23.901512850 -0700
Modify: 2022-06-29 17:14:47.032800542 -0700
Change: 2022-06-29 17:14:47.032800542 -0700
 Birth: 2022-06-29 17:14:46.820799462 -0700

Yep, you need an aarch64 compiled binary.

If you want I have an aarch64 compiled binary from my Raspberry PI:

https://x230.weebl.me/public/cardano-cli

But safest is to always compile from source ;).

Edit: you probably also need the libs: https://x230.weebl.me/public/usrlocallib.tar.gz

I’m confused - isn’t the version of cardano-cli that I copy from my BP an arch64 compiled binary?

Oh yeah, then you need an x64 machine. You can find binaries here: Hydra - Build 16159682 of job Cardano:cardano-node-pr-4100:required

I don’t have nix…

But I have ax86_64 mac… Can I build an x86_64 version of cardano-cli on my mac, and then copy that over to my air-gapped machine? Will that work?

(If it will work, what dependencies will I need on the air gapped machine? It’s running Ubuntu 22.04 - fresh install)

They should work without nix. This is the full build:

https://hydra.iohk.io/build/16276599/download/1/cardano-node-1.35.0-linux.tar.gz

It contains cardano-cli inside the archive.

Thank-you - that version works :slight_smile:

1 Like