Power loss during updates. Now no boot.

Asked by Troy StGermain on 2020-10-21

I was doing updates to the SW and we lost power. Now when I boot up the PC it comes to flashing curser. Put in a new HD and loaded Ubuntu and the PC works. But I would like to get the old drive booting again.
Ubuntu 20.04.1 LTS

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Troy StGermain
Solved:
2020-10-21
Last query:
2020-10-21
Last reply:
2020-10-21

Boot to live CD desktop and run an fsck on the internal pertitions (while they are unmounted). You can then chroot to the installed OS and run:

sudo fuser -vki /var/lib/dpkg/lock
sudo dpkg --configure -a
sudo apt-get -f install

Which will make the updates continue and may help resolve issues.

If power is an issue where you live I can suggest you grab a cheap UPS which will give you time to gracefully power off the system when power issues occur

Troy StGermain (troystg) said : #3

Manfred Hampl (m-hampl)

I am researching your answer now...

actionparsnip (andrew-woodhead666)

How do I chroot to the other operating system? I Googled and then tried the following (also have pics of the files system also but don't know how I would attach them) :

===========================================================================

ubuntu@ubuntu:~/Desktop$ chroot

chroot: missing operand
Try 'chroot --help' for more information.
ubuntu@ubuntu:~/Desktop$ chroot --help
Usage: chroot [OPTION] NEWROOT [COMMAND [ARG]...]
  or: chroot OPTION
Run COMMAND with root directory set to NEWROOT.

  --groups=G_LIST specify supplementary groups as g1,g2,..,gN
  --userspec=USER:GROUP specify user and group (ID or name) to use
  --skip-chdir do not change working directory to '/'
      --help display this help and exit
      --version output version information and exit

If no command is given, run '"$SHELL" -i' (default: '/bin/sh -i').

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation at: <https://www.gnu.org/software/coreutils/chroot>
or available locally via: info '(coreutils) chroot invocation'

ubuntu@ubuntu:~/Desktop$ fdisk -l

fdisk: cannot open /dev/loop0: Permission denied
fdisk: cannot open /dev/loop1: Permission denied
fdisk: cannot open /dev/loop2: Permission denied
fdisk: cannot open /dev/loop3: Permission denied
fdisk: cannot open /dev/loop4: Permission denied
fdisk: cannot open /dev/loop5: Permission denied
fdisk: cannot open /dev/sda: Permission denied

ubuntu@ubuntu:~/Desktop$ sudo fdisk -l

Disk /dev/loop0: 1.93 GiB, 2049204224 bytes, 4002352 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop1: 27.9 MiB, 28405760 bytes, 55480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop2: 54.97 MiB, 57614336 bytes, 112528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop3: 240.82 MiB, 252493824 bytes, 493152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop4: 62.9 MiB, 65105920 bytes, 127160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop5: 49.8 MiB, 52203520 bytes, 101960 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 111.81 GiB, 120034123776 bytes, 234441648 sectors
Disk model: KINGSTON SA400S3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x33899325

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1050623 1048576 512M b W95 FAT32
/dev/sda2 1052670 234440703 233388034 111.3G 5 Extended
/dev/sda5 1052672 234440703 233388032 111.3G 83 Linux

===========================================================================

Also thank you for the suggestion on the UPS... Actually power outages here are rare but apparently they had to take down power to add a nearby commercial building to the grid. And usually the machine is powered off but I just happen to be studying something and left it on over night and the next day while at work.

https://www.simplified.guide/ubuntu/build-chroot-environment

A simple Web search and you'll find guides.

Troy StGermain (troystg) said : #5

I'll keep using the new drive...