Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to learn basic systemd usage and I've run into a confusing issue with user service units.

When running ordinary services with systemctl start some.service I can find the full log for this service (including what it has printed to stdout / stderr, as I understand it) by running sudo journalctl --unit some.service.

Consider the example servicefile chatty.service:

[Service]
ExecStart=/usr/bin/echo "test from chatty.service"

When I place this service file in ~/.config/systemd/user/chatty.service and run it with systemctl --user start chatty.service I cannot find its output sent to stdout in journalctl, neither with plain journalctl nor with journalctl --user. I only get the following output in both:

Jan 15 19:16:52 qbd-x230-suse.site systemd[1168]: Starting chatty.service...
Jan 15 19:16:52 qbd-x230-suse.site systemd[1168]: Started chatty.service.

And journalctl --unit chatty.service does not return anything at all (with or without --user makes no difference).

While if I move the same service file to /etc/systemd/system and run it with sudo systemd start chatty.service I then get the following output when I run sudo journalctl --unit chatty.service:

Jan 15 19:28:08 qbd-x230-suse.site systemd[1]: Starting chatty.service...
Jan 15 19:28:08 qbd-x230-suse.site systemd[1]: Started chatty.service.
Jan 15 19:28:08 qbd-x230-suse.site echo[27098]: test from chatty.service

It seems like the user service unit isn't as well integrated somehow, is this expected, am I missing something or is it a bug?

I am running openSUSE 13.1 x86-64, with systemd 208 (default install).

share|improve this question
    
Same systemd 208 here on Arch Linux. You can use journalctl --user --user-unit chatty to get those start/stop messages from systemd, but not what the echo process outputs, at least in my case. You can get the echoed message with journalctl --user or use some other filter. –  lilydjwg Jan 22 at 17:11

1 Answer 1

I was able to view output of the service using:

$ journalctl -f

Playing around with journalctl some more, I stumbled upon:

$ journalctl --user-unit chatty

and that seemed to work.

share|improve this answer
    
Are you getting the "test from chatty.service" stdout message in the log output as well, or just the "Starting chatty.service..." and "Started chatty.service." messages? –  Quantumboredom Mar 28 at 18:34
    
Yes, I was able to get the output from the process as well (i.e. the "test from chatty.service" message). –  denaje Mar 29 at 13:15
    
That is what I was expecting as well, but I don't see it here. May I ask what operating system (with version) you are running? –  Quantumboredom Mar 30 at 12:31
    
Arch Linux 3.13.7-1. systemd version 212. –  denaje Mar 31 at 6:52
    
I see the output in the main journalctl now. But when I try running journalctl --user I get No journal files were found. And the journalctl --user-unit chatty didn't work for me. –  CMCDragonkai Jul 22 at 6:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.