1

I have no idea how this happened, but /etc/rc.*/ is simply missing.

As a result, aptitude and apt-get don't work right anymore.

Is there a quick-fix for this? I really don't want to reinstall the OS if I don't have to.

Alex R
  • 1,063
  • 3
  • 14
  • 29

3 Answers3

2

In what way doesn't apt-get work? A lack of init scripts shouldn't have any direct effect on package management.

What you'll want to do is restore those directories from backup. Since I'm assuming you don't have backups, then you'll need to identify all of the packages that had files in the removed locations (grovelling through /var/lib/dpkg/info/*.list is probably the quickest way), then on top of that reconfigure any package that has an init script, to recreate the symlinks that would have been in place (because the directories that are apparently missing consist mostly of symlinks created at package install time).

See how much easier life is when you have backups?

womble
  • 96,255
  • 29
  • 175
  • 230
1

Try this:

  • manually download sysv-rc and initscripts

  • manually install them with: dpkg -i sysv-rc*.deb initscript*.deb

  • then reinstall all packages with services with this script:

    #!/bin/bash
    for package in $(dpkg --get-selections | awk '{ print $1 }'); do
      if dpkg -L "$package" | grep -q /etc/init.d; then
        apt-get --reinstall install $package
      fi
    done
    
0

You could try installing it somewhere else (Like a virtualbox install) with the same services configuration and copy the directories over.

You shouldn't run into any configuration files in /etc/rc.*/ the main thing is making sure the services you expect to start on boot are starting. I forget Ubuntu's setup but many times the files in /etc/rc.*/ are just symlinks to files that actually reside in /etc/init.d/.

Still I would install it somewhere else and compare.

madflojo
  • 320
  • 2
  • 5