63

I am going through some tutorials. When I try to execute systemd-resolve --status in Ubuntu 22.04 desktop, the system reports command is not found. What am I doing wrong here?

I tried running sudo apt-get install -y systemd but it seems like systemd-resolve is not installed. Please help.

Ajay
  • 1,246
kwoonfai
  • 731
  • 4
    Please try: sudo service systemd-resolved status Welcome to Ask Ubuntu. – chili555 May 20 '22 at 22:58
  • 2
    @chili555 The systemd-resolve used to be a command in former Ubuntu versions. It's not the deamon systemd-resolved. Apparently it got removed, or left out. – ubfan1 May 21 '22 at 01:24
  • @ubfan1 It works perfectly well on my fully updated 22.04 system. – chili555 May 25 '22 at 13:25
  • 1
    @chili555 your command only shows the status of the currently running systemd-resolved service - which shows process info and recent log output. This is not the same thing as the output from resolvectl status (or systemd-resolved --status in prior ubuntu version). "resolvectl status" outputs nameserver information and other configuration information that isn't available in the service output. – Professor Falken Aug 02 '22 at 21:56

3 Answers3

94

Use resolvectl status instead.

In systemd 239 systemd-resolve has been renamed to resolvectl (see here).

For the most part resolvectl offers the same options as systemd-resolve, though they may be named slightly differently. Run resolvectl --help to find what you are looking for.

codezalot
  • 1,048
  • 2
    It's not a 1:1 replacement though. There's no --set-dns option that was available on systemd-resolve. – Tony Maro Aug 16 '22 at 20:12
15

Here I updated ubuntu to 22.04 and my VPN stopped working. I fixed it with: sudo ln /usr/bin/resolvectl /usr/bin/systemd-resolve

  • Thank you so much! This solved my problem (Ubuntu server 22.04 )! – Issam2204 Nov 08 '22 at 16:01
  • this works thanks! – CalfCrusher Nov 12 '22 at 14:56
  • 4
    +1 I would suggest to do a symbolic link instead with sudo ln -s /usr/bin/resolvectl /usr/bin/systemd-resolve. This is more transparant as ls -l /usr/bin/systemd-resolve will show that is is only a link to /usr/bin/resolvectl – zs11 Feb 28 '23 at 15:16
-2

First try these commands:

systemctl status 

or

sudo service --status-all 
zx485
  • 2,426
  • 3
    This answer doesn't solve or address anything because it has no relevance to the fact that systemd-resolve was renamed, as pointed out in this answer: https://askubuntu.com/a/1410472/587804 – miversen33 Jan 13 '24 at 17:17