4

I'm trying to recover from a faulty installation, and want to remove some packages. But I can't.

# apt autoremove offending-package
dpkg: warning:  'start-stop-daemon' not found in PATH or not executable

(My PATH is fine.)

According to packages.debian.org, start-stop-daemon should be in /sbin/.

It isn't there! What should I do?

Patrick R
  • 93
  • 1
  • 6

2 Answers2

5

My solution was to download the dpkg binary and install start-stop-daemon by hand.

# apt download dpkg

# sudo ar -x dpkg_version-info.deb

# tar -xzf data.tar.gz

# mv ./sbin/start-stop-daemon /sbin

Now everything works, but I'm still stumped how it went missing!

GAD3R
  • 63,407
  • 31
  • 131
  • 192
Patrick R
  • 93
  • 1
  • 6
  • @dirkt please explain the evidence that makes you guess that systemd blindly deleted files which belong to the dpkg package. – sourcejedi May 27 '18 at 11:52
  • 1
    @dirkt that’s blatant FUD. `start-stop-daemon` is part of `dpkg`, no package, systemd-related or not, could cause its removal. You can also use `sysvinit` on Debian 9 if you don’t like systemd, no need to switch to Devuan (but anyone wishing to do so is of course welcome to). – Stephen Kitt May 27 '18 at 14:13
  • In the future, use `dpkg-deb --extract dpkg_version-info.deb /tmp/dpkg` to extract the files into /tmp/dpkg – wurtel May 28 '18 at 14:55
  • It worked great for me. Note: in 2020, ver. 10/Buster, archives are .xz not .gz files, but after extracting it works. Must set to executable in order to "fool" apt. – gnicko Jun 02 '20 at 13:13
  • It worked for recover start-stop-daemon and ldconfig(from libc-bin) debian 11/Bullseye rescue. – gvd Sep 20 '21 at 00:27
2

Another way to do this is first create a dummy /usr/local/sbin/start-stop-daemon that does nothing:

#!/bin/sh
exec true
then simply reinstall the dpkg package:
aptitude reinstall dpkg
then (of course) remove the dummy /usr/local/sbin/start-stop-daemon.

Installing the dpkg package does not in fact require start-stop-daemon at any point. It is simply the case that the dpkg command, that is run to reinstall its own package, checks that start-stop-daemon is on the command search path in case a package installation/deinstallation script happens to use it.

JdeBP
  • 66,967
  • 12
  • 159
  • 343