Package: live-boot
Version: 1:20190614
Severity: important
Tags: patch upstream

Since Stretch, initramfs-tools has provided support for specifying
multiple stages for the parameter break=, which was introduced in
the commit b215c18c of initramfs-tools (#795832). However, the function
`maybe_break` gets overriden in live-boot and multiple stages cannot be
specified. This can be reproduced by creating a live-boot image and use
qemu to boot it:

```
debootstrap --variant=minbase --merged-usr buster rootfs
chroot rootfs/ apt-get install --no-install-recommends linux-image-amd64 
live-boot busybox live-tools
chroot rootfs/ bash -c '/usr/sbin/busybox --list-full | while read cmd; do [ ! 
-e "$cmd" ] && ln -s /sbin/busybox "$cmd"; done'
mksquashfs rootfs/ livetest.squashfs -noI -noD -noF -noX -noappend -e boot
ln -s rootfs/vmlinuz rootfs/initrd.img ./
python3 -m http.server 8000 &
qemu-system-x86_64 -cpu kvm64 -machine pc,accel=kvm -smp 
cpus=1,cores=1,sockets=1 -m 2G  -chardev stdio,mux=on,id=char0 -netdev 
user,id=net0 -device e1000e,netdev=net0,id=net0 -monitor chardev:char0 -serial 
chardev:char0 -kernel vmlinuz -initrd initrd.img -append 
'fetch=http://xx.xx.xx.xx:8000/livetest.squashfs boot=live toram console=ttyS0 
break=mount,mountroot,bottom'
```

In the above senario, the boot process only stops at ``mount" stage, but
not at ``mountroot" and ``bottom".

The following patch can fix this bug by directly calling the original
`maybe_break` function provided by initramfs-tools.

From 1dde5d3680e0f7c475b9d58cb8337fa99515bdaa Mon Sep 17 00:00:00 2001
From: Miao Wang <shankerwangm...@gmail.com>
Date: Sun, 4 Oct 2020 04:57:40 +0800
Subject: [PATCH] Call orignial maybe_break in our overriden verison

Signed-off-by: Miao Wang <shankerwangm...@gmail.com>
---
components/9990-initramfs-tools.sh | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/components/9990-initramfs-tools.sh 
b/components/9990-initramfs-tools.sh
index b251754..0954904 100755
--- a/components/9990-initramfs-tools.sh
+++ b/components/9990-initramfs-tools.sh
@@ -16,13 +16,12 @@ log_wait_msg ()

# Override maybe_break from scripts/functions
maybe_break()
-{
-       if [ "${break}" = "$1" ]; then
-               # Call original panic
-               . /scripts/functions
-               panic "Spawning shell within the initramfs"
-       fi
-}
+(
+       # Call original maybe_break
+       # which will call panic defined there
+       . /scripts/functions
+       maybe_break "$@"
+)

# Override panic from scripts/functions
panic()
-- 
2.28.0


-- Package-specific info:

-- System Information:
Debian Release: 10.6
 APT prefers stable
 APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-10-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages live-boot depends on:
ii  live-boot-initramfs-tools [live-boot-backend]  1:20190614

Versions of packages live-boot recommends:
pn  live-boot-doc  <none>
ii  live-tools     1:20171207
pn  rsync          <none>
pn  uuid-runtime   <none>

Versions of packages live-boot suggests:
pn  cryptsetup  <none>
pn  curlftpfs   <none>
pn  httpfs2     <none>
pn  wget        <none>

-- no debconf information

Reply via email to