stevesearle.com
Home
Champions
Techie Stuff
FAQ
Automake and Autoconf
MySQL and C++
CentOS 5.0 Server
Fedora 7 Workstation
Customise that Desktop
Blocking Online Ads
Downloads
Spam

Viewable With Any Browser

Valid HTML 4.01!
© Steve Searle 1999, 2006
Created and maintained using
Vim
Techie Stuff - FAQ

This page documents various odds and ends that I have had problems sorting out, or problems that I can never remember the answer for. Maybe they will help someone else too.

GNU/Linux Installation
How do I stop the installation freezing when running /sbin/loader (Alt + F4 shows Trying to read CD Device)?
Shell
How can a (non-XWindows) console be stopped from going into power-saving mode?
How do I access a USB memory stick?
X Window System
How can an XWindows application be run on one machine and have the output displayed on a second machine?
How do I set my default desktop environment under Redhat or Fedora?
When KDE is started, how do I stop it from launching a window containing the contents of a CD that is in the drive?
C++
Why do I get error: no matching function for call to `transform... on transform(send.begin(), send.end(), send.begin(), tolower);?
Compiling, Linking and Running Programs
I get foo: error while loading shared libraries: bar: cannot open shared object file: No such file or directory. Why? What do I do?
I'm trying to link to the mysqlclient library and I get undefined reference to `compress' and undefined reference to `uncompress' errors. Why?
Email
Why do I keep getting Deferred: Connection refused messages when I try to send email to another machine on the local network?
Browsers
Why won't Mozilla start with the home page I set in Edit -> Preferences...?
How do I get the Java plugin working with Firefox?
vi
Attempting to install a GUI enabled vim fails in configure with checking --enable-gui argument... no GUI support. How do I get round this?
How do I enter a character in vi that is not on the keyboard?
NFS
How do I configure a firewall to allow the mounting of an NFS volume?
GRUB
I have reinstalled Windows and it has wiped out GRUB from the MBR. How can I get it back?
gpg
I get a WARNING: using insecure memory error when I run gpg. How do I stop it?
ntpd
The ntpd service won't run, and gets a segmentation fault if I debug it. What can I do?
How do I stop the installation freezing when running /sbin/loader (Alt + F4 shows Trying to read CD Device)?

Supply the ide=nodma parameter, i.e.

 linux ide=nodma

Contents

How can a (non-XWindows) console be stopped from going into power-saving mode?

Enter

 $ setterm -blank

Contents

How do I access a USB memory stick?

Firstly establish what device the memory stick is. Plug it in and examine the last few lines of the message log.

 # tail /var/log/messages

Something similar to the following is displayed.

 Jun 12 15:32:25 jenny kernel: usb 1-5: new high speed USB device using ehci_hcd and address 3
 Jun 12 15:32:25 jenny kernel: scsi5 : SCSI emulation for USB Mass Storage devices
 Jun 12 15:32:30 jenny kernel:   Vendor: Kingston  Model: DataTraveler2.0   Rev: 4.70
 Jun 12 15:32:30 jenny kernel:   Type:   Direct-Access                      ANSI SCSI revision: 00
 Jun 12 15:32:30 jenny kernel: SCSI device sdc: 499200 512-byte hdwr sectors (256 MB)
 Jun 12 15:32:30 jenny kernel: sdc: Write Protect is off
 Jun 12 15:32:30 jenny kernel: sdc: assuming drive cache: write through
 Jun 12 15:32:30 jenny kernel: SCSI device sdc: 499200 512-byte hdwr sectors (256 MB)
 Jun 12 15:32:30 jenny kernel: sdc: Write Protect is off
 Jun 12 15:32:30 jenny kernel: sdc: assuming drive cache: write through
 Jun 12 15:32:30 jenny kernel:  sdc: sdc1
 Jun 12 15:32:30 jenny kernel: Attached scsi removable disk sdc at scsi5, channel 0, id 0, lun 0
 Jun 12 15:32:30 jenny kernel: Attached scsi generic sg2 at scsi5, channel 0, id 0, lun 0,  type 0
 Jun 12 15:32:31 jenny scsi.agent[4761]: disk at /devices/pci0000:00/0000:00:10.4/usb1/1-5/1-5:1.0/host5/target5:0:0/5:0:0:0

Note the reference to sdc: sdc1 - this is the device being used in this instance. Assuming directory /home/steve/mem exists, this can be mounted as follows.

 # mount -t vfat -oumask=0000 /dev/sdc1 /home/steve/mem

Contents

How can an XWindows application be run on one machine and have the output displayed on a second machine?

Here are two ways. From the XWindows machine, ssh to the other machine. Then run the application, e.g.

 (steve@candy:~)$ ssh fanny
 ...
 (steve@fanny:~)$ xterm &


Or, on the XWindows machine, enter

 $ xhost +

This will allow access to this machine's XWindows by any other machine on the network.

On the remote machine, enter

 $ DISPLAY=IP-alias:0.0
 $ export DISPLAY

IP-alias is the full name of the XWindows machine, e.g. candy.stevesearle.com

Contents

How do I set my default desktop environment under Redhat or Fedora?

Use the switchdesk command. For example, to set the default desktop to kde:

 $ switchdesk kde

This needs to be run from a virtual terminal, i.e. outside of the X Window system.

Contents

When KDE is started, how do I stop it from launching a window containing the contents of a CD that is in the drive?

For Fedora at least, enter:

 $ rm ~/.kde/Autostart/Autorun.dekstop

Contents

Why do I get error: no matching function for call to `transform... on transform(send.begin(), send.end(), send.begin(), tolower);?

You are probably using namespace std which is masking the global tolower and replacing it with std::tolower. To get round this code the line as follows.

 transform(send.begin(), send.end(), send.begin(), ::tolower);

Contents

I get foo: error while loading shared libraries: bar: cannot open shared object file: No such file or directory. Why? What do I do?

Program foo needs to dynamically call library bar. But it can't find it. First check to see that it exists

$ locate bar

If this doesn't display bar (preceded by its path) then you do not have the library on your system and need to download it.

If it does find it, (e.g. displays a line like /usr/local/bar) then you don't have the directory it is in (e.g. /usr/local) in the list of locations that your system looks for libraries in. To add it to the list, edit /etc/ld.so.conf and add a line for the directory (e.g. /usr/local). Then run

# ldconfig

to update the links and cache for the run time linker.

Contents

I'm trying to link to the mysqlclient library and I get undefined reference to `compress' and undefined reference to `uncompress' errors. Why?

This means that the client library is compiled with support for a compressed client/server protocol. The fix is to add -lz last when linking with -lmysqlclient.

Contents

Why do I keep getting Deferred: Connection refused messages when I try to send email to another machine on the local network?

Certain distros, including Red Hat and Fedora, default to setting up a client-only version of sendmail, that only listens on the localhost interface. To get round this on Fedora, edit /etc/mail/sendmail.mc and delete or comment out the 127.0.0.1 DAEMON_OPTIONS line as follows.

 dnl #DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Then regenerate the sendmail-cf file and restart sendmail.

 # make -C /etc/mail
 # service sendmail restart

See the Sendmail FAQ for more details.

Contents

Why won't Mozilla start with the home page I set in Edit -> Preferences...?

Even though you have set your preferred home page, when you start Mozilla it goes to some other page. Go -> Home does work, however.

Enter about:config as the URL for Mozilla to open. Find the browser.startup.homepage_override.1 setting, and change its value to false, by right clicking and selecting modify.

Contents

How do I get the Java plugin working with Firefox?

Download the JRE rpm from Sun. Change the downloaded file to make it executable and run it.

 # chmod 755 /tmp/jre-1_5_0_08-linux-i586-rpm.bin
 # /tmp/jre-1_5_0_08-linux-i586-rpm.bin

Now create a link in the Mozilla plugins directory to the JRE library.

 # ln -s /usr/java/jre1.5.0_08/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins

Restart Firefox.

Contents

Attempting to install a GUI enabled vim fails in configure with checking --enable-gui argument... no GUI support. How do I get round this?

Make sure you have XFree86-devel installed.

Contents

How do I enter a character in vi that is not on the keyboard?

Display the digraphs table by changing to the command mode if necessary, and entering :digraphs. Look for the character you require and note either the two character or three digit code for the character. Return to insert mode and either type Ctrl-K followed by the two character code, or Ctrl-V followed by the three digit code. Both of these will cause the character to appear.

E.g. A © symbol can be create with Ctrl-K Co or with Ctrl-V 169.

Contents

How do I configure a firewall to allow the mounting of an NFS volume?

Or, help! I'm getting mount: RPC: Unable to receive; errno = No route to host.

Or, why are my OpenOffice files allways read only if they are on a nfs server?

Much of the following section came from or was derived from the excellent HOWTO: Configure NFS for control by Firewalls and IPTABLES written by Chris Lowth.

Getting NFS through a firewall is complicated because by default some of the TCP/IP and UDP ports used are randomly generated. This behavior needs to be changed by altering the NFS start scripts to set it to use the same ports each time, and then opening the firewall for this ports, as well as port 111 for the Portmapper daemon and port 2049 for NFS.

I set the Status daemon port to 4000, and the mountd port to 4001. To do this, edit /etc/sysconfig/nfs (it may need to be created) and add the following lines.

 STATD_PORT=4000
 MOUNTD_PORT=4001

The NFS Lock Manager port is set to 4002. This is done by adding the following line to /etc/modprobe.conf.

 options lockd nlm_udpport=4002 nlm_tcpport=4002

The rquotad port is set to 4003, this time by editing /etc/services. Add rquotad lines as follows.

 rquotad	4003/tcp	# rquotad
 rquotad	4003/udp	# rquotad

Now add the following lines to /etc/sysconfig/iptables (before the -j REJECT line). This will allow nfs clients to access these services.

 ...
 # NFS exports
 # Portmapper
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
 -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
 # NFS
 -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
 # Status
 -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 4000 -j ACCEPT
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 4000 -j ACCEPT
 # mountd
 -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 4001 -j ACCEPT
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 4001 -j ACCEPT
 # NFS Lock Manager
 -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 4002 -j ACCEPT
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 4002 -j ACCEPT
 # rquotad
 -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 4003 -j ACCEPT
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 4003 -j ACCEPT
 ...
 -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
 ...

At this point the server needs to be rebooted. Restarting NFS and IPTABLES isn't sufficient. After rebooting, running rpcinfo -p (as root) should give ouput similar to the following (i.e. all services using the port numbers we have chosen).

   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp   4000  status
    100024    1   tcp   4000  status
    100021    1   udp   4002  nlockmgr
    100021    3   udp   4002  nlockmgr
    100021    4   udp   4002  nlockmgr
    100021    1   tcp   4002  nlockmgr
    100021    3   tcp   4002  nlockmgr
    100021    4   tcp   4002  nlockmgr
    100011    1   udp   4003  rquotad
    100011    2   udp   4003  rquotad
    100011    1   tcp   4003  rquotad
    100011    2   tcp   4003  rquotad
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100005    1   udp   4001  mountd
    100005    1   tcp   4001  mountd
    100005    2   udp   4001  mountd
    100005    2   tcp   4001  mountd
    100005    3   udp   4001  mountd
    100005    3   tcp   4001  mountd

NFS Clients should now successfully be able to get through the firewall now.

Contents

I have reinstalled Windows and it has wiped out GRUB from the MBR. How can I get it back?

Boot into GNU/Linux from your emergency boot diskette (You do have one, don't you? If not you can create a GRUB boot diskette).

Enter grub (assuming you didn't boot into it). At the grub prompt enter the following to reinstall grub to the MBR

 grub> root (hd1,0)
 grub> setup (hd0)
 grub> quit

The root command sets the partition that holds the grub files - in this case the first partition on the second drive. The setup command installs grub on the MBR of one of the drives - in this case the first drive.

Contents

I get a WARNING: using insecure memory error when I run gpg. How do I stop it?

You need to set uid (root) permissions. Enter

 # chmod 4755 /usr/bin/gpg

Contents

The ntpd service won't run, and gets a segmentation fault if I debug it. What can I do?

On Fedora Core 3, running the following command cures this. Don't know why. You only need to do it once.

 # execstack -s /usr/sbin/ntpd

Contents