PGTS PGTS Pty. Ltd.   ACN: 007 008 568               Mobile Version Coming Soon

point Site Navigation

Valid HTML 4.01!

   Give Windows The Boot!
   And Say Goodbye To Viruses!


   If you own a netbook/laptop~
   Download Ubuntu Netbook!

Feedback and Hints, October 2002.

If you have a question regarding any of the articles in this journal, or some comments please send them in. If there are any general questions about Unix or Database Administration, I will attempt to answer them. Some of the hints this month:

Missing ltermcap

Symptom: Compiling a package and linker returns following message:

	/usr/bin/ld: cannot find -ltermcap
Check /lib for the termcap library. If it already exists as a version number you may only need to create a link as follows:
	cd /lib
	ln -s

Making FreeBSD Booteasy work with LILO

Most documentation recommends that you modify your LILO installation to boot from the first sector of the boot partition rather than the MBR (Master Boot record). This can be done in the configuration dialog when installing Linux or by modifying the lilo.conf file to load from the boot sector. For example if your boot partition is /dev/hda5 then you would change the boot line in lilo.conf to read:

However, if Linux is installed on a seperate disk which is not the primary disk and the BSD boot manager is installed on the primary disk then you should install LILO in the MBR of the disk that the boot partition resides on. For example if your BootEasy is configured to load from /dev/hda (in FreeBSD 4.4 this would be called /dev/ad1 -- the device /dev/wdc1 is now obsolete) and the Linux root is in /dev/hdb1 then change the boot line to read:

Creating an Emergency Rescue Disk for FreeBSD 4.4

Mount the cdrom and enter the following command:

	dd if=/cdrom/floppies/fixit.flp of=/dev/rfd0c bs=36b
This can then be used as the second disk in a boot sequence. Alternatively it is possible to boot from the 2nd CDROM and when the standard install menu appears press 'Q'. This will then start /stand/sysinstall. Press 'F' to get the Fixit option. At the next menu choose '2'. After confirming you will get a screen where you must press Alt-F4 (to give you the 4th console) and that gives you a rescue screen. This will be a session that has many of the standard unix tools available. This is all documented but it is not very clear (I didn't find it very clear).

Making an MS-DOS file systems writeable by certain Linux users or groups

By default Linux makes FAT file systems writeable only by the super user. If you wish to make it writeable by other users you need to change the permissions at mount time. You do this by mounting the file system with the gid=nnn and umask=002 options. These can be put on the mount command when you mount it (use the -o option) or if it is mounted at startup then put an entry like the following in /etc/fstab:

	/dev/hdb1       /dosc   msdos   umask=002,gid=n
Where gid=n represents the group that you wish to grant write access to. This is a number that can be obtained from /etc/group. If you wish to give write access to the world then just use:
	/dev/hdb1       /dosc   msdos   umask=000

How do I search a file for a regexp and join it with the previous line?

There are many ways of doing this. But I think the easiest way would be to use awk

Suppose you are examining the file /mypath/filename and you are looking for the regular expression 'ecky', then this should do what you want:

	awk '{if ($0~/ecky/)print pl,$0;pl=$0}' /mypath/filename

Remember that 'ecky' is a regular expression and the whole one-liner is enclosed in single quotes so watch out for special characters or single quotes in your expression.

If the line that you want to join is more than one line previous to the regexp, then you might require a small script. Something like the following should do it:

	for($i = 0; $i <= $#t; $i++){
		chomp $t[$i];
		if ($t[$i] =~ /ecky/){
			print "$t[$i] $t[$i-6]\n";