Can't run monerod manually from AppVM

Hey all,

I am currently facing an issue on Qubes-Whonix while trying to run monerod manually. I received an error message while attempting to run my local node from the Gui: “Error: Couldn’t connect to daemon: 127.0.0.1:18081”. I have encountered this problem before on a regular Linux distribution and was able to resolve it by running monerod manually.

However, the issue I am facing now is related to qubes because the monerod is located on the Whonix-Workstation template, not on the AppVM, which means I cannot access monerod manually from my AppVM.

Do any of you have any suggestions for how to resolve this issue? Thank you in advance for your assistance.

Best regards.

You can follow this guide:
CLI Wallet/Daemon Isolation with Qubes + Whonix | Monero - secure, private, untraceable

Is that guide explaining the same thing than here? How-to: Use Monero with Wallet Isolation in Qubes-Whonix ™

Yes, it should be about the same.
Did you configure everything according to your guide?
Can you describe in more details what are you trying to do and what is not working?
In which VM are you trying to run monerod manually (monerod-ws or monero-wallet-ws?) and what for? monerod should be running in monerod-ws automatically on start.

It works perfectly but there is only one issue. I have my blockchain installed on a USB key that I was planning to mount only when needed, but that actual method is downloading me a new blockchain. I doesn’t know if there is a way to locate the blockchain?

You can persistently attach your USB key with monero node to the monerod-ws so it’d be attached on VM start. Then you can configure your monerod in monerod-ws to use the node on USB key. You need to mount the USB key before you start monerod, for example, by modifying the monerod.service. You need to add ExecStartPre and change --data-dir option:

ExecStartPre=mkdir /mnt/monero_node
ExecStartPre=mount /dev/xvdi /mnt/monero_node
ExecStart=torsocks monerod --data-dir=/mnt/monero_node/path-to-your-node-directory-on-USB-key \
    --no-igd --hide-my-port --pidfile=/home/user/.bitmonero/monerod.pid \
    --log-file=/home/user/.bitmonero/bitmonero.log --p2p-bind-ip=127.0.0.1 \
    --non-interactive

Hey man, thank you for providing the code snippet. My USB drive is named ‘USB’ and I found that it is located at ‘/media/user/USB’. Can you confirm if my code is correct? Also, will my USB drive be mounted before running monerod if my sys-usb key is turned on?

ExecStartPre=mkdir /mnt/USB
ExecStartPre=mount /dev/xvdi /mnt/USB
ExecStart=torsocks monerod --data-dir=/mnt/monero_node/media/user/USB \
    --no-igd --hide-my-port --pidfile=/home/user/.bitmonero/monerod.pid \
    --log-file=/home/user/.bitmonero/bitmonero.log --p2p-bind-ip=127.0.0.1 \
    --non-interactive

First you have to configure your system so it’ll automatically connect your specific USB key by Vendor ID/Product ID persistently to monerod-ws VM. You can read on how to do it here:

Once you’ve done it you’ll have your USB key block device in monerod-ws VM available inside when you start it.
By default the first attached block device to VM will be /dev/xvdi (next ones will be /dev/xvdj, /dev/xvdk, …).
So you’ll need to mount this /dev/xvdi device in the monerod-ws on boot to use the monero node data files on it in monerod.

My USB drive is named ‘USB’ and I found that it is located at ‘/media/user/USB’.

This is not a path to the monero node files I’m talking about, this is a path that your system mounted your USB key to.
I’m talking about the path to directory that contains lmdb directory. For example, you have lmdb directory in this patch:
/media/user/USB/mymoneronode/lmdb
Then you need to change the paths in monerod.service to:

ExecStartPre=mkdir /mnt/USB
ExecStartPre=mount /dev/xvdi /mnt/USB
ExecStart=torsocks monerod --data-dir=/mnt/USB/mymoneronode \
    --no-igd --hide-my-port --pidfile=/home/user/.bitmonero/monerod.pid \
    --log-file=/home/user/.bitmonero/bitmonero.log --p2p-bind-ip=127.0.0.1 \
    --non-interactive
1 Like

If someone were to obtain physical access to the USB key, they could potentially access a part of my machine. Is there a way to disable the monerod auto-run on VM start and instead manually mount the USB and start monerod by myself? I would greatly prefer this method if it is possible. Thank you.

edit, I will see if I can disable the auto start of monerod by using that command : systemctl --user enable monerod

And manually start monerod with that one : systemctl --user restart monerod

and then remove :

ExecStartPre=mkdir /mnt/USB
ExecStartPre=mount /dev/xvdi /mnt/USB

from the part of code.

Of course you can do all of it manually.
You need to disable monerod.service in monerod-ws:
systemctl --user disable monerod
Then when you start monerod-ws you’ll have to manually attach your USB key to monerod-ws and run the monerod in monerod-ws.
You can run the monerod from systemd:
systemctl --user start monerod
Or manually with these commands:

mkdir /mnt/USB
mount /dev/xvdi /mnt/USB
DNS_PUBLIC=tcp; TORSOCKS_ALLOW_INBOUND=1; torsocks monerod --data-dir=/mnt/USB/mymoneronode \
    --no-igd --hide-my-port --pidfile=/home/user/.bitmonero/monerod.pid \
    --log-file=/home/user/.bitmonero/bitmonero.log --p2p-bind-ip=127.0.0.1 \
    --non-interactive

You can remove --non-interactive if you want use monerod interactively.

Thanks man I appreciate, is these lines still useful to make my USB key work if I do it manually?

ExecStartPre=mkdir /mnt/USB
ExecStartPre=mount /dev/xvdi /mnt/USB

If you’re going to run these commands manually before you start systemd service then you don’t need them.

Unfortunately i’m encountering an issue.The last line of the bitmonero.log file say :

ERROR daemon src/daemon/main.cpp:364 Exception in main! boost::filesystem::create_directories: Permission denied: "/mnt/USB"

Mount like this instead:
sudo mount -o umask=0022,uid=user,gid=user /dev/xvdi /mnt/USB

1 Like

So, sys-usb is still on. I tried to do the command in the terminal of monerod-ws, this is what i’m getting.

mount: /mnt/USB: mount point does not exist. I tried to do the command with & without the USB mounted on that qube but both give me the same error.

Are we certain that /mnt/USB is the right directory? I’m asking because the only directory I could see for the USB is /media/user/USB

Do you have /media/user/USB which contains your USB key files in monerod-ws when you attach your USB key to monerod-ws?
Maybe it was automounted by system, then you don’t need to mount it manually and you can just use /media/user/USB in monerod command options.

Do you have /media/user/USB which contains your USB key files in monerod-ws when you attach your USB key to monerod-ws?

Yes I do. I created a file in my USB key that I named mymoneronode, and then put all the files of my blockchain ( containing lmdb, etc… ) in that file.

I tried to do ExecStart=torsocks monerod --data-dir=/mnt/USB/mymoneronode \ but I got the permission denied error.

Then I did ExecStart=torsocks monerod --data-dir=/media/user/USB/mymoneronode \ and I got the exact same error, with or without the USB key mount.

Then, instead of attaching my USB key with sys-usb manually, I tried to do your command sudo mount -o umask=0022,uid=user,gid=user /dev/xvdi /mnt/USB in the terminal of monerod-ws, and I got the following error : mount: /mnt/USB: mount point does not exist, with or without the USB key already attached.

Looks like Monerod really doesn’t want to mess with my USB, can that be the format of the USB? I think at the moment it’s a FAT32, but it can be changed easily.

By the way, I didn’t tried your line containing DNS_PUBLIC=TCP, etc… to put in the monero.service file, but I just tried what I sent a few line over that one.

You need to create a directory /mnt/USB before you can mount your USB to it with this command:
sudo mkdir /mnt/USB
Then you can mount you USB key with:
sudo mount -o umask=0022,uid=user,gid=user /dev/xvdi /mnt/USB
But you don’t need to do it if your USB key is mounted automatically in /media/user/USB when you attach it to your VM.

Try to run monerod manually first. Attach your USB key to monerod-ws and check that it was mounted in /media/user/USB correctly and you can see the monero node data files in /media/user/USB/mymoneronode/lmdb:
ls /media/user/USB/mymoneronode/lmdb
Then try to run monerod:

monerod --data-dir=/media/user/USB/mymoneronode \
    --no-igd --hide-my-port --pidfile=/home/user/.bitmonero/monerod.pid \
    --log-file=/home/user/.bitmonero/bitmonero.log --p2p-bind-ip=127.0.0.1

There we go… I downloaded my blockchain on windows monero gui because I was unable to download it on Qubes due to the initial error ’ Couldn’t connect to daemon: 127.0.0.1:18081 ', and so when I tried to run monerod from the terminal I could see ’ Existing lmdb database is incompatible with this version. '.

By any chance do you have the command to reinstall it at a specific location? I will reset my USB key and download a new one from the monerod-ws.

You just need to point to the directory where you want your monero node to be downloaded in --data-dir option:

monerod --data-dir=/path/to/the/node \
    --no-igd --hide-my-port --pidfile=/home/user/.bitmonero/monerod.pid \
    --log-file=/home/user/.bitmonero/bitmonero.log --p2p-bind-ip=127.0.0.1