Recently, I've started to get a whole bunch of errors during install. No matter, what I install:

http://paste.ubuntu.com/23373166/

Update:

OK, I've dug to this point. I ran:

sudo /usr/lib/insserv/insserv -f

And it gave me this:

insserv: warning: script 'showfsck' missing LSB tags and overrides
insserv: There is a loop between service reniced and showfsck if stopped
insserv:  loop involving service showfsck at depth 2
insserv:  loop involving service reniced at depth 1
insserv: Stopping showfsck depends on reniced and therefore on system facility `$all' which can not be true!
insserv: can not remove(../rc0.d/K04avahi-daemon): Permission denied
insserv: can not symlink(../init.d/avahi-daemon, ../rc0.d/K03avahi-daemon): Permission denied
insserv: can not remove(../rc1.d/K04avahi-daemon): Permission denied
insserv: can not symlink(../init.d/avahi-daemon, ../rc1.d/K03avahi-daemon): Permission denied
insserv: can not remove(../rc2.d/S08plymouth): Permission denied
insserv: can not symlink(../init.d/plymouth, ../rc2.d/S14plymouth): Permission denied
insserv: can not remove(../rc2.d/S08reniced): Permission denied
insserv: can not symlink(../init.d/reniced, ../rc2.d/S14reniced): Permission denied
insserv: can not remove(../rc2.d/S08grub-common): Permission denied
insserv: can not symlink(../init.d/grub-common, ../rc2.d/S14grub-common): Permission denied
insserv: can not remove(../rc2.d/S08ondemand): Permission denied
insserv: can not symlink(../init.d/ondemand, ../rc2.d/S14ondemand): Permission denied
insserv: can not remove(../rc2.d/S08rc.local): Permission denied
insserv: can not symlink(../init.d/rc.local, ../rc2.d/S14rc.local): Permission denied
insserv: can not remove(../rc3.d/S08plymouth): Permission denied
insserv: can not symlink(../init.d/plymouth, ../rc3.d/S14plymouth): Permission denied
insserv: can not remove(../rc3.d/S08reniced): Permission denied
insserv: can not symlink(../init.d/reniced, ../rc3.d/S14reniced): Permission denied
insserv: can not remove(../rc3.d/S08grub-common): Permission denied
insserv: can not symlink(../init.d/grub-common, ../rc3.d/S14grub-common): Permission denied
insserv: can not remove(../rc3.d/S08ondemand): Permission denied
insserv: can not symlink(../init.d/ondemand, ../rc3.d/S14ondemand): Permission denied
insserv: can not remove(../rc3.d/S08rc.local): Permission denied
insserv: can not symlink(../init.d/rc.local, ../rc3.d/S14rc.local): Permission denied
insserv: can not remove(../rc4.d/S08plymouth): Permission denied
insserv: can not symlink(../init.d/plymouth, ../rc4.d/S14plymouth): Permission denied
insserv: can not remove(../rc4.d/S08reniced): Permission denied
insserv: can not symlink(../init.d/reniced, ../rc4.d/S14reniced): Permission denied
insserv: can not remove(../rc4.d/S08grub-common): Permission denied
insserv: can not symlink(../init.d/grub-common, ../rc4.d/S14grub-common): Permission denied
insserv: can not remove(../rc4.d/S08ondemand): Permission denied
insserv: can not symlink(../init.d/ondemand, ../rc4.d/S14ondemand): Permission denied
insserv: can not remove(../rc4.d/S08rc.local): Permission denied
insserv: can not symlink(../init.d/rc.local, ../rc4.d/S14rc.local): Permission denied
insserv: can not remove(../rc5.d/S08plymouth): Permission denied
insserv: can not symlink(../init.d/plymouth, ../rc5.d/S14plymouth): Permission denied
insserv: can not remove(../rc5.d/S08reniced): Permission denied
insserv: can not symlink(../init.d/reniced, ../rc5.d/S14reniced): Permission denied
insserv: can not remove(../rc5.d/S08grub-common): Permission denied
insserv: can not symlink(../init.d/grub-common, ../rc5.d/S14grub-common): Permission denied
insserv: can not remove(../rc5.d/S08ondemand): Permission denied
insserv: can not symlink(../init.d/ondemand, ../rc5.d/S14ondemand): Permission denied
insserv: can not remove(../rc5.d/S08rc.local): Permission denied
insserv: can not symlink(../init.d/rc.local, ../rc5.d/S14rc.local): Permission denied
insserv: can not remove(../rc6.d/K04avahi-daemon): Permission denied
insserv: can not symlink(../init.d/avahi-daemon, ../rc6.d/K03avahi-daemon): Permission denied
insserv: fopen(.depend.stop): Permission denied
share|improve this question
    
You should probably ask a more specific question. Instead of trying to post the entire output you should edit in a few lines, to show what sort of errors you are getting. And add the paste bin as an attachment so to say, for those that might want to see the whole ting. As it is now you might not get many replies, as one can't see clearly out of your post what the problem might be. – Jorgen Oct 24 '16 at 6:15
    
That error log, I get every time I try to install anything. I don't know what to cut out from there. Since I don't know, what the problem is, I don't which portions of log are important, and which are not. Specifically, I get this error log every time I try to do sudo apt instal package, or sudo apt-get install package, or sudo apt -f install, or sudo apt-get -f install, or sudo apt upgrade, or sudo apt-get upgrade, or install a package from synaptic. – igoryonya Oct 24 '16 at 21:14
up vote 3 down vote accepted

OK, after much of hair pulling and digging deeper, I've finally found the issue:

It appears that insserv stumbles upon some services, so I've moved all services that insserv was complaining about to a temporarily created dir: /etc/d.init from /etc/init.d. Then, I did sudo dpkg --configure -a and voila, it worked almost without errors. I ran it a couple more times until all the errors disappeared.

After that, I did sudo apt-get -f install just to make sure, and there is nothing left.

Then I started to reinstall and reset the configs in problematic packages, so, gradually, I came up with the following script:

#!/bin/sh

#First, manually move problematic services from init.d to d.init (i.e.: /etc/d.init/)
cd /etc

var_srv=$1
var_pkg=$(dpkg-query -S init.d/$var_srv|egrep -o '^.*\:'|egrep -o '^.*[^\:]')

#To Reinstall the problematic package:
sudo aptitude reinstall $var_pkg
#To Restore missing configs:
sudo apt-get -o DPkg::options::=--force-confmiss --reinstall install $var_pkg

#Show that both (the backup copy and the newly created copy exist):
ls d.init/$var_srv init.d/$var_srv
#Show the difference between 2 files (the new and the backup):
meld d.init/$var_srv init.d/$var_srv
sudo rm -vi d.init/$var_srv

#To show what files have left for processing
find d.init/|sort

During comparison, I've noticed, that showfsck's file doesn't have the required header that I've read about on forums. All init.d scripts have to have the following header:

### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# X-Start-Before:
# X-Stop-After:
# Default-Start:
# Default-Stop:
# Short-Description:
# Description:
### END INIT INFO

I didn't know what values it should have so I left them empty. My installation works now without errors.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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