Tag Archives: GNU/Linux

Black pointer: Never lose track of your mouse pointer again

I’ve tried several ways to keep track of my mouse pointer.  It’s kind of hard from time to time.  Adding more than one monitor does not help at all!

Recently a colleague gave me the tip to make the mouse pointer black… and larger. I tried this and found that the mouse pointer was much easier to spot.  No surprise there, really.  After all, white on white tends to become a bit hard to keep track of, tiny silhouette outline or not.

I was told how to do this in Windows (Control Panel > Mouse > Pointer, but that’s another story).

In Gnome (I’m running Ubuntu 8.10) you do it in the System > Preferences > Appearance dialog (see below).  In my version of Window’s there’s no settings under Appearance > Mouse.

Appearance Preferences

Next you click the “Customize” button:

Customize Theme

In the new dialog select the “Pointer”-tab and select the color of pointer you want.  In order to resize it, see the “size slider” below the list of pointers (there seems to be three distinct sizes to choose from).

Click “Close” once you’re done, and voila, you have a new and much easier to spot mouse pointer!

Who writes GNU/Linux?

You may have thought GNU/Linux was written by idealistic Unix Gurus camped up with a bunch of Jolt-Colas in their mom’s basement, but a recent report from the Linux Foundation states the opposite. Since Linux kernel version 2.6.11 in Mars 2005 the number of developers has grown from 483 to 1,057 in version 2.6.24 (January 2008). However, the number of sponsoring companies has also grown from 71 to 186 in the same time.

The major contributors aren’t Mom’s Basement Inc. either. Companies like Novell, IBM, Intel, SGI, Oracle, Google and HP rank among the 20 largest contributors (counted in number of sponsored changes, and here sponsoring means paying employees to program those changes).

This is just the Linux kernel (some 8.5 – 9 million lines of code). However, the Linux kernel in itself is of little use to anyone. You have to add the GNU part of GNU/Linux, consisting of commands like fdisk, aspell, bison, ghostview, and wget to that, and you’ll be looking at a much larger number of lines of code. If we go even further adding programs from other projects (like the Mozilla project’s FireFox web browser, or the OpenOffice suite) more lines of code are added (for exact numbers see ohloh.net), and we’re still talking about programs supported by large companies (IBM, Sun, etc).

To sum it all up: no, GNU/Linux is not being written by enthusiasts in the basement anymore. It’s being written by large corporations for competitive reasons. Hardware manufacturers wants to make sure Linux will work on their hardware, software companies can be anything from Linux distribution owners (Red Hat, Novell, MontaVista), use embedded versions of Linux in their consumer hardware (Sony, Nokia, Samsung), or for other reasons (for instance Volkswagen uses Linux for in-car networking between different components).

FTP with Wget

I’ve just had the total pain of trying to get files (a lot of files, in a lot of directories) via a musty old FTP client (in Linux/Ubuntu).

The problem is that the FTP client (ftp) doesn’t offer much to help (like recursive downloads, or mapping up the directories on the client side with those on the serverside, etc).

I searched and I found this thread:

http://ubuntuforums.org/archive/index.php/t-378221.html

…with this excellent snippet (posted by Mr. C.):

wget -r --ftp-user YourUSERNAME --ftp-password YourPASS ftp://FTPSITE//dir/'*.html'

If you want to download something other than *.html, you can change the file name pattern as you would expect.

If you want to add more directories, simply add them, but keep track of the number of slashes (“/”).  There should be only one after the new directory names (at least that’s how I made it work.  It may work wonderfully regardless of the number of slashes, but then again, why challenge fate?)

Happy FTPing!

Using Statistical Analysis to Create Intrusion Detection

Professor Avishai Wool presents a system that protects GNU/Linux machines from intrusion and malicious program code by using statistical analysis and policy files defining a programs normal behavior, and if that program deviates from said behavior the system stops it.

Since the analysis is hooked into standard GNU/Linux build tools and uses the source code to derive the policy the system is said to guarantee zero false positives. A system of this type is cited to be able to perform protection from threats long before traditional anti virus solutions has categorized them, and with far less penalty to system performance.

Here’s a list of links for further reading:

Mounting devices with UUID identifiers instead of using /dev paths

I don’t know why, but from time to time drivers are assigned other “/dev”-paths on my ubuntu 6.10 LTS GNU/Linux server. I think a removable USB driver might have something to do with it…

However, when that happens it is a complete pain in the a$$ because if the driver is relocated, the system cannot find it and if it is mentioned in /etc/fstab the system reasons (justly so, I might add) that if it can’t find the drive it should pull the emergency break and jump into a rescue prompt (where mostly everything is disabled), letting the user (that’s me) deal with the problem.

I usually press the CTRL-D command exiting the shell and getting back to the boot process praying that no vital driver was lost. (I’m not really a guru, just a poor guy trying to make live a little easier).

For some reason (touch wood!) the drives with the boot image or with system specific things on them has never been moved around this way. Usually its the USB drive itself (when I still had it in the fstab) that has moved (I’ll get back on how to make it auto-mount in a later post) or in this latest case, one of the back-up drives.

However, there’s a solution. If you run GNU/Linux you might have seen it in your fstab-file. The use of a UUID to do mount instead of the regular /dev/something. My desktop computer’s fstab looks like this:

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options> <dump>  <pass>
proc            /proc           proc    defaults  0       0
# /dev/sda1
UUID=e1f37856-6cfd-43f9-bea0-d4c2e43afe29 /     reiserfs notail,relatime 0  1
# /dev/sda6
UUID=64549135-a478-4aef-bb2a-da37d245dd9c /home reiserfs relatime        0  2

From this rather confusing array of characters (I had to shrink the spaces in order to fit it on the site) you can determine that there’s three devices mounted at start up (proc, sda1 and sda6, I’ve got even more, but the exact number of devices are not interesting for this discussion).

The proc device always resides at the file system “proc”, and it does not have nor need a UUID. However the sda1 and sda6 devices are regular hard drives (formatted with reiserfs) and they can change designation, for instance if I start rearranging my sata-cables or start a USB drive in a USB slot with a lower ID than those of my sda drivers (I’m guessing on that one but I’ve seen it on my server so…) These are therefore interesting to mount not by their dev-names but by their UUID’s. The UUID are stored on the drive itself and it wont change unless the drive is reformatted. The drive can be moved, turned off, turned on, it will still have the same UUID.

So, using UUIDs are a good idea when I want to create my new, drives-moving-around-proofed server configuration. The first step is to determine what UUID the drives have. This is done with the following command:

sudo vol_id -u /dev/something

I had problems finding “vol_id”. It was not in the PATH, and could therefore not be run like above. I did a locate (locate vol_id) and found it in “/lib/udev” so I prepended that path to my command. I’ve also to determine how to get the UUID from a swap partition, but for now I’m happy to have the infringing drives on UUID and hope the swap wont move (perhaps with the extra 2GB of memory I also stashed in it will need the swap even less, but anyway)…

You won’t be able to determine the UUID of any drive part of a software raid configuration (but then again, the software raid is able to do its own magic locating of drives regardless of their sd-number — trust me, I’ve done that as well — so they won’t need a UUID anyway — wouldn’t surprise me if raid uses the same scheme behind the scene though)

Let’s look at the changes I did in my fstab file (always make backups before you start messing with this file! If you fail to set it up correctly your system will probably not start at all so have a live-cd handy before trying to do this!):

/etc/fstab before I changed it (just a part of it)

# /etc/fstab: static file system information.
#
# <file system> <mount point>    <type>   <options>           <dump>  <pass>
proc            /proc            proc     defaults            0       0
/dev/sdc1       /                reiserfs notail,user_xattr   0       1
/dev/sdc5       /home            reiserfs defaults,user_xattr 0       2

As you can see the situation is not as clear on this machine as it was on my desktop machine. Here sdc is the main system drive and that alone is a, well not a worrisome problem, but a slight discomfort… sdc never moved around, but being that I have a bunch (8 or 9) sata-cables in a large but far-from-large-enough case I’m bound to switch them around one day or another…

Anyway, using the above vol_id command to get the UUIDs of the drives, I’ve updated my fstab to look like this (still only partial fstab but you get the idea):

# /etc/fstab: static file system information.
#
# <file system> <mount point>    <type>   <options>           <dump>  <pass>
proc            /proc            proc     defaults            0       0
#/dev/sdc1
UUID=716cf691-dabd-4894-8e46-bc02b4c092b4 /     reiserfs notail,user_xattr   0  1
#/dev/sdc5
UUID=9587a32e-ebb2-45ab-9e68-7a66cf43d6b4 /home reiserfs defaults,user_xattr 0  2

Unfortunately I have the same problem as above, the lines wont fit in the editor (or on the site) if I tabulate them correctly, but hopefully you’ll still be able to connect the dots. Every group of white spaces (space, or tab) in the file counts as a field separator. I’ve commented out the “/dev/sdc…” section, added a line feed and replaced it with the “UUID=…” section, and then left the rest of the line intact.

This makes sense since I’ve replaced one identifier (“dev/sdc…”) with another (“UUID=…”). So, after the original “dev”-version of the file has been safely backed up, the entries in the original “/etc/fstab” has been checked and double checked, it’s time to restart and pray this will actually work. :O

Here’s a few links you might want to check out before you give it a try:

Good luck!

Update: If, however, you’re using LVM, you’ll get stable device names and you should mount these instead. If you use LVM-snapshots you’re going to get two or more volumes with the same UUID, and in that case you should absolutely not use UUID mounting.

Naivized by Linux

I’m all for Linux. Really. I love it, even though it’s from time to time a hate-love. However, I just realized one thing Linux has done to me that isn’t so good when you are forced to work and live in Windowsland.

I’ve become totally naive when it comes to certain aspects of the Windows world.

A couple of weeks ago I was looking for a program to help me keep my local hard drive synchronized (or in fact, backed up) to the network drive. A few factors have made this an issue for me, bad network performance but also the ability to just pick up your laptop and not worry about network connection to mention a few.

Anyway, I browsed around, moderately annoyed trying to avoid all the $oftware in favor for something simple that could do the job but wouldn’t cost money… just like home in Linuxland, right?

So I came a cross one really promising piece of software (no need to mention which since they’re not lone sinners :o), downloaded, tried it out and thought… hey this works! It had good integration with the desktop and a clean and simple UI and simple yet powerful features.

Great. Then today I spoke with a colleague who had been on the same mission and told him this was good software. He was rather surprised, since he had long ago figured out the software was not at all free (even though it’s listed as free software on several places, and they say it is free). The surprise will come after 30 days when the software stops working, for all intents and purposes unless you pay them money.

There’s nothing bad with companies asking for money. After all, I ask for money for working for a company, so the company should ask for money for selling my work, right? However, the serious problem is the lying part of the deal, where software companies say they are delivering free software where in fact they aren’t. In my case it ended up wasting several hours setting up the sync for real and would have wasted even more time had I been caught unaware when the 30 day trial was up. This, the lying seems, to me, to be a direct symptom of the software development model used…

There are no such thing as a free lunch, not even in the Linux world, but there you pay with time, and your apps aren’t programmed to stop work after 30 days. They might, because you’ve downloaded beta software, but that’s because some one did not program, or program right, not because someone did.

Anyway, I was baffled, totally unprepared and realized Linux naivized me! Wooh!

Badblocks

It took me some time to find out the equivalent of Window’s checkdisk/scandisk/chkdisk on Linux, but trust me, there are several.

For starters I am going to take a look at badblocks, a command that as the name implies, looks for bad blocks.

The basic format of badblocks are:

badblocks [options] device

If you have a fresh drive with no data or data that can be deleted on it you can do:

badblocks -s -w /dev/sdb

Note however, the -w command will erase all existing data on the drive so do not use it for drives with existing file systems on them. You cannot use -w on a mounted drive, unmount it first. The -s flag makes the command show a progress bar. This could come in handy when you are testing larger drives since even the fastest systems will take at least an hour to test an average sized drive (my 400GB took about 2 hours on a SATAII system).

If you want to test the drive without deleting data you can use the -n switch which will use non-destructive write-read mode, however, this switch can, for obvious reasons, not be combined with the -w switch.

badblocks -s -n /dev/sdb

Links:

BasKet Note Pads – note-taking application

BasKet is a very nice application I just stumbled across. It is a kind of OneNote for Linux.  In Ubuntu (probably Debian and others as well) it can be managed as a regular package.

I’m using it mostly when writing and ordering ideas and the like, but I can see myself doing much more with it…. once I’ve made sure it’s stable enough. Let me get back on that with a more proper review later.