How do you check logs in Guix?

Is there something similar to journalctl in Guix?

1 Like

These isn’t a journalctl equivalent in Guix AFAIK. But system logs lives in /var/log which you can view with any text editor or any of the tools from coreutils. E.g. view the last entries of a log sudo tail /var/log/some.log where some.log is the log you want to view.

Which works quite well when I need to review the logs. Only thing I miss from journalctl is the journalctl -b 0 -p err to view any errors during boot. Now you need to grep for them in dmesg or /var/log/messages

User logs usually lives in ~/.local/var/log.

2 Likes

Ah, ok. Got it. How do you know which file is some.log? Are apps more or less good about naming their log file something sane? Or do you just grep everything in /var/log?

For example, I did a guix install obsidian and the install went fine. But when I try to launch the program from the desktop app launcher, nothing happens. I’m guessing it’s crashing on startup. But… uhh… where would I check the logs for that?

There should be a console output for error with the log file name. Normally, you should see something contains obsidian or install in the file name.

First thing I do is open it from a terminal and see, if it prints any errors.
Next would be a strace to find out if files are missing or not accessible and if it writes to any logs, you would see this in the output.

So I’ve discovered that:

  • obsidian in the terminal points to /gnu/store/...obsidian-1.8.7/bin/obsidian
  • The desktop entry uses /gnu/store/...obsidian-1.8.7/obsidian

If I run the desktop entry command, obsidian, I get this:

$ /gnu/store/h88gfrafb0qs5jfhmbsqf5p2k1ydkb2s-obsidian-1.8.7/obsidian
/gnu/store/h88gfrafb0qs5jfhmbsqf5p2k1ydkb2s-obsidian-1.8.7/obsidian: error while loading shared libraries: libffmpeg.so: cannot open shared object file: No such file or directory

If I run bin/obsidian it launches correctly. (So is there a bug in the desktop entry file?)

It would be nice to know where the launch failure gets logged. I tried running strace as was suggested. I discovered Obsidian keeps a log here.

$ strace obsidian |& grep -i log
openat(AT_FDCWD, "/home/me/.config/obsidian/obsidian.log", O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, 0666) = 35

But seeing as how the obsidian binary isn’t even starting, there are no useful logs at that location.

1 Like

This can only be logged by the component executing the command from the desktop entry - probably the launcher of your DE.