Cover V09, I01


Questions and Answers

Jim McKinstry

 Q How can I print two pages on one sheet and have the date, time, userid, and page number neatly printed on the top of each page? I've seen people doing it but failed to set this up on my system.

 A Enscript will do what you need. Enscript is a very robust utility that converts text files to PostScript and spools generated PostScript output to a printer or writes it to a file. Try:

enscript -2rG <file1> <file2>

This will print two pages on one sheet (-2), using landscape mode (-r), with “fancy headers” (-G). “Fancy headers” can be configured to print what you need. Check out the man page (one location is for more details.

 Q I have a Sun Ultra 10 running Solaris 2.7, and I want to know if there is a way to kill X and go into a shell. I know in Linux you can use “ctrl + alt + f1” to do so, but is there a similar way in Solaris?

 A At the GUI login screen, you should see an “Options” button. Click on that and then on “Command Line Login”. This will stop the GUI and allow you to log into a shell directly. When you log out, the GUI will restart.

 Q I am new to UNIX, and I would like to know how to log in to my server using Windows 95/98. I just installed FreeBSD 2.2.8. I am not sure how to log into it from Windows.

 A Assuming that both boxes are on a network and configured correctly, the easiest way is to click on “Start” “Run...” then type telnet. Click on “Connect”, then “Remote System” and type in the information. This will run the Microsoft Telnet client and connect you to the BSD box. I recommend that you download a copy of NetTerm. It's “free” and reliable. If you want to have more security on the network, look into installing SSH (Secure Shell) on the UNIX and Microsoft machines.

 Q I have vxfs file system running. I used the following commands to backup:

vxdump -0  /dev/rmt/0n   /backup
vxdump -0  /dev/rmt/0n   /dumps

When I tried to restore it, it says this is not a valid vxdump, even though the vxdump logs says it was done successfully. Any help will be appreciated.

 A It looks like you left the -f flag out to use /dev/rmt/0n. Try this:

vxdump -0f /dev/rmt/0n /backup 
vxdump -0f /dev/rmt/0n /dumps

The -f flag defines which tape device vxdump should use. If you leave the -f flag off, it will try to dump to the default tape device /dev/rmt/0m. You may also want to confirm that the /dev/rmt/0n is a real device. If it isn't, and you use vxdump -0f /dev/rmt/0n /backup you will find that you dumped /backup to a file called /dev/rmt/0n, not the tape device.

 Q We are running a Sun Ultra 6000 with Solaris 2.6. The system randomly reboots, with no messages and no core dumps. Also, there are no error messages during POST. We have been in contact with Sun. They have received many calls, but have no solution right now. Any ideas?

 A By default, Solaris does not save dumps. You need to turn this on. To save core dumps, do the follwoing:

Edit /etc/init.d/sysetup

and uncomment the following lines at the end of the file:

#if [ ! -d /var/crash/'uname -n' ]
 #then mkdir -m 0700 -p /var/crash/'uname -n'
 #                           echo 'checking for crash dump...\c '
 #savecore /var/crash/'uname -n' # echo ''

Have Sun check for any patch that may address random reboots. I once had a SunOS4.1.3 system that would crash when the workload got too heavy. Sun supplied a patch and the problem went away. You may also want to call SUN and have them start swapping out hardware. I've seen random reboots caused by bad memory, bad motherboards, etc.

 Q I want to write daily pax archives to files that would have the date embedded in the filename. The filenames would be something like Is there a way to do this in Tru64UNIX 4.0?

 A Add your pax command to cron to run daily and redirect the output to a file with the date in the name. For example:

00 23 * * * pax_command > /log/home.'/usr/bin/date +\%y\%m\%d'.pax

This will run your pax_command every night at 11:00p.m. and send the output to /log/home. 991012.pax (if it was run on October 12, 1999). Don't forget the “\” in front of the “%” in the date command!

 Q I want to configure a Solaris 2.6 UNIX server for a new IP, subnet mask, and gateway setting. How can I do that?

 A One way to do this is to use sys-unconfig. This command (from man) “restores a system's configuration to an “as-manufactured” state. A system's configuration consists of hostname, Network Information Service (NIS) domain name, timezone, IP address, IP subnet mask, and root password.” sys-unconfig does the following:

• Saves current /etc/inet/hosts file information in /etc/inet/hosts.saved.

• Restores the default /etc/inet/hosts file.

• Removes the default hostname in /etc/hostname.??[0-9] and /etc/nodename.

• Removes the default domainname in /etc/defaultdomain.

• Restores the timezone to PST8PDT in /etc/TIMEZONE.

• Disables the Network Information Service (NIS) and Network Information Service Plus (NIS+) if either NIS or NIS+ was configured.

• Removes the entries for this host in /etc/net/*/hosts.

• Removes the password set for root in /etc/shadow.

• Removes the file /etc/.rootkey.

• Executes all system configuration applications. These applications are defined by prior executions of a sysidconfig -a application. (See sysidconfig(1M)). When sys-unconfig is run, all system configuration applications are passed one argument, -u.

When sys-unconfig is finished, it performs a system shutdown. When the system reboots, you will be prompted for all of the information that you were prompted for when you first installed the OS. Also note that if you had a lot of hosts defined in etc/inet/hosts, you can get them from /etc/inet/hosts.saved.

If you have the time, patience, and really want to learn more about the system, do this by hand (i.e., edit each file with vi and make the changes).

 Q I am trying to use NFS to remotely mount a CD-ROM from a Solaris system, which has a CD-ROM to a SunOS system. This is what I did and it does not work:

On the Solaris server system:

share -F nfs rw=servername /cdrom <enter>

I checked the /etc/dfs/sharetab file and the entry for /cdrom was present. On the SunOS client system:

mkdir /mountpoint <enter>
mount servername:/cdrom /mountpoint <enter>

I checked the /etc/mtab file and saw the entry for servername:/cdrom and the mount point /mountpoint.

cd /mountpoint <enter>

I did not see the CD-ROM files in the /mountpoint directory. I did see an empty directory called /cdrom/cdrom0.

Did I make the mistake of not starting the nfsd and the mountd deamons on the server and client, respectively? Or you could not mount devices like CD-ROM or tapes? I know that I can't use NFS to mount a tape, but I know one person who has NFS and mounted a CD-ROM in his network.

 A The only problem I see is that you are trying to mount the CD-ROM as a read/write filesystem. Try this:

share -F nfs -o ro=servername /cdrom/cdrom0

You also need to verify that the NFS server is running on the system that the CD-ROM is on:

ps -ef | grep nfs

This should return something like:

root   541     1  0 16:55:25 ?        0:00 /usr/lib/nfs/lockd
root   539     1  0 16:55:25 ?        0:00 /usr/lib/nfs/statd
root   966     1  0 16:56:14 ?        0:00 /usr/lib/nfs/nfsd -a 16
root   964     1  0 16:56:14 ?        0:00 /usr/lib/nfs/mountd

If nfsd and mountd are not there, try running /etc/rc3.d/S15nfs.server start. Since you said that there is an NFS entry for CD-ROM in /etc/dfs/sharetab, nfsd and mountd should start. Once the NFS server is started, try your mount command on the client again. Check that /CD-ROM is mounted by running the df command.

 Q What backup and recovery tool allows you to recover from a bootable tape from a network?

 A The only tool that I know of is Hewlett Packard's Ignite-UX. Ignite-UX has a feature called make_net_recovery. Check out for all the details. Ignite is a great tool.

 Q I am trying to set up a Windows 95 machine to access the Internet through my Linux box. I currently have my NIC and modem working correctly but cannot get the Win 95 machine to use the modem on my Linux box. Any suggestions?

 A Assuming that your Windows and Linux boxes are networked, and the Windows box can talk to the Linux box, then what you need to do is:

1. Dial-in to ISP from Linux.

2. Have the Windows box use the Linux box as its router to the Internet. For a step-by-step guide, check out:

(Thanks to Amy Rich for this link!)

You will have to run some sort of NAT (Network Address Translation) software on the Linux box. Check out:

for a lot of different options. For a better understanding of NAT, check out: 

About the Author

Jim is a Technical Analyst specializing in UNIX. He has worked for IBM, Rite Aid, EDS, and is currently working for Sprint Paranet. He can be reached at: