0

Sorry for not being able to properly format my question because I'm using SE Android app, my xubuntu isn't working. I dont know what exactly is the error but I'll try to describe what happened and hopefully you can help me further debug and solve the problem, im on xubuntu 13.10 64 bit.

2 days ago, while trying to make php work, I chmod -R /var

That worked but sudo apt-get install x says that var/lib should have chmod 0700 or something like that so I did chmod 0700 /var/lib and chmod -R 0700 /var/lib. I don't remember the exact permission but I messed /var permissions that's for sure.

Anyway I dont know whether that's a big deal or not. I also messed something else up, apt-get install tasksel, I didn't wait for it to finish installing, I remembered that I could install lamp without tasksel, so I abandoned installation ctrl-z.

Right after ctrl-z, I got that red icon next to the clock saying that this error usually occurs when a package doesn't finish installing dependencies. I tried updating the packages didn't work.

Apt-get no longer works, I cannot install nor remove anything var is locked or something. It's the same error you get when you try to install something from terminal while synaptic package manager is opened.

I tried restarting the pc thinking that some background process is running, now xubuntu doesn't work, it boots and everything I see the xubuntu blue screen loading but I dont see the login screen afterwards, just a black screen (not a tty).

I tried reinstalling, but there's no (reinstall option) in the live cd, so I'd have to format the hard drive, I dont want to do that. I have so many stuff.

If I go to tty and fix the mess I made in var, would it fix it? If so then what are the different permissions for folders and files in var?

Lynob
  • 6,675
  • My description of events is in chronological order, meaning that I messed var, then tried apt-get install which worked perfectly, then ctrl-z, after that ctrl-z everything stooped working – Lynob Mar 07 '14 at 23:27

1 Answers1

1

A short intro into Unix file permissions:

File and folder permissions are represented as 4 octets. The 1st octet is for special permissions. The 2nd octet represents what the owning user of the file/folder can do (this is almost always 7). The 3rd octet represents what the owning group can do (usually 5). The 4th octet represents what everyone else can do.

Each permission is represented by numbers. 4 is for reading, 2 is for writing, and 1 is for running/opening (running a script or opening a folder).

The first command that you ran couldn't have been chmod -R /var, because it doesn't specify the permission to set. If the permission that you chmod'd is indeed 0700, then that means only you have full (read and write) access to the folder; the system can't even peek inside the folder. I'm not sure how the first instance of apt-get worked, though.

Fixing the permissions should cause your system to fully boot (and likely restore apt-get). The solution I can think of (assuming you can't get to a tty) is to run a live session from the live CD and, on /var of your hard drive (not the live session), run:

chmod -R 0755 /var
chmod 0377 /var/crash
chmod 0755 /var/log
chmod 0777 /var/run
chmod 0777 /var/lock
chmod 2775 /var/local
chmod 3777 /var/mail
chmod 3777 /var/metrics
chmod 1777 /var/tmp

This should get you back on the right path.

Also, I strongly recommend you don't change the permissions of system folders (basically, anything outside of /home).

saiarcot895
  • 10,757
  • 2
  • 36
  • 39