Saturday, December 10, 2016

debugging systemd service in Raspbian 8 through core dumps

Taking notes on what I did to enable core dumps from a service running under systemd. Not sure which of these were strictly necessary, though.

Added to /etc/security/limits.conf
* soft core unlimited
* hard core unlimited

Added to /etc/sysctl.d/core.conf
kernel.core_pattern = core-%e-sig%s-user%u-group%g-pid%p-time%t
kernel.core_uses_pid = 1

fs.suid_dumpable = 2

Added to /lib/systemd/system/my-service.service [Service] -section

created world-writable dump directory
sudo mkdir -p /var/lib/coredumps
sudo chown nobody:nogroup /var/lib/coredumps
sudo chmod a+w /var/lib/coredumps/

Verified that limits are ok
grep core /proc/$(pgrep damon-process-name-here)/limits

Verified that core gets dumped
sudo kill -SIGABRT $(pgrep damon-process-name-here)
gdb /bin/my-daemon /var/lib/coredumps/core*

Tuesday, December 6, 2016

HP network printing in Ubuntu fails with m_Job initialization failed with error = 48

Note to self: next time my HP network printer fails to work properly in Linux, use hpsetup -i to install the printer. Don't rely on the easy looking graphical user interface to install the printer.

D [06/Dec/2016:22:20:54 +0200] [Job 5] Processing page 1...
D [06/Dec/2016:22:20:54 +0200] [Job 5] Set job-printer-state-message to "Processing page 1...", current level=INFO
D [06/Dec/2016:22:20:54 +0200] [Job 5] prnt/hpcups/Hbpl1.cpp 52: Hbpl1 constructor : m_szLanguage = HBPL1STATE: +hplip.plugin-error
D [06/Dec/2016:22:20:54 +0200] [Job 5] prnt/hpcups/HPCupsFilter.cpp 486: m_Job initialization failed with error = 48
D [06/Dec/2016:22:20:54 +0200] [Job 5] PID 3860 (/usr/lib/cups/filter/hpcups) stopped with status 1.
D [06/Dec/2016:22:20:54 +0200] [Job 5] Hint: Try setting the LogLevel to "debug" to find out more.
D [06/Dec/2016:22:20:54 +0200] [Job 5] prnt/backend/hp.c 919: ERROR: null print job total=0