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?
-
1Backup all your personal data and reinstall... I do not think that such a damage is recoverable. Sorry. – Rmano Nov 13 '14 at 09:59
-
1Agree 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 Answers
- Just to make sure: make a backup of your personal files. You can do this from command line. Reference: How would I use tar for full backup and restore with system on SSD and home on HDD? (but there will be more like this on AU).
- Restart with a Live DVD and re-install;
- During the setup of the partitions do not format your disks.
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.
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
, dols
and ensure/var
for the Ubuntu which is running is available thereThen go to
/media
folder and locate your/var
mount point. This usually a directory with very long name with hyphens and numbers etcCopy folders from your
/var
to/media/(your varfolder name)
withcp -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

- 8,905