Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: de...@packages.debian.org
Control: affects -1 + src:debvm

Please unblock package debvm

[ Reason ]

debvm is fairly new and was stabilizing right into the freeze. Thus
there are a few late changes that I hope to get into bookworm.

[ Impact ]

There are some notable changes indeed:
 * The biggest chunk of difference is documentation updates in various
   places. In particular, this includes adding examples for usage.
 * The biggest user facing change is the deprecation of the
   --architecture option for debvm-create. I paid attention to not just
   delete it (to avoid breaking things that already use it), but it no
   longer is documented and getting rid of it in bookworm already would
   make phasing it out later easier.
 * The --graphical option to debvm-run is fixed and improved.
 * Support for using 64bit kernels on mipsel.
 * An autopkgtest workaround for kernel bug #1029270 is being deleted.

[ Tests ]

autopkgtests succeed. The reason for the need on an unblock is that I
had to disable 32bit arm, because qemu tcg emulation is too slow to boot
Linux there. Other than that, it would migrate as a non-key package with
autopkgtests. On salsa, more tests are run. I've used the updated
version for quite some time now and not encountered more issues.

[ Risks ]

The affected functionality is not central to debvm or (in case of
--architecture) explicitly kept backwards-compatible. Thus I see little
risk for breakage.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

[ Other info ]

There is one possible change missing. Due to the archival of jessie,
using it with debvm now requires passing a mirror. If there is a need
for another update of debvm in bookworm, I intend to piggy-back an
example to the documentation about how to use jessie with
archive.debian.org.

unblock debvm/0.2.10

Thanks in advance

Helmut
diff --git a/README.md b/README.md
index 6fdda9e..1ccda36 100644
--- a/README.md
+++ b/README.md
@@ -77,9 +77,11 @@ The debvm tools are licensed under the MIT license.
 Contributors
 ============
 
+ * Arnd Bergmann
+ * Gioele Barabucci
  * Helmut Grohne (main author)
- * Johannes Schauer Marin Rodrigues (main author of `mmdebstrap`)
  * Jochen Sprickerhof
+ * Johannes Schauer Marin Rodrigues (main author of `mmdebstrap`)
 
 [^1] This technically is a lie. It employs user namespaces and thus requires
      the setuid binary `newuidmap` as well as a suitable subuid allocation.
diff --git a/bin/debvm-create b/bin/debvm-create
index 89256eb..1c7c29d 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -11,7 +11,7 @@ debvm-create - Create a VM image for various Debian releases and architectures
 
 =head1 SYNOPSIS
 
-B<debvm-create> [B<-a> I<architecture>] [B<-h> I<hostname>] [B<-k> F<sshkey>] [B<-o> F<output>] [B<-r> I<release>] [B<-s> <task>] [B<-z> I<size>] [B<--> I<mmdebstrap options>]
+B<debvm-create> [B<-h> I<hostname>] [B<-k> F<sshkey>] [B<-o> F<output>] [B<-r> I<release>] [B<-s> <task>] [B<-z> I<size>] [B<--> I<mmdebstrap options>]
 
 =head1 DESCRIPTION
 
@@ -26,12 +26,6 @@ No user account is created and root can login without specifying a password.
 
 =over 8
 
-=item B<-a> I<architecture>, B<--architecture>=I<architecture>
-
-Specify a Debian architecture name.
-By default, the native architecture is being used.
-A suitable kernel image is automatically selected and installed into the image.
-
 =item B<-h> I<hostname>, B<--hostname>=I<hostname>
 
 Set the hostname of the virtual machine.
@@ -131,15 +125,43 @@ All options beyond a double dash are passed to B<mmdebstrap> after the suite and
 This can be used to provide additional hooks for image customization.
 You can also request additional packages to be installed into the image using B<mmdebstrap>'s B<--include> option.
 Any positional arguments passed here will be treated as mirror specifications by B<mmdebstrap>.
+In particular, you can also change the architecture of the resulting image using the B<--architecture> option.
 
 =back
 
 =head1 EXAMPLES
 
-In order to create images for Debian ports architectures, you can pass two options to mmdebstrap:
+When creating an image with multiple architectures, the kernel selection will prefer the sibling 64bit architecture.
+
+    debvm-create ... -- --architecture=armhf,arm64
+
+In order to create images for Debian ports architectures, you can pass two options to mmdebstrap.
 
     debvm-create ... -- http://deb.debian.org/debian-ports --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg
 
+You can also install a graphical desktop environment.
+
+    debvm-create ... -- --hook-dir=/usr/share/mmdebstrap/hooks/useradd --aptopt='Apt::Install-Recommends "true"' --include=linux-image-generic,task-gnome-desktop
+
+Here the hook creates a password-less user C<user>.
+In order for C<task-gnome-desktop> to work reasonably well, C<Recommends> should be enabled.
+By default a C<-cloud> kernel that lacks graphics drivers is installed.
+
+Installing Ubuntu is also supported somewhat.
+
+    debvm-create --release kinetic -- --keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg --components=main,universe --include=e2fsprogs
+
+Note that C<universe> must be enabled as the C<merged-usr> and C<systemdnetwork> hooks rely packages from that component.
+C<e2fsprogs> should be pulled by C<initramfs-tools>.
+
+There also is an aid for sharing a directory with the VM.
+
+    debvm-create ... -- --include=linux-image-generic --hook-dir=/usr/share/mmdebstrap/hooks/9pmount
+    debvm-run ... -- -virtfs local,security_model=none,path=/host_path,mount_tag=guest_tag
+
+This will mount the directory C</host_path> from the host as C</media/guest_tag> in the VM during boot using 9P.
+Note that the C<-cloud> kernel lacks the 9P filesystem driver.
+
 =head1 SEE ALSO
 
     debvm-run(1) mmdebstrap(1)
@@ -149,7 +171,7 @@ POD2MAN
 
 set -u
 
-ARCHITECTURE=$(dpkg --print-architecture)
+ARCHITECTURE=
 IMAGE=rootfs.ext4
 INITSYSTEM=systemd
 SIZE=1G
@@ -170,7 +192,7 @@ die() {
 	exit 1
 }
 usage() {
-	die "usage: $0 [-a architecture] [-h hostname] [-k sshkey] [-o output] [-r release] [-s task] [-z size] [-- mmdebstrap options]"
+	die "usage: $0 [-h hostname] [-k sshkey] [-o output] [-r release] [-s task] [-z size] [-- mmdebstrap options]"
 }
 usage_error() {
 	echo "error: $*" 1>&2
@@ -178,6 +200,8 @@ usage_error() {
 }
 
 opt_architecture() {
+	# This option only exists for backwards-compatibility.
+	# You can pass it as mmdebstrap option instead.
 	ARCHITECTURE=$1
 }
 opt_hostname() {
@@ -280,10 +304,13 @@ set -- \
 	--verbose \
 	--variant=apt \
 	"--format=$MMFORMAT" \
-	"--architecture=$ARCHITECTURE" \
 	'--customize-hook=echo "LABEL=debvm / ext4 defaults 0 0" >"$1/etc/fstab"' \
 	"$@"
 
+if test -n "$ARCHITECTURE"; then
+	set -- "--architecture=$ARCHITECTURE" "$@"
+fi
+
 case "$INITSYSTEM" in
 	busybox)
 		set -- \
diff --git a/bin/debvm-run b/bin/debvm-run
index 53bfb3b..7da7cd0 100755
--- a/bin/debvm-run
+++ b/bin/debvm-run
@@ -28,6 +28,7 @@ A net interface configured for user mode is added automatically.
 
 By default, the option B<-nographic> is passed to B<qemu> and one interacts with the serial console of the machine.
 This configuration is skipped in the presence of this option.
+Note that B<debvm-create> defaults to installing a cloud kernel if available, so you may have to pass C<--include=linux-image-generic> during image construction to get graphics drivers.
 
 =item B<-i> F<image>, B<--image>=F<image>
 
@@ -66,7 +67,8 @@ F<rootfs.ext4>, resulting in an ephemeral run.
 
 Make sure C<$TERM> is set to a value known inside the VM.
 You may need to install B<ncurses-term> for more definitions.
-It also helps to run C<setterm --resize> after boot and when resizing the terminal emulator.
+The serial console will miss events of resizing the terminal emulator.
+You may run C<setterm -resize> in that case.
 
 =item How can I kill debvm-run?
 
@@ -140,7 +142,10 @@ while getopts :gi:s:-: OPTCHAR; do
 				help)
 					usage
 				;;
-				graphical|image|sshport)
+				graphical)
+					"opt_$OPTARG"
+				;;
+				image|sshport)
 					test "$OPTIND" -gt "$#" && usage_error "missing argument for --$OPTARG"
 					"opt_$OPTARG" "$(nth_arg "$OPTIND" "$@")"
 					OPTIND=$((OPTIND+1))
@@ -224,6 +229,7 @@ if command -v file >/dev/null 2>&1; then
 		# actually inspect the kernel version here, which happens to
 		# include amd64 for Debian kernels.
 		"i386:Linux kernel x86 boot executable bzImage, version "*"-amd64 "*) KERNELARCH=amd64 ;;
+		"mipsel:ELF 64-bit LSB executable,"*) KERNELARCH=mips64el ;;
 	esac
 fi
 
@@ -358,7 +364,17 @@ else
 		amd64|i386)
 			set -- -vga virtio "$@"
 		;;
+		*)
+			set -- \
+				-device virtio-gpu-gl-pci \
+				-display gtk,gl=on \
+				"$@"
+		;;
 	esac
+	set -- \
+		-device virtio-keyboard-pci \
+		-device virtio-tablet-pci \
+		"$@"
 fi
 
 if test -n "$SSHPORT"; then
diff --git a/bin/debvm-waitssh b/bin/debvm-waitssh
index 82eb14d..2b843a5 100755
--- a/bin/debvm-waitssh
+++ b/bin/debvm-waitssh
@@ -151,8 +151,8 @@ case "$HOST" in *@*)
 # Guard against strings containing anything but digits, strings starting with
 # zero and empty strings as the port number.
 #
-# We cannot use [!0-9] because that matches on any character (or possibly
-# multi-character collation element) that sorts in between 0 and 9.
+# In some locales, [0-9] can match other kinds of digits, see
+# https://unix.stackexchange.com/a/414230/46985.
 case "$PORT" in *[!0123456789]*|0?*|""|??????*)
 	die "$0: port '$PORT' is not an integer between 1 and 65535"
 ;; esac
diff --git a/debian/changelog b/debian/changelog
index 7d54283..79ab510 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+debvm (0.2.10) unstable; urgency=medium
+
+  * The "polish for bookworm" release.
+  * Support 64bit kernels on mipsel VMs.
+  * debvm-create:
+    + Deprecate --architecture flag.
+    + Automatically invoke setterm -resize after autologin.
+  * debvm-run: Fix --graphical option and improve graphical qemu flags.
+    (Thanks to Arnd Bergmann)
+  * Improve documentation in various places.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 21 Mar 2023 07:42:07 +0100
+
 debvm (0.2.9) unstable; urgency=medium
 
   * The "initsystem diversity" release.
diff --git a/share/customize-autologin.sh b/share/customize-autologin.sh
index 9effa29..da40342 100755
--- a/share/customize-autologin.sh
+++ b/share/customize-autologin.sh
@@ -4,12 +4,26 @@
 #
 # This is a mmdebstrap customize hook that configures automatic root login on a
 # serial console. It also parses the TERM kernel cmdline and passes it as
-# TERM to agetty.
+# TERM to agetty. Since serial consoles do not transmit SIGWINCH, it causes
+# the shell to run setterm -resize on interactive, serial logins.
 
 set -eu
 
 TARGET=$1
 
+cat >"$TARGET/etc/profile.d/resize_serial_term.sh" <<'EOF'
+if test -n "${TERM-}" && test -n "${PS1-}"; then
+	case "$(tty)" in
+		/dev/tty[0-9]*)
+		;;
+		/dev/tty*)
+			# Assume that every other tty is serial and should be resized.
+			setterm -resize
+		;;
+	esac
+fi
+EOF
+
 if test "$(dpkg-query --root "$TARGET" -f '${db:Status-Status}' -W systemd-sysv 2>/dev/null)" = installed; then
 	UNIT=serial-getty@.service
 
diff --git a/share/customize-kernel.sh b/share/customize-kernel.sh
index aef9fa7..d216eaa 100755
--- a/share/customize-kernel.sh
+++ b/share/customize-kernel.sh
@@ -45,6 +45,9 @@ case "$KERNEL_ARCH" in
 	;;
 	mipsel)
 		KERNEL_ARCH=4kc-malta
+		case "$ARCHITECTURES " in
+			*" mips64el "*) KERNEL_ARCH=5kc-malta:mips64el
+		esac
 	;;
 	ppc64)
 		KERNEL_ARCH=powerpc64
diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh
index c8efa3e..1db551d 100755
--- a/tests/create-and-run.sh
+++ b/tests/create-and-run.sh
@@ -20,14 +20,11 @@ cleanup() {
 trap cleanup EXIT INT TERM QUIT
 
 ssh-keygen -f "$SSH_KEYPATH" -N ''
-set --
 case "$ARCHITECTURE" in
 	# Booting an armel kernel on qemu is next to impossible.
-	armel) set -- -- --architecture armhf ;;
-	# Broken kernel #1029270.
-	i386) set -- -- --architecture amd64 ;;
+	armel) ARCHITECTURE=armel,armhf ;;
 esac
-debvm-create -k "$SSH_KEYPATH.pub" -o "$IMAGE" -a "$ARCHITECTURE" -r "$RELEASE" "$@"
+debvm-create -k "$SSH_KEYPATH.pub" -o "$IMAGE" -r "$RELEASE" -- --architectures="$ARCHITECTURE"
 
 SSH_PORT=2222
 timeout 300s debvm-run -s "$SSH_PORT" -i "$IMAGE" &

Reply via email to