AUR Dependency Conflicts


In my last post I wrote about gathering nginx VTS metrics with nginx-mod-vts, a dynamic nginx module I chose to build through an AUR package. This has come back to bite me a little bit, and I want to document the steps that went into my last nginx update so I have a reference going forward.

After the latest update of nginx-mainline, I started receiving this error when I attempted to update my system:

looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing nginx-mainline (1.19.0-1) breaks dependency 'nginx-mainline=1.17.10' required by nginx-mainline-mod-vts

I thought this was odd, I hadn’t known that dependencies from AUR packages could cause conflicts in my system updates. I went to build the AUR package for nginx-mainline-mod-vts, but found it was not updated for the last two releases of nginx-mainline. I assume whoever maintains this is busy – things are tough out there right now – and the PKGBUILD file is pretty straightforward, so I bumped the version numbers, updated the package references and hashes, and attempted to build, only to run into the same problem:

$ makepkg -sic
==> Making package: nginx-mainline-mod-vts 0.1.18-21 (Tue 09 Jun 2020 09:04:54 PM CDT)
==> Checking runtime dependencies...
==> Installing missing dependencies...
[sudo] password for lombardi: 
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing nginx-mainline (1.19.0-1) breaks dependency 'nginx-mainline=1.17.10' required by nginx-mainline-mod-vts
==> ERROR: 'pacman' failed to install missing dependencies.
==> Missing dependencies:
  -> nginx-mainline=1.19.0
==> Checking buildtime dependencies...
==> ERROR: Could not resolve all dependencies.

So at this point when I tried to update nginx-mainline, I would get a dependency conflict because nginx-mainline-mod-vts depended on a prior version, and if I attempted to update nginx-mainline-mod-vts, I would get a dependency conflict for the same reason (if I remember correctly, dropping the -s flag did not help). If I wanted to get an update through without downtime and without removing the packages dependency specification, it seemed to me that I would have to update these at the same time somehow.

Eventually I stumbled into this Reddit thread that led me to this Arch wiki page describing how to build packages with a clean chroot.

Here’s what I ended up running to get this package built and installed:

# Create the clean chroot, which will be stored in ~/chroot
mkdir ~/chroot
CHROOT=$HOME/chroot
mkarchroot $CHROOT/root base-devel

# Verify chroot has updated packages, which will be necessary for future runs with the same chroot
arch-nspawn $CHROOT/root pacman -Syu

# Make sure to run this in the directory with the broken packages PKGBUILD
makechrootpkg -c -r $CHROOT

# Installs the recently built AUR package and its dependencies at the same time
# Alternatively, you can install the recently built package with pacman -U $PACKAGE
makepkg -i 

I felt a huge relief seeing this output after the makepkg call:

==> WARNING: A package has already been built, installing existing package...
==> Installing package nginx-mainline-mod-vts with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (2) nginx-mainline-1.19.0-1  nginx-mainline-mod-vts-0.1.18-21

Total Installed Size:  1.79 MiB
Net Upgrade Size:      0.02 MiB

Installing some ~750mb for a clean chroot for that small of an upgrade felt a bit silly. Hopefully I’ll figure out a better system by the time the next nginx-mainline release comes out.