1

I accidentally deleted all files inside folder /var. Now, my computer restarts but switches to Command line interface. So, how to make my system work as before?

Eric Carvalho
  • 54,385
  • 1
    Backup all your personal data and reinstall... I do not think that such a damage is recoverable. Sorry. – Rmano Nov 13 '14 at 09:59
  • 1
    Agree with @Rmano make a backup but do not format your disks. If you do this without a format you will keep all your files and the default /var files are restored. If it works you get your system up and running but do not need to restore a backup. – Rinzwind Nov 13 '14 at 10:04

2 Answers2

1

If you do it like this you will keep all personal files and the default /var files are restored. You should get your system up and running but do not need to restore a backup. Otherwise do restore the backup.

Rinzwind
  • 299,756
0

I faced same issue while I was trying to free up /var mount point

The following fixed my issue:

  • Create a USB bootable drive (I followed a guide found in internet)

  • boot with the boot drive.

  • Go for "Test Ubuntu" mode. This will enable you to run Ubuntu from your boot drive without using your hard disk.

  • Once you have your Ubuntu desktop ready, open terminal and log in as root with sudo bash, do ls and ensure /var for the Ubuntu which is running is available there

  • Then go to /media folder and locate your /var mount point. This usually a directory with very long name with hyphens and numbers etc

  • Copy folders from your /var to /media/(your varfolder name) with cp -r command. I had about 14 folders in Ubuntu bootdrive /var, where as, /var of my system Ubuntu had very minimal folders. Copy all the folders.

That's it! Remove USB, boot in your own Ubuntu and enjoy.

Note that you may have to reinstall your applications to ensure your application files are restored in /var

Lorenz Keel
  • 8,905