20

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

Tim
  • 32,861
  • 27
  • 118
  • 178
user257308
  • 301
  • 1
  • 2
  • 4
  • 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 '14 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 '14 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 '14 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 '14 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 '14 at 10:29

2 Answers2

12

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
Radu Rădeanu
  • 169,590
  • 1
    Wait, isn't Ubuntu just effectively a collection of packages that, combined, give you the Ubuntu experience? – saiarcot895 Mar 15 '14 at 15:45
  • Finally got something that I can't do with the terminal lol :P – user247696 Mar 15 '14 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. – Radu Rădeanu Mar 15 '14 at 16:12
  • 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 – user257308 Mar 15 '14 at 17:20
  • @user257308 So, have you tried sudo apt-get install --reinstall ubuntu-desktop? – Radu Rădeanu Mar 15 '14 at 17:24
  • 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 Mar 15 '14 at 17:30
  • 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. – Eliah Kagan Mar 15 '14 at 17:58
  • 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. – user257308 Mar 15 '14 at 18:19
  • @user257308 What's happen when you run sudo service lightdm start from your tty? – Radu Rădeanu Mar 15 '14 at 18:28
  • @Radu, I get "lightdm start/running, process 1586" – user257308 Mar 15 '14 at 21:01
  • 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 '14 at 10:37
  • And yes, you do have issues with either your Internet connection or with your repositories (Source Packages). Do you have some DSL connection using pppoe? – Taz D. Mar 16 '14 at 10:45
5

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 !

snoop
  • 4,040
  • 9
  • 40
  • 58