Package: debian-kernel-handbook
Version: 1.0.19
Severity: normal

[Initially filed against debian-kernel-handbook because while the
problem is in src:linux, it's not strictly a problem with src:linux's
official binary packages.]

Debian Live images with custom kernels need some workarounds, because
"make bindeb-pkg" is inconsistent with official Debian kernels.
I would like to remove both the inconsistencies and my workarounds.

Attached are two scripts, one using stock kernel, one using custom
kernel built with "make bindeb-pkg" and then hosted on a PPA.
Removing either workaround breaks the "download" lines.

A few minor issues are annoying me:


  1. /vmlinuz and /initrd.img are not created.

     The problem appears to be inconsistency between these two scripts:

     a. official images use this, which calls linux-update-symlinks (and 
Depends: linux-base)

         
https://sources.debian.org/src/linux/5.14.9-2%7Ebpo11+1/debian/templates/image.postinst.in/#L17

     b. "make bindeb-pkg" use this, which does not

         
https://sources.debian.org/src/linux/5.14.9-2~bpo11+1/scripts/package/builddeb/#L186-L209

     Is it reasonable to make builddeb call linux-update-symlinks and Depends: 
linux-base?
     This seems reasonable to me.


  2. /boot/initrd.img-<version> is not created.

     I think this is because there is no Depends, so
     (if everything happens in a single "apt install"),
     /var/lib/dpkg/info/linux-image-X.postinst runs before
     /etc/kernel/postinst.d/initramfs-tools exists.

     This does not happen with stock kernels, which I think use this:

         
https://sources.debian.org/src/linux/5.14.9-2%7Ebpo11+1/debian/templates/control.image.in/#L3-L5

     Is it reasonable to make builddeb add equivalent 
Depends/Recommends/Suggests?

     It would need to NOT mention initrd when build with CONFIG_MODULES=n, but
     builddeb already knows when this is the case.

     If build with (for example) "make localyesconfig", then even if 
CONFIG_MODULES=y,
     it should probably only Recommends or Suggests initramfs-tools (for 
amd64-microcode).

     This gets a little messy!


  3. I'd like a Provides or metapackage equivalent to "linux-image-generic", so
     with a PPA, I can say --include=linux-image-inmate and have it always pick 
the latest available.
     Currently with --include=linux-image-5.14.9inmate, I have to keep updating 
the --include line.

     The "inmate" comes from CONFIG_LOCALVERSION=inmate, so
     I guess builddeb would check if that was set, and if so, add

         Provides: linux-image-${CONFIG_LOCALVERSION}

     Is this reasonable?
     I can't see any downside, and it sounds easy.
     If I can get my head around builddeb, I'll try to submit a patch for this.


-- System Information:
Debian Release: 11.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.14.0-0.bpo.2-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
#!/bin/bash
cmd=(
    mmdebstrap
    bullseye
    live/filesystem.squashfs
    --customize-hook='download /vmlinuz ./live/vmlinuz'
    --customize-hook='download /initrd.img ./live/initrd.img'
    --include=live-boot
    --include=linux-image-generic
    https://deb.debian.org/debian
)

mkdir live
"${cmd[@]}"
ls -hlR live
#!/bin/bash
cmd=(
    mmdebstrap
    bullseye
    live/filesystem.squashfs
    # Work around lack of linux-update-symlinks
    --customize-hook='chroot $1 linux-update-symlinks install 5.14.9inmate 
/boot/vmlinuz-5.14.9inmate'
    # Work around lack of Depends: initramfs-tools
    --customize-hook='chroot $1 dpkg-reconfigure linux-image-5.14.9inmate'
    --customize-hook='download /vmlinuz ./live/vmlinuz'
    --customize-hook='download /initrd.img ./live/initrd.img'
    --include=live-boot
    --include=linux-image-5.14.9inmate
    https://deb.debian.org/debian
    'deb [signed-by=/home/twb/PrisonPC-archive-pubkey.asc] 
https://apt.cyber.com.au/PrisonPC bullseye kernel-demo'
)

mkdir live
"${cmd[@]}"
ls -hlR live

Reply via email to