Getting rid of pulseaudio autospawn problem

Well, yes, after latest updates, my audio system stopped working properly. I have a Raspberry PI B+ with the HiFiBerry add-on card, providing a very nice and clear sound to my HiFi system. So, what was going on?

$ journalctl -f

Dec 28 09:43:48 xxxx pulseaudio[3050]: [pulseaudio] pid.c: Daemon already running.
Dec 28 09:43:48 xxxx spotifyd[2650]: 09:43:48 [ERROR] Could not start audio: Connection refused

The log shows the problem with spotifyd, but it also affected the mpd instance that used to worked very nicely.

After spending some hours (!) tinkering with the pulseaudio client.conf,, reinstalling it, etc, trying to avoid the –system mode, well, I managed to work it out. Sharing it here for others to spend less time.

The problem is with the pulseaudio “autospawn” feature, I think. This is a known issue and google searches prompted forums and bug tickets about it. Others were simply and squarely recommending disabling pulseaudio. That’s not an option for me as I also use the TCP sink to stream music to my HiFi system from other computers via pulseaudio native-tcp plugin.

The architecture of my setup is:

  • Have a pulseaudio system service start under the mpd user
    • Have this instance offer system-wide connections from other processes from localhost
  • Disable autospawn for the mpd user
  • Configure mpd to connect to localhost
  • Configure pulseaudio for user mpd so any process launched under it won’t autospawn but will connect to localhost instead. This is useful for the Spotify Daemon, in may case

The configuration files are here:

Just edit the files shown in that gist. You may need to create the mpd user’s client.conf file. I’ve shown there the default path as installed on Raspbian. If you’ve customized mpd’s HOME directory, then please adjust the path so you end-up with ${HOME}/.config/pulse/client.conf

Don’t forget to enable the pulseaudio service so it automatically starts upon next boot. Then stop mpd and any other pulse client, kill all pulseaudio instances, start the pulseaudio service then mpd and the other music-related daemons and enjoy. Don’t forget to have a separate terminal monitoring the “journalctl -f” so you quickly spot problems.

Have fun!

Installing debian on the 96boards poplar board

OK, I’ve received my 96Boards Poplar board. It comes with Android 5 pre-installed, and that’s not what I plan to use. I’d like to use Debian Linux instead to tinker a bit more with it.

The documentation is a bit hairy, and I was unable to directly install the Debian files on it so here are my notes to avoid other poplar beginners waste time.

  • Build Debian from sources as described in the documentation, steps 1..6
  • If you’re using Archlinux, then configure the TFTP server “tftp-hpa” and not “atftp” as this one has a limitation in the BLKSIZE and it simply serves truncated image files! And if you’ve disabled IPv6 on your Archlinux box, then add the -4 option to it’s options in the file /etc/conf.d/tftpd file

    TFTPD_ARGS=”–secure /srv/tftp/ -4″

  • Step 7 now becomes:

    cd ${TOP}/recovery
    sudo rm -rf /srv/tftp/recovery_files
    sudo cp -a recovery_files /srv/tftp
    sudo chown -R root:root /srv/tftp/recovery_files

  • The next steps about flashing the image won’t work. Or at least I was unable to make the board stop to the poplar# prompt as described there. Instead, use the USB stick method, but please use the prebuilt fastboot.bin and not the one you just built.Follow the Building recovery media instructions, only at “step 3: copy fastboot.bin” just copy the one downloaded from here
  • Now insert the stick in one of those 2 stacked USB ports, press the “usb_boot” switch and turn-on the board. Be vigilant to press a key when prompted in the `screen` terminal you’ve already started. If the board was already on, them press the “usb_boot” and while holding it depressed, press the “reset” button and keep the “usb_boot” depressed another second or two. Keep an eye on the screen terminal and press the key to interrupt the boot when prompted.
  • Now follow their instructions to flash Debian via TFTP and… have fun!

Make spamassassin learn spam messages right from mutt

If you’re using mutt and you also have your private e-mail server running spamassassin, then you’ll see some spam messages still getting through the pipeline, with scores just below the default 5.0. So here’s the cure: use sa-learn on the server in order to train spamassasin bayesian filter and help it increase score on real spam.

You already have:

  • offlineimap syncing your remote mailbox with a local folder from where mutt reads the messages.
  • Junk folder in your IMAP mailbox, and server-side SIEVE scripts automatically move spam messages into this folder.

The big picture:

  • Manually move the messages you want classified as spam into the Junk folder; offlineimap will automatically send them to the server upon next sync operation
  • Have a cron-job on the server call the sa-learn utility on the Junk folder

Detailed steps:

file .muttrc
macro index ,j “:set confirmappend=no delete=yes auto_tag=yes\n=Junk\n:set confirmappend=yes delete=ask-yes\n” “Send message to Junk folder”

Log-in to the mail server then:

file /root/
sa-learn –spam [path to dovecot Maildir]/.Junk/cur

#chmod +x /root/
#crontab -e

crontab file
# run each day at 01:00 AM the script
0 1 * * * /root/

Voilà ! Each time you’re on a spam message in mutt, just hit ,j and the next day you’ll get more messages automatically classified as spam in the Junk folder.

Bluetooth headset i3block

Recently I purchased a bluetooth headset as I really missed the ability to listen to my music in good conditions. They work quite well and I pretty happy with this wire-free system.

As an i3 window manager user I wanted an easy way to get it connected or disconnected, as I’m also pairing it with my phone. You might already know i3blocks and it’s ability to extend with custom blocks. These days I put together a bluetooth-headset i3block and I already submitted it to the main repository. Meanwhile, you can still get it from my personal clone. And BTW, if you happen to know a means of connecting/disconnecting bluetooth devices on ArchLinux without root access, please share!


Only two weeks from Randa, so many changes for me!

Three weeks ago I attended my second Randa Meetings. I found the same gentle Mario, richer now, as he has a little boy. The little boy’s actually a tester for the KDE Edu GCompris suite 😉 I’d like to thank Mario and his family for their support in organizing this event. It’s not that simple to keep happy so many people.

The kind people (I better say hackers) I already knew where joined by new faces, and it’s a pleasure to see our community is a very vivid and active one. They join this sprint from a bunch of different countries and I find it very interesting to discuss with them about their countries and experiences. And finally to see we are all the same.

Attending Randa was on my way from Lyon to Timisoara, Romania, where I started a new job on September 15. And that’s not my home town, neither my family’s. Actually, it’s my first time I live in this town, and I quite enjoy it. However, new job, new apartment, new people – all this let little to time for KSecret Service hacking. But as you can see, I can blog about it, so new commits will follow on the source code 🙂

Hopefully, until next Randa Meetings 2016 we’ll have a stable version everyone will be happy with. Until then, you only have two things to do, please:

  • Stay tuned and be a pre-alpha tester – I’ll blog here when first usable versions will become available
  • Donate to the ongoing fundraiser, to keep these KDE Sprints possible

Oh, last but no least, I may well organize a KDE Sprint here in Timi?oara. Anybody interested?


KSecret Service just created its first secrets file

Greetings from Randa!

Take a look at this:

Well, this is the first secrets file ever created with KSecret Service, and it happened here, in Randa. For the impatient – just hold your keyboards, the code is not yet ready. The tests are still failing, but items started to appear on disk, encrypted with libgcrypt.

Stay tuned and meanwhile remember, the fund raising campaign for KDE Sprints is still ongoing. Please consider to donate by clicking the banner below to make coding sprint like this one possible.
KDE sprints 2015 fundraiser campaign

Next week I’ll be in Randa

Since Akademy 2015 KSecrets Service development continued. I did lots of code cleanup. The async API now uses QFuture and the secrets file backend, based on libgcrypt, was added. Tests are there to confirm it’s not yet working. 🙂

One week from now I’ll be in Randa. The hacking ambiance will surely help to hopefully get a first pre-alpha version of the service. I also look forward to peer reviews and feedback on this new codebase.

This kind of events is made possible by our generous donors. If you’d like to join them and donate, helping the KDE community and me, then just click the image below:
KDE Sprints Fundraiser

Quick tip – sending notifications from the desktop to your phone with kdeconnect-cli

This entry is in the series “script addicts” using I3WM.

Put this in the scripts that are creating notifications:

kdeconnect-cli -d --ping-msg "${notificationMsg}"

That’s it! Now, the notifications will hunt you around if you’re not in front of your workstation.

Goodbye Akademy 2015, See You Randa 2015

OK, Akademy 2015 ended last week. This is my second Akademy, though the first full one.

A Coruña is located on the Atlantic front and on my way there, I encountered rainy spots and the rain was a familiar one for me, after having lived several years in northern France (Paris and Pays de la Loire). But this time I actually found it quite enjoyable, knowing that I left behind a 39°-heated Lyon. So, yes, A Coruña is warmer than what we could encounter in other parts of Spain. I shared my car with Sandro Knauß, who came to Lyon from Germany by train, so the one full-day trip was quite nice, KDE hacking-oriented. But be assured, we were also able to talk lots of other topics.

The venue and the hosting in Rialta were just perfect. The local team did an awesome job when organizing the event. They had it all: welcome party – we arrived at the right moment for the Queimada – sponsored food during the week-end (thanks Blue Systems), essential goodies (they carried the VIM T-shirt), “social event” – that was really a party where I had an excellent time -, the day trip and all the schedules which weren’t difficult to follow. Rialta has free swimming pool and I actually managed to use it.

Akademy is about KDE technology but also about meeting like-minded people. Getting along together is really easy, language barrier took apart, and I actually really enjoyed just sitting there and hacking with others, then having a beer or discussing technical issues or ideas. I already miss these spontaneous late evening hacking moments.

Speaking about KDE technology, we are at a turning moment, with Plasma Mobile becoming available. KDE is now ready to take on the mobiles platforms and that’s pretty cool. I look forward to the moment when I’ll have a Linux smartphone running both KDE software and Android applications (with Shashlik, bien-sur). I’ll do my best to help and I already plan to support KSecrets Service on mobile.

KSecrets Service had it’s own BoF. The updated slides are here. I’m working right now in implementing it and that would bring us to Randa, where I intend to continue even further and hopefully I’ll even have a working version by that time.

Randa is a great location for hacking. In fact, no, not Randa, but the venue in Randa is quite perfect for that 🙂 They have that big room under the roof, upstairs, where I look forward to hack, between some BoF’s or swiss meals. Some people who couldn’t make it to Akademy will go to Randa, so I look forward to meeting them there. Oh, and if you can, please help them getting there by the means of a small donation.

Finally, but not less importantly, I’d like to thank KDE e.V. and the sponsors for organizing these events and for providing travel reimbursement.

Stop using GIT for synchronizing files!

Well, this quick blog post is a sort of a quick rant.

That’s the second time I see someone trying to use GIT for binary files synchronization. That’s true, it’s quite easy to create a local GIT repository, then adding a remote is a piece of cake and “TADA” local commits could be pushed to the remote than from there cloned / pulled into another machine. But! Because there’s a really big “BUT”!

Remember for what GIT was designed. That’s right, source file handling, with history and merging. What are source files? They are text files, yes. That’s not binary. GIT can actually compare successive version and only handle diffs (patches). Have you tried using the patch tool with binary files? That makes you laugh, isn’t it! So why using GIT for file sync won’t you also make you laugh? Should I continue now? 😉 Well, I should continue, because GIT also has history. So you’ll force it to store every binary version you ever had, into it’s little .git directory. Is that what you really want?

If file synchronization is needed, then consider rsync, unison or equivalent tools, pretty please.