Archive for May, 2011
PodGrab, my open source audio podcast RSS downloader has been updated to version 1.0.3. This is the final release before PodGrab 1.2 comes out. I’m planning to add OPML import/export support for the next release.
Fixes for this version include:-
- Downloading previous episodes of a podcast now works again :-)
- Various error detection routines for incorrectly formatted podcast item dates.
- Disallows you to add a podcast subscription to the database if it already exists.
- When you delete a subscription, the files are also downloaded from the podcast download directory.
- Download directory now defaults to ‘podcasts’ rather than ‘Podcasts’ as this was annoying with Linux tab auto-complete.
You can download the latest version here.
Most normal Linux distributions allow you to change the Message Of The Day (MOTD) you get when you log in via the terminal. This is usually kept in a file called – obviously enough – /etc/motd and is simply a plain text file. However, Ubuntu works a bit differently and you’ll see that the motd file is actually soft-linked to /var/run/motd which is running a bunch of scripts to generate the MOTD on boot. You can append your own personal message to this generated output by adding a text file called /etc/motd.tail which will be automatically read in after the rest of the motd file is generated. Easy enough…
sudo vi /etc/motd.tail
But what if you want to change the auto-generated MOTD? Not obvious how you do this really, but you’ll notice there is a update-motd.d directory under /etc. Here’s what it contains: -
$ ls -la /etc/update-motd.d
-rwxr-xr-x 1 root root 1282 2011-05-19 14:00 00-header
-rwxr-xr-x 1 root root 1170 2011-05-19 13:55 10-help-text
-rwxr-xr-x 1 root root 149 2011-01-25 10:32 90-updates-available
-rwxr-xr-x 1 root root 129 2011-04-19 08:23 91-release-upgrade
-rwxr-xr-x 1 root root 142 2011-05-19 14:00 98-fsck-at-reboot
-rwxr-xr-x 1 root root 144 2011-01-25 10:32 98-reboot-required
-rwxr-xr-x 1 root root 1158 2010-10-21 14:04 99-footer
As you can probably guess from this, these scripts are responsible for generating the MOTD. Things like 90-updates-available and 98-fsck-at-reboot messages handle via bash scripting code if there are new security packages available or the file-system will be checked at next reboot. I didn’t want the Ubuntu help documentation URL displayed for everyone logging in, so I edited the “10-help-text” script and commented out the code using the ‘#’.
#if uname -r | grep -qs "\-server"; then
#printf "\n * Documentation: %s\n" "$URL"
This commented out code checks the “uname-r” value. uname will output the distribution type. If it finds the server version of Ubuntu, it’ll display the server documentation URL, else it’ll display the normal documentation. I didn’t want any of this, so I’ve commented it out with hashes.
You can do something similar or change it completely! While this type of MOTD system is less obvious than other distributions who simply use a plain text /etc/motd, you can use this system to expand the MOTD system to display all sorts of things when users log in via SSH.
This covers essentially 99% of all Android devices, sadly. Due to weak ClientLogin authentication protocols, users who sign into external services for data syncing on Android handsets have their authToken stored for 14 days and are apparently accessible if you know what you’re doing. After a user submits valid credentials for a Google account and other services (Facebook, Twitter, etc), the programming interface retrieves an authentication token that is sent in cleartext. Because the authToken can be used for up to 14 days in any subsequent requests on the service, attackers can exploit them to gain unauthorized access to accounts. The attacks can only be carried out when the devices are using unsecured networks, such as those offered at Wi-Fi hotspots, for example.
While Google has patched this vulnerability, only handsets that have access to Android 2.3.4 are secure – this essentially means only the Google Nexus S at present as this is Google’s reference implementation handset which gets updates way before anybody else.
If you have a Google Nexus S and aren’t sure what version of Android you have, go to Settings -> About Phone and look for the Android version. If you’re still running 2.3.3, go to System Updates and you should find that the 2.3.4 update is available for installation.
Researchers Bastian Könings, Jens Nickels, and Florian Schaub warned that the weaknesses could be used against people who use their Android devices on networks under the control of an attacker.
“To collect such authTokens on a large scale an adversary could setup a wifi access point with a common SSID (evil twin) of an unencrypted wireless network, e.g., T-Mobile, attwifi, starbucks,” they wrote. “With default settings, Android phones automatically connect to a previously known network and many apps will attempt syncing immediately. While syncing would fail (unless the adversary forwards the requests), the adversary would capture authTokens for each service that attempted syncing.”
The researchers recommend using SSL (HTTPS) connections whenever possible on unsecured WiFi networks, but frankly you should be doing that anyway regardless of device :-D Regular HTTP connections transmit an alarming amount of information in plain text, which was what the Firesheep Firefox plugin was meant to illustrate.
Upgrade if you can and if you can’t pester your carrier to roll out prompt updates. Many handsets still only have Android 2.2 or earlier and regardless of Google’s wishes, many carriers haven’t rolled out 2.3 at all as of yet. Just another reason to avoid public WiFi hotspots.
UPDATE 19/05/2011: – Looks like Google is pushing out a fix for all Android phones. From Gizmondo…
So Google’s pushing a fix right now that’ll patch up the vulnerability for every Android phone over the next few days. It’ll fix the problem for Contacts and Calendars immediately, though not for Picasa—there’s something different there technically, according to a Google spokesperson. (Any idea why, dear readers?) It won’t require you or your carrier to do anything—it’ll just like, happen, sometime in the next few days.
…so that’s a relief.
Google I/O was pretty exciting this year, with the announcement of the first Chromium OS-based netbooks (or ‘Chromebooks’ if you prefer), but the biggest announcement for me was the release of the Accessory Development Kit which allows you to develop USB peripherals for Android devices by way of a hardware component. Luckily for open source fans, this hardware component turned out to be Arduino, the open source hardware development platform. The board is based on the Arduino Mega 2560 and Circuits@Home USB Host Shield designs. Unfortunately, Google’s reference kit is around $400 USD and is sold out until the end of May anyway, while Arduino hardware usually goes for a lot cheaper. Luckily, those fine folks over at HackADay have worked out how to use standard Arduino hardware with the ADK. Nice :-)
Beginner Linux users often make mistakes, sometimes mistakes that they cannot recover from. In this situation, often the first instinct is to reinstall the operating system from DVD/CD. Or perhaps you’d like to use a different Linux distribution. Either way, the thought of reinstalling all your user data from backups (you do take backups right?) can be unwelcome. One of the first things I recommend to new users of Linux is to move your /home directory to a different partition which ideally should be on a different physical disk. When mentioning this though, most users have already installed the operating system. By default, most Linux distributions install everything onto one partition on one disk. This is how Windows usually works so does not seem too unusual for new users. It makes installing just a couple of mouse clicks. While this is an easy option, it’s not really ideal – but while pretty much all Linux distros allow you to manually configure the partitions for each section of the operating system via a graphical system at install time, you probably won’t have access to this after the fact. So you’ll have to get your hands dirty with the command line and learning about hard disk partitioning.
For this scenario, I’ll assume you’ve already installed your Linux system on one disk on one partition which is usually the default partition layout on today’s Linux systems. Now though, you want to install your home directory on a different partition and for added data autonomy, on a different disk. I’ll start at installing the new hard disk and take you through the whole process.
First, though, we’ll need to talk a little bit about drives and partitions in Linux and the difference between primary, extended and logical partitions.
All devices on your Linux system are listed (naturally enough) under /dev. Hard disk drives attached to your system are labelled /dev/sda for the first hard disk, /dev/sdb for the second and so on. For each of these disks the partitions are also listed. So for partition 1 on your system, this would be /dev/sda1. The second partition on that drive would be /dev/sda2 and so on. Historically, Linux used to make a distinction between IDE hard drives and SCSI hard drives. IDE hard drives were listed with a ‘h’ instead of an ‘s’, as in /dev/hda. SCSI hard drives were always ‘s’, as in /dev/sda. Now, however, all hard drives under Linux just use ‘s’ unless you’re using a very old system.
While it’s not critical knowledge for this exercise, it’s also worth mentioning something about the limitations of partitions. On x86 systems (your PC or server basically), Linux can only accommodate four partitions per hard disk. This is something that was decided way back when the original PC was designed and you can google why if you’re interested :-) These distinct partitions are what’s known as primary partitions and you need at least one primary partition on a hard disk that holds the operating system as the Master Boot Record (MBR) ignores all partitions except the first primary partition. On the default partition layout written to the hard disk during a basic Linux installation, this, along with Logical Volume Management (LVM), is the only partition that is used and your home directory will be sharing the same partition as the operating system.
On some Linux systems, you’ll see partitions listed for each disk which have more than four partitions, such as /dev/sda5 or /dev/sda7. How could this be?
Well, to have more partitions than four to take advantage of Linux’s various partitioning schemes (especially on servers), you cheat a little bit by using extended and logical partitions.
You can devote one of these four primary partitions as a container of sorts to hold smaller partitions. This container partition is called an extended partition. Since the partitions it hold are by definition not one of the four primary partitions, they are known as logical partitions.
So, under /dev if you had a secondary hard disk with three primary partitions and two logical partitions, this would be: -
- /dev/sdb1 – Primary partition 1
- /dev/sdb2 – Primary partition 2
- /dev/sdb3 – Primary partition 3
- /dev/sdb4 – The extended partition
- /dev/sdb5 – Logical partition 1
- /dev/sdb6 – Logical partition 2
As you can see from the above, the extended partition /dev/sdb4 is listed as a partition itself but you won’t be able to access it. It holds the next two logical partitions.
Okay, back to our secondary disk. Based on what you now know about Linux disks and partitions, this should be fairly easy.
Power off your system and install the new drive. After you’ve powered up again and logged in, you should see the new drive listed under /dev as /dev/sdb. If you’re not sure if the system has detected the new hardware you can use a command such as ‘hwinfo’ or ‘dmesg’. But as I said, if you’re using a one disk, one partition system, the next drive after /dev/sda should be /dev/sdb :-)
If you run: -
…this should show a new disk devoid of partitions. We’ll now use fdisk to create the partition table.
The commands for fdisk are somewhat cryptic but you can press ‘h’ to see a list of commands. The ones we’ll be using are: -
p = Print current partition table
n = Add new partition
w = Write new partition data to disk
q = Quit without saving modified partition data
If you press ‘p’ now, you should see no partitions on your new drive. If you do, or you’re using an old drive, press ‘d’ to delete the partitions followed by their number. Once the drive has no partition information, press ‘n’ to create a new partition then press ‘p’ to make it a primary partition as we’re going to use the entire disk for this exercise – but you should know enough about partitioning now to be able to modify the partition table to your liking.
Anyway, accept the default value for the size – this always defaults to the most allowable space available which is the entire disk in this case.
Press ‘w’ to write this new partition information to the disk and return to the command-line. If you now examine the /dev directory with: -
ls -l | grep sdb*
…you should see a device called /dev/sdb1 – this is our new first primary partition of the second disk. Now it needs to be formatted. Do this by using the command: -
If you’re using a slightly older Linux distribution, the default file-system might well be ext3 instead of ext4. In which case, use the mkfs.ext3 command instead.
Now you have a new secondary disk ready for use. For this exercise, make sure you’ve backed up the contents of /home – backups, remember? :-)
Also, before you do anything else, you need to make sure nobody is using /home – no other users aside from you. You can check to see if any processes are using /home using: -
lsof | grep /home
Now you need to mount the drive to copy the contents of /home to the new drive. I’ll use an empty directory called /mnt/sdb1 but you can create whatever directory you want.
mount -t auto /dev/sdb1 /mnt/sdb1
Then you’ll need to recursively copy everything under /home to this location: -
cp -rp /home /mnt/sdb1
The ‘r’ flag means copy recursively and the ‘p’ flag means preserve file permissions – else everything would reset to root ownership and none of your users will be able to access their files :-)
Once it’s all copied, you can rename /home to something else – this is for safety’s sake, if something goes wrong you can always restore everything.
mv /home /home_old
Now you need to create a new mount point for /home.
Now, unmount the drive.
You’ll want to have this new drive automatically mount as /home every time the system boots, so you’ll need to edit your /etc/fstab configuration file which is responsible for mounting drives during the boot process.
Add the following line:
/dev/sdb1 /home ext4 defaults 1 2
Verify this works by simply typing: -
While still logged in as root, try logging in as a user and can access their home directory. If all goes well, you can delete the old home directory with: -
rm -rf /home_old
Now you have home on a separate partition so if you make a mistake, your user files are safe. If you want to try a different Linux distribution you can and keep your files. You’ll need to either modify the /etc/fstab to point to your second drive or use any advanced graphical partitioning tools during the installation process to point the home mount point for the new installation to your second drive. Phew!
I tried the new Unity interface with Ubuntu 10.10′s Netbook Edition when it first came out and wasn’t very impressed. The Unity menu bar used up a large amount of screen real-estate and even with windows maximised, wouldn’t actually go away, so it was there on the left constantly eating up precious screen room. It was also very slow and buggy and didn’t in any way seem to be suited for the devices that it was aimed at (netbooks, natch). I switched to the normal GNOME desktop and didn’t really look back.
So when Canonical announced that the next version of Ubuntu – 11.04 – would use the Unity3D desktop by default, my heart sank.
However, I was willing to try Ubuntu 11.04 on my netbook simply because my netbook has always run a version of Ubuntu since 9.04 and is really used as my “primary” Linux desktop. So, with a certain amount of trepidation, I clicked the “upgrade” button on 10.10 and waited.
Now, I’ve been using Ubuntu 11.04 LTS on my netbook since it came out and y’know….it’s actually not all that bad. Canonical have cleaned up my two major complaints with Unity – firstly that it would never get out of the way when a window was maximised and secondly, that it was slow as hell. It’s still not super – the animations are not as smooth as I would like. However, this is apparently being addressed by Canonical in the next version – 11.10 – which will include Unity2D which is further optimised for netbooks and other low power devices. As it stands, Unity3D is usable, but like any version 1.0 product, needs a little more love.
The Unity interface itself is pretty usable albeit not exactly intuitive to start with. For example, when opening up a console window, it’s not clear how to open another command line window. This is actually performed by looking further up than you’d expect at the top panel where all the menus used to be. This is a context sensitive menu that appears and gives you the usual menu options for opening new windows and the like. Once I had this figured out, things were much easier. The scroll up and down the interface is also slower than I would like, but you don’t have to scroll from top to bottom. As the interface collapses down to all items on-screen, you can simply point the cursor at the general area of launchers you want and go straight there rather than scrolling. For adding new items or applications to the Unity launcher, you simply click on the Applications launcher and either type the item into the search and then drag the item to Unity much like you would in Docky. There are also expanded menus further down that gives you access to the complete list of installed applications and settings which allows you to add whatever you like to the Unity interface.
So, all in all, my worst fears for Unity (Unity3D in this case) were unfounded. It still has a certain amount of rough edges, but I’d imagine that Canonical will iron these out with time. Generally, I’d call this release a success. I guess we’ll see how the Fedora Project fairs seeing as they’ve gone for GNOME 3.0 windowing system. Time will tell.