#952404 scanbd: crash on startup: kernel internal error: Oops 206 with current raspbian buster on rpi4 4g

Package:
scanbd
Source:
scanbd
Description:
Scanner button daemon
Submitter:
Ingo Breßler
Date:
2023-06-27 12:42:06 UTC
Severity:
important
#952404#5
Date:
2020-02-23 20:21:45 UTC
From:
To:
Dear Maintainer,

I installed the package *scanbd* on the current Raspbian buster on a
Raspberry Pi 4 (4GB).
The behaviour is identical regardless of version '1.5.1-5' or '1.5.1-4'.
The latter version works fine with a Raspberry Pi 2B and Raspbian stretch.

Running the program *scanbd* with default configuration causes a kernel Oops
even without any scanner attached (and with one attached which used
to work fine):

    # export SANE_CONFIG_DIR=/etc/scanbd
    # /usr/sbin/scanbd -f -c /etc/scanbd/scanbd.conf

Result:

    root@rpi4:~# scanbd -f -c /etc/scanbd/scanbd.conf
    scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.054930] Internal error: Oops: 206 [#4] SMP ARM

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.147131] Process scanbd (pid: 2082, stack limit = 0x35d03bc2)

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.150005] Stack: (0xd2581e88 to 0xd2582000)

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.152873] 1e80:                   c1004d88 d262f300 fe52a6aa d2581f60 d2581f60 00000001

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.155781] 1ea0: d2581f2c d2581eb0 c03d4f48 c06f1038 ef9c0a50 00000101 00000002 000007b8

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.158703] 1ec0: 00000000 00000000 00000000 d2581ed0 c0292810 c03d235c 00000000 c09c996c

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.161640] 1ee0: 00000000 ef9c0ad0 d2581f04 d2581ef8 c09c996c c0292c68 d2581f1c fe52a6aa

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.164581] 1f00: c09cc028 00000001 d262f300 beabdb8b d2581f60 beabdb8b d2580000 00000003

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.167521] 1f20: d2581f5c d2581f30 c03d5108 c03d4f0c c03f5be4 c03f52b8 d262f300 c1004d88

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.170469] 1f40: d262f301 00000001 beabdb8b d2580000 d2581f94 d2581f60 c03d5750 c03d5078

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.173430] 1f60: 000003bd 00000000 000003bd fe52a6aa b6f17968 00000001 beabdb8b 0000000b

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.176395] 1f80: 00000003 c02011c4 d2581fa4 d2581f98 c03d57dc c03d56e8 00000000 d2581fa8

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.179356] 1fa0: c0201000 c03d57d0 00000001 beabdb8b 0000000b beabdb8b 00000001 00000000

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.182313] 1fc0: 00000001 beabdb8b 0000000b 00000003 b6f17968 b4c32d08 00000000 00000000

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.182313] 1fc0: 00000001 beabdb8b 0000000b 00000003 b6f17968 b4c32d08 00000000 00000000

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.185275] 1fe0: 00000002 beabdb70 00000000 b6de3274 80000010 0000000b 00000000 00000000

    Message from syslogd@rpi4 at Feb 23 17:51:52 ...
     kernel:[ 3081.214669] Code: 03a02000 e3520000 0a00000c e2442612 (e5d22000)

It is expected to *not* lead to a kernel Oops and should detect when the scanner button was pressed instead.

It is a pity that it does not work as expected when moving to the recent rpi4.
I am investigating this further with the source code which will take some time.

#952404#10
Date:
2020-02-26 17:45:13 UTC
From:
To:
I tried it on a qemu image for aarch64 and could not reproduce the probem,
and there was no error in dmesg.

root@debian-arm64:/home/sudip# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

root@debian-arm64:/home/sudip# lscpu | grep Arch
Architecture:        aarch64

root@debian-arm64:/home/sudip# uname -r
4.19.0-8-arm64

root@debian-arm64:/home/sudip# export SANE_CONFIG_DIR=/etc/scanbd
root@debian-arm64:/home/sudip# /usr/sbin/scanbd -f -c /etc/scanbd/scanbd.conf
/usr/sbin/scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'
/usr/sbin/scanbd: no devices, not starting any polling thread
/usr/sbin/scanbd: Not Primary Owner (2)

#952404#15
Date:
2020-03-10 09:54:36 UTC
From:
To:
Thanks for testing, I appreciate it very much!

I am interested which exact commands you were using for qemu?
I haven't used it for emulating the raspi yet and had some trouble finding useful/working settings.
The qemu model versatiblepb ('-M versatilepb') works for emulating the initial raspi1
and it provides networking. While the latest model I found working is '-M raspi3'
with '-dtb bcm2710-rpi-3-b.dtb' from the raspbian image.
However, I did not get it running with raspi4 related settings
('-cpu cortex-a72' and '-dtb bcm2711-rpi-4-b.dtb' and 4G RAM).

I used the following script for raspi1 emulation and setting up the raspbian image
with networking for upgrading the system ('apt-get update && apt-get dist-upgrade')
and installing scanbd ('apt-get install scanbd'):

    imgfn=2020-02-13-raspbian-buster-lite.img
    offset="$(fdisk -l "$imgfn" | awk '/img2/ {print $2}')"
    offset=$((offset*512))
    mountp=/mnt/raspbian
    sudo mkdir -p "$mountp"
    sudo mount -v -o offset=$offset -t ext4 "$imgfn" "$mountp"
    sudo sh -c "echo > $mountp/etc/ld.so.preload"
    sudo umount "$mountp"
    qemu-system-arm -M versatilepb -cpu arm1176 -m 256 -serial stdio -audiodev none,id=none -drive format=raw,file="$imgfn" -kernel kernel-qemu-4.19.50-buster -dtb versatile-pb.dtb -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' -no-reboot -nic user,model=virtio-net-pci,hostfwd=tcp::5022-:22

After these preparations, to emulate the raspi3 on aarch64, I used:

    qemu-system-aarch64 -M raspi3 -cpu cortex-a53 -m 1024 -kernel kernel8.img -serial mon:stdio -nographic -audiodev none,id=none -drive format=raw,file="$imgfn" -dtb bcm2710-rpi-3-b.dtb -append 'console=ttyAMA0 root=PARTUUID=738a4d67-02 rootwait rootfstype=ext4 rw' -no-reboot

Right after successful boot, I showed my that scanbd is defunct:

    # ps ax | grep scanbd
      245 ?        Zsl    0:09 [scanbd] <defunct>
      422 ttyAMA0  S+     0:00 grep scanbd

Killing that defunct process and restarting scanbd in foreground produced
an Oops as well (reproducible in this raspi3 qemu setting):

    # kill -9 245
    root@raspberrypi:~# ps ax | grep scanbd
      424 ttyAMA0  S+     0:00 grep scanbd
    root@raspberrypi:~# export SANE_CONFIG_DIR=/etc/scanbd
    root@raspberrypi:~# scanbd -f -c /etc/scanbd/scanbd.conf
    scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'
    [  248.273492] Unable to handle kernel paging request at virtual address ffffffbefee003bd
    [  248.276850] Mem abort info:
    [  248.277181]   ESR = 0x96000006
    [  248.277520]   Exception class = DABT (current EL), IL = 32 bits
    [  248.277979]   SET = 0, FnV = 0
    [  248.278249]   EA = 0, S1PTW = 0
    [  248.278618] Data abort info:
    [  248.281919]   ISV = 0, ISS = 0x00000006
    [  248.282685]   CM = 0, WnR = 0
    [  248.283296] swapper pgtable: 4k pages, 39-bit VAs, pgdp = 0000000017e1e18d
    [  248.284288] [ffffffbefee003bd] pgd=0000000000d66003, pud=0000000000d66003, pmd=0000000000000000
    [  248.287752] Internal error: Oops: 96000006 [#2] PREEMPT SMP
    [  248.288350] Modules linked in: sha256_generic cfg80211 rfkill 8021q garp stp llc raspberrypi_hwmon hwmon uio_pdrv_genirq uio ip_tables x_tables ipv6
    [  248.290447] Process scanbd (pid: 432, stack limit = 0x000000005b20de07)
    [  248.291505] CPU: 1 PID: 432 Comm: scanbd Tainted: G      D W         4.19.97-v8+ #1294
    [  248.291791] Hardware name: Raspberry Pi 3 Model B (DT)
    [  248.292221] pstate: 40000005 (nZcv daif -PAN -UAO)
    [  248.293119] pc : read_port+0xa8/0x138
    [  248.293338] lr : __vfs_read+0x60/0x178
    [  248.293529] sp : ffffff800a513cc0
    [  248.293709] x29: ffffff800a513cc0 x28: ffffffc034f71d00
    [  248.294015] x27: 0000000000000000 x26: 0000000000000000
    [  248.294281] x25: 0000000046000000 x24: 0000000000000011
    [  248.294650] x23: 00000000ffea3b23 x22: ffffff800a513e20
    [  248.294950] x21: 00000000ffea3b23 x20: ffffff800a513e20
    [  248.295227] x19: 0000000000000001 x18: 0000000000000000
    [  248.295493] x17: 0000000000000000 x16: 0000000000000001
    [  248.295740] x15: 0000000000000000 x14: 0000000000000000
    [  248.296279] x13: 0000000000000000 x12: 0000000000000000
    [  248.296943] x11: ffffffbefee00000 x10: 0000000000000000
    [  248.297399] x9 : 00000000ffea3b23 x8 : 000000000000ffff
    [  248.297889] x7 : ffffffc034f71d00 x6 : 00000000000003bd
    [  248.298162] x5 : 0000000000000000 x4 : 00000000ffea3b23
    [  248.298652] x3 : 0000007fffffffff x2 : ffffffbefee003bd
    [  248.299031] x1 : 00000000ffea3b23 x0 : 0000007fffffffff
    [  248.299815] Call trace:
    [  248.300313]  read_port+0xa8/0x138
    [  248.300845]  __vfs_read+0x60/0x178
    [  248.301218]  vfs_read+0x94/0x150
    [  248.301902]  ksys_read+0x74/0xf0
    [  248.302460]  __arm64_sys_read+0x24/0x30
    [  248.304005]  el0_svc_common+0xf4/0x1c0
    [  248.304744]  el0_svc_compat_handler+0x30/0x40
    [  248.305163]  el0_svc_compat+0x8/0x18
    [  248.306136] Code: ea20009f 9a9f0089 d503229f 8b0b00c2 (39400042)
    [  248.308521] ---[ end trace 70c280beaea0275a ]---

    Message from syslogd@raspberrypi at Mar  4 18:53:49 ...
     kernel:[  248.287752] Internal error: Oops: 96000006 [#2] PREEMPT SMP

    Message from syslogd@raspberrypi at Mar  4 18:53:49 ...
     kernel:[  248.290447] Process scanbd (pid: 432, stack limit = 0x000000005b20de07)

    Message from syslogd@raspberrypi at Mar  4 18:53:49 ...
     kernel:[  248.306136] Code: ea20009f 9a9f0089 d503229f 8b0b00c2 (39400042)

A note on the environment:
qemu 4.2 on ubuntu focal (upcoming 20.04) was used which itself was running in
a virtual machine (VMware, 4 cores, 8G RAM) to have the latest available package.

    root@raspberrypi:~# lsb_release -a
    No LSB modules are available.
    Distributor ID:	Raspbian
    Description:	Raspbian GNU/Linux 10 (buster)
    Release:	10
    Codename:	buster

    root@raspberrypi:~# lscpu | grep Arch
    Architecture:        aarch64

    root@raspberrypi:~# uname -r
    4.19.97-v8+

I am happy to provide more information, just let me know.
Thanks for reading!

#952404#20
Date:
2020-03-25 21:21:00 UTC
From:
To:
Investigating the error by building the packages of scanbd and libsane
from source and adding some debugging output turned out that it is not
an issue of scanbd. Thus, this bug can be closed.

This kernel Oops is triggered by the canon_pp backend of libsane.
Disabling it in /etc/scanbd/dll.conf resolves the issue and scanbd works
fine.

This Oops can be triggered directly by calling 'sane-find-scanner -p'
which explicitly probes for parallel port scanners. Because the
raspberrypi platform does not have a parallel port, it leads to the
kernel Oops, I assume.

More specifically, the functions from ieee1284.h such as
ieee1284_read_status() trigger this Oops. Therefore, it is also not an
issue of libsane.

At this point, my research stopped and I can't tell if it is a bug of
package libieee1284 or the kernel itself. Presumably, ieee1284 function
should be no-op if there is no parallel port(?).

I hope this helps anyone running into this too.

#952404#25
Date:
2020-03-25 21:50:00 UTC
From:
To:
Thanks for testing and debugging it.

Can you please send me your dmesg which shows the trace.

#952404#30
Date:
2020-03-27 10:57:25 UTC
From:
To:
Of course, the dmesg is attached.
Let me know if I can provide more info.

Am 25.03.20 um 22:50 schrieb Sudip Mukherjee:

#952404#35
Date:
2021-08-25 13:21:27 UTC
From:
To:

#952404#40
Date:
2023-06-27 12:40:36 UTC
From:
To:
Greetings, I am MARINA TKACHENKO. Please I sent you an email last time I
have something important to discuss with you please reply.