LJ Archive

Best of Technical Support

Various

Issue #108, April 2003

Our experts answer your technical questions.

Root Partition Mysteriously Read-Only

I have a Red Hat 7.2 system with two physical drives, each partitioned with three logical volumes. I have done something that caused my main root partition to be read-only. I've checked the directory permissions, and they are fine. But if I try to vi or touch a file in root or anywhere in a root subdir, I receive touch: creating 'test': Read-only file system.

—Jeff Manning, Jeff@VMWorks.com

Make sure you are truly on the root partition:

# cd /
# df .

The output should include a Mounted on column with a value of /. If it truly is mounted read-only, it is most likely because you had some filesystem error. You should fix it before you mount the partition read-write:

# fsck /dev/hda2

Replace /dev/hda2 with the entry under the Filesystem column in the output of df. Finally, do this to mount the root partition as read-write:

# mount / -o remount,rw

—Christopher Wingert, cwingert@qualcomm.com

Switching to GDM from KDM

When my machine boots up in X, I get back what I think is the KDE login manager. I would prefer to use GNOME's GDM, as it has better features and is more customizable. How do I make GDM the default X login manager?

—Gordon Baldwin, gordonbaldwin@bigpond.com

Log in as root and edit the /etc/sysconfig/desktop file, changing:

DESKTOP="KDE"

to:

DESKTOP="GNOME"

—Keith Trollope, ktrollope@san.rr.com

Upgrade Makes Printers Disappear

I recently upgraded StarOffice from 5.2 to 6.0, and my system can no longer access the network printers. The printers are HP LaserJets with JetDirect cards, and they have their own IP addresses. Using spadmin outputs only to a default printer; there is no obvious way to specify an IP address. Looking at psprint.config shows a location parameter but offers no documentation saying how to set up an IP printer.

—Murray Zangen, murray@nj.com

First, add the printers to the system using printtool and specify JetDirect printer. Then, in spadmin, add the printer definition for StarOffice. When you get to the print command window, specify the printer in the command, for example:

lpr -P hp3

—Keith Trollope, ktrollope@san.rr.com

Emergency LILO Tip

This is a follow-up to the bulletproof backup/boot question that appeared in Best of Technical Support in the January 2003 issue. LILO knows about the -R option, which basically means “install this boot entry just once, then use default”. You may, at an early boot stage, install your emergency mode with lilo -R. At system shutdown (when all went well, if you are picky after remounting / as read-only) you may re-install your normal mode. So, if the box crashes unexpectedly (or goes down quickly from, say, a forced reboot with Ctrl-Alt-Delete), you come up in emergency mode.

—Tomas, mlavergne@cfl.rr.com

Connecting to a Microsoft Network

How do I stick a Linux box into my Windows peer-to-peer network? I have an existing Windows peer-to-peer network that includes one Windows XP machine and three or four Windows 98 machines. They have fixed addresses in the 10.1.1.1-10.1.1.14 range. All the machines are completely shared, and there are no passwords; I'm the only actual user most of the time. How do I make the Windows machines see the drives on the Linux machine and vice versa?

—J. G. Owen, owen_labs@worldnet.att.net

Samba can help with this task. Setting up Samba this way can be confusing, however, because the documentation doesn't make it clear from the first step that there are actually two halves to this task. In Windows, client and server functionality is the same. Once the network is up, you can browse other systems, and they can browse yours. With Samba, each side has to access the other. Once Samba is installed, it takes only a little work to access other systems. You should be able to use the smbmount command to mount a share from another system. In fact, if you have other name resolution methods correctly installed, such as DNS, you generally don't need to run nmbd and smbd. For permanent shares, you can add a line to /etc/fstab that is similar to the following:

//machname/share  /mountpt smbfs åusername=xxx,password=yyy  1 1

You do need to set the Linux machine up as a server to enable other machines to access it. This is done by editing smb.conf to define the basic server properties as well as the shares to create. Then run nmbd and smbd to provide those services. The trick to avoiding sometimes-messy PDC-related work is to compile Samba such that it supports your normal password services. You can then add users to your system normally and use the smbpasswd utility to create the file Samba actually uses. It's a relatively manual process (described in the “Unofficial HOWTO” at www.samba.org), but it does do the trick. If you want to browse as well as share, make sure you add the guest or no-name account.

—Chad Robinson, crobinson@rfgonline.com

Various versions of Windows are a bit touchy with the Network Neighborhood. The best thing to do is edit /etc/samba/smb.conf. Make sure the “workgroup = line” matches your workgroup. Add a “netbios name =” for the name of your machine. Depending on your installation, the default passwords will be picked up from /etc/password.

—Christopher Wingert, cwingert@qualcomm.com

I Have No Inetd and I Must...Telnet?

inetd on my system, Slackware 2.0.28, stops on occasion, barring access from telnet. Is there an easy way to automatically restart inetd if it dies?

—Mark Johnson, Mark.Johnson@InfoHarvest.ca

You're running an extremely old version of inetd, and some versions did have stability problems. Several solutions to your problem are available. If it is possible to upgrade your system, newer versions usually work fine, and you'll receive other benefits as well. If you'd like a replacement, try such alternatives as xinetd or daemontools, both of which are quite stable and add some features to the mix. However, if your cron service is trustworthy and you don't need to restart the service the second it dies, you might try running the following script every five minutes or so from cron:

#!/bin/sh
ISINETS=`ps ax | grep inetd |
grep -v grep | wc -l`
  if [ $ISINETD != 1 ]; then
     /usr/sbin/inetd
  fi

—Chad Robinson, crobinson@rfgonline.com

We've said this before, but please replace telnet with OpenSSH to avoid exposing your passwords and other sensitive data to the network. Packages for the OpenSSH client and server are available for all the Linux distributions, and compatible clients are available for every common platform. SSH is as easy to use as telnet, and it automatically encrypts your connection.

—Don Marti, info@linuxjournal.com

Setting the IP Address on SuSE

I'm operating SuSE 8.0 on my IBM ThinkPad 600E and am trying to connect to our LAN server at work. How do I configure TCP/IP so it automatically recognizes the addresses?

—Layla, satchumwatch@netscape.net

Run YaST2, the SuSE setup tool, and go to the Network address setup screen. Select Automatic address setup (via DHCP) to use a DHCP server if one is available, or select Static address setup and fill in an IP address and subnet mask to set the address manually.

—Don Marti info@linuxjournal.com

LJ Archive