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

Monday, March 14, 2016

Macports Octave build hangs on El Capitan

While trying to install Octave from Macports on El Capitan, the build hangs during atlas compilation. Existing bug reports don't really provide a solution.

Luckily, Octave wiki provides a solution in 4.3.1 Simple Installation Instructions

  sudo port install atlas +gcc5
  sudo port install arpack -acclerate +atlas
  sudo port install octave

Wednesday, February 10, 2016

Personal streaming music server


I would like to have a private Spotify / Google Music / Apple music like setup. For free. As I already have bought the music once in the past.

Music files would be stored at home, but accessible anywhere. This way I could listen to all my favourite songs on the go. And do this with low end smartphones which have limited storage capacity but flat fee 3G/4G network access.



Raspberry PI to start with.


  • Both the server and the mobile application keep on crashing
  • Depends on Tondo servers to be available. I can only hope their freemium business model is sustainable forever.
  • Implemented in Java
    • Needs to be configured for low ram from defaults

    • You need patience to start it up on a Raspi model B 
  • Auto start for now
    su -c /var/madsonic/standalone/ pi

    Mobile application


    General host/network setup

    • Public IP - attach to a VLAN outside the firewall
    • Dynamic DNS from
    • Set up DNS update in /lib/dhcpcd/dhcpcd-hooks/
    case "$reason" in
    curl -u user:pass ''

    • Set up usbmount to automatically mount USB sticks

     sudo aptitude install usbmount

    • Set up NAT from a privileged port to an user process
    iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 4040