Reinstalling Ubuntu via Terminal

323,917

Solution 1

Reinstall Ubuntu Operating System

You can install programs/applications via Terminal, but in neither case an operating system. The Terminal is good and you can do a lot of things with it, but this time you will need more than only the Terminal to reinstall Ubuntu.

Please read the following community wiki to find out what you need:

Reinstall Ubuntu desktop system

If you are referring only to the Ubuntu desktop system package, then you can use the following command to reinstall it:

sudo apt-get install --reinstall ubuntu-desktop

Solution 2

Trying to recover from a failed update between Ubuntu 14.04 and 16.04. The update was locked, the only to get out of it was to reboot the computer, and after reboot, I was presented with the terminal prompt and it would not launch Ubuntu desktop.

I followed your suggestion :

sudo apt-get install --reinstall ubuntu-desktop

It did not work, system told me to do :

sudo dpkg --configure -a" first. 

Which I did.

A new :

sudo apt-get install --reinstall ubuntu-desktop

failed and suggested to do :

sudo apt-get -f install

Back to a

sudo apt-get install --reinstall ubuntu-desktop

This one terminated. I shutdown the computer. During Shutdown I noticed it was displaying Ubuntu countdown. Good sign. I restarted again the computer, and it start to load as usual and launch Ubuntu desktop Unity. Success. Thanks for the tips !

Share:
323,917

Related videos on Youtube

user257308
Author by

user257308

Updated on September 18, 2022

Comments

  • user257308
    user257308 over 1 year

    I've currently encountered some issues with ubuntu causing me to be stuck in tty mode. I already tried fixing the issue but since I'm not sure of what really happened for this issue to occur I now just want to reinstall ubuntu. I was wondering if there is a way to reinstall ubuntu via terminal? I'm currently running 12.04.4 lts and I already tried the command line: sudo dpkg-reconfigure -phigh -a But that didn't do anything (after ~10 min of nothing happening a new command line appeard, I tried to restart but nothing changed)

    Any help is highly appreciated Thanks

    • Taz D.
      Taz D. about 10 years
      Have you tried the second choice in the boot menu, the one saying 'linux image generic [recovery mode]', and not the first one which says 'linux image generic'. Once you get to the recovery screen, choose the repair option from the menu. It should work especially if you have a working Internet connection up and running.
    • user257308
      user257308 about 10 years
      Thank you for your quick response, and Yeah I've tried that but it just goes to a bigger terminal screen and the last thing it says is "[9.122663] init: Failed to spawn console-setup main process: unable to execute: No such file or directory".
    • Taz D.
      Taz D. about 10 years
      Change your keyboard, use another one, i mean use some USB keyboard or better a ps/2 keyvoard if you can plug it in. What you just experienced seems to be a bug which has something to do with the keyboard. Maybe it will work with a generic keyboard.
    • psusi
      psusi about 10 years
      @floppy, the recovery screen gives you the option to repair ( fsck ) a damaged filesystem, which has no need for a network connection, and is quite unlikely to help anyhow.
    • Taz D.
      Taz D. about 10 years
      The recovery screen fixed my issues for a few times in the past. It uses sudo apt-get update and sudo apt-get upgrade, and it can download missing packages from the Internet or fix broken packages. I may be wrong since I am completely new to all this Linux experience.
  • saiarcot895
    saiarcot895 about 10 years
    Wait, isn't Ubuntu just effectively a collection of packages that, combined, give you the Ubuntu experience?
  • user247696
    user247696 about 10 years
    Finally got something that I can't do with the terminal lol :P
  • Radu Rădeanu
    Radu Rădeanu about 10 years
    @saiarcot895 Yes, you have right, but you probably need to be a very experienced user to do this with success until the end. Not to say about the time that you can lose it in comparison with the method described in the given link. See also my new edits.
  • user257308
    user257308 about 10 years
    Soooo....my problem is that I can only access the terminal so the link didn't really help, but thank you. Also it's ok if the reinstallation deletes my files since I have my important documents backed up anyway
  • Radu Rădeanu
    Radu Rădeanu about 10 years
    @user257308 So, have you tried sudo apt-get install --reinstall ubuntu-desktop?
  • user257308
    user257308 about 10 years
    Yeah I've tried that before but all I get is error messages and a ton of "Failed to fetch" messages. They seem to mostly involve us. archives.ubuntu.com, and security.ubuntu.com.
  • user257308
    user257308 about 10 years
    Well....I didn't get any error messages so it seemed to have worked.....but after rebooting I'm still in tty mode... So I don't know much about ubuntu or computers in general but generally when I update or when I tried to install (not reinstall) I always get the messages "failed to fetch" and they seem to be mostly archives. Could it be that it some how affected my internet connection? And if yes how could I check to make sure? Obviously this is just a hypothesis of a noob so if that is just a rediculous statement please tell me.
  • Radu Rădeanu
    Radu Rădeanu about 10 years
    @user257308 What's happen when you run sudo service lightdm start from your tty?
  • user257308
    user257308 about 10 years
    @Radu, I get "lightdm start/running, process 1586"
  • Taz D.
    Taz D. about 10 years
    What would happen if you typed instead: 'sudo service lightdm stop' ? Wait for a few seconds to get the message lightdm stopped/waiting, and restart lightdm using code: 'sudo service lightdm start' . This shold get you to the graphical login console so you be able to run a desktop session.