journalctl -u sshd.service command returns 'no entries'

cw flag

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?

hr flag

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?

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.