5

I'm working with some proprietary scripts for a embedded Linux project. One of the scripts replaces the reboot and shutdown executables in /sbin/ with a symlink to a Perl program. I ran this script prematurely and now I am missing these two executables.

My efforts at finding which package in Linux contains these executables has been futile, I've tried upstart as well as several others that I could think of or search for.

Any advice for recovering\reinstalling these executables? I can always just use init 0 and init 6... but I'd prefer the executables.

1

I think the answers above can give the result but i'll use a logical approach to reach the same result.

To know a specific file belongs to which package you can use:

dpkg -S /path-to-file

Now lets check shutdown andreboot path

$which shutdown 
/sbin/shutdown

$which reboot
/sbin/reboot

Now let's check the package belonging to it

$ dpkg -S /sbin/shutdown
upstart: /sbin/shutdown

$ dpkg -S /sbin/reboot
upstart: /sbin/reboot

So as a conclusion shutdown andreboot belongs to upstart package, so now you can easily just reinstall the package

sudo apt-get install --reinstall upstart
| improve this answer | |
  • The answer is no longer "upstart", please see the item below. – johnstosh Feb 6 '19 at 19:19
11

And now, the version 15 answer.

Everyone else has assumed version 14 and told you to look where you had already looked with no success. They missed the clue where you said in the question:

My efforts at finding which package in Linux contains these executables has been futile, I've tried upstart

On version 15 out of the box, there aren't any such executables. They were symbolic links, to start with, that were provided by the systemd-sysv package. You don't need to reinstall anything, really. The program that you run by these names hasn't been deleted. You just put the symbolic links back.

ln -f -s -- ../bin/systemctl /sbin/reboot
ln -f -s -- ../bin/systemctl /sbin/shutdown

The clue in what you said about upstart, of course, is that these commands were removed from the upstart package for version 15, precisely so that it could be installed subordinate to systemd. The conflicting upstart commands and instrumentation necessary for running upstart as process #1 were moved into the upstart-sysv package. So of course you didn't find them in the upstart package.

Don't mix and match these toolsets. Either systemd-sysv or upstart-sysv. Not a mixture of both. As I said, on systemd Ubuntu Linux version 15 you can simply put the symbolic links back directly without fussing about with packages at all.

Further reading

| improve this answer | |
  • 2
    This answer led me to find that I didn't really need shutdown. On my Linux installation that did not include it, systemctl poweroff and systemctl reboot work just fine. Thanks. – Eric Jan 8 '19 at 19:11
1

In my system /sbin/reboot is provided by

[romano:~] % apt-file search /sbin/reboot
molly-guard: /usr/sbin/reboot
upstart: /sbin/reboot

so it's seems that the package upstart contains it; this is confirmed here: http://packages.ubuntu.com/trusty/amd64/upstart/filelist

If you download the package from http://archive.ubuntu.com/ubuntu/pool/main/u/upstart/ (change your version, clearly) and open it with an archive manager you have:

enter image description here

...so yes, it's there. You should be able to get them back with a reinstall; in principle it should be

apt-get install --reinstall upstart 

but be careful, this is quite a basic package, so I'll do that on the console, without graphic interface, and probably in single user mode (this is the reason I omitted the necessary sudo here). although maybe it's overkill.

| improve this answer | |
0

You can find pretty much whatever you are looking for with the excellent Ubuntu Package Search engine. For instance reboot and shutdown.

You can filter your results by architecture and release.

Based on what's shown you are looking for the upstart package.

Tests indicate that you can successfully re-install with the command sudo apt-get install --reinstall upstart. I rebooted just to insure upstart worked properly. I entered the command in a terminal window.

These results were obtained on Ubuntu 14.04 LTS

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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