Accidentally Changed Ownership of /var/lib

I recently upgraded my postgresql installation and intended to run the command:

sudo chown -R postgres:postgres /var/lib/postgres

Unfortunately, I accidentally forgot the “postgres” part at the end and ran this instead:

sudo chown -R postgres:postgres /var/lib

Needless to say, this has caused a slew of issues. For example, I’m not able to boot into my operating system.

I’m running Arch Linux with i3 as the window manager and GDM as the display manager. I would appreciate any help in getting the original ownership to the necessary directories in /var/lib. As of now, it permanently hangs on this part of the process. I am using luks and the filesystem is encrypted.

enter image description here

However, I am able to spawn a shell via grub by adding “init=/bin/bash” to the kernel line, of course, so this should be fairly easy to fix once I know the proper ownership requirements. Here are the current directories in /var/lib:

enter image description here

One issue is that the gdm folder, which is owned by gdm, contains several sub-directories that are owned by postgres

enter image description here

Any aid would be greatly appreciated.