Repair Ubuntu installation

56,255

Solution 1

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.

Solution 2

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.

Share:
56,255

Related videos on Youtube

Ricky Adams
Author by

Ricky Adams

Updated on September 17, 2022

Comments

  • Ricky Adams
    Ricky Adams over 1 year

    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 :)

    • quack quixote
      quack quixote about 14 years
      not really a duplicate of those -- while the livecd-chroot helps, the important part of this question is what to reinstall that will fix the problem .
  • Ricky Adams
    Ricky Adams about 14 years
    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?
  • Justin Smith
    Justin Smith about 14 years
    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.
  • quack quixote
    quack quixote about 14 years
    +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.)
  • Ricky Adams
    Ricky Adams about 14 years
    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?
  • quack quixote
    quack quixote about 14 years
    @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
  • Ricky Adams
    Ricky Adams about 14 years
    @~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?
  • quack quixote
    quack quixote about 14 years
    @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.