How To Create A Monero Service in Linux : Part 2 – Troubleshooting

Introduction

Table of Contents

In Part 1 we turned our monero daemon into a service.

Here in Part 2 we will go over how to troubleshoot a service that is not starting.

Finally in Part 3 we’ll go deeper in security matters, such as using Monero with SELinux and firewalling your service.

Troubleshooting

Anticipating all of the potential problems would be an impossible task. Instead I will give you some basic ideas about how to troubleshoot your new Monero service.

Isolating the Problem

The first step is to determine whether it’s systemd, monerod or some other part of the system that is complaining and preventing start up.

Eliminating SELinux

First let’s confirm it’s NOT an SELinux problem. This common enough that it may be worth doing first since there’s a quick workaround that will enable us to go in with checking our service is working.

Is SELinux currently enforcing?

> getenforce
Enforcing

If you see anything other than Enforcing then SELinux is not the problem and we can move on. If you do see Enforcing we need to look at the journal to see exactly why it’s causing the service startup to fail. But we’ll do that in Part 3 – Security. For now, let’s just turn SELinux to Permissive mode:

> setenforce 0
> getenforce
Permissive

Warning

Turn off SELinux at your own risk! Doing so won’t harm the functionality on your system, but it may make your system vulnerable to attacks while it is turned off. If your system is behind a home router or firewall, it’s probably not a big risk. Be more careful with internet-facing systems.

Now restart the service and see if we’ve fixed the problem, or uncovered a new one.

systemctl restart monerod
systemctl status monerod

Eliminating Systemd

The problem with the status command is it only displays the the last 10 or so logs and problem may appear a bit further back in the logs. So let’s switch to our monitoring terminal and turn to journalctl:

journalctl -t systemd -e

I can’t predict what you’re going to see, but if it’s not immediately obvious where the problem lies, try checking these gotchas:

  • File permissions (particularly data-dir)
  • Typos (mine or yours!)
  • A corrupted blockchain when using a pre-existing one
  • Connectivity to network problem (no internet connection or traffic being blocked somewhere)

Eliminating Monero

Like for systemd, there’s a whole range of reasons that monerod could fail to start. But hopefully the journals are informative.

journalctl -t monerod -e

A common gotcha might be passing invalid options to monerod via the configuration file we created. The Monero Project often changes these, so check that one or more of these hasn’t changed in the current version against the help:

/opt/crypto/monero/monerod --help

If you need more detail you can also up the log-level to 1 or even 2 in the monerod.conf and restart.

> vi /etc/monerod.conf
log-level=1
> systemctl restart monerod

Summary

Hopefully that’s some useful general advice for troubleshooting your service and it’s now starting to sync.

In Part 3 we’ll tackle some more details about security matters.

Leave a Comment

Your email address will not be published. Required fields are marked *