Eliminating PXE Boot “Missing parameter in config file” Error Messages

I’d recently made a bunch of changes to my company’s server build scripts, making changes that automatically generate system builds for a variety of operating systems and CPU architectures. We use PXE Boot to boot servers, then install images from a central install server which is running OpenSUSE 11.1.

After I made the changes I started seeing the error message “Missing parameter in config file” at boot:

XELINUX 3.07 0x41e470ae  Copyright (C) 1994-2005 H. Peter Anvin
Missing parameter in config file.
Missing parameter in config file.
Missing parameter in config file.
Missing parameter in config file.
Missing parameter in config file.
Missing parameter in config file.
Missing parameter in config file.
Missing parameter in config file.
boot:

Everything worked just fine, we had no problems booting or building servers, but the error messages seemed to indicate that there was a problem. I searched the net to see if anyone else was having this problem, and many people were, but no one seemed to have a good answer as to what was causing the error message.

Our pxelinux.cfg/default config file lists about a hundred different boot options, so I made a backup copy and started deleting portions of pxelinux.cfg/default to see if I could reduce the number of errors.

I managed to reduce the number of errors, but couldn’t find anything in the lines I’d deleted that would cause a problem — I was deleting working configurations from the list, and I couldn’t figure out why a working configuration would cause an error message.

I finally figured it out — it was the comment blocks that I’d added. Something is buggy about the way that PXE parses comment lines. I’d commented out some old labels and even though every line started with “#”, those were the lines that were causing the “Missing parameter in config file” errors.

To solve the problem, I edited pxelinux.cfg/default, deleted blank lines in-between comments and labels, deleted blank lines between comments, deleted spaces between “#” and the start of any comment text, deleted old labels that had previously been commented out, and restarted atftpd.

By simplifying the comment lines and deleting old blocks of commented-out code I eliminated the error messages. I couldn’t believe that comment lines could be causing errors, so I tried various combinations of edits on the pxelinux.cfg/default file, restarting atftpd and rebooting a spare server about 30 times, but the only thing that eliminated the error messages was removing comment lines and blank lines from pxelinux.cfg/default.

Hope you find this useful.

Comments (1)

Nathan Myhrvold Shoots Mosquitoes with a Laser

What do you do if you want to kill malarial mosquitoes and you don’t want to use insecticide? Nathan Myhrvold and his group of engineers use off-the-shelf parts to track and shoot mosquitoes out of the sky, one at a time, using a laser. This high tech bug zapper can even distinguish between types of bugs and male and female mosquitoes.

Leave a Comment

Running Oracle’s CSSCAN utility as sysdba

If you need to run Oracle’s CSSCAN utility to check a database prior to converting to a new character set, you may have problems getting it to run “as sysdba”. There are a number of articles on the web that explain how to do this, and most of the explanations don’t work.

Oracle.com says that you should use:

CSSCAN /AS SYSDBA FULL=Y

This gives the error:

LRM-00108: invalid positional parameter value 'SYSDBA'
failed to process command line parameters                                      

Scanner terminated unsuccessfully.

Others recommend:

csscan "SYS/[password] as sysdba" full=y tochar=AL32UTF8 array=1024000 process=16

Which results in:

LRM-00108: invalid positional parameter value 'as'
failed to process command line parameters                                                           

Scanner terminated unsuccessfully.

Various other guides on the web also fail to work. Trying to run csscan as “SYSTEM”, as suggested by Tech Republic and Oracle UK, you get the error:

CSS-00113: user system is not allowed to access data dictionary

Trying to run csscan as “SYS”, as suggested by Oracle Forums, results in the error:

ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

ORACLE-BASE shows a method for running csscan in a Windows environment:

C:\>CSSCAN \"sys/password@db10g AS SYSDBA\" FULL=Y

This might work in Windows, on a Linux server you get:

CSS-00110: failed to parse userid
Scanner terminated unsuccessfully.

Here’s how you do it. Log in as a user with DBA rights and do the following:

> csscan full=y tochar=AL32UTF8 array=1024000 process=16

Character Set Scanner v2.1 : Release 10.2.0.0.0 - Production on Sat Apr 10 18:41:37 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Username: sys/[password] as sysdba

That should run the database character scanner on your database. If you get the error:

CSS-00107: Character set migration utility schema not installed       

Scanner terminated unsuccessfully.

… then go back and install the character set migration utility schema, then try running csscan again. You can install the character set migration utility schema with:

> cd $ORACLE_HOME/rdbms/admin
> sqlplus /nolog                                         

SQL*Plus: Release 10.2.0.2.0 - Production on Sat Apr 10 18:40:04 2010

Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.

SP2-0640: Not connected
18:40:04 nolog> connect / as sysdba
Connected.                         

Session altered.

Elapsed: 00:00:00.00
18:40:08 sys> @csminst.sql

If you get this error you can ignore it:

grant READ on directory log_file_dir to system
                        *
ERROR at line 1:
ORA-22930: directory does not exist

Hope you find this useful.

Leave a Comment

Adding an external encrypted drive with LVM to Ubuntu Linux

I recently added an external eSATA drive to my home computer so I could back up critical data from my home network to one drive. I bought a Western Digital 1TB “green” drive and a Thermaltake external hard drive enclosure with eSATA and USB connectors.

Since my internal hard drives are encrypted it didn’t make sense to back up all of that data to an unencrypted external drive. I’d read Uwe Hermann’s excellent how-to article on disk encryption, but he didn’t cover setting up an LVM partition, which I always use so I can change drive volume sizes on the fly.

This is what I did to set up an external encrypted drive with LVM on an Ubuntu system:

  1. Open a terminal
  2. Get a root prompt:
    sudo /bin/bash
  3. Watch the system log:
    tail -f /var/log/messages
  4. Attach the external drive. The system log tells me that it was detected as /dev/sdc.
  5. Check the drive for bad blocks (takes a couple of hours):
    badblocks -c 10240 -s -w -t random -v /dev/sdc
  6. Write random data to the entire drive. This step takes all night, but it ensures that never-written drive space can’t be differentiated from encrypted data if someone ever tries to crack the drive. (If you’re going to do this, you might as well do it right.)
    shred -v -n 1 /dev/sdc
  7. Create one big LVM partition on the drive using fdisk. Set up one big primary partition /dev/sdc1, set the tag to system id “8e” LVM, and write the changes to disk:
    > fdisk /dev/sdc
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel with disk identifier 0xa6846916.
    Changes will remain in memory only, until you decide to write them.
    After that, of course, the previous content won't be recoverable.                                                                                                                   
    
    The number of cylinders for this disk is set to 121575.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
       (e.g., DOS FDISK, OS/2 FDISK)
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)                                                                                                      
    
    Command (m for help): p                                                                                                                                            
    
    Disk /dev/sdc: 999.9 GB, 999989182464 bytes
    255 heads, 63 sectors/track, 121575 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xa6846916                                                                                                                                                         
    
       Device Boot      Start         End      Blocks   Id  System                                                                                                                      
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-121575, default 1): [ENTER]
    Using default value 1
    Last cylinder, +cylinders or +size{K,M,G} (1-121575, default 121575): [ENTER]
    Using default value 121575
    
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): 8e
    Changed system type of partition 1 to 8e (Linux LVM)
    
    Command (m for help): p
    
    Disk /dev/sdc: 999.9 GB, 999989182464 bytes
    255 heads, 63 sectors/track, 121575 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xa6846916
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1               1      121575   976551156   8e  Linux LVM
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.
  8. Use cryptsetup to encrypt the drive:
    cryptsetup --verbose --verify-passphrase luksFormat /dev/sdc1
  9. Unlock the drive:
    cryptsetup luksOpen /dev/sdc1 backupexternal
  10. Create the LVM physical volume:
    pvcreate /dev/mapper/backupexternal
  11. Create the LVM volume group:
    vgcreate xbackup /dev/mapper/backupexternal
  12. Create a logical volume within the volume group:
    lvcreate -L 500G -n backupvol /dev/xbackup
  13. At this point you have a device named /dev/xbackup/backupvol, so create a filesystem on the logical volume:
    mkfs.ext4 /dev/xbackup/backupvol
  14. Mount the volume:
    mount /dev/xbackup/backupvol /mnt/backup
  15. To get the volume to mount automatically at boot time add this line to your /etc/fstab file:
    /dev/xbackup/backupvol      /mnt/backup     ext4    defaults        0 5
  16. To be prompted for the decryption key / passphrase at boot time first get the drive’s UUID:
    ls -l /dev/disk/by-uuid

    (In my example I use the UUID for /dev/sdc1)

  17. Then add this line to the /etc/cryptab file:
    ext_drive  /dev/disk/by-uuid/[the UUID of the drive] none luks

That’s it. You now have an external, encrypted hard drive with LVM installed. You’ve created one 500GB volume that uses half the disk, leaving 500GB free for other volumes, or for expanding the first volume.

Hope you find this useful.

Comments (4)

Pidgin, purple-remote, and solving the “No existing libpurple instance detected” error

I was Googling around tonight to find an answer to a question I was asked about purple-remote and duplicate status messages in the Pidgin Instant Messaging Client and I ran across many, many people posting messages that they couldn’t get purple-remote to work. They had no problem running purple-remote from a command line, but as soon as they tried to call it from a web page or a cron job or from some other process they started seeing the “No existing libpurple instance detected” error.

The solution to this problem is the same as the solution to my original Update Pidgin IM status on Ubuntu using cron article. purple-remote communicates with Pidgin using DBUS. If you’re running purple-remote from a cron job or from some a process that is not owned by you (for instance, an Apache CGI script being run by the “apache” user) then you need to set the DBUS_SESSION_BUS_ADDRESS environment variable for that process so that it matches the DBUS_SESSION_BUS_ADDRESS environment variable for your login. Once that’s done, any processes run by that user that communicate using DBUS will use the same DBUS session that you’re using, so when the “apache” user runs purple-remote it’ll talk to the copy of Pidgin that you are running.

There are many ways you can disclose the value of your login’s DBUS_SESSION_BUS_ADDRESS value to other programs. The easiest way I’ve found is just to save the value to a file and then have your cron job or Apache CGI script execute that file as a script. Check out the Update Pidgin IM status on Ubuntu using cron article for examples of exactly how to do this.

Comments (1)

One-line search and replace command using Perl

I’ve been using these one-line commands for over a decade. They’re a really easy way to do a search and replace across many files using a Perl regular expression.

This example replaces all instances of the word “old” with the word “new” in “myfile”, saving the old file version as “myfile.bak”:

# perl -i.bak -pe 's/old/new/g;' myfile

This replaces all instances of the word “old” with the word “new” in all of the .html files in the current directory:

# perl -i.bak -pe 's/old/new/g;' *.html

This does the same thing, but also updates all .html files in all subdirectories:

# find . -name '*.html' -exec perl -i.bak -pe 's/old/new/g;' {} \;

Hope you find this useful.

Comments (2)

Add an entire directory tree to CVS

A web application project I’m working on uses YUI widgets for the user interface and CVS as the version control repository. We needed to keep separate versions of YUI around for development, testing and production, so we separate the versions by their release numbers.

Adding a new YUI build tree to CVS means adding several hundred new files to CVS. Unlike Subversion or Git, if you add a directory to an existing CVS project CVS doesn’t automatically add all of the subdirectories and files. If you try to add all of the files in a subdirectory using “*” you will also get the CVS directory that CVS uses to store information about the directory’s contents, which will generate warning messages from CVS until the end of time.

If you combine the “find” command with “cvs add” you can add all of the subdirectories and files with one command, skipping all of the CVS subdirectories. The syntax is a little arcane, so I thought it was worth posting here.

For the initial setup assume that I have an existing CVS project “apache” with a directory “js”. I add the directory ~/apache/js/yui to my local copy of the project, copy the YUI zip file into the directory, and unzip it. Unzipping it creates the directory “yui” (in this case ~/apache/js/yui/yui) but since I want separate versions of each copy of YUI I rename the directory and call it “2.8.0r4″. Then I add the new directories to CVS.

# mkdir ~/apache/js/yui
# cp yui_2.8.0r4.zip ~/apache/js/yui/
# cd ~/apache/js/yui
# unzip yui_2.8.0r4.zip
# mv ~/apache/js/yui/yui ~/apache/js/yui/2.8.0r4
# cd ~/apache/js
# cvs add yui
# cvs add yui/2.8.0r4

I want to add the directory ~/apache/js/yui/2.8.0r4/build to CVS as well, but I don’t want to add the “~/apache/js/yui/2.8.0r4/examples” or “~/apache/js/yui/2.8.0r4/docs” directories, just ~/apache/js/yui/2.8.0r4/build, so I use a “find” command that specifies just the “build” directory and I prune out any directories containing the name “CVS” from the results returned by find:

# cd ~/apache/js/yui/2.8.0r4/
# for f in `find ./build -name CVS -prune -o -print | sort`; do cvs add $f; done
# cvs ci -m "Adding YUI v2.8.0r4 to the CVS repository"

Piping find’s results to the “sort” command puts the files in order, so directories always get added before the files that they contain.

To use this technique for your own directories, just go to the parent of the directory you just added and use the above “find” command, just substitute the name of your new directory for “./build”.

A side note: We add a symlink that points to the version we want to use at the moment so that the application code can be run with whichever version we want to test with:

# cd ~/apache/js/yui
# ln -sf 2.8.0r4 current

A script tag in the application would look like this:

<script src="/js/yui/current/build/utilities/utilities.js" type="text/javascript" />

Hope you find this useful.

Leave a Comment

Installing Skype on Ubuntu 9.04 using Synaptic

Want to make free phone calls using Skype? Running Ubuntu 9.04? Want to make sure that Skype stays up-to-date with the latest security patches and updates once you install it? Here’s how:

On the Skype Download for Linux page Skype lists Ubuntu 7.04-8.04 as the only supported versions of Ubuntu. You can install Skype on Ubuntu 9.04, but when new updates or security fixes come out you won’t get an automatic update. If you want to make sure that your Skype installation stays up-to-date you should add skype.com as a valid software repository and install Skype from that. If you do this you’ll automatically get updates when they’re available.

To add skype.com as a repository:

  • Start up Synaptic Package Manager. (On Gnome go to System > Administration > Synaptic Package Manager)
  • Select Settings > Repositories
  • Click the Third-Party Software tab
  • Click Add
  • Enter “deb http://download.skype.com/linux/repos/debian/ stable non-free” as the APT line
  • Click the Reload button in the upper left-hand corner to download the list of available files from download.skype.com
  • Type “skype” in the Quick Search box and you should see Skype listed as an installable package
  • Mark it for installation and install

Skype should now appear on your Applications > Internet menu.


Update: At the time that I wrote this the instructions worked. However, it looks as if Skype has removed their apt repositories for 9.04. If you attempt to connect to http://download.skype.com/linux/repos/debian/ you’ll get a “Hi, this page is off limits” error message.

If you are running Ubuntu 10.04 or later you can get Skype directly from Canonical. See https://help.ubuntu.com/community/Skype for more info.

Comments (15)

Getting ActiveScaffold to work under Ruby on Rails 2.3

I had started an application using Ruby on Rails and I wanted to try out ActiveScaffold as a replacement for standard scaffolding. I’d seen ActiveScaffold in action before but I’d never used it. I knew that ActiveScaffold dynamically generates application pages using a standard format, and if you change the format it updates all of your application’s pages — unlike standard scaffolding where you have to tweak each and every page. For the application I’m working on it sounded like a huge time-saver, so I decided to try it out.

I was trying to install ActiveScaffold for Ruby on Rails using the steps shown on the Active Scaffold – Getting Started tutorial. However, when I installed ActiveScaffold using the instructions the Mongrel web server I use for development would die as soon as I tried to restart it, dumping a large list of errors:

earl@earl:~/projects/TotalWorldDomination > script/server
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/
module/aliasing.rb:33:in `alias_method': undefined method `_pick_template'
for class `ActionView::Base' (NameError)
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/
core_ext/module/aliasing.rb:33:in `alias_method_chain'

… and the error messages continued, filling up the entire screen.

I quickly figured out that the problem was that I was using Rails 2.3.2, and the release version of ActiveScaffold was for Rails 2.2.x. The tutorial was for Rails 2.2.x, not 2.3.x.

Since I’d just commited all of my changes to my Subversion repository before installing ActiveScaffold I reverted to the previous version of my application, removing any files installed by ActiveScaffold.

I checked the README for ActiveScaffold on GitHub and installed the following branches:

script/plugin install git://github.com/activescaffold/active_scaffold.git -r master
script/plugin install git://github.com/ewildgoose/render_component.git -r rails-2.3

After that Mongrel loads just fine:

earl@earl:~/projects/TotalWorldDomination > script/server
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

Following the tutorial I added this to my layout:

<%= javascript_include_tag :defaults %>
<%= active_scaffold_includes %>

And I added this to one of my controllers (just so I could test out ActiveScaffold with one model):

  layout "admin"
  active_scaffold

At this point if I try to pull up a view for the controller I just modified I get a “Template is missing – Missing template admin.erb in view path vendor/plugins/active_scaffold/frontends/default/views” error.

Active Scaffold - missing admin view

This error is misleading, since (checking GitHub) there are no admin.* files in active_scaffold/frontends/default/views in any of the four ActiveScaffold branches. It’s not a view that comes built into ActiveScaffold, even though the tutorial makes it sound like a built-in layout, it’s the name of a layout file for your application.

In my case the layout that I’d modified in the previous step was application.html.erb, and it was the only layout in my small application. I made a copy of the file named admin.html.erb:

cd app/views/layouts
cp application.html.erb admin.html.erb

Then following advice I found in the ActiveScaffold forums I commented out everything in all of my standard-scaffold-generated controllers, leaving only the lines:

  layout "admin"
  active_scaffold

… in between the “class” and “end” lines for each controller.

Once I did that ActiveScaffold worked fine.

One note: If you do get any “Request Failed (code 500, Internal Error)” errors, check log/development.log for hints about what’s going on, it’ll usually tell you what the problem is.

Hope you found this useful.

Comments (7)

Samsung SSD drives achieve 2GB/s write speeds

I spend a fair amount of my time administering large databases and trying to squeeze the maximum speed out of computer hardware. The types of databases I work on are typically in the 1-2TB range and the disks that they run on have to support a mix of bulk writes, bulk deletes, random writes and random reads. Some of the systems I work on can burst at up to 500MB/s and sustain random write speeds of 250MB/s. Your typical SATA2 drive for home use supports a maximum sequential write speed of around 60MB/s, and they run slower still when doing lots of random IO, so getting 250MB/s sustained random write speeds requires some special hardware.

This is why I was so impressed with a demo I saw of the new Samsung SSD (solid state drive). Since these drives are solid state — no moving parts — they have 220MB/s sequential read and 200MB/s sequential write speeds. If you tie a bunch of them together in a RAID configuration you can speed writes up even more, which is what the guy in the video below did. The end result was a desktop server that could read and write sequential data at 2GB/s.

Usually when I see demos like this the caveat is that the total amount of space available is 80MB or so. Not the case here. These new drives are 256GB each, and the RAID array built below has a total capacity of 6TB.

Check this out. If you’re into high-speed hardware using off-the-shelf parts, this is just incredible.

One thing to note, the demo does not show random read/write speeds. All of the guy’s demonstrations are of sequential IO speed. This is significant, because in the past SSD drives slow down significantly if they’re asked to do random IO, and you want lots of speed for random IO if you want to use these drives for database applications.

Comments (1)