The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd-pkg-ubuntu/pull/42
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Improves upgrade handling when LXD is upgraded on WSL under certain circumstances. Fixes https://bugs.launchpad.net/ubuntuwsl/+bug/1862550 Signed-off-by: Hayden Barnes hayden.bar...@canonical.com
From 709285465de32a1cc23b4904bf4422e1dfd64f71 Mon Sep 17 00:00:00 2001 From: Hayden <hayden.bar...@canonical.com> Date: Fri, 17 Apr 2020 15:19:24 -0400 Subject: [PATCH] Add handling for LXD upgrades on Ubuntu on WSL Improves upgrade handling when LXD is upgraded on WSL under certain circumstances. Fixes https://bugs.launchpad.net/ubuntuwsl/+bug/1862550 Signed-off-by: Hayden Barnes hayden.bar...@canonical.com --- debian/lxd.preinst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/debian/lxd.preinst b/debian/lxd.preinst index aede3e04..0ece79a4 100644 --- a/debian/lxd.preinst +++ b/debian/lxd.preinst @@ -1,6 +1,32 @@ #!/bin/sh set -e +skip_unusable_snapd() { + if [ -e "/run/snapd.socket" ]; then + # Snapd is present, run the upgrade + return 1 + fi + + if [ ! -e "/var/lib/lxd/server.crt" ]; then + # LXD was never used, safe to skip + return 0 + fi + + for path in containers images networks storage-pools; do + if [ ! -e "/var/lib/lxd/${path}" ]; then + # Path doesn't exist, continue to next one + continue + fi + + if [ -n "$(ls -A "/var/lib/lxd/${path}")" ]; then + # Detected some data, unsafe to skip automatically + return 1 + fi + done + + return 0 +} + case "$1" in install|upgrade) . /usr/share/debconf/confmodule @@ -23,6 +49,12 @@ case "$1" in COUNT=0 SKIP=false while :; do + if skip_unusable_snapd; then + echo "===> System doesn't have a working snapd and LXD was never used, skipping" + SKIP=true + break + fi + snap info lxd >/dev/null 2>&1 && break db_fset lxd/snap-no-connectivity seen false
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel