[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to restore corrupted initscripts?



John O'Hagan wrote:
Hi,

When shutting down my etch laptop of late, it stops just short of power-off with a message along the lines of "No more processes in this runlevel". I then have to power-off manually. I looked in /etc/init.d and noticed that the "halt" script was no longer a script, but a text file containing configuration for asterisk. Also, the mountvirtfs script had been replaced by a gif image! This explained some other boot error messages I had been getting e.g., about /proc and /sys.

I'm guessing this was caused by some random filesystem corruption I've been getting lately as a result of a faulty power-supply in the laptop, requiring manually running fsck.(It's an ext3 filesystem.) Even after this I occasionally notice random file substitutions like the above. But my question is, how to fix it?

From what you write it appears that either
- some files of your system have been more or less randomly manipulated
- you have been hacked.

In either case I would do a clean reinstall, because you will never know, what'll break next.

1. Back up your data
2. Back up your /etc
3. save your package installation information
$ dpkg --get-selections "*" >myselections # or use \*
save 'myselections'
4. you could also save your configuration options by
$ debconf-get-selections > file
(I have never done this myself, in my case it doesn't save enough time to bother)
5. Reinstall only base-system
6.
# dpkg --set-selections < myselections
restores package selections
7. install your packages with aptitude

compare backup of /etc with new /etc and copy 'your' modified configuration files.

I keep regular backups of /etc, 'myselections' and my data plus some personal configuration scripts and can reinstall from bare metal within about an hour. Most of that time the machine is busy by itself and requires little attention.

For a scenario like the one you describe this would be certainly less hassle and time than to try to track down all problems and find solutions.

HTH, YMMV, etc.

Johannes



Reply to: