You are not logged in.

#1 2017-02-12 17:27:09

DavidEGrayson
Member
Registered: 2012-12-11
Posts: 10

[SOLVED] Arch virtual machine cannot boot after botched package update

Hello.  I run Arch Linux (x86_64) as a VirtualBox guest (with guest additions) on a Windows 10 host.  It was working fine for over a year but now it cannot boot because of a botched package upgrade.  I'll split this post up into two main sections: the log of what has happened to the system, and a summary of the system's current state.

Log of what happened to the system

The other night, I was running "pacman -Syuu" or something very close to that to update my system.  The system somehow totally crashed during the update and rebooted.  The first time it rebooted, it was actually able to start X and KDE, but I was unable to click on anything or type anything in the virtual machine.  The second time it booted, I was unable to get past the GRUB menu; I would select Arch Linux in the menu but GRUB would just instantly reset in the blink of an eye without doing anything.

I forget if I did it before that second boot or after, but upgraded VirtualBox to the latest version (5.1.14 r112924), thinking that it might solve my problem, and it did not.

I downloaded the live CD (archlinux-2017.02.01-dual.iso) and "inserted" it into my virtual machine so I could see what is going on and try to fix it.

I tried many things on the live CD to fix the problem.  I don't remember exactly what things I did and what order I did them in, but here are some of the things I did:

I mounted my hard drive at /mnt successfully by running "mount /dev/sda1 /mnt".

I have chrooted into the /mnt directory successfully using "arch-chroot /mnt".

I might have run a pacstrap command, I forget the result.

I have run "pacman -Syyuu" several times to try to finish the upgrade.  One of the first times I ran this, pacman complained about how under /var/lib/pacman, it was missing the "desc" metadata file for the Linux package.  (Sorry I didn't write down the exact error message, but I think the package version was 4.9.8-1, the latest version.)

I Googled that error message and I found pacman commands to clear my package cache and to clear the metadata in /var/lib/pacman, so I ran those.  Sorry, I don't remember the exact commands.  There were also errors about some files existing on the operating system already, so I installed certain pacakges using --force to get around that.  Sorry, I don't remember which files.

But this stuff actually allowed me to make progress.  I was able to run "pacman -Syyuu" mostly successfully.  However, when installing or reinstalling the Linux package (with "pacman -Syyuu" or "pacman -S linux"), during hte "Updating module dependencies" phase, I get dozens of warnings of the form:

ldconfig: File /usr/lib/libQt5WebKitWidgets.so.5.8 is empty, not checked.

I think those warnings don't matter, and I don't see them every time I install the Linux package.  But I consistently get this error message when installing the Linux package:

:: Running post-transaction hooks...
(1/3) Install DKMS modules
==> dkms install vboxhost/5.1.14_OSE -k 4.9.8-1-ARCH
==> dkms install vboxguest/5.1.14_OSE -k 4.9.8-1-ARCH
(2/3) Updating linux initcpios
call to execv failed (Exec format error)
error: command failed to execute correctly
(3/3) Arming ConditionNeedsUpdate...

I wish that error message about execv were better.  If we look at the source code of the linux package (https://git.archlinux.org/svntogit/pack … ages/linux), we can see that the command that failed might be "/usr/bin/mkinitpcio -p linux".  I have run that command directly several times and it always succeeds without printing anything.

At one point I noticed that /boot/vmlinuz-linux had a size of zero, so I deleted it, but was able to recreate by reinstalling the linux package.


Summary of the system's current state

If I try to boot my system using GRUB or using the Arch Linux live CD's "Boot existing OS" option, I see the GRUB menu for a while, then GRUB tries to boot to Arch Linux using this command:

.linux ../vmlinuz-linux root=/dev/sda1 rw initrd=../initramfs-linux.img

Here is the entire output I get when GRUB runs that command.

Probing EDD (edd=off)
:: running early hook [udev]
Warning: /lib/modules/4.9.8-1-ARCH/modules.devnmae not found - ignoring
starting version 231
:: running hook [udev]
:: Triggering uevents...
Waiting 10 seconds for device /dev/sda1 ...
ERROR: device '/dev/sda1' not found.  Skipping fsck.
ERROR: Unable to find root device '/dev/sda1'.
You are being dropped to a recovery shell
    Type 'exit' to try and continue booting.
sh: can't access tty; job control turned off
[rootfs ]#

So my system cannot find /dev/sda1 and that is the main issue I am trying to solve right now.  Also, note that sh cannot access the tty, and I cannot actually type anything in the recovery shell so it is unusable.

If I choose "Arch Linux Fallback" from the GRUB menu, I get the exact same behavior.

The output of "fdisk -l" on the live CD looks normal, and it is:

Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 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
Disklabel type: gpt
Disk identifier: 6414565C-69F2-4F26-9E4A-3F426D5980D1

Device     Start       End   Sectors  Size Type
/dev/sda1   2048 419430366 419428319  200G Linux filesystem


Disk /dev/loop0: 361.1 MiB, 378667008 bytes, 739584 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

I can mount /dev/sda1 as /mnt and use arch-chroot and pacman to manage packages installed on that partition.

Here is the output from "ls -l /mnt/boot" (I don't understand the timestamps):

total 30812
-rw-r--r-- 1 root root 20983447 Sep 23 01:21 initramfs-linux-fallback.img
-rw-r--r-- 1 root root  5694005 Sep 23 01:21 initramfs-linux.img
drwxr-xr-x 2 root root     4096 Apr 28  2016 syslinux
-rw-r--r-- 1 root root  4863776 Feb  6 12:01 vmlinuz-linux

The non-comment lines of /mnt/etc/mkinitcpio.conf are:

MODULES=""
BINARIES=""
FILES=""
HOOKS="base udev autodetect modconf block filesystems keyboard fsck"

There is only one file in /mnt/etc/mkinitcpio.d.  It is named "linux.preset" and its contents are:

# mkinitcpio preset file for the 'linux' package

ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux"

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux.img"
#default_options=""

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-linux-fallback.img"
fallback_options="-S autodetect"

If anyone can give me tips on how to get my operating system to recognize /dev/sda1 or how to get the recovery shell to recognize keystrokes, that would be great.  I've tried a lot of things I saw on this forum but nothing has helped.  Thanks!

Last edited by DavidEGrayson (2017-02-13 17:28:35)

Offline

#2 2017-02-13 16:43:55

DavidEGrayson
Member
Registered: 2012-12-11
Posts: 10

Re: [SOLVED] Arch virtual machine cannot boot after botched package update

Update: I was already suspicious that my initramfs images had such an old timestamp.  I looked into it and found out that /usr/bin/mkinitcpio was an empty file, so most of the time when I ran it, it just quietly did nothing.  By force-reinstalling the mkinitcpio package and then force-reinstalling the linux package, I was able get a better Linux image to boot into. This time, the issue is that "init" could not be run and I am looking in to that.  There are a lot of files in /usr/bin and /usr/lib that are size 0, so I will look into telling pacman to reinstall all my packages.

Side note:  Any idea why so many files would have a size of 0?  Does pacman set multiple files to be empty before changing their contents?

Last edited by DavidEGrayson (2017-02-13 16:48:13)

Offline

#3 2017-02-13 17:28:20

DavidEGrayson
Member
Registered: 2012-12-11
Posts: 10

Re: [SOLVED] Arch virtual machine cannot boot after botched package update

SOLVED:  Using the LiveCD, I ran this command to reinstall all my packages:

pacman -Qnq | pacman -S --force -

This fixed all or most of those files that had a zero size.  The package hooks for the mkinitcpio and the linux package probably would take care of remaking the propery initramfs images.  After doing this, I was able to boot normally and run things like KDE, Konsole, and emacs again, so I think things are working.

Offline

Board footer

Powered by FluxBB