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

  • 1
    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.
    – Taz D.
    Mar 15, 2014 at 15:29
  • 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".
    – user257308
    Mar 15, 2014 at 15:36
  • 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.
    – Taz D.
    Mar 15, 2014 at 15:53
  • @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.
    – psusi
    Mar 15, 2014 at 23:12
  • 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.
    – Taz D.
    Mar 16, 2014 at 10:29

2 Answers 2


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
  • 1
    Wait, isn't Ubuntu just effectively a collection of packages that, combined, give you the Ubuntu experience? Mar 15, 2014 at 15:45
  • Finally got something that I can't do with the terminal lol :P
    – user247696
    Mar 15, 2014 at 15:47
  • @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. Mar 15, 2014 at 16:12
  • 3
    @RaduRădeanu Why would reinstalling ubuntu-desktop help? It's a metapackage that doesn't directly provide software (instead, it just has lots of dependencies); reinstalling it shouldn't be expected to cause real software to be reinstalled. Have you checked to see what happens when you try this? (Or when you try simulating it with apt-get -s --reinstall install ubuntu-desktop?) "Reinstalling" ubuntu-desktop only fixes problems if there are missing dependencies for ubuntu-desktop that need installation. Mar 15, 2014 at 17:58
  • 1
    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.
    – Taz D.
    Mar 16, 2014 at 10:37

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 !


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