Bug 252099 - multimedia/webcamd after a stop of the webcamd service, the service will not start
Summary: multimedia/webcamd after a stop of the webcamd service, the service will not ...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Hans Petter Selasky
URL: https://svnweb.freebsd.org/ports/head...
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-24 07:04 UTC by Graham Perrin
Modified: 2021-02-11 14:51 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (hselasky)


Attachments
Photograph of ttyv1 after leaving KDE Plasma and stopping sddm (598.79 KB, image/png)
2020-12-24 11:41 UTC, Graham Perrin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Perrin 2020-12-24 07:04:27 UTC
# sysrc rc_debug=YES
rc_debug: NO -> YES
# service webcamd status
/usr/local/etc/rc.d/webcamd: DEBUG: checkyesno: webcamd_enable is set to YES.
/usr/local/etc/rc.d/webcamd: DEBUG: run_rc_command: doit: webcamd_status 
webcamd is running as pid 2025.
# service webcamd stop
/usr/local/etc/rc.d/webcamd: DEBUG: checkyesno: webcamd_enable is set to YES.
/usr/local/etc/rc.d/webcamd: DEBUG: run_rc_command: doit: webcamd_stop 
Stopping webcamd.
Waiting for PIDs: 2025
# service webcamd status
/usr/local/etc/rc.d/webcamd: DEBUG: checkyesno: webcamd_enable is set to YES.
/usr/local/etc/rc.d/webcamd: DEBUG: run_rc_command: doit: webcamd_status 
webcamd is not running.
# service webcamd start
/usr/local/etc/rc.d/webcamd: DEBUG: checkyesno: webcamd_enable is set to YES.
/usr/local/etc/rc.d/webcamd: DEBUG: run_rc_command: doit: webcamd_start 
/usr/local/etc/rc.d/webcamd: DEBUG: checkyesno: hald_enable is set to YES.
Starting webcamd.
# service webcamd status
/usr/local/etc/rc.d/webcamd: DEBUG: checkyesno: webcamd_enable is set to YES.
/usr/local/etc/rc.d/webcamd: DEBUG: run_rc_command: doit: webcamd_status 
webcamd is not running.
# service webcamd status
/usr/local/etc/rc.d/webcamd: DEBUG: checkyesno: webcamd_enable is set to YES.
/usr/local/etc/rc.d/webcamd: DEBUG: run_rc_command: doit: webcamd_status 
webcamd is not running.
# grep -i cuse /boot/loader.conf
cuse_load="YES"
# grep -i cuse /etc/rc.conf
kld_list="cuse fusefs drm"
# grep -i webcam /etc/rc.conf
webcamd_enable="YES"
webcamd_flags="-H"
# date ; uptime ; uname -v
Thu Dec 24 07:00:03 GMT 2020
 7:00AM  up  3:20, 5 users, load averages: 2.02, 2.35, 2.49
FreeBSD 13.0-CURRENT #74 r368589: Sun Dec 13 07:55:46 GMT 2020     root@mowa219-gjp4-8570p:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG 
# service hald status
/usr/local/etc/rc.d/hald: DEBUG: checkyesno: hald_enable is set to YES.
hald is running as pid 7756.
# lsusb | sort
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen0.2: ID 0424:5434 Microchip Technology, Inc. (formerly SMSC) Hub
Bus /dev/usb Device /dev/ugen0.3: ID 046d:c408 Logitech, Inc. Marble Mouse (4-button)
Bus /dev/usb Device /dev/ugen0.4: ID 03f0:354a HP, Inc Slim Keyboard
Bus /dev/usb Device /dev/ugen0.6: ID 0424:5434 Microchip Technology, Inc. (formerly SMSC) Hub
Bus /dev/usb Device /dev/ugen0.7: ID 174c:5106 ASMedia Technology Inc. ASM1051 SATA 3Gb/s bridge
Bus /dev/usb Device /dev/ugen0.8: ID 1038:1229 SteelSeries ApS 
Bus /dev/usb Device /dev/ugen1.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen1.2: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus /dev/usb Device /dev/ugen1.3: ID 04f2:b230 Chicony Electronics Co., Ltd Integrated HP HD Webcam
Bus /dev/usb Device /dev/ugen1.4: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus /dev/usb Device /dev/ugen1.5: ID 041e:4041 Creative Technology, Ltd Webcam Live! Motion
Bus /dev/usb Device /dev/ugen1.6: ID 03f0:3d1d HP, Inc 
Bus /dev/usb Device /dev/ugen2.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen2.2: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus /dev/usb Device /dev/ugen2.3: ID 0a5c:21e1 Broadcom Corp. HP Portable SoftSailing
# service virtual_oss onestatus
/usr/local/etc/rc.d/virtual_oss: DEBUG: checkyesno: virtual_oss_enable is set to YES.
/usr/local/etc/rc.d/virtual_oss: DEBUG: run_rc_command: doit: virtual_oss_status 
virtual_oss is not running.
#
Comment 1 Graham Perrin 2020-12-24 09:45:16 UTC
Does any of this help? 

----

# date 
Thu Dec 24 08:51:35 GMT 2020
# sysrc rc_debug=NO
rc_debug: YES -> NO
# service webcamd status
webcamd is not running.
# ls -hl /var/run/webcamd.*.0.pid
-rw-------  1 root  wheel     5B Dec 24 08:47 /var/run/webcamd.1.3.0.pid
# rm /var/run/webcamd.*.0.pid
# service webcamd status
webcamd is not running.
# service webcamd start
Starting webcamd.
# service webcamd status
webcamd is not running.
# rm /var/run/webcamd.*.0.pid
rm: /var/run/webcamd.*.0.pid: No such file or directory
# kldstat | grep cuse
65    1 0xffffffff83b6d000     6730 cuse.ko
# kldunload cuse
# kldload cuse
# kldstat | grep cuse
65    1 0xffffffff83b6d000     6730 cuse.ko
# kldunload cuse
# kldstat | grep cuse
# kldload cuse
# kldstat | grep cuse
65    1 0xffffffff83b6d000     6730 cuse.ko
# service webcamd status
webcamd is not running.
# service webcamd start
Starting webcamd.
# service webcamd status
webcamd is not running.
# ls -hl /var/run/webcamd.*.0.pid
ls: /var/run/webcamd.*.0.pid: No such file or directory
# webcamd -l | sort
Available device(s):
Show webcamd usage:
webcamd -h
webcamd [-d ugen0.1] -N 0x8086-XHCI-root-HUB -S unknown -M 0
webcamd [-d ugen0.2] -N vendor-0x0424-product-0x5434 -S unknown -M 0
webcamd [-d ugen0.3] -N Logitech-USB-Trackball -S unknown -M 0
webcamd [-d ugen0.4] -N vendor-0x03f0-HP-USB-Slim-Keyboard -S unknown -M 0
webcamd [-d ugen0.6] -N SMSC-USB5534 -S 1239567 -M 0
webcamd [-d ugen0.7] -N StoreJet-Transcend-StoreJet-Transcend -S X3E1SAKRS -M 0
webcamd [-d ugen0.8] -N SteelSeries-SteelSeries-Siberia-350 -S unknown -M 0
webcamd [-d ugen1.1] -N Intel-EHCI-root-HUB -S unknown -M 1
webcamd [-d ugen1.2] -N vendor-0x8087-product-0x0024 -S unknown -M 0
webcamd [-d ugen1.3] -N Chicony-Electronics-Co---Ltd--HP-HD-Webcam-Fixed -S SN0001 -M 0
webcamd [-d ugen1.4] -N vendor-0x0424-product-0x2514 -S unknown -M 0
webcamd [-d ugen1.6] -N HP-HP-hs2350-HSPA--MobileBroadband -S 9F5C9DB7AE4197M0 -M 0
webcamd [-d ugen2.1] -N Intel-EHCI-root-HUB -S unknown -M 0
webcamd [-d ugen2.2] -N vendor-0x8087-product-0x0024 -S unknown -M 1
webcamd [-d ugen2.3] -N Broadcom-Corp-BCM20702A0 -S B8763FD8EF34 -M 0
# webcamd -N Chicony-Electronics-Co---Ltd--HP-HD-Webcam-Fixed -S SN0001 -M 0
alloc_chrdev_region: Unknown region name: 'lirc'
webcamd 37259 - - Attached to ugen1.3[0]
webcamd 37259 - - Creating /dev/video0
webcamd 37259 - - Creating /dev/video1
^C
# ls -hl /var/run/webcamd.*.0.pid
-rw-------  1 root  wheel     5B Dec 24 08:54 /var/run/webcamd.1.3.0.pid
# rm /var/run/webcamd.*.0.pid
# service webcamd status
webcamd is not running.
# service webcamd start
Starting webcamd.
# service webcamd status
webcamd is not running.
# webcamd -N Chicony-Electronics-Co---Ltd--HP-HD-Webcam-Fixed -S SN0001 -M 0
alloc_chrdev_region: Unknown region name: 'lirc'
webcamd 37408 - - Attached to ugen1.3[0]
webcamd 37408 - - Creating /dev/video0
webcamd 37408 - - Creating /dev/video1
^C^C^C^C^C
load: 1.42  cmd: webcamd 37408 [W] 63.14r 0.07u 0.15s 0% 10152k
mi_switch+0xc1 sleepq_timedwait+0x2f _sleep+0x1ab pause_sbt+0xfe cuse_server_free+0x3c devfs_fpdrop+0xa3 devfs_close_f+0x44 _fdrop+0x11 closef+0x278 fdescfree_fds+0xdc fdescfree+0x3ec exit1+0x42b sigexit+0x133 postsig+0x251 ast+0x337 doreti_ast+0x1f 

# 

----

During the second manual run of webcamd I confirmed usability in Firefox at https://talky.io/usb-audio-freebsd and (I guess this is normal) Control-C was not effective until I closed the tab in Firefox.
Comment 2 Graham Perrin 2020-12-24 11:41:42 UTC
Created attachment 220889 [details]
Photograph of ttyv1 after leaving KDE Plasma and stopping sddm

Photographed
============

I left KDE Plasma, stopped sddm then retried a start of the service: 

* webcamd did not run. 

After restarting the computer: webcamd ran normally. 


Not photographed
================

I restarted the computer, refrained from using KDE, stopped sddm, stopped the service, tried to start the service: 

* webcamd did not run. 

After restarting the computer: webcamd ran normally.
Comment 3 Hans Petter Selasky freebsd_committer 2020-12-24 11:42:04 UTC
What does:

pgrep -d ' ' webcamd

Output?

--HPS
Comment 4 Hans Petter Selasky freebsd_committer 2020-12-24 11:44:21 UTC
It might be that webcamd has crashed. Do you have any "webcamd.core" files in your file system?

--HPS
Comment 5 Hans Petter Selasky freebsd_committer 2020-12-24 12:04:51 UTC
Try to compile the webcamd port with debugging enabled.

Then start webcamd in the foreground (should also be picked up by the rc.d script's status).

Try to see if a core dump may be generated.

--HPS
Comment 6 Graham Perrin 2020-12-24 13:25:50 UTC
$ whoami
grahamperrin
$ pwd
/home/grahamperrin
$ ls -hl *.core
-rw-------  1 grahamperrin  grahamperrin    41M 24 Dec 03:38 kglobalaccel5.core
$ ls -hl /root/*.core
ls: /root/*.core: No such file or directory
$ su -
Password:
root@mowa219-gjp4-8570p:~ # pgrep -d ' ' webcamd
root@mowa219-gjp4-8570p:~ # 

(In reply to Hans Petter Selasky from comment #5)

Thanks, I'll try that: 

----

root@mowa219-gjp4-8570p:~ # sh
# cd /usr/local/poudriere/ports/default/multimedia/webcamd/
# ls -hl
total 23
-rw-r--r--  1 root  wheel   2.6K Dec  2 17:27 Makefile
-rw-r--r--  1 root  wheel   376B Dec  2 17:27 distinfo
drwxr-xr-x  2 root  wheel     4B Dec  3 05:54 files
-rw-r--r--  1 root  wheel   377B Dec  2 11:29 pkg-descr
-rw-r--r--  1 root  wheel   554B Nov 30  2019 pkg-message
-rw-r--r--  1 root  wheel   1.3K May 12  2014 pkg-plist
# grep -i debug Makefile 
OPTIONS_DEFINE= DEBUG HAL VT_CLIENT VT_SERVER DVB INPUT KEYBOARD MOUSE RADIO WEBCAM
DEBUG_MAKE_ARGS=        HAVE_DEBUG="YES"
# 

----

– should I create a Makefile.local and if so, what should it contain?
Comment 7 Hans Petter Selasky freebsd_committer 2020-12-24 15:09:07 UTC
Just enable the debug option before compiling.
Comment 8 Graham Perrin 2020-12-24 17:32:58 UTC
(In reply to Hans Petter Selasky from comment #7)

I added this to the Makefile before building with poudriere: 

MAKE_ARGS+=     DEBUG="YES"

I'm probably wrong. Sorry for my lack of expertise.
Comment 9 Graham Perrin 2020-12-25 19:49:06 UTC
I think I now have it built with debugging support. This in /etc/make.conf –

WITH_DEBUG_PORTS=webcamd

– before I built with poudriere. 

No core dump when I run this: 

# webcamd -N Chicony-Electronics-Co---Ltd--HP-HD-Webcam-Fixed -S SN0001 -M 0
alloc_chrdev_region: Unknown region name: 'lirc'
webcamd 75412 - - Attached to ugen1.3[0]
webcamd 75412 - - Creating /dev/video0
webcamd 75412 - - Creating /dev/video1
^C
#
Comment 10 Graham Perrin 2021-01-01 20:10:49 UTC
I see recent <https://svnweb.freebsd.org/ports?view=revision&revision=559567> relating to kld, cuse(3) and virtual_oss … 

… is that, in any way, food for thought for this webcamd bug?

Thanks
Comment 11 Martin Birgmeier 2021-02-09 18:04:46 UTC
In /usr/local/etc/rc.d/webcamd it says:

# By default webcamd instances are invoked by the devd(8) system
# daemon and you do not normally need to do any extra configuration
# just restart the devd service. If the devd service is not enabled,
# you need to add instances of "webcamd_N_flags=" which contain at
# least one of the "-d", "-D", "-N", or "-S" options.

If one wants to start a webcamd directly for a specific device, that device would have to be specified:

service webcamd start ugen1.3

Does this help?

-- Martin
Comment 12 Tatsuki Makino 2021-02-10 04:35:04 UTC
Isn't webcamd supposed to be started by devd?
/usr/local/etc/devd/webcamd.conf
Comment 13 Graham Perrin 2021-02-10 09:05:58 UTC
This morning: 

Webcams with FreeBSD-CURRENT and an HP EliteBook 8570p : freebsd
<https://old.reddit.com/r/freebsd/comments/lgpsmv/-/>

tl;dr

*   the Microsoft webcam that certainly works (with Linux) 
    does not work with FreeBSD at <https://webcamtests.com/>

*   webcamd crashed.

Realistically: until I get a webcam working, again, with FreeBSD, it might be difficult for me progress this bug. Sorry!
Comment 14 Graham Perrin 2021-02-10 09:14:45 UTC
root@mowa219-gjp4-8570p:~ # service -e 
/etc/rc.d/rctl
/etc/rc.d/hostid
/etc/rc.d/zpool
/etc/rc.d/zvol
/etc/rc.d/hostid_save
/etc/rc.d/zfsbe
/etc/rc.d/zfs
/etc/rc.d/cleanvar
/etc/rc.d/ip6addrctl
/usr/local/etc/rc.d/vboxnet
/etc/rc.d/autounmountd
/etc/rc.d/mixer
/etc/rc.d/devmatch
/etc/rc.d/netif
/etc/rc.d/devd
/etc/rc.d/resolv
/usr/local/etc/rc.d/sndiod
/etc/rc.d/dmesg
/etc/rc.d/newsyslog
/etc/rc.d/os-release
/etc/rc.d/gptboot
/etc/rc.d/motd
/etc/rc.d/virecover
/etc/rc.d/cleartmp
/etc/rc.d/linux
/etc/rc.d/syslogd
/etc/rc.d/savecore
/etc/rc.d/automountd
/etc/rc.d/automount
/etc/rc.d/powerd
/usr/local/etc/rc.d/dbus
/usr/local/etc/rc.d/webcamd
/etc/rc.d/ntpd
/usr/local/etc/rc.d/cupsd
/etc/rc.d/cron
/usr/local/etc/rc.d/bsdstats
/etc/rc.d/sshd
/usr/local/etc/rc.d/sddm
/etc/rc.d/bgfsck
/etc/rc.d/sendmail
root@mowa219-gjp4-8570p:~ #
Comment 15 Hans Petter Selasky freebsd_committer 2021-02-10 09:20:06 UTC
Which version of webcamd are you using?

Can you open the core dump with GDB from ports, and get the crashing backtrace?

Try also building webcamd with DEBUG option.

--HPS
Comment 16 Tatsuki Makino 2021-02-10 21:25:45 UTC
On another note, daemons that discard privileges do not dump the core.
We need to change the location to writable directory in /etc/sysctl.conf where we want the core to be dumped.
I have set the following full course :).
kern.corefile=/tmp/%N.%U.%P.%I.core
The % substitution is explained in core(5) manpage.
Comment 17 Graham Perrin 2021-02-10 21:36:24 UTC
(In reply to Hans Petter Selasky from comment #15)

Thanks, I don't recall seeing a core file. If there was one, I might have removed it (sorry). 

I have this in my /etc/make.conf

WITH_DEBUG_PORTS=webcamd

– but I haven't installed from ports recently. 

% pkg query '%o %v %R' webcamd
multimedia/webcamd 5.10.6.0_1 FreeBSD
% pkg info webcamd | grep stalled
Installed on   : Tue Feb  9 01:06:28 2021 GMT
% 

I'll build and install now but I might not find time to retest until later in the week, or the weekend. 

In the meantime, <https://old.reddit.com/r/freebsd/comments/lgpsmv/webcams_with_freebsdcurrent_and_an_hp_elitebook/gmssxev/> does the observation of bsdsisks using 100% CPU offer any clue?
Comment 18 Tatsuki Makino 2021-02-10 22:55:22 UTC
(In reply to Graham Perrin from comment #17)

I felt that WITH_DEBUG_PORTS had to be written like WITH_DEBUG_PORTS=multimedia/webcamd .

More simply, WITH_DEBUG=yes all ports are built for debugging.
Comment 19 Graham Perrin 2021-02-11 13:19:26 UTC
This morning, 

Feb 11 11:12:53 mowa219-gjp4-8570p kernel: ugen0.4: <Creative Technology Ltd. Creative WebCam Live Motion> at usbus0
Feb 11 11:12:54 mowa219-gjp4-8570p kernel: pid 8586 (webcamd), jid 0, uid 0: exited on signal 10 (core dumped)

I found the dumps, 

% ls -hl /*.core
-rw-------  1 root  wheel    67M  3 Feb 06:29 /bsdisks.core
-rw-------  1 root  wheel    12M 11 Feb 11:12 /webcamd.core
% 

– but nothing useful in the latter: 

root@mowa219-gjp4-8570p:/ # gdb attach /webcamd.core
GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd14.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
attach: No such file or directory.
[New LWP 102249]
[New LWP 107804]
[New LWP 107805]
[New LWP 107806]
[New LWP 107807]
[New LWP 107808]
Core was generated by `/usr/local/sbin/webcamd -i 0 -d ugen0.4 -H -B -U webcamd -G webcamd'.
Program terminated with signal SIGBUS, Bus error.
#0  0x00000000005b7a90 in ?? ()
[Current thread is 1 (LWP 102249)]
(gdb) bt
#0  0x00000000005b7a90 in ?? ()
#1  0x0000000000000001 in ?? ()
#2  0x00000000000000d8 in ?? ()
#3  0x0000000000000000 in ?? ()
(gdb) q


(In reply to Tatsuki Makino from comment #18)

> WITH_DEBUG_PORTS=multimedia/webcamd

Thanks, I updated my /etc/make.conf then rebuilt and reinstalled. 

----

root@mowa219-gjp4-8570p:/ # service webcamd start
Starting webcamd.
root@mowa219-gjp4-8570p:/ # service webcamd status
webcamd is not running.
root@mowa219-gjp4-8570p:/ # 

– I'll restart the computer and maybe get another crash of webcamd.
Comment 20 Hans Petter Selasky freebsd_committer 2021-02-11 14:51:50 UTC
Please install the GDB from ports and use that gdb instead.

Repeat.

Thank you!

--HPS