linux, ubuntu

How to restore Ubuntu after “Can’t write PID file”

Today one of my colleagues ran into a permission problem with his Ubuntu 14.04.1 after doing the latest updates for Ubuntu.
The problem somehow is still in place, however we where able to turn around the problem by creating another user and moving the folders to the new user.

Steps to create a new user and move your things around so you can get your box back:

Start your Ubuntu with shift pressed until you see the recover screen, choose recovery mode:

Then select the option root:

Step 1:
You will then have access to the command line as root, so now create a new user with the name of your preference:
adduser vagrant_bkp sudo

Step 2:
If this happens to fail, is because your drive is not mounted with the correct permissions, so run the following command to remount it with read and write:
mount -o remount,rw /
(Now run step 1 again)

Now just restart the Ubuntu and your new user should be available for you to use, you can then sudo as root and recover your files! đŸ™‚


PS: If for some reason you are not able to sudo with your new user, go back to recovery mode, execute Step 2 and after it manually add your new user to suddoers file:
vi /etc/sudoers
Add the line:
vagrant_bkp ALL=(ALL) ALL
(You may also want to add (set nocp) to VI just so it works properly), you can do this by pressing shift + : and then type set nocp and press enter.
Restart your Ubuntu box and you should be able to logIn with your new user.


2 thoughts on “How to restore Ubuntu after “Can’t write PID file””

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s