Unable to view logs for systemd-user service
Aman-1412 opened this issue · 8 comments
What?
The user service is not showing any logs.
Followed these steps to create and start the user unit service :
./fishnet-x86_64-unknown-linux-gnu systemd-user | tee ~/.config/systemd/user/fishnet.service
systemctl enable --user fishnet.service
systemctl start --user fishnet.service
I confirmed with systemctl status --user fishnet.service
that the service is active and running.
However, Live view of log doesn't work for me:
journalctl --follow --user-unit fishnet
It shows:
Hint: You are currently not seeing messages from the system.
Users in the 'systemd-journal' group can see all messages. Pass -q to
turn off this notice.
No journal files were opened due to insufficient permissions.
Running the journalctl with sudo, it runs successfully but shows no logs.
I had to run this to view my logs,
sudo journalctl --follow _SYSTEMD_USER_UNIT=fishnet.service
Source: https://unix.stackexchange.com/a/486566
Maybe this command should be added to the 'Example Usage' instead? It could just be an issue on my end, though.
Creating a new issue since I did not see anyone else reporting this.
My system:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Please let me know if I can provide any more information.
Ah, maybe that should be
journalctl --follow --user --unit fishnet
Can you confirm?
on Ubunut 18.04 this works:
journalctl -f -u fishnet.service
with or without sudo
@jim-perkins That's for a system unit.
Ah, maybe that should be
journalctl --follow --user --unit fishnet
Can you confirm?
Running it without sudo gives me the same error as I mentioned previously:
Hint: You are currently not seeing messages from the system.
Users in the 'systemd-journal' group can see all messages. Pass -q to
turn off this notice.
No journal files were opened due to insufficient permissions.
Running,
sudo journalctl --follow --user --unit fishnet
returns,
No journal files were found.
So, no that did not work :(
Mhh ... are you running it from the same user that runs fishnet?
According to https://serverfault.com/a/814913/266410 there has been a change that might explain why it works for me but not for you. How about even more user
?
journalctl --follow --user --user-unit fishnet
Yes, it is the same user.
Found a fix!
Since I was not able to run journalctl without sudo, I added my user to the systemd-journal group.
Source: https://unix.stackexchange.com/a/235117
And now i'm able to see the logs using,
journalctl --follow --user-unit fishnet
Also, the following doesn't work for me though,
journalctl --follow --user --unit fishnet
Anyway, this fixed my issue and it can be closed! It was completely an issue on my end.
Thanks for the help!
Thanks for reporting and testing.