Subject: bug#583: lxc-templates: Devuan template for LXC

From: Ryutaroh Matsumoto <[email-masked]>
Date: Sun, 30 May 2021 19:07:51 +0900 (JST)

Package: lxc-templates
Version: 3.0.4-5
Severity: normal
Tags: patch chimaera ceres

Dear Maintainer,

There is no official way to build an LXC container running a Devuan host.
I modified /usr/share/lxc/templates/lxc-debian so that it can install Devuan
as attached diff.
I tested the modified template by the following two cases
on Devuan Chimaera amd64 host:

lxc-create -n devuan-beowulf -t devuan -- -F --enable-non-free -r beowulf
lxc-create -n beowulf-arm64 -t devuan -- -F --enable-non-free -r beowulf -a arm64

Best regards, Ryutaroh Matsumoto

-- System Information:
Distributor ID:	Devuan
Description:	Devuan GNU/Linux 4 (chimaera)
Release:	4
Codename:	n/a
Architecture: x86_64

Kernel: Linux 5.10.0-6-amd64 (SMP w/2 CPU threads)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages lxc-templates depends on:
ii  lxc  1:4.0.6-1

Versions of packages lxc-templates recommends:
ii  bridge-utils       1.7-1
ii  busybox-static     1:1.30.1-6+b1
ii  cloud-image-utils  0.31-2
ii  debootstrap        1.0.123+devuan3
ii  distro-info        1.0
ii  mmdebstrap         0.7.5-2.2
ii  openssl            1.1.1k-1
ii  rsync              3.2.3-4
ii  uuid-runtime       2.36.1-7+devuan1
ii  xz-utils           5.2.5-2

Versions of packages lxc-templates suggests:
ii  qemu-user-static  1:5.2+dfsg-10

-- no debconf information
--- usr/share/lxc/templates/lxc-debian	2021-03-12 19:53:24.000000000 +0900
+++ usr/share/lxc/templates/lxc-devuan	2021-05-30 17:20:09.881654064 +0900
@@ -37,8 +37,8 @@
 export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
 export GREP_OPTIONS=""
 
-MIRROR=${MIRROR:-http://deb.debian.org/debian}
-SECURITY_MIRROR=${SECURITY_MIRROR:-http://security.debian.org/debian-security}
+MIRROR=${MIRROR:-http://deb.devuan.org/merged}
+SECURITY_MIRROR=${SECURITY_MIRROR:-http://deb.devuan.org/merged}
 LOCALSTATEDIR="/var"
 LXC_TEMPLATE_CONFIG="/usr/share/lxc/config"
 # Allows the lxc-cache directory to be set by environment variable
@@ -98,6 +98,7 @@
 $(for tty in $(seq 1 "$num_tty"); do echo "c${tty}:12345:respawn:/sbin/getty 38400 tty${tty} linux" ; done;)
 p6::ctrlaltdel:/sbin/init 6
 p0::powerfail:/sbin/init 0
+pf::powerwait:/sbin/shutdown -h -P now
 EOF
 
     # symlink mtab
@@ -200,6 +201,9 @@
     local release="${1}"; shift
     local -i release_code=0
 
+    echo "${release}-updates"
+    return 0
+
     # oldoldstable is too old, let's ignore that case.
     if [[ "${release}" == "oldoldstable" ]]; then
         echo "${release}/updates"
@@ -386,7 +390,7 @@
     mkdir -p "$cache"
 
     # If debian-archive-keyring isn't installed, fetch GPG keys directly
-    releasekeyring=/usr/share/keyrings/debian-archive-keyring.gpg
+    releasekeyring=/usr/share/keyrings/devuan-archive-keyring.gpg
     if [ ! -f $releasekeyring ]; then
         releasekeyring="$cache/archive-key.gpg"
         case $release in
@@ -854,7 +858,7 @@
     exit 1
 fi
 
-configure_debian_systemd "$path" "$rootfs" "$config" $num_tty
+#configure_debian_systemd "$path" "$rootfs" "$config" $num_tty
 
 post_process "${rootfs}" "${release}" ${arch} ${hostarch} "${interpreter}" "${packages}"

---

From: Mark Hindley <[email-masked]>
Date: Sun, 30 May 2021 12:49:59 +0100

Control: tags upstream

Ryutaroh,

> lxc-create -n beowulf-arm64 -t devuan -- -F --enable-non-free -r beowulf -a arm64

Thanks for this. However Devuan doesn't fork any of the lxc pacakges and uses
Debian's pacakges directly without recompilation. This is probably best included
by submitting upstream, either to Debian or perhaps better
https://linuxcontainers.org/.

Are you able to do one of those?

Thanks

Mark

---

From: Ryutaroh Matsumoto <[email-masked]>
Date: Mon, 31 May 2021 09:06:20 +0900 (JST)

Hi Mark,

> https://linuxcontainers.org/.

I tend to disagree. Because

* linuxcontainers.org dropped support of templates other then "download".
   They actively maintain only the "download" template.
* Now each distro. seems having responsibility to maintain its own version of
   template, if that distro. is not satisfied with "download" template.
* Debian package maintainers maintains the Debian template, see
https://metadata.ftp-master.debian.org/changelogs//main/l/lxc-templates/lxc-templates_3.0.4-5_changelog
* "download" template only provides the limited choices of Devuan as
# lxc-create -n test -t download -- -d devuan
Setting up the GPG keyring
Downloading the image index

---
DIST	RELEASE	ARCH	VARIANT	BUILD
---
devuan	ascii	amd64	default	20210530_11:50
devuan	ascii	arm64	default	20210530_12:22
devuan	ascii	armel	default	20210530_12:07
devuan	ascii	armhf	default	20210530_12:22
devuan	ascii	i386	default	20210530_11:50
devuan	ascii	ppc64el	default	20210530_11:50
devuan	beowulf	amd64	default	20210530_11:50
devuan	beowulf	arm64	default	20210530_12:07
devuan	beowulf	armel	default	20210530_12:22
devuan	beowulf	armhf	default	20210530_11:50
devuan	beowulf	i386	default	20210530_11:50
devuan	beowulf	ppc64el	default	20210530_11:50
---

By the above observation, in my view,

(1) Attaching "upstream" to this issue is inappropriate. This is not an upstream issue.
(2) The question is whether or not Devuan is satisfied with "download"
template as above. If yes, attaching "wontfix" tag or closure of this issue is
appropriate.

Best regards, Ryutaroh

---

From: Mark Hindley <[email-masked]>
Date: Tue, 1 Jun 2021 09:25:47 +0100

Ryutaroh,

Thanks for adding more background to this.

> https://metadata.ftp-master.debian.org/changelogs//main/l/lxc-templates/lxc-templates_3.0.4-5_changelog

Looking at
https://salsa.debian.org/lxc-team/lxc-templates/-/tree/debian/unstable/templates,
Debian also has support for many other distros. Asking them to include Devuan
would seem to get the best coverage. 

Devuan doesn't fork lxc-templates. Even if we were to do so, only users of the
forked package would benefit from your suggested updates. If it is included in
Debian, then it will also benefit Debian itself and all derivatives.

Mark