Running crashplan (headless) on a Raspberry pi 2

In my grand scheme of “abuse all the low-power computing things!”, I’ve moved my crashplan backups over to the Raspberry Pi 2 (rpi2 for short). Installation is relatively painless: download the installer from the crashplan site, and unpack and execute. I installed mine under /opt/crashplan.

Afterwards, there are some things to fix, though, as by default Crashplan is only supported on the Intel architecture:

Install a working JRE (& dependencies for the GUI app should you want to launch it through X forwarding):

apt-get install oracle-java8-jdk libswt-gtk-3-jni libswt-cairo-gtk-3-jni
rm /opt/crashplan/jre; ln -s /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/ /opt/crashplan/jre
rm /opt/crashplan/lib/swt.jar; ln -s /usr/share/java/swt.jar /opt/crashplan/lib/swt.jar

Replace some libraries by their recompiled variants – you can compile them yourself (thanks to Jon Rogers for the instructions) or download them straight from his site if you’re lazy.

wget http://www.jonrogers.co.uk/wp-content/uploads/2012/05/libmd5.so -O /opt/crashplan/libmd5.so
wget http://www.jonrogers.co.uk/wp-content/uploads/2012/05/libjtux.so -O /opt/crashplan/libjtux.so

Add a library to the CrashplanEngine startup classpath:

sed -i 's|FULL_CP="|FULL_CP="/usr/share/java/jna.jar:|' /opt/crashplan/bin/CrashPlanEngine

And now you should be able to start your engine(s)!

/opt/crashplan/bin/CrashPlanEngine start

And the desktop app (which you can forward to your local Linux pc via ssh -X user@rpi2)

/opt/crashplan/bin/CrashPlanDesktop

this does take forever to start. But it works. Or you can use these instructions (from Crashplan Support) to administer it remotely.

ASUS UX305UA and Linux

The ASUS UX305UA is an ultrabook with the Skylake microarchitecture – the (as of writing) latest iteration in Intel processors. Unfortunately, Skylake support on Linux wasn’t really a granted thing the time the device got released. Fortunately it’s gotten a lot better of late.

After searching and reporting some bugs to the Debian Bugtracker, nearly everything works out of the box on Debian Sid (unstable), and probably soon on Stretch (current testing). So if you’re installing a new one now, I’d really suggest you go for Sid instead.

After installing the base system via a netinstall image, you’ll probably end up with a Stretch (testing) installation with a 4.3 kernel. This will not really work when rebooting, giving you a black screen. To solve that, boot with

i915.preliminary_hw_support=1 i915.modeset=0

on the kernel command line.

After this, I’d recommend adding a line for unstable and experimental to your apt sources:

# echo "deb http://httpredir.debian.org/debian/ unstable main contrib non-free" > /etc/apt/sources.list.d/unstable.list
# echo "deb http://httpredir.debian.org/debian/ experimental main contrib non-free" > /etc/apt/sources.list.d/experimental.list

and then upgrading your system to the latest unstable:

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

This will result in you getting a linux-4.5 kernel and a boatload of updated drivers (eg. Xorg)

Next, upgrade even further: scary experimental mode on! This you’ll need to do manually (experimental never auto-upgrades, because of the possible breakage that might be caused):

First, find out the latest kernel

# apt-cache search linux-image-4 | grep amd64
linux-headers-4.5.0-1-amd64 - Header files for Linux 4.5.0-1-amd64
linux-image-4.5.0-1-amd64 - Linux 4.5 for 64-bit PCs
linux-image-4.5.0-1-amd64-dbg - Debugging symbols for Linux 4.5.0-1-amd64
linux-headers-4.6.0-rc3-amd64 - Header files for Linux 4.6.0-rc3-amd64
linux-image-4.6.0-rc3-amd64 - Linux 4.6-rc3 for 64-bit PCs
linux-image-4.6.0-rc3-amd64-dbg - Debugging symbols for Linux 4.6.0-rc3-amd64
linux-image-4.5.0-1-amd64-signed - Signatures for Linux 4.5.0-1-amd64 kernel and modules
linux-headers-4.4.0-1-grsec-amd64 - Header files for Linux 4.4.0-1-grsec-amd64
linux-image-4.4.0-1-grsec-amd64 - Linux 4.4 for 64-bit PCs, Grsecurity protection

As you can see above, 4.6.0-rc3 is available, but since it’s a prerelease kernel it’s not automatically installed. We want it, and with it, a bunch of firmware packages (to make sure we have the latest)

# apt-get install -t experimental linux-image-4.6.0-rc3-amd64 firmware-linux firmware-iwlwifi firmware-misc-nonfree intel-microcode

For good measure, you can even throw the latest iwlwifi firmware (not packaged yet in Debian) in the mix (found on GitHub):

# wget https://github.com/OpenELEC/iwlwifi-firmware/raw/master/firmware/iwlwifi-7265D-21.ucode -O /lib/firmware/iwlwifi-7265D-21.ucode

Next, reboot, and things should look a lot better already. Right now everything will work, except..

  • screen brightness buttons (Fn-F5 Fn-F6 Fn-F7). This requires (for now) this patch from kernel bugreport 98931. (Debian bugreport: 818494)
  • Screen auto brightness/ambient light (Fn-A): you can use the driver from GitHub
  • Disable-touchpad button (Fn-F7): you can use any old script, really. Just call synclient TouchpadOff=1 and it’s off. And =0 for on)

Using adb with a OnePlus X on Linux…

… is not really that hard. Just annoying. Since OnePlus’ USB ID is not in the default adb list, you need to add it yourself:

echo "0x2a70" >> ~/.android/adb_usb.ini

where 0x2a70 is the identifier for OnePlus. (you can find this with lsusb)

To add automatic permissions to the device node when it’s created, add this udev rule to /etc/udev/rules.d/51-android.rules (all on one line):

SUBSYSTEM=="usb", ATTR{idVendor}=="2a70", MODE="0666", GROUP="plugdev" ATTR{idVendor}=="2a70", ATTR{idProduct}=="9011|f003", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

Replacing OS X with Linux on my Mac Mini 2,1

I still had an old Mac Mini (model 2,1) – which I bought during a period of experimentation with different operating systems –  connected to the TV, running Mac OS X Lion. Not Apple’s finest installment of OS X, truth be told.

The reasons I wanted to get rid of it:

  • Apple stopped providing updates for it. Not fantastic from a security point of view.
  • They also managed to actually break VNC for anything except the OS X client
  • TeamViewer takes up a ridiculous amount of CPU power on OS X
  • You can’t turn off the Mac Mini using the power button, it goes to sleep, and it can’t be reprogrammed.
  • It’s just .. sooo… slooooooooow

The only thing the device is used for is

  • iTunes to manage an iPod classic, and to auto-rip newly bought CD’s
  • Using Videostream to cast movies to our Chromecast
  • Playing music from the audio library to the connected amplifier

Not much, really. So, in the end, being tired of the general slowness of the device, I bit the bullet, exchanged the old 80GB hard disk with a newer and bigger model, and went on the journey to install Debian on it.

So, the road to success was:

  1. download the multiarch network install CD image, burn it to a CD. 1
    Why multi-arch, you might ask? Why not use the x86_64 (64-bit) install image, as the Intel Core2Duo is capable of handling this? Because Apple, in all their wisdom, decided to include a 32-bit EFI with a CPU capable of handling 64-bit code. So you get a bit of a schizophrenic situation. The multiarch CD image supports both 32-bit and 64-bit (U)EFI, and hence, it works for this device.
  2. boot from said CD (press and hold the ALT button as soon as the grey screen appears on your Mac)
  3. profit!

I installed:

All in all it works rather nicely. The only problems I ran into was with respect to the iPod management, which was solved by resetting the iPod with iTunes for windows, which formatted the device as VFAThttps://en.wikipedia.org/wiki/File_Allocation_Table#FAT32, instead of Mac OS’ HFS+.

  1. note that this link points to the daily built CD images, which might or might not be broken at any given day

Connecting your Chromecast to wired networking – DIY

I’ve had a Google Chromecast (1st generation) for a while now, connected over WiFi. Works great, although sometimes the wireless reception cuts out, or the signal gets saturated. Since I’m mostly streaming from a device which sits less than 10 cm away, it is also rather stupid to have all those packets going back and forth to my router, causing unnecessary load.
Google has a nifty solution, the Ethernet Adapter for Chromecast, but it’s 1. rather expensive for what it is (in my opinion), and 2. difficult to get your hands on (in Belgium, where I live).

So, after some digging, enter a DYI solution that works ;) It costs about half, but requires more patience (for delivery).

I ordered following pieces of DealExtreme, and had them ship here:

To install it all: plug the mini-USB power supply (delivered with the Chromecast) into the blue plug, the network dongle into the normal USB plug, and the black connector into the Chromecast. (And an ethernet cable into the network dongle, duh). It should automatically pick up the fact that it’s now connected via ethernet, and other than that… it just works. Enjoy ;)

(Edit: I’ve noticed that this setup does cause plenty of electrical interference… so FM reception becomes nearly impossible. Have to figure out what is real cause)

Managing TP-Link easy smart switches from Linux

I’ve recently acquired some TP-Link ‘Easy Smart’ managed switches – cheap, decently built (metal casing), and a lot of features above the usual unmanaged stuff:

  • Effective network monitoring via Port Mirroring, Loop Prevention and Cable Diagnostics
  • Port and tag-based QoS enable smooth latency-sensitive traffic
  • Abundant VLAN features improve network security via traffic segmentation
  • IGMP Snooping optimizes multicast applications

Unfortunately, it uses a windows application to manage the switches – the 5 and 8 port varieties don’t have a usable built-in web server to manage them. Luckely, there’s a way to make that still work on Linux ;) as it seems that it’s just a JavaFX application. The only thing you’ll ever need a windows installation for (or use Wine) is to install the actual application.

After installation, You’ll find a file called “Easy Smart Configuration Utility.exe” in the installation path. Copy that to your Linux installation, rename to .jar, and you’re good to go.

To run it, you’ll also need the Oracle Java distribution, as JavaFX is not yet part of OpenJDK. Install that in your distribution of choice, and you’ll be able to start the application using java -jar “Easy Smart Configuration Utility.jar” and it’ll start right up.

tplink_easysmart

Unfortunately, it doesn’t work out of the box. The tool doesn’t find any devices on the network, but they are there.
Checking with netstat, the tool bound itself on UDP port 29809, on the local ip address.

$ PID=$(pgrep -f "java -jar Easy Smart Configuration Utility.jar"); netstat -lnput | grep -e Proto -e $PID

Proto  Recv-Q  Send-Q  Local Address            Foreign Address  State  PID/Program name 
udp6   0       0       [your ip address]:29809  :::*                    28529/java

Checking with tcpdump showed that the traffic was returning, but since our tool is only listening on the local ip, and not the UDP broadcast address, it never sees anything.

# tcpdump udp port 29809
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlp1s0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:35:48.652235 IP [your ip address].29809 > 255.255.255.255.29808: UDP, length 36
09:35:48.961586 IP [switch ip address].29808 > 255.255.255.255.29809: UDP, length 159

It seems the tool binds to the local IP instead of the ‘any ip’, 0.0.0.0, so you need to locally forward the traffic incoming on the port to your local ip. To do this, execute this command (and/or add it to your local firewall script):

# iptables -t nat -A PREROUTING -p udp -d 255.255.255.255 --dport 29809 -j DNAT --to [your ip address]:29809

And don’t forget to enable IP forwarding

# echo 1 > /proc/sys/net/ipv4/ip_forward

Now you should be able to find and configure the switches in your local network.

OpenWRT, dual routers, dual SSIDs and VLANS

Back in the day I used to have one router in the house: the D-Link DIR-825, flashed with OpenWRT. Configured with two SSIDs – one for internal network use, and one for guest access – the latter being separate from the internal network of the flat.

After moving to our house, I discovered that the house construction materials provide a better shielding for radio signals, which in turn meant that the reach of my WiFi router wasn’t quite what it should be to reach the far corners of the place. I tried increasing the output wattage, but that had only a marginal increase in reach. So in the end I opted getting a new primary router – the TP-Link Archer C5 (though mine has three antennas?), which was promptly reflashed with OpenWRT. The DIR-825 was moved to the opposite corner of the house to increase reach, and at the same time I lowered the output wattage of the radios.
Because of time constraints, I didn’t bother stretching the guest wifi to the second router, as it requires a bit more configuration to properly separate the flows of data between the two networks: vlan configuration.

Continue reading