Title: --- layout: post title: "Installing Updates (Do not unplug or turn off your c
Author: goakley
Pastebin link: http://pastebin.com/fvx12K5t
First Edit: Monday 30th of September 2013 08:43:27 PM CDT
Last Edit: Monday 30th of September 2013 08:43:27 PM CDT
---
layout: post
title: "Installing Updates (Do not unplug or turn off your computer)"
date: 2013-09-29 18:00:00
---
Laptop batteries: possibly the most expensive component to replace on a laptop. Unless you go third party, of course!
What's more reliable than trusting an off-brand manufacturer to supply the driving component of your entire machine? Probably trusting the original manufacturer to supply the driving component of your entire machine. Leaving my laptop on battery causes it to die:
* At over 90% CPU load
* Loading a multitude of tabs in Firefox
* Because I needed it to be on
By now, I should have learned my lesson to not run `pacman -Su` on battery, but what are the odds that I'll die at 80% battery?
Okay, well, no big deal, I've died during updates before, and as long as it wasn't during `mkinitcpio`, there haven't been any immediate repercussions.
```
switch_root: failed to execute /sbin/init: Input/output error
[ 0.000000] Kernel panic - not syncing: Attempted to kill init!
```
Oh dear.
Okay, no big deal! There have been lots of times where I've been left with a 0-byte file on the system; that would totally cause an I/O error. Perhaps it had something to do with the fact that [I changed syslinux to mount rw](https://bbs.archlinux.org/viewtopic.php?pid=1303683#p1303683). Regardless, time to boot off of USB! Good thing I always have an Altoid tin full of Arch Linuxes (Linuxii?).
Since `init` is owned by systemd, I first decided to forcibly reinstall systemd and systemd-sysvcompat
```
$ mount /dev/sda1 /mnt
$ pacman -S -r /mnt --force systemd systemd-sysvcompat
$ ls -l /lib/systemd/systemd
-rwxr-xr-x 1 root root 1039792 Sep 19 18:12 /lib/systemd/systemd
```
Cool! Clearly fixed!
```
switch_root: failed to execute /sbin/init: Input/output error
[ 0.000000] Kernel panic - not syncing: Attempted to kill init!
```
wat
Okay, well, is this just systemd?
```
nano /mnt/boot/syslinux/syslinux.cfg
...
LABEL archfallback
...
APPEND root=/dev/sda1 init=/bin/sh rw
...
```
```
switch_root: failed to execute /bin/sh: Input/output error
[ 0.000000] Kernel panic - not syncing: Attempted to kill init!
```
...Right. OKAY, WELL, let's think. What was I doing when the laptop died?
```
$ cat /var/log/pacman.log
...
[0000-00-00 00:00] [PACMAN] starting full system upgrade*SO MUCH CORRUPTED BINARY DATA*
```
WELL THEN. Maybe the packages are still there.
```
$ ls -l /var/cache/pacman/pkg
-rw-r--r-- 1 root root 8611472 Sep 26 13:28 glibc-2.18-5-x86_64.pkg.tar.xz
-rw-r--r-- 1 root root 0 Sep 26 13:28 glm-0.9.4.6-1-any.pkg.tar.xz
-rw-r--r-- 1 root root 0 Sep 26 13:28 lib32-flashplugin-11.2.202.310-1-x86_64.pkg.tar.xz
-rw-r--r-- 1 root root 0 Sep 26 13:28 lib32-glibc-2.18-5-x86_64.pkg.tar.xz
-rwxr-xr-x 1 root root 0 Sep 26 13:28 libdvbpsi-1-1.1.0-1-x86_64.pkg.tar.xz
-rw-r--r-- 1 root root 0 Sep 26 13:28 m4-1.4.17-1-x86_64.pkg.tar.xz
-rw-r--r-- 1 root root 0 Sep 26 13:28 phonon-vlc-0.6.2-2-x86_64.pkg.tar.xz
-rw-r--r-- 1 root root 0 Sep 26 13:28 vlc-2.1.0-2-x86_64.pkg.tar.xz
```
wat
WAT
That might be a bit of a problem! A quick re-download and MASSIVE FORCE INSTALL from the USB drive...
```
Generating locales...
Floating Point Exception.
```
Reeeaaally? Okay. That's fine. Fine! Booting back to /bin/sh, and ignoring all the horrible boot warning and errors, there is a shell!
```
$ locale-gen
Generating locales...
en_US.UTF-8... done
ja_JP.UTF-8... done
ru_RU.UTF-8... done
```
Reboot to /sbin/init, and fixed! Just in time for class. I'd like to say I've learned my lesson, but I know something like this will happen again.