Setting correct permissions for /var directory recursively

Hi,

I had to move my /var and /opt directories to another partition. It looks like I got away with it, mostly. There is a bit of trouble, however:

  1. Before the login screen I now see an error message: Can’t write to /var/lib/sddm/.config/sddm-greeterrc. Pretty obvious why:
/var/lib/sddm $ ls -al
total 60
drwxr-xr-x 14 sddm sddm 4096 окт 27 12:31 .
drwxr-xr-x 46 root root 4096 дек 11 00:00 ..
drwxr-xr-x  7 root root 4096 окт 27 12:31 .cache
drwx------  2 root root 4096 дек 11 06:47 .config
drwxr-xr-x  2 root root 4096 окт 27 12:31 Desktop

This is not the only problem. I also have this:

...
==> Creating package "stm32cubeide"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
bsdtar: (null)
==> ERROR: Failed to create package file.
 -> error making: stm32cubeide

I can’t see where there was an attempt to write, but it looks suspicious.

Is it advisable to do something like this? Or is it fatally indiscriminate?

$ sudo chmod -R 755 /var

Hi @Llama :wink:

I would advice you to correct all permissions by re-applying them from the database:

sudo pacman -Sy pacutils

Check the files:

pacman -Qq | sudo pacman -Qkk 

Repair it:

find /var | sudo pacrepairfile --uid --gid --mode

Next time use rsync to preserve permissions. :wink:

3 Likes

Thank you very much! I’ve had no idea that a piece of fine tuning like this is possible. It can be a life saver some day.

Meanwhile, my problems are subtler than this :slight_smile:

I’ve got two boxes powered with Manjaro KDE, one of them “intact” - no fooling with system directories, no visible quirks. I checked the relevant permissions:

drwx------  2 root root 4096 дек 12 18:01 .config

nothing there, no error messages…

Another weird thing: stm32cubeide AUR package won’t install on the box with the /var and /opt moved. It can’t be relevant anyway because all the building takes place in the user space. Still, makepkg fails, just as yay -S stm32cubeide does.

So I build the package on the good box, carry it to the tampered with, and install:

$ yay -U stm32cubeide-1.8.0-1-x86_64.pkg.tar.zst

Success(of sorts)!

Today I tried to build the package again on the bad box, just to report the errors.

$ makepkg
...
==> Checking for packaging issues...
==> Creating package "stm32cubeide"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: stm32cubeide 1.8.0-1 (Вт 14 дек 2021 15:37:30)

Success again, quite unexpected. WT…?