Running installed MAAS in debug logging/mode

Introduction

When running MAAS sometimes more detailed information is required to help identify an issue or understand how MAAS is operating. Debug logging is easy to turn on both for the regiond and the rackd services.

Sometimes even the debug logging is not enough and you need to place a breakpoint in the code and debug live with an installed MAAS. Running in debug mode is also easy for both the region and the rackd services.

Regiond - debug logging

To enable debug mode on the regiond edit /etc/maas/regiond.conf and append debug: true to the file. Then just restart the regiond service, sudo systemctl restart maas-regiond. Tailing the /var/log/maas/regiond.log will now show DEBUG level information that was previously not present.

Rackd - debug logging

To enable debug mode on the rackd its the very similar as the regiond. Edit /etc/maas/rackd.conf and append debug: true to the file. Then just restart the rackd service, sudo systemctl restart maas-rackd. Tailing the /var/log/maas/rackd.log will now show DEBUG level information that was previously not present.

Regiond - debug mode

Now to run the regiond process in debug mode directly, allowing the ability to set breakpoints in the code you need to stop the currently running regiond service: sudo systemctl stop maas-regiond. Then you can just run sudo -u maas -H regiond -d, which will spawn the regiond process in single process mode. Which means no other workers will be spawned and everything will be running in a single process. This allows the set breakpoints to occur on the connected tty.

Rackd - debug mode

Running rackd in debug mode is just the same as running regiond. Stop the rackd service: sudo systemctl stop maas-rackd, then spawn the process directly with debug mode enabled: sudo -u maas -H rackd -d.

Note: The sudo -u maas -H is important because it ensures that the processes runs as the maas users which is required for the process to work correctly.

3 Likes

With the conversion to snap packaging, the paths in this post should be modified:

/etc/maas/* is now located in /var/snap/maas/current/
/var/log/maas/* is now in /var/snap/maas/common/log/

I suspect that the sudo commands to run the daemons interactively probably need to be updated as well.

2 Likes