Restart KDE

When plasmashell crashes, restart it like this without logging out:

$ kquitapp plasmashell ; sleep 3 ; plasmashell --shut-up &

If that doesn’t work, kill the process plasmashell with SIGKILL.

If KWin doesn’t work any more, restart it with:

$ kwin_x11 --replace 2>&1 > /dev/null &

 

flac + cue to mp3

To convert a single flac file with a cue sheet to mp3, first split it up:

$ shnsplit -f <sheet.cue> <source.flac>

Then convert the wav-files to mp3 with ffmpeg:

for i in *.wav ; do ffmpeg -i ${i} -codec:a libmp3lame -qscale:a 2 ${i%%wav}mp3 ; done

Or, if you have individual flac files:

for i in *.flac; do ffmpeg -i ${i} -codec:a libmp3lame -qscale:a 2 ${i%%flac}mp3 ; done

qscale:a 2 produces mp3s with an average bitrate around 170-210 kbit/s. It should be close to lossless.

Upgrade Mailscanner

The easy part:

  • Download the tarball from the official website
  • Unpack to somewhere
  • execute <unpack-dir>/install.sh

The hard part:

Do not agree to install the missing perl modules from CPAN! Install them via the package manager. If almost every module is missing, perldoc is not installed. Debian is especially nasty here. They have a perldoc executable, even if it isn’t installed, and it only prints “the package perl-doc is not installed” or something and instructions how to install it.

Unfortunately the installer uses perldoc to figure out which modules are missing, so when it calls the stub everything is missing…

If there is a version mismatch, check if you have a CPAN-Version installed in /usr/local/<something>.

# perl -V

shows @INC at the bottom. Remove the offending package and install it via your favorite package manager.

The config part:

Generate a new config in the new etc-Directory as described in the docs. If you’re using MailWatch, don’t forget to copy

lib/MailScanner/CustomFunctions/MailWatch.pm

to the new directory. Stop mailscanner, link the new version to /opt/MailScanner or something and start it. You applaud 🙂

 

Upgrade wheezy to jessie

All in all, it was easy. Just one big caveat regarding apache2. Can’t say if it was PEBKAC any more. But read below.

1. Check for obsolete packages

As stated in the official Upgrade Guide: Do an audit!

# dpkg --audit

Really, do it! And fix the non-compliant packages.

2. Install the Distribution Kernel

Again, really do it. Otherwise the dist-upgrade will fail on udev, if your custom kernel doesn’t have CONFIG_SIGNALFD, CONFIG_FHANDLE and whatnot built in. You can override it, but then it won’t boot. So better be safe.

3. Update and dist-upgrade

Change /etc/apt/sources.list to use jessie. Then

# apt-get update
# apt-get dist-upgrade

Carefully watch for configfile-conflicts. Esp. Apache and cyrus! Keep the config for:

  • /etc/cyrus.conf
  • /etc/imapd.conf

Don’t overwrite them! We’ll fix them later!

4. Reboot

Reboot into the new system, get systemd running. Again, don’t even think to go on without a reboot

5. Fix cyrus and postfix

The command for cyr_* has changed. Now it’s so cyrus <*>, so move the old config out of the way and replace it with .dpkg-dist. Then diff it and change the relevant line(s). That would be especially:

lmtpunix cmd="lmtpd" \
   listen="/var/spool/postfix/cyrus-socket/lmtp" \
   prefork=0 maxchild=20

with

lmtp cmd="lmtpd -a" listen="localhost:lmtp" prefork=0 maxchild=20

So don’t listen on an AF_UNIX socket any more but on a network socket. For this to work you need to add this line to /etc/services:

lmtp        24/tcp

LMTP doesn’t seem to be a well known port, whatever…

Now for postfix: Change /etc/postfix/main.cf accordingly:

mailbox_transport = lmtp:inet:localhost

I.e. listen on a network socket instead of AF_UNIX. This way you don’t have to bother with permissions on the socket file, and it’s IPv6-enabled as a bonus 🙂

6. Fix apache2

Make sure all your files in sites-available end in *.conf! Otherwise they won’t be loaded! I learned the hard way, wondering why SSL-Connections failed because there was no SSL. Check what VHosts are loaded with:

# apache2ctl -t -D DUMP_VHOSTS

If that shows no Vhosts, you don’t have any! Fix it. BTW, NameVirtualHost is obsolete. Remove it. So seems to be gnutls…

Create an IPv6-enabled-VHost like this:

<VirtualHost _default_:443>
...
</VirtualHost>

 

Archlinux and Networkmanager

NetworkManager is a nice piece of software, congrats to the developers! But there are several catches on Arch Linux:

  1. Disable systemd-networkd
  2. Disable systemd-resolvd
  3. The most important one: Remove the package openresolv! If you don’t, you may end up  with an empty /etc/resolv.conf! It will be there for one or two seconds, but then the openresolv-scripts will remove it and in the best case link it to some non-existing file in /run

Back to KDE

What happened?

Some things were just too annoying with awesome:

  • cvlc -f not opening full screen, just sometimes, completely at random. When  it didn’t, it froze.  When it did, it slowed down everything. First I thought that it had  something to do with VDPAU  and tried to turn it off, but I didn’t even get that far.
  • Maximizing a youtube-video in Chromium seemed to freeze the screen. Eventually I figured out that awesome decided to open it in the background or something. Surprisingly, maximizing the window in that state raised it. Learned that by accident.
  • ffplay and mplayer windows centered right where they shouldn’t: between both screens.

Overall, a tiling window manager is nice when  you use X just as a console multiplexer, but if you want more, the disadvantages outweigh the advantages.

So I decided to give KDE another shot. I used it before, but eventually got annoyed by all the useless crap I don’t want nor need, like Akonadi or Nepomuk.

The Experience

So I replaced

exec awesome

with

exec startkde

in my .xinitrc. First thing I noticed was my CPU fan spinning up. Baloo_file decided to have my 6 CPUs work overtime. I found out that it is the new file indexer of the KDE framework. Don’t want it, don’t need it, but easily fixed. Just turn  off the Desktop Search in System Settings. For good measure I also added

chmod -x /usr/bin/baloo_file

Other than that I’m quite happy with it. cvlc -f  always starts full screen again, and a tabbed Konsole is so much nicer than a tiled urxvt 🙂 Chromium and youtube also work as  expected again.

What I miss

What I really miss is separate desktops per screen, but from what I read that won’t be implemented soon, if ever. Well, you can’t have everything. Fortunately I found workarounds for most cases.

 

RAID

RAID-Devices

  • /dev/md0
    am@hadante ~ $ sudo mdadm -Q --detail /dev/md0 
    /dev/md0: 
            Version : 1.2 
      Creation Time : Wed May 27 13:52:56 2015 
         Raid Level : raid5 
         Array Size : 1463976960 (1396.16 GiB 1499.11 GB) 
      Used Dev Size : 487992320 (465.39 GiB 499.70 GB) 
       Raid Devices : 4 
      Total Devices : 4 
        Persistence : Superblock is persistent 
     
      Intent Bitmap : Internal 
     
        Update Time : Sat Jun 10 15:26:28 2017 
              State : clean  
     Active Devices : 4 
    Working Devices : 4 
     Failed Devices : 0 
      Spare Devices : 0 
     
             Layout : left-symmetric 
         Chunk Size : 512K 
     
               Name : archiso:0 
               UUID : 6d795529:03e05967:c4d50bcf:5dd604b7 
             Events : 3136 
     
        Number   Major   Minor   RaidDevice State 
           0       8      130        0      active sync   /dev/sdi2 
           1       8       18        1      active sync   /dev/sdb2 
           2       8        2        2      active sync   /dev/sda2 
           4       8      146        3      active sync   /dev/sdj2
  • /dev/md1
am@hadante ~ $ sudo mdadm -Q --detail /dev/md1 
/dev/md1: 
        Version : 1.2 
  Creation Time : Thu May  2 18:08:00 2013 
     Raid Level : raid5 
     Array Size : 8790405120 (8383.18 GiB 9001.37 GB) 
  Used Dev Size : 2930135040 (2794.39 GiB 3000.46 GB) 
   Raid Devices : 4 
  Total Devices : 4 
    Persistence : Superblock is persistent 
 
    Update Time : Sat Jun 10 15:26:58 2017 
          State : clean  
 Active Devices : 4 
Working Devices : 4 
 Failed Devices : 0 
  Spare Devices : 0 
 
         Layout : left-symmetric 
     Chunk Size : 512K 
 
           Name : hadante:1  (local to host hadante) 
           UUID : 0227c805:00c429e6:231a9f6f:168e5a4a 
         Events : 587869 
 
    Number   Major   Minor   RaidDevice State 
       7       8       64        0      active sync   /dev/sde 
       5       8       80        1      active sync   /dev/sdf 
       6       8       96        2      active sync   /dev/sdg 
       4       8      112        3      active sync   /dev/sdh

Order in external casing

From top to bottom:

  1. ST3000DM001-1ER166, Serial W501VAJY
  2. ST3000DM001-1CH166, Serial Z1F58T6T
  3. HGST HDN724040ALE640, Serial P4HU954B
  4. ST3000DM001-1CH166, Serial Z1F1JTDT

Slot History

  1. Original -> replaced by a recertified drive (Z1F2X130 – 2015/04/25) -> replaced by  a defective HGST 4TB that didn’t even start up on 2017/06/09 -> replaced by another SEAGATE 3TB drive in stock the same day (W501VAJY – delivered 2016/10/18)
  2. Original? (no history available)
  3. Original -> replaced by recertified drive (W1F2L184) -> replaced by Z1F142XH on 2016/08/26 (in stock, delivered 2016/06/26), which turned out to be defective and out of warranty (returned to sender, the replacement is in slot 1 now) -> replaced by HGST 4 TB (Serial: P4HU954B) on 2016/09/03. Read the whole story here
  4. Original? (no history available)

Remarks

  • [2017/06/10] I’m not really sure about the history of slot 3. A previous version said that it was slot 4, but the Amazon history says otherwise.
  • [2017/06/10] Despite still having a SEAGATE 3TB drive in stock I ordered a new HGST 4TB on Whitsunday 2016/06/04, delivered as promised on 2016/06/07. Unfortunately I couldn’t get my hands on it until Friday 2016/06/09, because the neighbor accepting the parcel wasn’t around when I was. Not at 3pm, 6pm nor 9pm (Wednesday and Thursday), so I took an early lunch break on Friday at about 11:15am and rode home to pick it up, yay! Much to my dismay the drive was defective. Instead of spinning up it made clicking, scratching sounds and didn’t show up in /dev, so I eventually replaced it with the 3TB SEAGATE drive, because I didn’t trust the still working, but failing drive any more. After a hard crash on Wednesday hadante kicked the (healthy) HGST drive out of the array, so I had to rebuild with the failing drive. About 24 hours later the rebuild finished, lucky me! I’m gonna return the HGST drive to the sender next week instead of voiding my warranty.
# journalctl -k | grep md1 
Jun 09 15:25:31 hadante kernel: md: md1 stopped. 
Jun 09 15:25:31 hadante kernel: md/raid:md1: device sdf operational as raid disk 1 
Jun 09 15:25:31 hadante kernel: md/raid:md1: device sdh operational as raid disk 3 
Jun 09 15:25:31 hadante kernel: md/raid:md1: device sdg operational as raid disk 2 
Jun 09 15:25:31 hadante kernel: md/raid:md1: raid level 5 active with 3 out of 4 devices, algorithm 2 
Jun 09 15:25:31 hadante kernel: md1: detected capacity change from 0 to 9001374842880 
Jun 09 15:27:46 hadante kernel: md: recovery of RAID array md1 
Jun 10 13:44:01 hadante kernel: md: md1: recovery done.

 

OpenVPN and IPv6-Bridging

Nothing is as easy as it seems. Sigh… 🙁

I was getting strange timeouts when accessing sites via tunneled IPv6 (OpenVPN). Turned out that the sender never got the ICMPv6-Redirect from the tunnel endpoint, i.e. OpenVPN-Server. The ICMPv6-Packet is sent from the link-local address of the gateway (fe80::some:thin:g/64), because it gets dropped in the FORWARD-Chain of the gateway if the policy is DROP.

Setting it to ACCEPT magically makes things work, but that’s equal to turning off the firewall. Allowing traffic from and to fe80::/8 doesn’t help, either. Never figured out why.

What now? The physdev-module comes to rescue! Despite its name it can match the (virtual) tap-interface of the OpenVPN-Server. Just add the following rules to the beginning of the FORWARD-Chain:

ip6tables -I FORWARD -m physdev --physdev-out tap0 -j ACCEPT
ip6tables -I FORWARD -m physdev --physdev-in tap0 -j ACCEPT

and things run smoothly again 🙂

Change DirColors (literally)

1. Export the database to a file, say .config/dircolors:

$ dircolors -p > .config/dircolors

2. Customize it, eg. change directories to cyan:

...
DIR 01;36 # directory
...

3. Include it into .bashrc. Add this somewhere at the top:

eval $(dircolors .config/dircolors)

4. ANSI color codes

Ansi Color codes can be found here