25

I was attempting to update my 11.10 install to 12.04beta. During the install step, I accidentally lost power to my laptop (the power cable came unplugged) and it shut down. Whenever I go to boot now, I can select my install via Grub and it loads up to where the sign-in should happen, but I get a display that looks like what you see as soon as you shut down. It looks like it locks after checking for the battery.

Is there anyway, with or without Live media, to restore my machine's install/update to 12.04 but still keep my settings/applications/files?

Organic Marble
  • 23,641
  • 15
  • 70
  • 122
Ryan McClure
  • 6,021
  • I know the question is marked as answered, but I note that part of this question hasn't been answered as of posting this comment. I'd also like to know how to switch to 12.04 in case of trouble. – Kernel Oct 21 '13 at 17:00

2 Answers2

38

Did you try booting into the recovery mode (selected via grub)? You could then try to restart the upgrade with

sudo apt-get update
sudo apt-get upgrade

You may need to run

sudo dpkg --configure -a

to fix the partially installed packages.

If the recovery mode is also broken, you could try booting off a live cd and then chroot'ing into your hard drive installation and performing the above steps.

To chroot into your hard drive installation, first boot off a live cd. You can use the ubuntu install CD for this task, just choose the option "try ubuntu" rather than installing. Once booted, open a terminal and mount your root partition. If your root partition is /dev/sda1 (to find out your root partition, there is a guide at https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows#The_terminal_way):

sudo mkdir -p /media/ubuntu
sudo mount /dev/sda1 /media/ubuntu

Then you need to mount the proc, dev, and sys filesystems into your new environment:

sudo mount --bind /dev /media/ubuntu/dev
sudo mount --bind /proc /media/ubuntu/proc
sudo mount --bind /sys /media/ubuntu/sys

Enable networking:

cp /etc/resolv.conf /media/ubuntu/etc/resolv.conf

Finally, chroot into it:

sudo chroot /media/ubuntu

From here you can run apt-get and dpkg to fix your system. This is identical to the way that people fix grub using chroot, in case you run into problems you can google something like "grub chroot ubuntu livecd" and find more info.

pestilence
  • 1,595
  • How exactly do I chroot into my install from Live? – Ryan McClure Mar 09 '12 at 19:12
  • Updated my answer with that info. – pestilence Mar 09 '12 at 19:51
  • I'm unable to run "sudo dkpg --configure -a"... "unable to resolve host ubuntu".

    Also, if I try to do "apt-get update", I get "failed to fetch..." for every repository.

    And, running apt-get upgrade does nothing. Any thoughts?

    – Ryan McClure Mar 09 '12 at 20:09
  • Sounds like networking isn't setup properly. Is networking setup on the live cd? If it is, there has to be some way to make it accessible in the chroot environment as well. – pestilence Mar 09 '12 at 20:18
  • 1
    managed to get it to boot up from recovery mode after i did a dpkg from the menu...now I can boot 12.04 but a lot is missing and not working properly. I can, however, run apt-get update and upgrade, so when my 56k internet decides to finish up, I'll post a result. – Ryan McClure Mar 10 '12 at 00:50
  • I have a similar problem; during the upgrade from 14.04 to 15.04 via 'do-release-upgrade' my laptop shut down and I didn't know until morning and now I can't boot it up. I've posted a question about it here on askubuntu and this helped a little bit, but I'm still having issues loading my system and can do nothing but boot into recovery. How would I try to fix it from the root shell? I don't have a media (lack of preparation I know) – Jerry White Nov 07 '15 at 18:47
  • I also need to add that I was able to run dpkg --configure -a. And apt-get update and upgrade but still the issue persists. – Jerry White Nov 07 '15 at 19:05
0

Debian and Ubuntu are similar and for these kind of problems the same solutions works.

During Debian update, my workstation experienced a power lost. Grub worked and MS Windows does, but Debian entry didn't. Setup crashed with an unusual prompt in text mode.

The solution was quite simple. Run the computer with a Debian CD and choosing the Advanced options->Rescue Mode (something like that) on the main and initial menu.

Network is not important.

I chose the option of the bottom "continue without mounting or installing root file system" (this provided reduced functionalities)... but I required just them...

Once in the prompt I used

#fdisk -l to list my partitions.

My root partition was in /dev/sdb1

I used:

#fsck /dev/sdb1 

to fix my problem... giving "yes" to all questions.

When it finished I repeated the command. Obtaining in this case no questions and quick finish (because problems were fixed in the first invocation of the command) Just to be sure.

I rebooted my system without the Live CD and it was able to run again the Linux System... during setup many problems with other partitions were found and fixed but the system setup was successful.

I hope this experience will be useful.