Long story short, I destroyed /var
and restored it from backup – but the backup didn't have correct permissions set, and now everything in /var
is owned by root. This seems to make a few programs unhappy.
I've since fixed apt failing fopen on /var/cache/man
as advised here as well as apache2 failing to start (by giving ownership of /var/lib/apache2
to www-data
). However, right now the only way to fix everything seems to be to manually muck around with permissions as problems arise – this seems very difficult as I would have to wait for a program to start giving problems, establish that the problem is related to permissions of some files in /var
and then set them right myself.
Is there an easy way to correct this? I already tried reinstalling (plain aptitude reinstall x
) every package that was listed in dpkg -S /var
, but that didn't work.
Best Answer
Actually
apt-get --reinstall install package
should work, with files at least:Now, you probably didn't get all the packages that have files on your
/var
directory, so its better to find them all:In my case, it accounts for 460 paths that have a package, this is actually less if you consider that the same package can have several paths, which with some post processing we can find out that are ~122:
This of course counts several package that has the same path, like
wamerican, aspell-en, ispanish, wspanish, aspell-es, myspell-es
. This is easily fixable:So, I have 107 package that have any kind of file in
/var
or subdirectories. You can reinstall them using:This should fix the permissions.
Now, there's another option, find a good installation and copy the file permissions over your installation with: