Using a old intel cpu cooler on the raspberry pi 4.

Intel cpu cooler on raspberry pi

The raspberry pi 4 has one of the fastest CPU on a SBC , but it doesn’t come with any cooler ,
The raspberry is indeed capable of running without a cooler , but if you do anything other than idling, or something very lightweight like pihole, you are going to thermal throttle.

Since i have a old intel cpu cooler laying around i figured i could adapt it to cool my raspberry pi.

A old intel cpu cooler without the fan.

the cooler is way to big to be used the way it was designed. so i need to cut the cooler with a metal saw to make a new flat face , and put part of the cooler on the raspberry pi CPU.

sawing the intel cooler in two parts

after cutting the cooler you can see that i was far from having a flat surface to put in contact with the cpu.

To flatten the surface , I used a sanding disc fixed on my drill

After sanding the bumps , I obtained a kind of flat surface ,
i’m aware that it’s not truly flat , so to remedy that fact , i putted some thermal paste on the cpu surface.
The thermal compound will fill any irregularities enabling a good contact between the cpu and cooler.

Intel cpu cooler on raspberry pi
raspberry with cooler installed

Then to maintain the cooler flat on the cpu surface , i added a rubber band around the raspberry .
It will help put pressure on the radiator keeping it well pressed on the raspberry cpu

With this cooler the idle temp is aroud 50c and jump to 65c under load (ffmepg encoding)
The thermal throttling temperature of 85c is nevec reached

Installing Jellyfin on a Rasberry PI4 (Rasbian Buster)

The openSSL problem is now corrected , you should not be obliged to do what is described in this page

As soon as the raspberrypi foundation announcement of the new raspberry pi was made. I was sure it was going to be a great headless media server for my network.
with the Rasberry pi 3b and the severe lack of bandwidth on the ethernet and the USB2 ports , using the device as a media server wasn’t really practical.
Now that i received my Raspberry pi 4 B 2GB edition i looked at what was available in term of good media server and I heard about Jellyfin . a pretty features full media server .

I first installed the release of raspbian buster lite available on the raspberry pi website , then activated the ssh by creating an empty ssh file in the boot partition, ran sudo apt update && sudo apt upgrade and was soon ready for the next step

After i was ready to install Jellyfin , i went to the official jellyfin website and started reading the installation instructions.
Raspbian is a tuned version of debian so I chose the instructions regarding debian and launched the following commands :

After downloading more or less 400MB, the installation was completed ,
but the server wasn’t responding on the 8096 port !
after launching the command netstat -tlp on my raspberry I figured out the port wasn’t even opened.

Weirdly systemctl status jellyfin.service was telling me the service was active and running ,
shortly after that i located the log of the application ( /var/log/jellyfin/jellyfin )

/var/log/jellyfin/jellyfin

[2019-06-30 12:40:10.020 +01:00] [INF] Jellyfin version: "10.3.5.0"
[2019-06-30 12:40:10.113 +01:00] [INF] Arguments: ["/usr/lib/jellyfin/bin/jellyfin.dll", "--restartpath=/usr/lib/jellyfin/restart.sh", "--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg", ""]
[2019-06-30 12:40:10.147 +01:00] [INF] Operating system: "Linux" "4.19.50.7"
[2019-06-30 12:40:10.148 +01:00] [INF] Architecture: Arm
[2019-06-30 12:40:10.156 +01:00] [INF] 64-Bit Process: False
[2019-06-30 12:40:10.156 +01:00] [INF] User Interactive: True
[2019-06-30 12:40:10.157 +01:00] [INF] Processor count: 4
[2019-06-30 12:40:10.158 +01:00] [INF] Program data path: "/var/lib/jellyfin"
[2019-06-30 12:40:10.159 +01:00] [INF] Web resources path: "/usr/lib/jellyfin/bin/jellyfin-web/src"
[2019-06-30 12:40:10.159 +01:00] [INF] Application directory: "/usr/lib/jellyfin/bin/"

this log wasn’t helping at all it was just the same 10 line repeating over and over again, i just knew something prevented the launch of the application ,it was a starting loop, but the log wasn’t verbose enough for useful information to be logged.

After unsuccessfully trying to remove and reinstall jellyfin i tried to run the application manually and not from her service.
i first stopped the service by launching


Then launched the app by

and BINGO , i got the message No usable version of the libssl was found

after a little googlefu I figured-out the libssl installed by default in raspbian buster was too new and was causing an issue with jellyfin

my version was ssl 1.1.1c and i needed a 1.0.x version

So , to force my system to use a old version of this library without having to recompile half the OS , i created the file : /etc/apt/sources.list.d/jessie.list
and written inside the following lines :

i then launched the commands

after theses last commands , your raspberrypi is now ready to launch Jellyfin.
you can do it with


you can now access the webserver of your media server on the tcp port 8096

bash : Random number in OpenWRT

On some light linux environement running busybox or openWRT you will notice that you don’t have access to the $RANDOM variable ,
the date command is also incomplete so you can’t use the tail of the nanosecond date to have a random number.

.

Using this command you will get a random number beetween 0 and 69.
if you wish to change the range of the random numbers , just edit the regex in the grep part

Using AWK to display the min the max and the average of a list

awk is a extremely powerful tool !
i’m always surprised how much you can do with it.

My latest finding is pretty amazing.

Lets say you have a list of numbers , and you want to figure out the bigger number , the lower number , and the average of all the numbers in the list.

you can use the following awk code to print minimum, maximum and average.

The output is going to  be :
avg 32.93 | max 100.1 | min 1.5

you can also use this code with decimal numbers

 

How to update Grafana from version 4 to version 5

Grafana is a wonderful tool to display time series ans a lot of different metrics
The project is in a very active development state , and new features are added constantly.

The version 5 is particularly desirable since a new layout engine for the dashboard has been developed, and is quite powerfull !

So to update your install of Grafana from 4 to 5 you need to launch several command with root or a privileged user.

The service should automaticly restart when the update is done , but check that it is running with :

service grafana-server status

You should see something like this

? grafana-server.service – Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled)
Active: active (running) since ven. 2018-04-20 17:47:41 CEST; 1 day 22h ago

Use the keyboard on a remote machine over SSH?

If you use a Linux box to display some infos in a public space , you might not have the possibility to connect a mouse and keyboard every time you need to click on the page.

For example, at work we use a TV to display some metrics with grafana,
Sometime, when we reboot the machine , the identification cookie will be outdated and the browser will land on the authentication page instead.
Since the machine has no keyboard and mousse attached this cause some issues , .
So I’ve used the tool xdotool that allow a privileged ssh user or a script to interact with the mouse and keyboard

An important step is to select the screen on witch you want to send mouses clicks and keystrokes.

After that lets say your screen is displaying a full-screen browser with a login page ,
By default the cursor is already in the login form.

for the example , the login/password are going to be admin/admin

you are now logged and you dashboard will display

Bash keyboard shortcuts

When you are spending your day in the terminal , you will find that navigating using only the arrows keys although fine at the the start will frustrate you because it’s quite slow.
Bash come with a lot of keyboard shortcuts design to gain precious time.

CTRL+A # will move the cursour to the beginning of the line
CTRL+E # moves to end of line
CTRL+C # halts the current command and back to prompt
CTRL+D # deletes one character backward or logs out of current session, similar to exit
CTRL+K # deletes all the text forward to the end of the line
CTRL+L # clears screen and redisplay the line
CTRL+R # searches history entering keyword ,
CTRL+T # transposes two characters
CTRL+U # kills backward from point to the beginning of line
CTRL+W # kills the word behind the cursor

i’ve put in bold the shortcuts that i use every day , i don’t use CTRL+A and CTRL+E because the keyboard has keys that are foing the same thing.