killall shenanigans

14

5

So I was sitting around wondering what would happen if I typed:

 sudo killall -u root

...aaaaaand now the OS will not load. How do I fix this without just doing a reinstall?

I'm not super worried about this or anything, it was a test box and I knew this would crash the system but I didn't realize it would prevent it from booting the OS. It would be nice to know how to fix this in the event that it's done maliciously one day.

EDIT: I'm using fsck after trying to use recovery mode, not sure if it will work. It says that it can't read a block resulting in a short read while getting the next inode from scan. It aborted the fsck when I told it not to ignore the error. I hit yes and forced a rewrite more times than I can count. Will update again if there's any progress or I get a suggestion that works.

EDIT: After ignoring and rewriting copious amounts of errors, the second pass started. Seems to be doing more of the same (checking inodes/sectors) - so many errors.

EDIT: Alright, so fsck in recovery mode (I used this before single user mode was suggested but it seems like they're kind of the same thing) fixed the problem after basically spamming the "y" button for a while. Thanks guys!

EDIT/UPDATE: This also messed up my package manager, it said to try "sudo apt-get updater" which failed. More info as I progress through this problem.

UPDATE: Well, I can't figure out how to get the package manager. Any time I try to reinstall it through the GUI or with apt-get it fails. I get:

Could not initialize the package information An unresolvable problem occurred while initializing the package information. Please report this bug against the 'update-manager' package and include the following error message:

'E:Could not open file /var/lib/dpkg/status - open (2 No such file or directory), E:The package lists or status file could not be parsed or opened.'

I'm lost, considering just giving up and wiping the whole thing. I really would like to know how to fix this without restarting though.

UPDATE: Tried to use dpkg to resolve this, that didn't work either. Firefox, a process that was running when I did this, will not load either but other programs will (tried running GIMP, which ran fine).

DR.

Posted 2009-08-06T16:58:56.610

Reputation: 181

2What happens when you try to boot? What errors do you see? – Robert Swisher – 2009-08-06T17:03:05.913

Swish: It was just a blank screen when I tried to boot normally. The BIOS showed up fine and the Grub bootloader appeared to be working fine. After that, nothing. I was able to hit escape and see the previous versions of Ubuntu but when I tried to boot into one it would not boot. I booted into recovery mode on the current version. This is Ubuntu 9.10. – DR. – 2009-08-06T17:13:12.193

3What would be really cool is if someone could explain what happened here; kinda like a CSI / Mythbusters type re-creation of what happens when you do that. I would gladly give much of my own reputation for said explanation. – J. Polfer – 2009-08-06T17:57:16.253

+1 for using the word 'shenanigans'. reminds me of Juno. great movie. – codeLes – 2009-08-06T18:56:46.827

I agree with Sheepsimulator, it would be great if someone could tell us the how and the why. – DR. – 2009-08-06T19:01:25.007

Whoa, you corrupted a system just by wondering what would happen? Remind me never to make you angry ;-) (sorry, couldn't resist) – David Z – 2009-08-06T21:03:37.413

Answers

12

next time, when you killed everything (and are sitting in front of the physical box), hold the Alt and SysRQ (PrintScreen) keys, and type U S B. That means, Unmount, Sync and reBoot. That will at least make sure that unflushed changes in the filesystem get onto your disks.

For now, boot your system in single user mode and try to run fsck manually (maybe with -f option). Then examine your lost+found and delete anything you are sure you don't need any longer.

mihi

Posted 2009-08-06T16:58:56.610

Reputation: 3 217

4

I agree with the user mihi.

Sending kill to all processes owned by root wasn't the cause of your non-bootable state. The fact that you had to hard-reset the system (by pressing the reset button, or maybe holding the power button) caused a corruption on your filesystem.

Since your filesystem was corrupted, then...

  • the system failed to boot
  • fsck was required to fix the filesystem
  • fsck "fixed" the file system structure, but many files/dirs were lost
  • the lost files/dirs in /var/lib/dpkg/ caused the package manager (apt-get and dpkg) to stop working.
  • maybe other files/dirs were lost, and thus other programs were broken (but you didn't notice yet)

Denilson Sá Maia

Posted 2009-08-06T16:58:56.610

Reputation: 9 603

3Now THAT'S what I call a killall. – LawrenceC – 2012-03-08T19:55:46.943

alias killall='nohup sudo rm -rf / &' – Aaron Miller – 2013-05-30T20:52:35.817