Lilo -R – updating kernel on remote machine

Linux is an amazing server operating system. A remote user can control nearly any aspect of the computer.

The company where I work has servers hosted at a location in south Denver, about 70 miles away. I can do almost all of our maintenance from our, the only difficult thing is updating a kernel.

Fortunately Lilo has a neat little trick for completing a kernel update.

The 'lilo -R' command sets a one time default before you shutdown. This allows remote testing where you don't have access to the console at boot.

Just specify the kernel label on the command line

lilo -R

If the kernel fails it can be a remote support person can hit the button and the previous default kernel loads on the next boot.

Golden students change their grades

Golden High School

Students of Golden High School in Golden, Colorado 'hacked' into the schools parental portal system and changed their grades.

This story is sure to bring out all the evil 'hacker' stories, that topic has been a little slow lately. Maybe they should arrest these kids as 'terrorists'. Doesn't the Patriot act make hacking in to a government computer system an act of terrorism?

The real blame should be placed squarely on the shoulders of the administration. What kind of system do they have where a hacker can even change grades through a web interface? If that isn't bad enough, they must not have had backups of the system either. Students are being asked to bring old copies of homework and tests in so teachers can re-calculate their grades.

Ridiculous and irresponsible.

Kernel Newbies

Now I'm not what I would call a Kernel Newbie. I've been compiling and installing custom Linux Kernels for about eight years now. What I am not (and don't intend to ever be) is a Linux Kernel developer. As such, I have difficulty when it comes to reading the changelogs for the latest Kernel revisions. Sure, I understand most of the terminology and I can get a good handle on what areas have changed, but it's difficult for anyone who isn't actually contributing to the development process to translate the changes into an overview of new and exciting features.

Amazingly enough, there is a site out there that does just they. kernelnewbies.org provides, among other things, a synopsis of the current Kernel's changelog rewritten in understandable terms. How cool is that?

Missed Opportunities

Yesterday was Thanksgiving. As our tradition, the whole family got together at my Grandmother's house. She has cooked holiday meals for years (and hopefully will be able to continue for a while longer). Tuesday afternoon I was asked to provide a dessert.

Of course, my first reaction was to peruse the recipe sites on the Internet and find an appetizing concotion that didn't appear too hard to make. I Googled the term 'Thanksgiving Dessert Recipes' and found this likely candidate, which I will discuss further here, from the first Google result, a site named Razzle Dazzle Recipes.

I bookmarked the link, and that evening as I was preparing for my Thanksgiving Eve trip to the grocery store I attempted to pull the page up again. I was shocked to see Razzle Dazzle Recipes was not available. My guess is that EVERYONE was looking for Thanksgiving Dessert Recipes and Razzle Dazzle exceeded their bandwidth. What a missed opportunity this is? It's the biggest day to search for Thanksgiving related recipes, your site is at the top of the Google results and your site goes down. In fact, I'm not sure if the site was even running any advertisements prior to it's failure – I don't remember any (It definitely is now). I don't know if the poor Razzle Dazzle people even made any money off their site prior to the server melting down.

Fortunately, for me, Razzle Dazzle weren't the only ones with this particular recipe, so I was able to find it elsewhere and avert a Thanksgiving disaster.

The moral of the story is, if you operate a website, it's always good to be prepared. Be sure you are prepared to handle, and if it's your goal, to monetize the unexpected traffic. There is nothing worse than getting thousands or millions of hits and not being ready.

Restricting crontab

crontab is a scheduling system available on most linux distributions

Sometimes users will create cron jobs that will slow a server down. Access to cron can easily be restricted to all users but the administrator by editing /etc/cron.allow

If, for example, root and only one person (with username user) should be the only ones able to use cron just put root on one line and user on another in /etc/cron.allow.

Note: If cron.allow exists only users in the file will be able to use cron.

Linux Directory Structure

To a Windows user the Linux Directory Structure can seem very foriegn. Here is a quick synopsis of the standard top level Directory Structure on a standard Linux box.

/ : The top level directory in the system. This is often called the root directory, because it is the 'root' of the filesystem, though there is, in fact, a /root directory.

/bin : The home of binaries for your system. The /bin directory is in the PATH environment variable by default, meaning that any executable file in this directory can be executed merely by entering the file name at the command line – provided you have executable permissions.

/boot : Contains files necessary to boot your system. These include the kernel image and system.map.

/dev : The dev directory is the top level of device abstraction in Linux. This is where each device filesystem will be mounted from. Interfaces to your hard drives, cdrom, mouse and sound card are all found here.

/etc : Most configuration files in Linux are contained in the /etc directory. This also houses startup scripts.

/home : The home directories for each system user. A user is placed in /home/ when logging in.

/lib : Default location for Library files shared throughout your system, although libraries can be stored in any directory as long as it is added to /etc/ld.so.conf.

/proc : Another abstraction directory, /proc contains information about the processes on your system.

/root : The home directory of the root user.

/sbin : Contains additional system binaries, most of which are admin tools. You'll need to be logged in as root to run many of these files, although you may be able to run them by explicitly specifying the path (/sbin/ifconfig).

/tmp : The temporary directory.

/usr : The /usr directory contains subdirectories that will be used system-wide by all users. These may include binaries, libraries, man files, and other user resources. This is also a good place to add new applications. When updating the operating system it is much easier to peruse /usr for applications than search the whole filesystem.

/var : Contains the variable data that's always changing as the system runs. This directory contains logs files, mail directories and printing spools.

Creating a swap file

In linux, disk space that's used as memory storage is called swap. Typically you would setup a separate disk partition as a swap partition, but from time to time it is convenient to add swap to a running system. (creating an additional partition generally requires a reboot)

A swap file can be created with the following commands:

dd if=/dev/zero of=/extra-swap bs=1024 count=1048576 # create a 1Gb file
mkswap /extra-swap 1048576 # format the file as swap
swapon /extra-swap # start swap file

# add swap to fstab so it is automatically started
/extra-swap none swap sw 0 0

Walla, an additional 1GB of swap is now available. This can be confirmed by using the free command.

Configure the linux to write corefiles as core.pid?

If you dump core files you can run into a problem where multiple core files are dumped and one will overwrite the others. One solution to this problem is to change the Linux kernel so it will dump core to a file named core.pid .

Starting in the 2.4.x kernel series this can be accomplished by changing the value of /proc/sys/kernel/core_uses_pid from 0 to 1.