From 90d19b9733ed798b704056b81ef715a727203aaa Mon Sep 17 00:00:00 2001 From: Joseph Marrero Corchado Date: Mon, 26 Aug 2024 22:43:35 -0400 Subject: [PATCH 1/2] docs: Add debug.md Add a initial doc on how to enabled verbose debugging to aid users trying to contribute or figure out issues. --- docs/debug.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/debug.md diff --git a/docs/debug.md b/docs/debug.md new file mode 100644 index 0000000000..39d28c20f5 --- /dev/null +++ b/docs/debug.md @@ -0,0 +1,60 @@ +--- +parent: Contributing +nav_order: 1 +--- + +# Debugging rpm-ostree +{: .no_toc } + +1. TOC +{:toc} + + +## Setting verbose debug messages when using the CLI. + +The rpm-ostree and ostree code uses gtk's glib for the as a C library. An advantage to using glib is that to enable verbose debug messages we just need to set an environment variable: +[G_MESSAGES_DEBUG=all](https://docs.gtk.org/glib/logging.html#debug-message-output). + +Additionally, part of rpm-ostree code is written in Rust to enable verbose logs on the Rust code the environment variable is: +[RUST_LOG=debug](https://docs.rs/env_logger/latest/env_logger/). + +An example of how to set use the environment variables is: + +``` +env G_MESSAGES_DEBUG=all RUST_LOG=debug rpm-ostree status +``` + +Since ostree is called from rpm-ostree it will output ostree debug messages too. + +## Enabling verbose debug messages when not using the CLI. + +If you need output from rpm-ostreed.service, another client such as Zincati or ostree-finalize-staged.service +you might need to override the environment variables for those services. + +A way to do this is using the `systemctl edit` command. + +For example: + +``` +systemctl edit rpm-ostreed +``` +or +``` +systemctl edit zincati.service +``` + +Then adding: +``` +[Service] +Environment="G_MESSAGES_DEBUG=all" +``` + +and restarting the service. + +After that a more verbose output should be seen in the journal: + +``` +journalctl -b -u rpm-ostreed +``` + +**Please Note** depending on what are you trying to debug you might need to override the environment for different services. From 3a79dfc76599d5d2c971a8012043a22b1932e960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Fri, 4 Oct 2024 17:18:17 +0200 Subject: [PATCH 2/2] Update docs/debug.md Co-authored-by: Dusty Mabe --- docs/debug.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/debug.md b/docs/debug.md index 39d28c20f5..2b5d42c0a3 100644 --- a/docs/debug.md +++ b/docs/debug.md @@ -31,7 +31,7 @@ Since ostree is called from rpm-ostree it will output ostree debug messages too. If you need output from rpm-ostreed.service, another client such as Zincati or ostree-finalize-staged.service you might need to override the environment variables for those services. -A way to do this is using the `systemctl edit` command. +A way to do this is using the `sudo systemctl edit` command. For example: