2

I recently downloaded the Buster lite installation package and have the latest updates. I get systemctl not found. The systemd files it uses are present. Apt-get systemctl fails. I need to run commands such as systemctl daemon-restart. I have researched this and found 'get the latest OS' but I have the latest OS. How do I get systemctl ?

1
  • 2
    Pls add exact command and full error msg to your question
    – Dirk
    Commented Oct 25, 2020 at 15:57

3 Answers 3

2

There are two likely possibilities:

  • systemctl is gone
  • your shell cannot find it

To see if systemctl is still there, you can do find / -name systemctl. If it is there, try to execute it with the whole pathname (like /bin/systemctl).

If find does not find it, it is gone. Then you may try to copy /bin/systemctl from an image that has the same version of OS as your Pi, but there is no guarantee tat it will work. That depends on what other files are missing. I would try this only as part of the actions to backup data before re-imaging your system.

To see if systemctl is still there, you can do find / -name systemctl. If it is there, try to execute it with the whole pathname (like /bin/systemctl). If that works, then you must look at your PATH in your shell:

echo $PATH

The output should contain the directory where systemctl is

Example:

$ sudo find / -name systemctl 2> /dev/null
/usr/share/bash-completion/completions/systemctl
/bin/systemctl
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
$ 

You seen here that /bin/systemctl exists and you see /bin in the PATH. So, on my system, systemctl works.

2
  • There is at least one more possibility: the command was typed wrong. We know nothing and everything is guessing.
    – Ingo
    Commented Oct 26, 2020 at 12:31
  • 1
    @ingo There may be even more possibilities. That is why I tried to include some basic problem determination in the answer, instead of just saying that the system is corrupt and tell to re-image. Commented Oct 26, 2020 at 13:51
1

If the error is really this:

pi> systemctl
sh: systemctl: command not found

And the output of echo $PATH includes:

/bin:/sbin:/usr/bin:/usr/sbin

Then something went very wrong, most likely SD card corruption, the usual cause of which is not shutting the Pi down properly before killing the power/pulling the plug.

In any case, there is no point in you trying to repair this. You will have to start again by re-imaging the card. If you did pull the plug arbitrarily, try not to do it again.

0

Probably the "Buster lite" package does not ship with systemd installed by default. (Perhaps provide a link so we can confirm?)

You can install it just like any other package.

# Make sure package index is up to date
apt-get update
# Install
apt-get install -y systemd

You will probably have to enable some services and reboot before it becomes fully operational. Alternatively, use a less "lite" image if you need the full system, not a stripped-down one.

Your Answer

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

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