Sunday, April 27, 2008

'yum-protectbase' vs. RHN

I can't seem to get 'yum-protectbase' to behave correctly with RHEL5's rhnplugin. From `rpm -qi yum-protectbase`:

Description :
This plugin allows certain repositories to be protected. Packages in the protected repositories can't be overridden by packages in non-protected repositories even if the non-protected repo has a later version.

The problem is that, the RHN repositories aren't defined by standard files in '/etc/yum.repos.d/' so I can't add 'protect=1'. The same problem is documented here and here.

[EDIT]: This bug has now been fixed. See my comments on this post for details.

Wednesday, April 23, 2008

Dmidecode - print hardware information from your BIOS

Dmidecode reports information about your system's hardware as described in your system BIOS according to the SMBIOS/DMI standard (see a sample output). This information typically includes system manufacturer, model name, serial number, BIOS version, asset tag as well as a lot of other details of varying level of interest and reliability depending on the manufacturer. This will often include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI, ISA) and memory module slots, and the list of I/O ports (e.g. serial, parallel, USB).

Monday, April 21, 2008

Cross-subnet booting of HP-UX

The following link describes how to set up an HP-UX 11i box as a "Boot-Helper System":

http://docs.hp.com/en/5992-3336/apds01.html

swinstall a specific version

Here's how to swinstall a specific version of a depot, product or fileset:

swinstall -s ignite:/swdepot/Ignite/IgniteUX Ignite-UX.BOOT-KRN-11-11,r=C.6.8.152

Then verify it:

swlist -l fileset -a state Ignite-UX.BOOT-KRN-11-11

Testing mdadm's '--grow' option on RAID 5

Here's a simple script to test mdadm's ability to grow a RAID 5 volume onto new disks. This is an amazing feature, which would previously have only been found on expensive hardware RAID solutions.

# Install the required tools.
sudo aptitude install ext2resize mdadm

# Set up the loop devices to be used as RAID
# devices.
for foo in `seq 0 4`; do dd if=/dev/zero bs=1M count=100 of=/tmp/$foo; sudo mknod /dev/loop$foo b 7 $foo; sudo losetup /dev/loop$foo /tmp/$foo; done

# Create a 4 'disk' RAID 5 on /dev/md5.
sudo mdadm -C -l 5 -n 4 /dev/md5 /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3

# You may want to wait for the initial (re)build to
# complete before proceeding.
watch 'sudo mdadm -D /dev/md5|tail -n 20'

# Make a file system on the RAID 5 volume.
sudo mke2fs /dev/md5

# Mount it up.
sudo mkdir /mnt/tmp
sudo mount /dev/md5 /mnt/tmp

# Create a 250MB test file.
sudo dd if=/dev/urandom bs=1M count=250 of=/mnt/tmp/file

# Take a checksum of the file.
md5sum /mnt/tmp/file|tee /tmp/file.md5sum

# Unmount the volume.
sudo umount /mnt/tmp/

# Add the 5th 'disk' and grow the volume.
sudo mdadm -a /dev/md5 /dev/loop4
sudo mdadm -G /dev/md5 -n 5

# You may want to wait for the grow operation to
# complete before proceeding.
watch 'sudo mdadm -D /dev/md5|tail -n 20'

# Resize the file system to fill the volume.
sudo ext2resize /dev/md5

# Mount it back up.
sudo mount /dev/md5 /mnt/tmp

# Verify that the file is unchanged.
md5sum -c /tmp/file.md5sum

# Unmount the volume.
sudo umount /mnt/tmp/
sudo rmdir /mnt/tmp

# Stop the RAID volume
mdadm -S /dev/md5

# Remove the loop devices and checksum file.
for foo in `seq 0 4`; do sudo losetup -d /dev/loop$foo; rm /dev/loop$foo /tmp/$foo; done
rm /tmp/file.md5sum

Recursively setting sensible permissions

find . -type d -exec chmod 755 {} \; -or -type f -exec chmod 644 {} \;

UPDATE: Norgg and patrick have pointed out that the following, more simple command, does the same:

chmod -R a+rX .

Friday, April 18, 2008

ssmtp: extremely simple MTA to get mail off the system to a mail hub

A secure, effective and simple way of getting mail off a system to your mail hub. It contains no suid-binaries or other dangerous things - no mail spool to poke around in, and no daemons running in the background. Mail is simply forwarded to the configured mailhost. Extremely easy configuration.

http://packages.debian.org/stable/mail/ssmtp

Monday, April 14, 2008

Mapping Edinburgh Pubs

http://www.batchgeocode.com/map/?i=298962ded5928f254e45c345d66c05eb

Here's a map I made using http://www.batchgeocode.com/. I found that you need a full address to make it work well. I started using just the post code and it got the points totally wrong. Here's the data that made the map:

Address|City|Zip|State|Name
15 Parkside Terrace|Edinburgh|EH16 5XW|GB|Flat
212 Cowgate|Edinburgh|EH1 1NQ|GB|Bannerman's Bar
1 West Register St|Edinburgh|EH2 2AA|GB|Guildford Arms
29 Niddry St|Edinburgh|EH1 1LG|GB|Nicol Edwards
26 Brougham St|Edinburgh|EH3 9JH|GB|Cloisters
19 Cockburn St|Edinburgh|EH1 1BP|GB|Ecco Vino
24 West Preston St|Edinburgh|EH8 9PZ|GB|The Junction
74 Grassmarket|Edinburgh|EH1 2JR|GB|The Last Drop‎
8 Young St|Edinburgh|EH2 4JB|GB|Oxford Bar‎
23 St. Leonard's St|Edinburgh|EH8 9QN|GB|The Auld Hoose

HP 2133 miniNote 1.2GHz 2GB XP Pro 6 Cell from RM

http://www.rm.com/HE/Products/Product.asp?cref=PD1164671

Wednesday, April 9, 2008

Xvnc with inetd

Here's how to use Xvnc with inetd to allow users to use a VNC client to get to an xdm:

http://www.realvnc.com/products/free/4.1/man/Xvnc.html#lbAG


As RHEL 5 uses xinetd I created '/etc/xinetd.d/Xvnc' with the following contents:

# default: off
# description: Xvnc server which talks XDMCP to a local xdm in order
# to give the user a local GUI login prompt.
service Xvnc
{
disable = no
port = 5900
socket_type = stream
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query localhost -once securitytypes=none
log_on_failure += HOST
}

GNOME's vino might also be of interest but it's designed for connecting to running GNOME sessions.

Friday, April 4, 2008

How to specify a configuration file for pxelinux from ISC DHCP server 3

option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
site-option-space "pxelinux";

option pxelinux.magic f1:00:74:7e;
if exists dhcp-parameter-request-list {
# Always send the PXELINUX options (specified in hexadecimal)
option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,d0,d1,d2,d3);
}
option pxelinux.configfile "pxelinux.cfg";

Thursday, April 3, 2008

Forwarding queries to local (no TLD) DNS zone

How do you get one name server to talk to another one, when you're using a local domain (one with no registered TLD)?

Use the 'forward' zone type and specify the remote name server to query:

zone "jdt" {
type forward;
forward only;
forwarders { 192.168.0.200; };
};