My laptop is a Thinkpad T40 from 2003 with 1GB of RAM and a 30GB HDD (Yes, you can laugh now). I bought it second hand many years ago, it had Windows installed and it was slow as molasses. It was also a time that I got interested in FLOSS. So I looked for a suitable Linux distro and I found Puppy Linux (Slacko and later the TahrPup release). It turned my unusable laptop into a fast and very capable computer. I’ll never forget the amazement when I booted Puppy for the first time and saw how fast it was.
I’m not much of a distro hopper but last year I switched to AntiX because I felt that development of Puppy had slowed down. AntiX does more or less the same as Puppy in that it brings life to an old computer. Both are very lightweight but at this moment I find AntiX definitely more polished with JWM, FluxBox and IceWM as window managers to choose from.
Both Puppy and AntiX contain, as do most of the other Linux Distros, proprietary bits and pieces (e.g drivers and it’s possible to install proprietary programs from the Snap store or PPM) but are mostly FLOSS and are available thanks to many volunteers that dedicate so much of their time to these operating systems. So I think it’s fair to contribute back e.g by donating to the developers that make this possible.
I wrote earlier about the Logitech Media Server (LMS), open source software that I’ve used to turn a Raspberry Pi into a music server for my Squeezebox devices. I’m using my Raspberry Pi based Logitech Media Server a couple of months and I’ve grown very fond of it. What started as an experiment now has become a device I’m starting to rely on. I guess that eventually I have to replace the USB-HDD that I connected to the Raspberry Pi with a better one. In the meantime however I do need to maintain the LMS. In this blogpost I’ll explain how I add and remove music files from the LMS and create a simple backup of your music files. Finally I provide a tip to debug problems with the Logitech Media Server. All software that I used for this project is free and open source.
Adding, changing and deleting music files
When I buy a new CD I want to add it to my LMS. All the ripping is done using Asunder, a low resource ripper for Linux. Asunder has a simple interface but it has many options can encode to many different formats. It can also tag the files using CDDB but I use MusicBrainz Picard because does a much better job when it comes to tagging (in addition MusicBrainz can organize your digital music library). The tagger completes the metadata on the music files which is very convenient when uploading the files to the LMS. A simple example is that album art is added to the file.
Now about moving the encoded files to the LMS. At first I unmounted the USB hard disk from the LMS, removed it and connected it to the laptop and copied the albums. For adding new albums this proved to be be a clumsy method and I quickly found myself looking for an alternative.
I decided to use FTP to transfer files over the network to the Raspberry Pi. FTP is a network protocol to transfer files between a client and a server. The software that I’m using is either FileZilla or gFTP. They have basically the same functionality but gFTP is not available for Windows while FileZilla is available for GNU/Linux, OSX and Windows. Working with both is easy enough.
Later I also used the scp command (Linux, OSX) in the terminal and simply copy the music files on my PC to the music folder on my Raspberry Pi powered LMS.
Read this if you (like me) run into problems with file ownership on your Raspberry Pi. In the past I couldn’t set the ownership for the USB hard disk on the Raspberry Pi. Only root was able to write to the disk. The reason is a bit technical and maybe confusing but I had used the Windows FAT filesystem for the USB hard disk and when I mounted it on my Linux laptop (Puppy Linux distribution), ownership of all files was changed by Puppy Linux to root. At this point it was impossible to change ownership and permissions with chmod and chown from the media server. To solve this problem I had to first unmount and mount the USB hard disk. To mount the hard disk use the following general command is used:
mount device mount-point -o uid=foo -o gid=foo
or in my specific case
sudo umount ~/media/usb-drive
and then mount
sudo mount /dev/sda1 ~/media/usb-drive -o uid=pi -o gid=pi
This command sets the ownership of all files on the USB hard disk to pi instead of root enabling me to use FileZilla and gFTP to copy files from a remote PC to the Raspberry Pi.
Adding Podcasts to the server
Podcasts can be easily added to the Logitech Media Server and there is no need to subscribe to a service. First the Podcasts app must be added to myApps on the Squeezebox player or players. Next to add podcasts to the list a plugin needs to be installed. To do this open the web interface in your browser and type:
<your_Raspberry_Pi_ip_address:9000> (in my case 192.168.178.69:9000)
Choose Settings at the bottom right of the web browser and then choose the Plugins tab. Now enable the Podcasts (v2.0) plugin and reboot the Raspberry Pi for the changes to take effect. The Podcasts plugin is now active and can be entered through a new tab in the Settings menu. In this tab new feeds can be entered that will immediatly be available on the Squeezebox players. To find a certain feed look for the rss feed of your favorite podcast and copy the link into ‘add a new feed’ in the podcast tab of the Settings menu mentioned above (e.g. http://feed.thisamericanlife.org/talpodcast for This American Life).
Creating a backup of the music collection
I invested a lot of time in ripping my CD collection so it would be a shame if I lost my music files due to a hard disk crash. I therefore use a very simple backup method, largely copied from the Raspberrypi.org website to ensure that my files are safe. First make sure that there’s enough harddisk space available with df -h. Next do:
tar -cvf backup.tar.gz ~/media/usb-drive
This creates a file ‘backup.tar.gz’ that contains files in /media/usb-drive, the mounting point of my USB drive and places it in the same map. Next I use (again) Filezilla to move the backup file to my desktop computer. Alternatively the ripped files on the PC they were ripped on can serve as a backup.
Debug problems with the Logitech Media Server
I didn’t encounter much problems with the LMS but if you do take a look into the log file of the server. This can be done opening a terminal on your PC and login into the Rasperry Pi with:
The sudo ssh command prompts for the password of the Raspberry Pi. Now look for anything suspicious in the log, copy it and do an internet search with your preferred search engine. Chances are someone already encountered the same problem.
If you, like me, own one or more Squeezebox players you can either choose between the service mysqueezebox.com, that streams music from the internet, or set up the Squeezebox Server on your own network. The Squeezebox Server software (aka Logitech Media Software, aka Slimserver) being free and open source software guarantees that you’ll take control of your Squeezebox players and the music that you’re streaming.
There many hardware options for the Squeezebox Server software but I decided to use the Raspberry Pi 2 that I had lying around because of it’s small footprint and massive support for the Pi. Within a couple of hours I had the Logitech Squeezebox Server up an running with my music playing.
Below I’ll show how to set up the Logitech Squeezebox Server on a Raspberry Pi in five steps. I got some important steps from the Variax Firmation website but I tested everything successfully.
Step 1: Ripping CD’s and writing them on an HDD (choosing an audio format)
For this project I used a small USB-HDD that was also lying around. I formatted the HDD. Next I collected all my music CD’s and ripped them. As ripping software I used the Asunder software on my Linux laptop but I guess that there are good alternatives (fre:ac appears to be an free and open source alternative that is also available for OSX and Windows). As audio format I choose MP3. If I buy a larger drive I’ll probably move to FLAC.
Step 2: Installing Raspberry Pi OS
Next install Raspberry Pi OS (previously called Raspbian) on the Raspberry Pi by first downloading the image and writing the image to the micro SD card using these instructions for OSX (or these instructions for Windows and Linux). I chose the Lite version of Raspberry Pi OS because I don’t need the desktop software and it makes the server as lightweight as possible. I had no problems booting the Raspberry Pi and connecting it to my network using Ethernet. To avoid potential problems connect the Pi to a monitor with an HDMI cable and make sure that it boots properly.
NOTE: If you do install the Lite version of the OS make sure to enable SSH via raspi-config. This enables you to access the Pi remotely later on.
Step 3: Mount the HDD on the Raspberry Pi
Now with Raspberry Pi OS installed I mounted the HDD that we prepared in step 1. For this first connect the HDD to the Raspberry Pi (in my case I connected the HDD through a USB port of the Raspberry Pi), login remotely and retrieve the name of the drive. To login remotely we need another computer (Windows, Linux or OSX). Open a terminal (Windows users either need to install Putty or for Windows 10 users enable the SSH client) and type:
sudo ssh pi@Raspberry_Pi_ip_address (in my case 192.168.178.69)
The default password is raspberry. Then type:
sudo fdisk -l
Then look for the HDD that is just connected. This was /dev/sda1 in my case (but this may differ in yours). To make the files on the HDD accessible to the Raspberry Pi we need mount the drive. But before that we need to make a mounting point (in this example at ~/media/usb-drive).
sudo mkdir ~/media/usb-drive
sudo mount /dev/sda1 ~/media/usb-drive
You should hear some HDD activity. Now type:
cd ~/media/usb-drive && ls -l
and a list of your music should be visible. To unmount the HDD do:
sudo umount ~/media/usb-drive
Step 4: Installing Logitech Media Center on the Raspberry Pi
First we need to install a library to play audio files. Since you want mp3 only do:
And reboot. With all the software installed we’re ready to go.
NOTE: with a recent fresh install of both Raspberry Pi OS (formerly Raspbian) and Logitech Media Server 7.9.3 a problem occurred. Apt complained about some unmet dependencies. However after apt –fix-missing update all problems were solved and after a reboot the server worked as before.
Step 5: Working with Logitech Media Center
To enter the web interface of the Logitech Media Center on the Pi we need a computer and a browser. In the browser URL we type:
<your_Raspberry_Pi_ip_address:9000> (in my case 192.168.178.69:9000)
The Logitech Media Center is started for the first time and a script is started to set it up. Important is that the mounting point of the HDD (in my case ~/media/usb-drive) is entered. This way the Media Center is able to retrieve all the music files. This is done in the web interface by entering the path of the mounting point under Media Settings under Media Folders.
The Logitech Media Server is now ready and every time the Raspberry Pi boots the Logitech Media Server is automatically started however the HDD is not automatically mounted so we need to change that. This is done by editing (with nano) the fstab system configuration file that can be found at /etc/fstab
sudo nano fstab
and add the following line
/dev/sda1 /media/usb-drive vfat& defaults 0
Save the file and exit nano. Reboot the Raspberry Pi. Now the installation is complete.
The music can be controlled from the web interface (see above), with the remote controls that come with the Squeezebox devices, with apps for Android such as this one or with iPeng for iOS. The Squeezebox Radio and the Squeezebox Boom also have controls on the device to play the music. So, plenty of options.
Step 6: Change the web interface to Material Skin (optional)
The default web interface of the Logitech Media Server looks outdated. Luckily, thanks to the plugin architecture, the server and its user interface are highly customizable. In the list of third party plugins of the default web interface you’ll find the Material Skin plugin (an excellent community effort led by CDrummond). Enable this plugin, select it and voila the web interface looks awesome.
When I came home the other day my neighbours were loading electronics on their bicycles (I live in the Netherlands you know) to dispose of them. Among all the stuff was a desktop computer that looked in pretty good shape. It was a Packard Bell iMedia S1800. I informed why they would dispose of the PC and they told me that according to their daughter it had become unusable. They are very nice people so I asked them if I could have the PC. They agreed to it and I took the desktop with me.
Back home I took another look at the computer and it was even nicer than I expected. It didn’t have a scratch and when I opened it it looked clean. That night I booted the PC and quickly found out it had Windows 10 running. The PC was slow as molasses and it was very noisy. I felt I had already found the cause of the daughter complaining, Windows 10. I had no intention to run Windows so I took out my Puppy Linux disk (Xenial Pup 7.5) and rebooted the PC.
The difference couldn’t have been greater. Puppy Linux booted fast and ran even faster. I got the idea to make this a general purpose workstation that, if goes well, can replace my iMac. How much I love Puppy Linux I don’t think it’s suitable for my purpose. Besides all the usual tasks I use my iMac for light 3D CAD work (for 3D printing), web design and video editing. I also like to have access to a broad software repository because I like to test new software and to replace the workflow I have on the Mac. In this department Puppy Linux can be lacking due to the Puppy Package Manager which differs from the mainstream package managers.
I therefore decided to give Ubuntu MATE 18.04 LTS (Bionic Beaver) a spin. My son already runs Ubuntu so I’m familiar with it and the MATE desktop is relatively lightweight (Gnome 2). Installation from a USB drive went flawless (overwriting W10 in the process). The desktop looks very clean and the software suite is great. I can add software through the new Software Boutique and if it isn’t there I have access to the Ubuntu repository (through apt). For a full review of MATE 18.04, read this.
So here I am. A nice Packard Bell is sitting on my desk instead of having become e-waste. If you read this don’t throw away your old PC because Windows 10 made the experience a nightmare. Install Ubuntu MATE or any other Linux distro you like and enjoy. In the mean time you’ll be doing the environment a favour. Cheers.
In November last year I decided to revive my very old (2003) Thinkpad T40 with Puppy Linux. Back then I was thrilled by the ease of installation and the speed of this Linux distro on this ancient laptop. Now eight months later I’ll give an update on Puppy Linux on my PC. Am I still happy with Puppy Linux?
Both Puppy Linux Slacko 5.7, which I had installed initially, and Puppy Linux Slacko 6.3 have been very stable on my T40 and I loved Puppy Linux because of it’s speed. However both of these Slacko distributions are based on Slackware. The one problem with this distributions is the lack of software. Some programs that I needed are just not available in the repositories. I could install software myself but only if I was able to find the right pet or sfs file (I cowardly didn’t try to compile the source files).
To solve the problem with the software I decided to install Puppy Linux Tahrpup 6.0. This operating system is based on Ubuntu 14.04 Trusty Tahr. I liked it the minute I installed it. The look and feel are the same as with Slacko with the JWM as window manager and ROX-Filer file manager and all the helpful shell scripts (a lot of them written by Barry Kauler, the original creator of Puppy Linux). Also a lot of the pre-installed programs are the same such as Abiword, Geany and pfind, a file finding program MtPaint and Sylpheed, a mail client. They’re also notable differences. The default browser for Tahrpup is Palemoon instead of Firefox and the Simple Screen Recorder (I forgot the name of the default Slacko screen recorder but I never got it to work). The system is still very fast, exactly the reason why I chose for Puppy Linux in the first place.
Easily create your own operating system
Puppy Linux (and Linux in general) not only let’s you create your own desktop environment, where just about everything is customizable, it even lets you customize the whole operating system. If you, for instance, don’t like the window manager or the file manager, you can change it. Try doing that on Windows or OSX. This way you can create your very own system doing honor to the acronym PC. TahrPup even has an option to easily change the Linux kernel, something that I couldn’t do with Slacko. With Remaster Puppy live-CD a copy of the personalized operating system can be written to either a USB drive or CD. For the latter a CD burner is needed of course. This copy of the personal operating system with all the favourite programs can be used to boot on any PC elsewhere e.g. on holiday or in school. On the Puppy Linux discussion forum many examples can be found of unofficial Puppy Linux distros such as Tahr NOP (Xfce desktop environment), Ami-Pup (an Amiga like interface) or Fatdog64 (a not so slim 64bit version).
Even with little experience in programming, additions can be made to the operating system using shell scripts. In fact plenty of programs that come with Puppy Linux are shell scripts. Pfind and pmount are good examples of this. Although this is not for beginners, shell scripts are relatively easy to write. An intermediate user should be able to improve existing scripts or write new ones. A script can be shared on the Puppy Linux forum as a contribution to the operating system and the community. This is a good start for programming for Puppy Linux. It’s also possible to use C or C++ as programming language for Puppy Linux but this is more complex and outside the scope of this blog entry. A good starting point for programming for Puppy Linux is this link.
The only drawback so far is that the new Puppy Package Manager v2 (PPM) seems a bit slower on my old laptop than with Slacko. PPM is the equivalent of the Ubuntu Software Center or Pacman for Arch Linux and provides access to the repository with all the available packages for Puppy Linux. The numerous packages in Tahrpup are possibly the reason for this slower behaviour.
Eight months later my Thinkpad T40 is still very much alive thanks to Puppy Linux. With Tahrpup I gained easy access to a huge amount of programs satisfying my increasing PC needs. The best feature about Puppy Linux (and Linux in general) is that it feels like my very own operating system. It’s easy to get involved into Puppy Linux thanks to it’s open nature and the vivid community. A feeling that I’m severely missing in the proprietary OSX on my iMac, my primary computer. In fact, if not for my wife who is still attached to the iMac and OSX, I would exchange my iMac for a (Puppy) Linux PC without hesitation.
In my previous blog post I finished my audio cooler. It’s a small cooler with a tiny audio system that nevertheless sounds good. The only way to control the audio is through a wired connection. It would be a nice addition to have some kind of remote control either by WiFi or Bluetooth. While testing the cooler I’ve got the idea to connect a Raspberry Pi A+, that was still unused, to the cooler and stream audio over WiFi to the Pi. This could be useful for a garden party or BBQ where WiFi is available and I don’t want to attach the smartphone to the cooler. In this blog post I’ll share my experience with installation and operating the software needed for this project on the Pi.
Installing music software on the Raspberry Pi
Since I run the Raspberry Pi headless I use SSH login to the Pi. SSH is available for most operating systems with the notable exception of Windows. I already had Raspbian installed on the Pi so first I updated the OS.
last year I built a PC especially for OpenELEC. For those of you who don’t know, OpenELEC is a Linux based system with the sole purpose to run Kodi, the all-in-one solution to play all media you throw at it. Because of this sole purpose OpenELEC is very fast, especially on the Intel based system that I built, and very reliable. Over time however some maintenance of the system is necessary to keep the system up-to-date and fully functional.
The burglar that “visited” our house a couple of weeks ago took our laptops and tablets. Luckily our desktops were left alone (probably to heavy). Also a very old IBM Thinkpad T40 was left behind. The burglar probably thought it didn’t have any value. That was a bit of luck for me because with a little effort this 12 year old laptop is still very usable. After all these years the only thing that failed in this laptop was the battery. Everything else is still in excellent condition. These Thinkpads were (are?) very sturdy. On top of that they are very modular. Almost every component is easy accessible with just a screw driver. Very different from modern laptops that are almost impossible to open without special equipment.
The twelve years old IBM Thinkpad T40. Is it worth reviving it?
With a 1.4GHz Pentium M inside the T40 is, I suspect, hardly faster than the Raspberry Pi 2. I therefore needed an Operating System that isn’t a burden for this hardware. Since Windows XP isn’t an option any more I looked at Linux and decided to give Puppy Linux 5.7 Slacko a spin.
Puppy Linux is very small and it loads into the ramdisk and is therefore very zippy , even on old machines. Installing it on the Thinkpad T40 was easy. It recognized all hardware even the Wi-Fi (which can be a problem with other distro’s). Unfortunately I can’t use the Wi-Fi chip inside the T40 because the WPA2 security protocol that I use in my network is unknown to this chip. This was easily solved with a Wi-Fi USB-stick.
Now I’m typing this blog from the T40. Firefox (version 17 ESR) works fine. I can access Google+, YouTube and other sites without problems although the rendering of some sites isn’t perfect. With Geany I can create html/css pages and code Python. Wordprocessing is done with Abiword and spreadsheets with Gnumeric.
Do I want my laptops and tablets back? Of course but in the mean time I thank Barry Kauler and Co for this wonderful distro.
Puppy Linux Slacko 5.7 runs fine on this very old laptop.
Last week I wrote about the Raspberry Pi, the camera module and Motion acting as a surveillance camera. I’ve been testing my Raspberry Pi surveillance camera for a week now and the results are satisfying although there are also some problems. I think much of the succes of the camera comes down to finding the best settings of the /etc/motion.conf file of Motion for a given scenario. The motion.conf file enables you to setup the Motion program. Everything from camera settings to motion detection can be changed in this file.
Image from a motion video. If someone (in this case my son) is entering our backyard it is perfectly recorded by Motion.
I want my surveillance camera to record anyone entering my backyard but this sounds easier than it is. If the threshold parameter in motion.conf is too low all kinds of events are recorded that are completely irrelevant. E.g. on a rainy day raindrops falling on the window are recorded. With higher threshold values I might miss something relevant. After experimenting with different values of the threshold I found that a value of 1500 works best in my case.
On a sunny day bright sunlight can fall onto the camera lens causing lens flare. This reduced contrast and color saturation (see image below). More importantly the Motion program detect changes in lens flare as motion and records them. I think problem can easily be solved with some kind of lens hood.
Lens flare caused by sunlight reducing contrast and color saturation.
A whole different problem is motion detection at night. My camera, the regular Raspberry Pi camera module, is just not up to this task. For detection at night I’ll need the NoIR Pi camera. This camera has no infrared filter. As a consequence colours at daylight look odd but you’re able to record at night, but only with infrared light illuminating the subjects. Several add-on boards for the NoIR Pi camera are on the market that do just that. These boards fit right over the camera module.
The regular Raspberry Pi camera module is useless at night.
Proper file permissions
I created a directory /home/pi/Camera on the Raspberry Pi. I want all my video files to be stored in this place however before Motion is able to do this I had to change the permissions. Motion (the Program) creates it’s own user motion so this user needs proper permission in the home/pi/Camera folder (that is created by the user pi). To do this I first changed the group ownership of the folder:
chgrp motion /home/pi/Camera
And next give the group the proper permission:
chmod g+rwx /home/pi/Camera
The number of motion video’s that are stored on the Pi increase rapidly over the days. My backyard is quiet but not that quiet (not to mention the false positive that I described above). Since the Raspberry Pi stores the files on an SD card I will easily run out of storage space. So I need a method to remove the files automatically e.g after five days. Cron is perfect for this since it let me schedule commands or scripts periodically. I wrote a shell script that removes avi files created by Motion older than five days and added this to my crontab file to be executed daily. The key command in this script is:
Whenever I want to check the motion files (e.g after one day) I copy them to my iMac using scp from the OSX terminal and then created a playlist in VLC by dragging all the files into it. The harvest of that one day is then displayed.
Next I’ll test the surveillance camera further until I’m satisfied with the settings and build a proper housing for the camera. Possibly I will switch from the regular camera module to the NoIR camera.
One week ago we’ve had a burglar in our house. Of course I immediately started improving the security of our home. After improving the usual stuff I felt the need for some kind of security camera. This camera could provide me a good view of the backyard which is a very quiet place and therefore preferred by burglars. Because I like to make things myself I thought it was a good idea to use a Raspberry Pi and it’s camera module. I used them in the past for time-lapse video’s of scenery but I hadn’t used it much lately.
The goal that I had set was a camera that detects and records motion and that I could access through our local network preferably a browser. I also wanted the camera to give decent images by day and night.
The heart of the system is a Raspberry Pi B with the Raspberry camera module. Furthermore I use an Edimax dongle for my Wi-Fi connection and a micro-USB power supply (1A). Initially I use an MDF case that I made to fit the camera and the Pi. It isn’t pretty but it protects both the camera and the Pi. If everything works as planned I probably built it into a dummy camera such as this one or may make a wooden enclosure myself.
Initially I had some problems connecting to the Pi through SSH. I discovered that this was caused by the Edimax dongle (8192cu Wi-Fi chip) that apparently goes into sleep mode after a period of inactivity. This was solved with a command line fix that disables power saving (see here on page 17 how to fix this).
On top of Raspbian I installed Motion. Motion is a Linux program that monitors the video signal from camera’s and, very important to me, is able to detect motion. Motion is widely used and there is plenty of good information on it on the internet. A simple tutorial how to install Motion specifically on the Raspberry Pi and get it to work with the Raspberry camera module can be found on here (go to step 7 for software installation). However Motion has far more possibilities and it is worthwhile to explore these once you start using it.
Configuring and testing the system.
Motion can support multiple camera’s but I’ll stick to one camera for now. Configuration of Motion for the Raspberry Pi and it’s camera module is done in the /etc/motion.conf file (not in the /etc/motion/motion.conf file). There is a very good YouTube tutorial on configuring Motion for Linux here and here. At this point I made only a few changes to the motion.conf file such as camera width and height, directory where the video is stored on the Pi and some camera specific variables.
The camera works great. The image quality is good and the system appears to be stable. I can open a stream of the security camera in my browser by entering the URL of the Raspberry Pi and the selected port (default 8081). My motion files are stored as avi’s on the Raspberry Pi. I can play them with VLC media player on my iMac. Next I’ll experiment with the settings of Motion (e.g. sensitivity of motion detection, resolution of the camera), test in under different circumstances (indoor, outdoor, night and day) and build a proper housing for the security camera.