5. Administration


Contents of this section

5.1 How do I bring the system up in single/multi-user mode?

Select Options->Booting... in the Booter. If you want to boot single- user, check the box. To boot multi-user, uncheck the box.

5.2 Why isn't adduser implemented? or How do I add a new user?

To manually add a user, follow the steps below, or you can read the adduser(8) man page for a more complete description of the process.

  1. edit the password file with vipw:
            # vipw
    
  2. add entry for the new user, write, and quit vipw
  3. add entry for the user in /etc/groups
  4. create the home directory
  5. chown the home directory to the new userid.group
  6. set the initial password if necessary
            # passwd [username]
    

If, however, you actually have a large number of users, or you just prefer to use a script to do it, you might want to try Hubert Feyrer's (Hubert.Feyrer@rz.uni-regensburg.de) answer:

ftp://ftp.uni-regensburg.de:/pub/NetBSD-Amiga/contrib/adduser-1.2.tar.gz
or
ftp://ftp.NetBSD.org/pub/NetBSD-Amiga/contrib/adduser-1.2.tar.gz
It's written in perl and might need some customizations.

Another possible solution

ftp://ftp.quick.com.au/pub/unix/adduser.sh
was suggested by Simon J. Gerraty (sjg@zen.void.oz.au), who writes:
This works fine on NetBSD, SunOS, Solaris, HP-UX and probably others.

It will use vipw so file locking, etc. is not an issue, and will
populate the user's home dir with default files if a suitable
prototype directory is available.

You can have it prompt you for user-id full name, or give it
everything on the command line.

Keep in mind that none of these scripts are the "official" NetBSD solution and I cannot guarantee they will work in the way you would like. The adduser(8) manual page is still the "official" answer.

5.3 Once I've booted single-user, how do I bring the system up into multi-user?

Exit the single-user shell with "exit" or ctrl-D.

5.4 My filesystem is mounted read-only. How do I mount it read/write?

Use mount -u /. More than likely, you booted single-user which mounts the Root filesystem read-only by default. This gives you a chance to run fsck by hand before bringing the system up into multi-user. One other way to mount all the filesystems in /etc/fstab as read/write is to use mount -a.

However, the best way to do this is to go into multi-user mode by exiting from your single-user shell. This will mount all of the filesystems in /etc/fstab in whatever mode they are listed.

5.5 When is it safe to use fsck?

Only use fsck on an unmounted or read-only filesystem. Running fsck on a r/w filesystem is dangerous and could corrupt the filesystem. If you bring the system up into single-user mode, the system will be mounted read-only. From there you can do an

fsck -p
to check all filesystems before bringing the system up into multi-user mode. If the filesystem has previously been marked "clean," and you still want to check it, you can use the -f flag to fsck.

If you do make any changes to the filesystem using fsck, it is probably best to type:

reboot -n
to reboot the machine immediately without syncing the disks.

5.6 How do I shutdown the machine?

Use

shutdown -h now

Please note that this is one of the commands in NetBSD that seems to stop working on some machines from time to time. Occasionally it will hang before finishing the shutdown sequence. You can almost always reboot and shutdown in the Mac OS instead.

If rebooting does not work either, you might try running shutdown to go single-user, then run sync to sync the disks, and finally power off the machine manually. This should avoid filesystem damage.

5.7 How do I reboot the machine?

Use

shutdown -r now
or
reboot

Please note that this is another one of the commands that seems to stop working on some machines from time to time. The major symptom is that the machine will appear to reboot, then it will hang before actually restarting. Sometimes compiling a custom kernel with all the unnecessary devices deleted will fix the problem.

As a last resort to avoid power-cycling the machine and possible file-system damage, you can shutdown to single-user mode, run the sync command to sync the disks, and then restart the Mac via the programmer's switch or keyboard command.

5.8 How do I set the TZ environment variable to my timezone?

See the question below on setting the correct time .

5.9 How do I set the correct time (and timezone) in MacBSD?

Here is a quick summary of how to correctly set the time and timezone under MacBSD:

  1. In the Mac OS, set the time and timezone correctly:
  2. In the Booter, set the appropriate GMT bias:
  3. Under NetBSD, set the appropriate local time zone:

The timezone specification in the kernel configuration file (via options DST and options TIMEZONE) is now obsolete. The proper link from /usr/share/zoneinfo/ to /etc/localtime combined with a correctly set clock (and time zone in newer versions of the Date & Time control panel) and Map control panel and the correct GMT bias in the Booter described above should handle this just fine. Keep in mind that if your /usr directory is not on your root partition, you might want to copy the zoneinfo file to /etc/localtime instead of making a link in order ensure that the file will be present even when your /usr partition isn't mounted.

However, instead of setting the GMT bias in the Booter, you can also compile the offset in to the kernel with:

options RTC_OFFSET=###

The default timezone is probably either EST or PST, so you may initially experience some warnings like:

Warning: Battery clock earlier than filesystem date
until your filesystem has caught up with the local time.

The following people helped with this one:

5.10 What is the /kern directory used for?

It is used for mounting the kernfs filesystem. See "man mount_kernfs".

5.11 What is the /proc directory used for?

It is used for mounting the procfs filesystem. Consult The Design and Implementation of the 4.3BSD UNIX Operating System by Leffler, McKusick, et al., p. 104-5, 436. Also see "man mount_procfs".

5.12 How do I change the information that gets displayed via finger?

Use the "chfn" command. Or use vipw to edit /etc/master.passwd

5.13 What files do I need to configure in order run NetBSD?

Although NetBSD is fairly usable with almost no configuration file editing, it is useful to configure the following files:

In general, if there is some facility that you need to configure, there is probably a man page for it in section (5) of the man pages. You may find the rc.conf(5) manual page especially useful.

Thanks to Brian Gaeke (brg@dgate.org) for much of the above information.

5.14 Is there anything I can read to find out more about administering my NetBSD system?

Check out the Recommended Reading section of the Meta-FAQ.

The *BSD FAQ also contains a lot of useful information on NetBSD administration.

5.15 I'm having a little bit of trouble trying to mount a NetBSD directory with my Linux box over NFS (the other way it works very well).

Are you using an older GENERIC kernel? If so, this is your problem. The GENERIC configuration did not have the NFSSERVER option set in its config file until NetBSD 1.2E. You can either build your own kernel with this option set (see man 8 config for details on configuring your own kernel, or look at the Kernel building HOWTO ), or get a more recent -current GENERIC kernel.

5.16 Is there any reason to run in single-user mode?

Several, you might want to:

Thanks to Ken Nakata (kenn@eden.rutgers.edu) for the above answer.

5.17 I'd like to change the message in /etc/motd, but a while after I changed it, something reset it to its original contents.

You need to change the part after the header (i.e. the kernel info line). If you delete the header, then one of the tasks in /etc/rc.local will overwrite your changes on boot.

5.18 How do I go about setting up networking under NetBSD?

Please see the answer below in the Communications and Networking section.


Next Chapter | Previous Chapter

Table of contents of this chapter, General table of contents

Beginning of this Chapter


(Contact us) $NetBSD: faq-5.html,v 1.2 2007/06/09 20:18:04 dsieger Exp $
Copyright © 1994-2003 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.