I accidently uninstalled (apt-get purge) lots of important system stuff, including gnome dekstop and whatever-is-responsible-for-internet-connetion, among other things. Is there any way to repair it? Without complete reinstall?

I can access it via command line (terminal) more or less normally. move, copy files, etc., just no apt-get install due to no internet connection. So I guess repairing internet would be first priority... Any way to check why it doesnt work and what needs to be done?

I do have LiveCD I can boot from. So I can manually copy neccessary files from it, if any.

Thanks in advance for your help

Edit: after I boot from my LiveCD I can use internet, however, as soon as I chroot into real filesystem, I cannot use internet from there. Guess it's how expected to work...

Edit 2: how I fixed it: with the help of people here, I finally did it. I booted from liveCD, copied /etc/resolv.conf to real installation, chrooted there, apt-get install ubuntu-desktop. While installation failed due to many errors, files got downloaded into real installation nevertheless. So I rebooted machine from live cd into real ubuntu, and this time while I still had no internet, apt-get had ubuntu-desktop cached. So I installed ubuntu-desktop and rebooted with GUI this time. After some minor manual fixes (ifupdown managed) I got wireless working too, now it's only a matter of auto-updates etc., with synaptic. Phew.... thanks again everybody :) Special thanks to ~quack who didnt provide any "formal" answer I could formally accept, but was the most helpfull with comments :)


if you can run the ifconfig utility (as root), and have a single ethernet adapter which can use DHCP to access the network:

sudo ifconfig eth0 up
sudo dhclient eth0 &

That should activate your first ethernet adapter and run dhclient to get it an address via DHCP. If that works successfully, you might be able to do repair your installation by running:

sudo aptitude install ubuntu-desktop

That command will install the packages which are included in a base Ubuntu install. (you can substitute "kubuntu-desktop" if you use KDE or "xubuntu-desktop" if you use XFCE.

If you cannot get networking at all, the best bet is as Justin suggested above, use apt-cdrom to install the ubuntu-desktop package from your CD.

  • +1, this is the right aptitude command -- the ubuntu-desktop meta package will pull in anything else that his purge removed. see help.ubuntu.com/community/… for booting from a LiveCD and using chroot to reinstall packages to the broken installation; that should take care of the internet. (you only need the chroot instructions at that link, not the "fix grub" instructions.) – quack quixote Feb 19 '10 at 18:07

You can configure apt to use the install cd as its repository, and then install what you need for net access, and gnome, from the cd.

sudo apt-cdrom -d <mountpoint> add is the command you want for this. make sure the mountpoint is the cd-rom mountpoint listed in your /etc/fstab.

  • 1
    NB: you don't run this from the livecd, you run this with the livecd from your actual install. Another option is backing up /home (which is where all of your own data is) to another drive / partition and then copying it back after a full reinstall. – Justin Smith Feb 19 '10 at 17:07
  • I added CD-Rom and it looked like worked, i.e., no errors, some packages found. But after it when I tried apt-get install ubuntu-desktop, apt was still trying to fetch it from internet... maybe I need to configure something or use command with some arguments to make it use cd? – Sejanus Feb 20 '10 at 6:10
  • @sejanus: you didn't remove the internet repositories from apt's list. comment out the lines in /etc/apt/sources.list .. then run the apt-cdrom command .. then run sudo apt-get update ... and finally run sudo apt-get install ubuntu-desktop – quack quixote Feb 20 '10 at 8:30
  • @~quack: in this case, apt-get shows error about not finding ubuntu-desktop ("...but it was referenced in another package" and so on). I double checked sources.list, I have commented out everything but lines starting with apt cdrom. If ubuntu-desktop is supposed not to be in LiveCD, maybe you could give me short list of package names I need to install to get at least desktop gui and/or internet working, please? – Sejanus Feb 20 '10 at 10:53
  • @sejanus: my bad, i assumed without checking that the package you need was on the cdrom. (i don't have a 9.04 livecd handy, but at least on 9.10 it's not.) in that case restore your /etc/apt/sources.list and let's get your network up and running. – quack quixote Feb 20 '10 at 14:06

If you boot into the CD it should give you an option to 'Recover a broken system'.

  • I'm pretty sure there was no such option, I was looking precisely for something like that. Unless it is in some not so obvious place? – Sejanus Feb 19 '10 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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