Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm on 12.04LTS.

I had an old OS disk mounted at /media/backup/, and I was converting it to use as a backup disk. I accidentally ran sudo rm -rf /var/ rather than sudo rm -rf var/, and deleted some of my /var/ before catching my mistake with ^C.

I recopied across some files from /media/backup/var/ using cp -na /media/backup/var/specific_path/* /var/specific_path/, mainly doing the obvious here (folders in /var/ which had fewer files than in /media/backup/var/ for example). A few things were obviously not working:

  • Totem complained from the command line that it was unable to connect to jack (this is important as the machine is a HTPC running mythtv)
  • some programs complained that there is no /var/lib/dbus/machine_id, and this folder and file was not recreated on reboot (I had expected it might be)

Once I felt I had done enough, I tried a reboot.

The tty7 fails, and I get a text-based login. Do I need to copy across some gdm files? My old installation had been gradually upgraded to 12.04LTS from 8.04LTS originally. I'm guessing its var/ has some legacy folders that I don't need to reproduce in my /var/. For example it has a var/lib/gdm/ folder, but /var/lib/ doesn't. Then again I thought gdm had been deprecated?

Can I do a 'repair' using an installation CD, or is there a way to use my backup to repair the rest?


cp /media/backup/var/lib/gdm/* /var/lib/gdm/ got me to the point where I can boot to the desktop. I'm now in a less critical state, but my question above still stands: is there a way to detect what should be missing, or force some sort of intelligent dpkg-reconfigure for just those packages with missing files?

share|improve this question

Your best approach will be to reinstall and use the backup to transfer your data to the new install.

share|improve this answer
Thanks for this suggestion. I realise that it's the obvious solution, but I'm reticent to resort to this due to the lengthy setup time of this machine. Although I have adequate backups, I don't have the space to backup all the media on this htpc, so this is a difficult response. Anyway, as you can see above, I've managed to get to the desktop now, so I'm hoping there's also less need to be so drastic. – nimasmi Jan 4 '13 at 23:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.