A couple of tips on how to recover from a failed Ubuntu upgrade

25/12/2011 at 9:50 am Een reactie plaatsen

Last week I decided to give Ubuntu 11.10 a try on my Toshiba Satellite L670-1DT (64 bit). Having Ubuntu 11.04 already installed on this machine, and having a lot of extra software that I did not want to reinstall on that machine, I thought it was wise to go for an upgrade, instead of a fresh install. Well, I was wrong.

I started the upgrade from within the graphical screen. Downloading the new packages went without a flaw. However, just after about ten minutes, and during the software replacement phase of the upgrade, bang, there it was: just a black screen, no graphical screen any more, and a fatal error message on the screen: kernel panic, and no other activity on the machine whatsoever. The only option I had, was to power off the machine, and hope for the best.

I powered the machine back on. It would still boot into Linux, but  with a lot of error messages and only a text screen. There was no prompt, neither text based, and certainly not a graphical interface. So here I was, with a broken machine in an in-between state of two Ubuntu versions. What would be the best tactic of repair? And generally speaking, what are the best tactics of diagnosis and repair?
This is what I want to discuss in this blog entry, with a few simple basic tips. Oh and by the way: I fixed the Toshiba machine was (without reinstall…) and it’s working fine with Ubuntu 11.10 now, and Ubuntu 11.10 is just great. But would I recommend an upgrade from 11.04 to 11.10 instead of doing a fresh install? Well, I’m not so sure about that…just install a fresh Ubuntu 11.10.

Anyway, here is a couple of tips, for an Ubuntu machine that an upgrade was attempted on, with (at least…) no graphical screen appearing after a failed upgrade. My own situation after the failed upgrade was:

- no prompt
- no network
- a machine with an in-between Ubuntu version.

NB: all commands in Linux are case sensitive.

Tip 1. Always first check that your personal data is still in place.

If your personal data is still in place, you’ll feel a lot less lost.

Start your computer in Ubuntu recovery mode, and select root shell prompt. Press Ctrl-Alt-F2. A login prompt will appear. Type in your regular name and password. Type in: ls  (Enter). Do you see your files? Okay then, your data is still in place.

Tip 2. Check and possibly repair your internet connection (at least temporarily), and use it to repair. With a network cable plugged in into the machine, start your machine in Ubuntu recovery mode. In the recovery menu, select the drop to root shell prompt option (possibly with networking option). Type in: ifconfig (Enter). In the best case, it will show something like this:


eth0      Link encap:Ethernet  HWaddr 87:ae:1e:cf:0e:b3
inet addr:  Bcast:  Mask:
RX packets:7047 errors:0 dropped:0 overruns:0 frame:0
TX packets:6503 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6643595 (6.6 MB)  TX bytes:1093342 (1.0 MB)
Interrupt:40 Base address:0×8000

lo        Link encap:Local Loopback
inet addr:  Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:336 errors:0 dropped:0 overruns:0 frame:0
TX packets:336 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:26880 (26.8 KB)  TX bytes:26880 (26.8 KB)

The eth0 part is the networking part, and is the cable connection. It tells you that you have an IP address (inet addr). You could try a ping command to some internet site that can be pinged. If you get a response, you know that your network is still working.

From here, we have two scenarios:

- save personal data in a safe place and do a fresh installation; next, copy your data back on a fresh install
- continue the failed upgrade

If you want to go for the first option (save your data and start all over again), you can do the following, using the winscp program:

- install ssh on your Ubuntu machine: sudo apt-get install ssh. After installation, type: sudo /etc/init.d/ssh start. This will start your machine in server mode, and will allow you to get your files from the machine to any other place, including a to Windows machine. Download winscp. Install the package, and start it. Basically, you can now make a connection to your Ubuntu machine by entering the IP address of the Ubuntu machine, and by entering your username and password. Copy / paste all data that you would like to save. Your personal data is in /home/username.

Now let’s assume we want to opt for the second option: continue the failed upgrade. With a working network connection, you can just type in: sudo apt-get update, followed by sudo apt-get upgrade. Ignore error messages, and wait for the upgrade to finish.

But the situation could also be that you only see this:

lo        Link encap:Local Loopback
inet addr:  Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:336 errors:0 dropped:0 overruns:0 frame:0
TX packets:336 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:26880 (26.8 KB)  TX bytes:26880 (26.8 KB)

In this case, your network is not working, and you’ll have to do some more work to, at least, get an Internet connection and to continue the previously failed upgrade.

Restart your computer in Ubuntu recovery mode, and select root shell prompt again. You can still:

- start scripts
- enable network interfaces
- get an IP adress through DHCP

Start scripts: all initialization scripts are located in the folder /etc/init.d/ Type in: /etc/init.d/networking start (Enter). After getting back to the prompt, type in: dhclient (Enter). Now check your network: ifconfig eth0. You should see that your Internet connection is working again, at least manually, and you should see something like shown in the first example, and you can continue the previously failed upgrade:sudo apt-get update (Enter) and sudo apt-get upgrade (Enter). Follow the instructions as shown on the screen.

Most of the time, and despite some very not-reassuring messages on the screen, you will see that the upgrade will continue up to a point where the upgrade procedure will prompt you to restart your machine. With a little bit of luck, the machine will be up and running again. If you’re not lucky, the machine will start, but will, e.g., not show any graphical screen. That happened in my case.

Tip 3. Check log files after (unsuccesful) full start.

Again, you may be lucky, or not. This was the case with my laptop, telling me (in text mode) something about apache being not well configured, and it just halted there: a black screen with some text.
Now we have two choices: on another machine, Google  for the exact error message (I think that’s a don’t) and check some log messages (I think that’s a do). I think that Googling for the exact error message is a don’t, because the last message on the screen is NOT per se the fatal message. Myriads of causes can apply tho the system not booting 100% correctly, and you will find at least a hint to the exact cause in the log files.
Log files are located in the /var/log/ directory. You can always access them, non-graphically, by doing the Ctrl-Alt-F2 thing, logging in with your normal account. Once you are logged in, type in cd /var/log (Enter). Type ls, and you’ll see all log files. You can read the content with the cat command, e.g. cat boot.log. If the file is too big, you can do cat boot.log | more.

The most important log files are:

- boot.log. Always check it. It will tell you which programs did load correctly, and which did not. Sometimes, the load failure is as simple as the package not being installed. If this is the case, you can always add it by typing sudo apt-get install <packagename>
- Xorg.0.log (that is with X, not with x). This is the log file of the graphical part (the “X server”). Any problems with the graphical screen will be reported here
- dpkg.log. That’s a log of all installed and  removed packages. Check what this file says about the missing (or wrongly installed package).
- syslog. That is the running system log.

The most important commands to read the log files in text mode are:

- cat (“show on the screen”)
- cat filename | more (“show on the screen as much as can fit on the screen”)
- cat filename | grep sometext (show on the screen the content of the file, but only the things that I want to see. e.g.: cat boot.msg | grep error
- tail -f filename (show the content on the screen and see the content as it is appended). e.g.: tail -f -n 100 /var/log/syslog. The -n is the number of lines

A tail command can always be interrupted with Ctrl-c.

Hope this information is helpful for anyone facing a failed Ubuntu upgrade.

Entry filed under: Uncategorized. Tags: .

Previewing files and folders on Ubuntu 11.04 with Gloobus Preview How to recover your Windows files when nothing helps any more

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )


Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Posted previously


Ontvang elk nieuw bericht direct in je inbox.

%d bloggers like this: