DæmonNews: News and views for the BSD community

January 2000 Get BSD New to BSD? Search BSD Submit News FAQ Contact Us Join Us
Search


Get BSD Stuff

Hey! Mister Answer Man

by Todd Whitesel

Welcome to the year 2000! I'm spending January first holed up in my apartment with all my computers shut down, hoping the power stays on long enough for my alarm to wake me up in time for the Tournament of Roses parade.

"If you can read this..." :)

But enough monologue.

This month we have a veritable Santa's Bag full of questions and mailbags, plus an index of questions from previous editions of the column.

List of Topics

What's the incantation to get BSD and Windows to share my PC's clock properly?
Help me get my mouse working with X on FreeBSD.
Why does the Bourne shell not let me redirect both stdout and stderr to the same place?
How do I unify passwords and such on a heterogeneous network?
I have FreeBSD CDs and a laptop with no CD-ROM. Help.
How do I use scon to configure the text console on OpenBSD 2.5?
My home ISP gives me one address via DHCP. How can I get all my other home systems onto the net?
I need help understanding what to put in /etc/exports.
Why do people compare "X$foo" in the shell instead of just "$foo"?
Woe is me, I have a 250 meg parallel port Zip drive. Help!
Smooth user vs. guest logins for a netatalk setup.
I can't run dhclient because it says there are no bpf devices.
Help, I switched from NetBSD to FreeBSD and graphics printing stopped working.
How do I get MS-DOS parallel port code to run on NetBSD/i386?
First mailbag of the new millennium!


Q:
What's the incantation to get BSD and Windows to share my PC's clock properly?

A:
When I need to do this, I build a new kernel with the following line added to the config file:

        options RTC_OFFSET=(minutes west of GMT)
  

Why is this hard-coded into the kernel? Well, parts of the kernel can query the time before any user-editable config files are read. Other possible routes for setting the local timezone before that code executes, but without patching the kernel, would be to poke bits into the boot block, or to steal some space in the CMOS memory and store the timezone there. Of these I'd prefer the boot block method, but I don't know of anyone actually doing this to implement clock compatibility with Windows.


Q:
Help me get my mouse working with X on FreeBSD.

A:
If you are using syscons (the default console driver), you can configure FreeBSD to support a mouse pointer on each virtual screen. In order to avoid conflicting with X, syscons supports a virtual device called /dev/sysmouse. All mouse events received from the real mouse device are written to the sysmouse device, using the MouseSystems protocol. If you wish to use your mouse on one or more virtual consoles, and use X, the following configuration is recommended:

        /etc/rc.conf:
          moused_type=ps/2          # or whatever your actual type is
          moused_port=/dev/psm0     # or whatever your real port is
          moused_flags=

        /etc/XF86Config
          Section Pointer
              Protocol "MouseSystems"
              Device   "/dev/sysmouse"
              .....

Some people prefer to use /dev/mouse under X. To make this work, /dev/mouse should be linked to /dev/sysmouse:

        # cd /dev
        # rm -f mouse
        # ln -s sysmouse mouse

A big Answerman cheer goes out to Ronnie Bell (ronbell@cais.com) for sending in both the question and the answer he found on his own, less than an hour later.


Q:
Why does the Bourne shell not let me redirect both stdout and stderr to the same place?

A:
If you try it like this (with any of the Bourne family of shells):

% fargle 2>&1 >/dev/null

Then you should have swapped the redirections, like this:

% fargle >/dev/null 2>&1

The earlier syntax redirects stderr to come out on the original stdout, and stdout to go to /dev/null. While of dubious practical value, this is one of those things that Bourne shells let you do, but csh family shells do not.

The Bourne shell processes redirections left to right, and aliasing operators like >& simply arrange for a dup() to happen at the right time. So if you haven't redirected stdout before you clone it, you'll clone the old stdout instead of the redirected one. (If you go crazy with these, the shell will patiently execute them all in order, and you'll get whatever you specified, though it may not be what you wanted :) .)

Note that pipe redirection happens early, so you can do things like this:

% fargle 2>&1 | tee fargle.log
It is the equivalent of the csh redirection operator "|&".


Q.
How do I unify passwords and such on a heterogeneous network?
Specifically, I want to unify passwords and promote generally peaceful coexistence for database, samba, mail, and file services between SCO Openserver (5.0.5), BSD, and Windows (mainly Win95) machines. The network is fairly small, if that matters.

A:
This is a tough one in general, and deserving of a feature article (which I am not qualified to write :(). However, if I were suddenly faced with a huge need to do it, I'd start by checking out l0phtcrack for the Windows side, and NIS for the unix-to-unix part of it.


Q.
I have FreeBSD CDs and a laptop with no CD-ROM. Help.

Details: I have a copy of The Complete FreeBSD with 4 CDs. I want to install it on my Toshiba Satellite CS110 subnotebook. It has a floppy and Compaq 288 PCMCIA modem, but no CD-ROM. The parallel port has a 100 Meg Zip, plus I have the Toshiba networked to my desktop via a Xircom CreditCard Ethernet adapter (with a Cat5 Crossover cable). The laptop HD has 774 Megs, of which Win95 is using 175 Megs. The rest is free. Also, it has 16 Megs of RAM.

A:
For your setup, I recommend trying the FTP install first:

  1. If you haven't done this yet, skim the installation chapters of the book, and browse the FAQ, so you know where to find stuff later when you have questions.
  2. Read the chapter Shared OS Installation (chapter 5 in the 2nd edition that I have here), because you'll need to check your laptop HD partitions and probably run FIPS to make a separate partition for FreeBSD. If you need to do the stuff described in this chapter, do it before installing FreeBSD!
  3. Use your desktop machine to get familiar with the contents of the CD-ROMs. In particular the file LAYOUT.TXT on the first CD tells you where various things live on that CD.
  4. Create a boot floppy for your laptop by copying /cdrom/boot.flp to a floppy. (In the 2nd edition of the book, this is described on page 44.)
  5. Follow the instructions in the section Installing via FTP (page 45 in the 2nd edition), and most of the sections from Booting the install kernel (page 47) until the end of the chapter. With any luck, the boot floppy will recognize your laptop's ethernet card without problems.
  6. If you can't get the boot floppy to work with the laptop ethernet, move the Zip over to your desktop machine and copy the bin, dict, des, doc, games, info, manpages, proflibs, and src directories from the first CD-ROM to a Zip disk (if they don't all fit, leave out src first, followed by proflibs, games, and doc until you have enough room). Then go back to Booting the install kernel and proceed from there, but when you get to the Installation medium menu (page 65), try picking 4 (DOS partition) or 6 (existing filesystem) if you can figure out how to mount the Zip disks before running sysinstall.

I'm sorry I don't have a cookbook style answer for you, but there are lots of alternatives here, and I don't have a Xircom card or a parallel Zip 100 with which to test the cookbook directions.


Q:
How do I use scon to configure the text console on OpenBSD 2.5?

I want to get 80x50 characters and custom colors, like green-on-black.

A:
I answered the NetBSD version of this question last year, and OpenBSD's pcvt driver is probably very close to the NetBSD one, so the instructions given there should also work for you. If they do but you find small differences, let me know so I can add OpenBSD footnotes to the page.


Q.
My home ISP gives me one address via DHCP. How can I get all my other home systems onto the net?

A:
Browse through the September 1999 AnswerMan and you should find some leads, specifically the ipnat bits.


Q.
I need help understanding what to put in /etc/exports.

I am trying to install NetBSD for a diskless sparc, using i386 FreeBSD as the NFS server.

A:
The simplest use of /etc/exports is to list directory names there with no options; each directory so listed will be exported read-write to all clients and users on those clients, except for root. For security reasons, the default is to give remote root users access as if they were the user nobody. Clearly this is bad for diskless machines, so when exporting directories to diskless machines, you need to at least use -maproot=root when exporting the client's root directory on the server. Some of the other options are a good idea (especially if you care anything for network security), but aren't strictly required for a successful netboot.

For a more detailed tutorial, go see the Diskless NetBSD HOW-TO web page, and be enlightened.


Q.
Why do people compare "X$foo" in the shell instead of just "$foo"?

A:
Hmm, you must mean something like this:

[ "X$x" = XHELP -o "X$x" = XBOB ] && echo bob
The main reason for this is to bulletproof the script against bugs in older versions of the shell and test command; if you do not have the X in front, and $x expands to ! or -f or some other unary operator, it may be recognized first and will silently do something totally different than what the script's author intended.

Modern shells are much smarter about counting and analyzing the arguments, and are less likely to screw up, but it is still possible to write scripts that expose themselves to data-dependent errors, for example if you forget to use double quotes when you should:

[ $x = $y ] && echo x=y
Looks reasonable, right? Try setting x="-n" and y="". Then the test command (or shell built-in) will see:
[ -n = ] && echo x=y
Depending on the shell, you'll either get a false positive because the test has silently mutated, or an error ("test: argument expected") because somebody tried to fix the earlier bugs and did it incorrectly! (I actually got that just now, on Solaris 2.5.1 with sh. Amazing...)


Q.
Woe is me, I have a
250 meg parallel port Zip drive. Help!

What changes do I need in the basic parallel port ZIP setup to get this to work? The docs I've seen so far give a lot of details about EPP settings and other hardware stuff. Is it really that tricky? And what do the /etc/disktab entries for a 250 meg Zip look like?

A:
The main advantage of EPP is higher performance, so I would hope that it isn't required just to use the Zip 250 model. However, I must admit that I don't have any of these, nor do I know anyone who uses them. I should confess up front that I am a card-carrying SCSI bigot; I have quite a few SCSI Zip 100's and they all work great; of the two ATAPI Zip 100's I currently have, one initially turned up DOA due of the infamous "Click of Death", and had to be exchanged. All were purchased at Fry's Electronics, the legendary geek supermarket chain, which inexplicably refuses to run an official web site.

Sadly, the only thing I can really help you with is your last question. My September 1998 AnswerMan column covers this extensively for the Zip 100, so I would hope that you can adapt those examples, either by upping the cylinder counts 2.5 times, or running disklabel on a DOS-formatted cartridge and noting the geometry numbers given it by the Windows driver.


Q.
Smooth user vs. guest logins for a netatalk setup.

A reader writes in:

Greetings, a few months ago I asked how I could use netatalk to serve applications to all the Macs in my house, and allow users to log in without having to log out the guest user first. As I had things set up, guest would log in automatically at startup, and open the volume of shared applications. A user who wanted access to their home directory would then have to log out of the applications directory before logging in as himself.

A:
By upgrading to netatalk 1.4b2+asun 2.1.3 (I think 1.4b2 alone will do this, but the asun extensions are nice to have) I was able to define multiple servers. /usr/local/afpd.conf grew from a blank file into the following:

### The -noadouble is to avoid littering all directories with a .AppleDouble
### file.  Some xwindows file managers then clutter the desktop with
### this file, which is undesirable.
### Other then that, the - stands for default server, it takes default options
- -noadouble

### The following three lines are actually one long line.
### Note that the only important parts are the first word, which defines
### the volume name, and the -port, which puts the server on a different port.
### The -address is highly desirable if you are internet connected and need to
### keep people outside your network from using your commercial applications.
"Applications" -port 12001 -nouservol  -address 192.168.0.8
-defaultvol /usr/local/etc/AppleVolumes.default.applications
-systemvol /usr/local/etc/AppleVolumes.system.appliactions

I then created AppleVolumes.default.applications and AppleVolumes.system.applications, which define the volumes for this server.

Now, when the guest user logs in at startup time, it uses the second server, leaving the main server free for users to log in as themselves.


Q.
I can't run dhclient because it says there are no bpf devices.

A:
First thing to check is for /dev/bpf* and if those files don't exist, you'll need to do something like

(cd /dev && sh MAKEDEV bpf)
to create them.

If they do exist but it still claims you don't have them, then it probably means your kernel was built from a config file that did not have an uncommented line like:

        pseudo-device	bpfilter	4	#Berkeley packet filter


Q.
Help, I switched from NetBSD to FreeBSD and graphics printing stopped working.

Details: Printer is a Panasonic KX-1123 (using Epson ESC/P2 emulation). Text files do print correctly. Prior to the switch, printing worked very well, both locally and remotely using Samba.

A:
Probably something in /etc/printcap and the associated filter(s) didn't get copied over when you switched BSDs. If there is someone who might have set things up without you knowing, go find out if they did, and have them repeat it with your current system. If you still have backups of the previous installation, you can try checking those. Otherwise, I recommend the relevant section of The FreeBSD Handbook.


Q.
How do I get MS-DOS parallel port code to run on NetBSD/i386?

A:
Check out

	% man i386_iopl

and this example program. Enjoy!


Q.
First mailbag of the new millennium!

A:

  1. I use a Logitech "marble mouse", how is this different from a "wheel mouse" and how do I configure it for best use with BSD (and Linux even)?
  2. I have a BSD box with a hundred users on it. How do I increase the global maxproc settings so that everyone sees large maxproc limits when they first log in?
  3. I'm trying to make FreeSWAN on Linux talk to IPSec on OpenBSD. How do I make the key exchange and how does it work in general?
  4. I have a SB 16 PnP, and FreeBSD 4.0 installed. How do I get my microphone to work, and how can I get rid of the high pitched squeal that happens after playing certain waves?
  5. I am trying use a S3 Sonic Vibes PCI with FreeBSD 3.3, but the kernel does not seem to recognize it. What's the best way for me to get to a kernel that supports this sound card?
  6. We have a huge installation (roughly 100K users) and have been using NIS+ on Solaris to manage things. We would like to switch to BSD but haven't been able to convince ourselves that facilities like NIS+ will be available there. Heavy scalability is a requirement for us, can you point us to info about BSD's abilities in this area.
  7. Modern sound cards are annoyingly hard to configure, and no single configuration ever seems to work for everything I want to do (MP3's, WAV's, recording, etc). Does there exist a complete web resource for sound card settings?
  8. How do I use ipf (or any other method you can think of) to block portscans?
  9. I cannot get the ftp install of OpenBSD to produce a usable system. Everything looks like it installs okay, but when I try to boot the new system it keeps saying
    booting hd0a: /bsd failed(2): will try /obsd
    and eventually fails to boot. Was there something I needed to do to the partitions. I set up one big partition and one swap partition. I tried the help and man pages for the partitioning and I couldn't seem to get what it was getting at. Help?


Index of Articles (1998-1999)

September, 1998

November, 1998

January, 1999

March, 1999

May, 1999

July, 1999

September, 1999

November, 1999


Do you have questions for the BSD Answer Man? Send them to bsd-answerman@toddpw.org.
Any email sent to this address is assumed intended for publication and will become the property of Dæmonnews.
That's all for this month, folks. Until next time, remember: there's no shame in asking RTFM questions any more, because these days, there is just too much FM to R.


About the Author

Todd Whitesel has been grokking computers for fun since his first grade school Apple II in 1980, and doing it for a living since 1992, when he escaped from Caltech with a B.S. degree. He helps promote Japanese Animation in America by running Registration for Anime Expo, and helps promote NetBSD by way of his NetBSD Architecture Farm.

[home| mail]




Author maintains all copyrights on this article.
Images and layout Copyright © 1998-2004 Dæmon News. All Rights Reserved.