I am currently working on Ubuntu 20.04 machine. When I am running the command journalctl -u sshd.service, I am getting the below response.

-- Logs begin at Wed 2022-12-21 13:01:52 UTC, end at Fri 2023-03-31 15:10:32 UTC

-- No entries -- .

But, when I am running journalctl -u ssh.service, I am getting the log entries. since sshd.service and ssh.service are different systemd units, why it is not giving any entries for journalctl -u sshd.service command?


1 Answer 1


At least in the default Ubuntu + OpenSSH implementation, sshd.service and ssh.service are in fact not different units - the former is an alias for the latter, defined in the [Install] section of its unit file, /lib/systemd/system/ssh.service:


Such aliases are discussed in the DESCRIPTION section of man systemd.unit, and essentially work by creating symbolic links - in this case,

$ ls -l /etc/systemd/system/sshd.service 
lrwxrwxrwx 1 root root 31 Feb 16  2022 /etc/systemd/system/sshd.service -> /lib/systemd/system/ssh.service

allowing you to start / stop / query the status of the service via systemctl using either ssh.service, or sshd.service (or even just ssh or sshd).

So what you are observing is that journalctl apparently doesn't resolve these systemd aliases - there's some discussion of why and whether it should in Issue #11846: Journalctl working with Systemd Alias (in Install section) and also a related (but not satisfactorily answered) question on our sibling site, How to use systemd aliases with journalctl?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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