Troubleshooting my Raspberry Pi's Wireless Issue

It has been almost a week since I decided to self-host my Ghost blog. It was a fun experience and most importantly, I knew a lot of new things that I would not otherwise know. On the less technical side, it inspired me to write more about my learning journey because not only does it solidify what I already know, it also drives me to learn more.

There is a little problem though. My Internet connection is flaky and it causes my blog to be sporadically down throughout the day. This is not intended to be a for-profit blog, however, seeing people share some of my posts while my blog is down was frustrating. I just had to do something about it. I observed the Pi's behavior by writing several BASH scripts and cron jobs that makes sure these events are logged. Sifting through the logs after work, I found out that aside from the ISP problem, there is another queer phenomenon that was happening. Whenever my home router loses Internet connection, the Raspberry Pi will lose its default gateway; it persists even after rebooting the router.

My initial attempts to fix this issue was to mess with the resolve.conf and /etc/network/interfaces configuration files. I tried everything from manualdhcpand even static. Nothing really fixed the issue and it was still losing the default gateway route whenever the Internet connection goes down. I finally solved this problem by writing a small BASH script:

#!/bin/bash

ping -c1 google.com > /dev/null

if [ $? != 0 ]
then
  echo `date` "No network connection, restarting wlan0" >> /home/uplogs.txt
  /sbin/ifdown 'wlan0'
  sleep 5
  /sbin/ifup --force 'wlan0'
else
  echo `date` "Internet seems to be up" >> /home/uplogs.txt
fi 

The script pings google.com and then checks the exit code. If the ping exited with an error, the Pi restarts the wireless LAN interface. It also logs all these events so that I can check how reliable my Internet connection was throughout the day. It was a quick and dirty fix. Nothing fancy, but it works.

How To: Play MP3 and other codecs on Moblin 2.1

Moblin (short for Mobile Linux) is a new Linux distribution that is designed by Intel to support multiple platforms and usage models ranging from Netbooks to Mobile Internet Devices (MID), to various embedded usage models, such as the In Vehicle Infotainment systems.

Moblin 2.1 was released recently and you could check out the screenshots hereor watch the intro video here for a quick look on how the Moblin 2.1 Netbook looks like. You could check for tested netbook models here. The full release note and download link could be found here.

Looks promising, but the problem is, as with any other Linux distributions, it does not play mp3 and other proprietary codecs out of the box for legal reasons. It only plays Ogg Vorbis audio and Ogg Theora video upon installation and the Gstreamer packages needed to play mp3 and other video codecs are not available from Moblin's repository or from the Moblin Garage. So we have to compile these packages from source.

DISCLAIMER: Try this at your own risk.

Step 1: Download the souce code here. We need the following source codes:

gst-ffmpeg-0.10.9.tar.bz2
gst-plugins-bad-0.10.16.tar.bz2
gst-plugins-base-0.10.25.tar.bz2
gst-plugins-good-0.10.16.tar.bz2
gst-plugins-ugly-0.10.13.tar.bz2
gstreamer-0.10.25.tar.bz2

After installing these, extract them to a directory of your choice (ex. /Home/Downloads).

Step 2: Open the terminal and type this command to download and install necessary development tools and build packages:

yum install gcc bison flex *glib* *diff* liboil*dev*

Step 3: Compile and build the source code. Using the Terminal, use the cd command to navigate to the folder where you have extracted the downloaded source codes (ex. cd /Home/Downloads). Then type these commands in order (press Enter after each line):

cd gstreamer-0.10.25
./configure -prefix=/usr && make && make install

cd ..

cd gst-plugins-base-0.10.25
./configure -prefix=/usr && make && make install

cd ..

cd gst-plugins-good-0.10.16
./configure -prefix=/usr && make && make install

cd ..

cd gst-plugins-bad-0.10.16
./configure -prefix=/usr && make && make install

cd ..

cd gst-plugins-ugly-0.10.13
./configure -prefix=/usr && make && make install

cd ..

cd gst-ffmpeg-0.10.9
./configure -prefix=/usr && make && make install 

Then reboot and have fun with your media. I might write an automated script later to do all of these upon execution of the script, but I'm busy at the moment.

Random Linux Post

"'Free software' is a matter of liberty, not price. To understand the concept, you should think of "free" as in 'free speech,' not as in 'free beer.'"

We all grew up using one Operating System, and I am pretty sure that the new blood still does. Maybe not all of us, but at least in my generation, at least 99.8% grew up using one Operating System. And yes, I am referring to Microsoft Windows.

Personally, I do not have any problem with Microsoft Windows. I grew up using it and Macintosh, but I've only used Macintosh in my early years, as far as I remember, when I was still in Grade 2. It was a lot easier to use as compared to Windows, for it uses a lot of graphics, unlike Windows which tends to focus on words and phrases. Windows offers clear explanation for each, though nothing beats that power of imagery and intuitive icons. If I am not mistaken, Macintosh has first introduced the Graphical User Interface or the GUI, for I remember my mom back in the days using Windows 3.1. It uses Command Line Interface and I remember using a Mac computer then which already has a black and white GUI.

You might be wondering by now why I am talking about these two Operating Systems when I should be explaining why I switched over to a new one which only a few people knows that such OS exists. Well these two OS are the most popular and people find it peculiar why I switched over to a "not-so-popular" OS, at least on where I live. Most reaction I get from people is a smirk, followed by "Is it easy to use Linux? Some people said they had a hard time using it" and such, and some people even look at it as inferior as compared to Microsoft and Macintosh and they are really skeptical when it comes to performance. Well, here's my defense.

The notion that Linux is hard to use is like 20 summers ago. Some people still refer to Linux as a pure Command Line Interface OS, and does not have a good GUI like the two popular OS I have mentioned above. If you are still under that impression, you might be living under a rock for decades! I could say that Linux has better GUI than any OS I have used because it gives you choices. What do I mean? Instead of the usual taskbar with Start menu with icons on the desktop or the clean desktop with a familiar dock, in Linux, there are several Desktop Environments that you could choose from, each of them has an array of features that is suited to your preference or hardware. For instance, there is the traditional GNOME desktop environment which is common on most Linux distributions. There is also the K Desktop Environment or KDE which is targeted to new Linux users who are well accustomed in using Microsoft Windows. Plus there is also the XFCE desktop environment which is becoming popular in the past few months. It is an extremely lightweight desktop environment which could bring an old computer to life, for the applications that are bundled with it uses less memory consumption and requires less processing speed. There are endless customizations that could be done on each of the desktop environments I have mentioned and you won't get bored; you can get the look that you want and need. And, you won't ever have to go into suspicious sites again looking for cracks and or syndicated Serial Numbers for your software since everything is free in Linux. Well, almost all are free, only a few programmers charge for their programs and they come real cheap if they does.

Speaking of cracks, well in Linux, you don't need them so no need to bother. I know some of us ( and I should say a lot of us here ) have used pirated software, pirated OS and all things that are not that legal and I should say I grew tired of it. It's like this: Why would I use such commercial OS when I cannot really afford it? I mean how much is OS X or Vista these days? That's only the core OS, how about additional productivity software, which are sold separately? Being street smart, we could always manage to get some "cracked" or "stripped" or worst "pirated" versions, but come on, show the programmers some respect. They certainly need the money that's why they chose to work there. And why count on them if there are ones out there who are willing to make authentic software for all of us to enjoy for free? All they need is support. And they are going to support us back.

Another thing that made me switch to Linux is speed. I know, this statement of mine might trigger a lot of grunts and "Come on"s from a lot of people since they believe that the computer's hardware is responsible for that, meaning that if you have a great specs, then it would be great with any OS and vice versa. Well that might be true, but I am sure that a new Windows box would run like a charm the first few days and then after a week or so, it will start to lag and faster boot times might then be noticeable. It is caused by the fact that there are thousands of viruses and worms known in Microsoft, while there are only around 400 known viruses in Linux and Mac OS. That's just a rough estimate.

Add all those useless services (programs that run in the background) that came installed in Windows XP and you'll get a boot time close to five minutes.

Well...

The Support system of Linux is really interesting. Instead of calling a number and paying for Tech Support Representatives, all you have to do to get support is to have an internet connection. In Linux, you get support from the user community and not from hired technical people. You just need to register in your distribution's community forum and fire your questions their. Help would be there in 1-2 hours time, and in several week's time, you'll see yourself gaining familiarity with the Linux distribution that you have chosen and you'll see yourself hanging out in the community forums, helping newcomers out.

There are a lot of great things I could mention about Linux, but let me clarify things out: Linux is just the kernel used, and not the OS. A kernel together with the bundled software makes a so called distribution. Those distributions that uses the Linux kernel are Ubuntu, Fedora, Mandriva, Debian, OpenSUSE and etc. Among the most famous are Ubuntu, as they said it is the most user friendly and I have to admit that it has a great community. Personally, I use Fedora, not because Linus Torvalds himself and all the computers at NASA uses it, but I guess I just got used at using it and I feel uncomfortable using any other distributions.

Linux and Open Source OS and applications seems to be more popular now than ever due to the sudden boom of netbooks and other low priced portable devices that comes with Linux pre-installed.

To end this post, I would say that GNU/Linux would be the future of computing, it does not solely give us free software, it also gives everyone an idea of how everything works inside the box.


Installing Cairo-Dock on the Acer Aspire One

Cairo-Dock is an OSX-ish application laucher that you could place on your desktop to replace your panel. Or if you're like me, you could have both and will make your desktop similar to this [It is recommended to have at least 1GB of RAM though]:

Hopefully, it is fairly easy once you have activated the standard XFCE desktop and set aside the Acer modified desktop, instructions on how to do that could be found here. Of course, this is assuming that you already have added the new RPM-Fusion repositories, if you haven't yet, then simple instructions could be found here.

Once we have the standard XFCE desktop, we need to activate Compiz [it is a program pre-installed and can make great 3D effects on your desktop] by downloading Fusion-Icon. Just go to the Terminal and then type in:

sudo yum install fusion-icon

After installation, we can run it by pressing Alt+F2 on your keyboard and then typing in fusion-icon and then click Run. You will know if it is successful if you see a new blue icon on your system tray [where the clock, etc. is]. You can right click it for you to configure some effects that you might like to enable. If you might ask and be interested what Emerald theme is, it is a theme manager and you can get themes for it by opening the package manager and searching for emerald-themes. Later on this guide, we are going to add fusion-icon and cairo-dock so that they would run automatically upon startup.

Now that we have fusion-icon, all we need to do is to get the cairo-dock RPM from any of the mirrors listed in here. After downloading it, just double click it and it will automatically installed. You can find it in you menu under System, named Cairo-Dock. Click on it and then the dock will appear in your desktop. Right click it so that you can personalize it and adding applications is as easy as dragging and dropping .desktop files from /usr/share/applications to the dock, or you can create manually configured lauchers/subdocks/etc. if you want.

Themes for it are also available, try searching some at http://rpm.pbone.net/ by typing in cairo-dock-themes. I got my themes there but I forgot the direct link, but I'll update this later.

Now if you notice, fusion-icon and cairo-dock does not open upon startup. This can be easily remedied by opening a Terminal and typing:

xfce4-autostart-editor

A new window should pop up and just add those two applications, the commands being cairo-dock and fusion-icon, respectively. And that's pretty much it.

Have fun on your new desktop!

Installing Mozilla Thunderbird and Pidgin on Acer Aspire One

This How-To is Acer modded Linpus Lite specific, please don't try this on an Acer Aspire One that has Microsoft Windows XP or Vista installed.

This How-To will guide you in installing Mozilla Thunderbird and Pidgin Messenger in your Aspire One and change the icon on your desktop to the original icon. This will only work assuming that you are still using AME or the Acer e-mail client that came pre-installed with your Aspire One and the Acer Messenger as well.

First thing that we need to do is to uninstall AME, by typing this command in the Terminal [alt+f2 and then type Terminal and then click on Run]:

sudo yum remove evolution-data-server libpurple

When the terminal is finally done performing those task, we can go ahead and install Pidgin and Thunderbird using pirut or in my case the Smart Package Manager [assuming the you have already signed keys using this command: sudo yum update fedora-release]. Open pirut or Smart and then search for Pidgin and then Thunderbird. After we're done with that, we're going to associate both programs with the default Mail and Messenger icon by typing these commands on the Terminal:

cd /usr/acer/bin

sudo ln -s /usr/bin/thunderbird AME

sudo ln -s /usr/bin/pidgin UIM

Well actually, it is as easy as that and we are done. You should now be able to use Mozilla Thunderbird and Pidgin using the default icons, but in case you are unhappy with those icons and wants to have the original icons, don't worry because we can do that by going to the Terminal and then typing:

sudo mousepad /usr/share/applications/AME.desktop

It should open a notepad that has a lot of text written on it and just in case you want to label the icon differently, let's say change it from E-mail to Thunderbird, just replace the text after Name= and GenericName= to your preferred name. Let's get back to the icon. When we scroll down, we should be able to see a line that says Icon= , just replace it with thunderbird.png, save it and we're done. Well, sad to say for Pidgin it has to be done in a different way and I'll just cover that on my next post, because it involves tweaking of group-app.xml, and a single mistake can ruin your desktop.

If you're already satisfied, then that's all, however for additional info, you can read below.

So now we have Mozilla Thunderbird and its original icon, what to do next? Well this is not that necessary but just in case you found out, the Mozilla Thunderbird we just installed does not update itself automatically and if we check on the Help menu, Check for Updates is grayed out, that is due to the fact that this version of Thunderbird is from the Fedora 8 [the Linux distribution where Linpus is based] repository. So in order for us to fix this, we need to do these steps in the Terminal so that we will be getting the official release from Mozilla and we're going to install it in the /opt directory. This is how:

wget "http://download.mozilla.org/?product=thunderbird-2.0.0.17&os=linux&lang=en-US"

sudo tar -xvf thunderbird-2.0.0.17.tar.gz --directory /opt

And then a lot of unpacking happens. After it's done we can type this again in the Terminal:

sudo chown user -R /opt/thunderbird

sudo mousepad /usr/share/applications/AME.desktop

And we just need to change the Exec= line to look just like this:

Exec=/opt/thunderbird/thunderbird

That's pretty much it. But if you're bothered to have 2 Mozilla Thunderbirds installed in your Aspire One, we can delete the old one via pirut or Smart but it will delete the icon as well which can be remedied easily by searching Google these keywords that I have used which is 'thunderbird.png 64x64'. Just copy the image to your Downloads folder and then move it to the pixmaps directory using this command:

sudo cp /home/user/Downloads/thunderbird.png /usr/share/pixmaps

After that, we're done. Have fun!