MacBook Ubuntu Overheating

I dual boot Ubuntu 14.04 LTS on my work MacBook Pro (2015?). The SSD makes it a pretty quick dev machine but out of the box temperature control doesn’t seem to work. There are lots of outdated old forum posts about manually setting the fan speed. In 2018 all you need to do get fan control working is install macfanctld!

$ sudo apt install lm-sensors
$ sensors
Adapter: Virtual device
temp1: +35.3°C

Adapter: ISA adapter
Physical id 0: +73.0°C (high = +84.0°C, crit = +100.0°C)
Core 0: +73.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +69.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +71.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +68.0°C (high = +84.0°C, crit = +100.0°C)

Install fan control daemon:

sudo apt install macfanctld

Instantly the fans spin up and the temperature quickly drops down to normal:

$ sensors
Adapter: Virtual device
temp1: +33.9°C

Adapter: ISA adapter
Physical id 0: +54.0°C (high = +84.0°C, crit = +100.0°C)
Core 0: +54.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +50.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +50.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +50.0°C (high = +84.0°C, crit = +100.0°C)

Canon EOS 650D (T4i) SD Card Repair


The SD card slot had become unreliable on a friend’s 650D and was giving a “no media” error message. At first I had just packed one side of the SD card with a piece of paper, which worked a couple of times but actually ended up damaging the pins more. The following photos show how I dismantled and repaired the camera.

Tools required:
– Small Phillips screw driver
– Small Torx screw driver
– Tweezers


  • Remove the 4 Torx screws under the grip


  • Remove the view finder cover and the two Phillips screws


  • Remove the two Phillips screws on the other grip


  • Remove the 4 Phillips screws along the base of the camera, closest to the screen.


  • Prise open the camera back from top to bottom, taking care for the ribbon and screen cable at the bottom.


  • The camera motherboard is now revealed. The SD card slot is on the bottom right corner on the under side. There are 5 Phillips screws to remove before you can take out the motherboard. One of them is covered by the plastic around the zoom button, but you can only just bend it out of the way to get the screw in the top right hand corner.


This is a good education in ribbon cable connectors as there’s a few different kinds. Most just have a brown flick up cable lock.

  • After removing the motherboard I could inspect the SD card slot properly and see just how damaged the pins were. I used a minimally destructive approach and cut the metal box slightly, so I could get tweezers in there to bend the pins. One of them was twisted but could be twisted back. Another one snapped off at the end, so I had to bend a new contact point. When you are doing this you really need to test with a card and be sure the pins are low enough to make contact, but high and bent enough to not get stuck on the underside!


In the above image, the SD card “Write Protect” detect is inside the RHS of the socket. Do yourself a favour and bend it in to shape the first time so you don’t have to re-open the camera. It should theoretically be possible to bridge two pins on the connector to completely bypass write protect, but I didn’t manage to reason exactly which ones so thankfully bending the pins was sufficient.


After reassembling, testing, and going round the loop of taking the camera apart again, I finally got it working again 🙂



Camera does not power on

This happened the first time I reassembled it. The camera will not power on if either the battery or SD card compartments are open.

Lots of videos suggest: powering off, removing battery and SD card and lens, then reattaching, inserting a battery but not SD card, closing all compartments, power on again. This didn’t work for me.

Another suggestion was to power off and remove battery, then switch to ‘P’ mode, power on camera and hold down shutter for 15 seconds. Don’t know if this helped.

What worked for me: Remove the internal battery momentarily after reinstalling the motherboard! This seems to reset the camera firmware in some way, and it will just ask for the timezone on first boot.

SD Card Write Protect stuck on

Once I finally had the camera powering on again, I was getting the ‘write protect’ error. I was able to resolve this by reopening the camera, and bending the pins on the right protect detect switch on the side of the SD card slot. I believe that when the switch makes contact, Write Protect is disabled.

SD Card not detected

This was the original problem. I should never have tried to fix the pins without taking the camera apart, it only weakened them. Dismantling the camera isn’t hard and I should have just done that first time.

Remote Torrent Server with Deluge Web & Systemd

The Deluge torrent client can be run headless which is useful for downloading on a remote media server.

Install deluge & deluge-web

sudo apt install deluge deluged deluge-web

Systemd Services


Description=Deluge Torrent Server

ExecStart=/usr/bin/deluged --do-not-daemonize



Description=Deluge Torrent Server



Starting the Services

sudo systemctl enable deluged.service
sudo systemctl start deluged.service
sudo systemctl enable delugeweb.service
sudo systemctl start delugeweb.service

Using Deluge Web UI

Open the web client:


The default password is ‘deluge’

Auto-connect of Web UI to Daemon

Modify ~/.config/deluge/web.conf and set “default_daemon” to the hash found in ~/.config/deluge/hostlist.conf.1.2

I assume you need to manually connect once to populate hostlist.


Media Server for Chromecast Streaming

I have now switched to using a Chromecast for all our TV needs. I have an old Android phone (Moto G) that has been re-purposed as the remote. For local pre-downloaded content, I have a Media Server running Ubuntu 17.10. The best setup I have found for streaming this local content to the Chromecast is VideoStream.


VideoStream Install

The Android App can be found here:
On Linux, there is no native install so you need to use Chrome and install VideoStream as an extension:

As my server is headless, the install of Chrome and the VideoStream extension are done using ssh -X.

When you Pair your device, you also need to have Chrome open over SSH to receive the popup and accept the pairing.

Running VideoStream Headless on Boot

Create the following systemd service file: /etc/systemd/system/videostream.service

Description=VideoStream Server

ExecStart=/bin/bash xvfb-run google-chrome --app-id=cnciopoikihiagdjbjpnocolokfelagl


Streaming Apps

Netflix, TVNZ and TV3.

Meizu Flyme Notifications Fix

Meizu are making some really great value phones. The operating system they come with is a skinned version of Android called Flyme. By default notifications don’t work for Facebook messenger and the Google apps most people use. This can be resolved by modifying the settings in the pre-installed “Security” app as follows.

1. Open the Play Store and install the “Google” app by Google Inc. if it isn’t already installed. Install all the apps that you need to get notifications like Messenger or Gmail.

2. Open the “Security” app




3. Open “Accelerator”


4. Open the Settings page by clicking on the cog icon in the top right hand corner.


5. Open the “Memory acceleration whitelist”


6. Click on “ADD TO WHITELIST” and select the apps for which you want to enable notifications and run in the background.

7. Go back to the main menu of the Security app and open the “Permissions” page.



8. Open “Auto-launched apps” and enable all the apps you want to run in the background.


9. Back to the Permissions page then open “Notifications of apps”



10. Enable notification for all your chosen apps.

11. Back to the Permissions page and open “App management”



12.On the “App management” page scroll down to each of your chosen apps and ensure they have “Notification” enabled. E.g. for Facebook Messenger:



13. Back to the main menu for the “Security” app and select “Power”



14. Open “Standby management” (which will have the confusing heading App management as below)


15. Allow any apps that you want notifications from to run in the background.

And finally we’re done.




Vox Guitar Amp Reboxing

The Vox on stage with Sulks in a previous life

I ended up with a beat up little Vox AD30VT about a year ago. It has a number of presets to emulate some different amps which are mostly bad, but you can get a pretty nice sound if you go for the clean settings. It had been serving me well at band practice for some time as is conveniently portable but at 30W you need to run at almost full volume to compete with drums in a band setting. We played at a house party earlier this year where I let the rest of the bands also use it which unfortunately resulted in the speaker blowing up after 5 hours at full noise.

The Vox comes with a 10 inch speaker which don’t tend to be as common. I picked up a cheap 12 inch speaker from the Swop Shop that was out of a Fender Blues Junior. I was hoping the case would be just big enough to squeese a 12 in… but unfortunately not. With the help of an amatuer carpenter friend Paul we spent an afternoon whipping up a new box from some ply he had picked up in hard rubbish.


The box after being sealed up:


It definitely wasn’t designed with acoustics in mind, but I’m really happy with the sound of the amp. Although the Blues Jr. is only a 15W amp, it’s speaker is 50W so I can happily crank the amp without fear.

To try and avoid my cats scratching the speaker cone I covered the front in some rubber matt from Bunnings.



Const and pointers in C

The syntax of constant pointers in C can be confusing. Try reading from right to left, away from the variable name. E.g.

Pointer to a constant of type char:

const char *ptr_name;

Constant pointer to a variable of type char:

char *const ptr_name;

Constant pointer, to a constant of type char:

const char *const ptr_name;