BSD daemon

NetBSD 문서:

기타 FAQ 및 HOWTO

사용자 환경 설정

인쇄와 스캔

Using removable media

General questions about NetBSD

Common (and less common) problems

Other questions

기타 링크


사용자 환경 설정


사용자 추가 (맨 위)

adduser(8) 맨페이지에 있는 절차에 따라 수동으로 하거나 NetBSD 패키지 컬렉션에 있는 user 패키지를 사용할 수 있습니다. user 관리 도구 모음은 NetBSD 1.4.2 이후로 기본 시스템에 통합되어 있습니다.

root로 로그인하거나 'su'하는 문제 (맨 위)

여기서는 다음과 같은 몇 가지 발생 가능한 문제를 다룹니다:

경로에 디렉터리 추가 (맨 위)

예를 들어 /usr/X11R6/bin을 경로에 추가하려면 홈 디렉터리에 있는 .login 파일을 편집하여 다음을 추가합니다:
set path = ( /usr/X11R6/bin $path )

이것은 C-셸 csh(1)과 그 파생 프로그램인 tcsh에만 해당됩니다. sh(1)와 파생 프로그램(bash2 같은)의 경우 올바른 문장은 다음과 같습니다:

PATH=/usr/X11R6/bin:$PATH
export PATH

모든 사용자에게 적용되는 항목 설정 (맨 위)

csh(1) 또는 tcsh 를 사용하는 모든 사용자에게 적용되는 항목을 설정하려면 다음중 한가지 파일에 추가하면 됩니다:

셸에서의 커서키 편집과 파일이름 완성 (맨 위)

이 방법은 사용중인 셸의 종류에 따라 다릅니다:

메시지 출력용 언어 지정 (맨 위)

NetBSD는 에러 메시지 및 기타 메시지에 사용할 언어를 결정하기 위해 'LANG' 환경 변수를 사용합니다. 이 변수는 csh이나 tcsh로는 'setenv LANG XX' 명령으로 설정할 수 있고, 여기서 XX 대신 두글자 국가 코드를 넣어주면 됩니다. 지원되는 코드 명단은 'ls /usr/share/nls' 명령으로 볼 수 있습니다.

주의사항: 아직 일부 메시지만 번역이 되어 있는 상태입니다. 시험하려면 LANG 변수를 설정하고 'cd /존재하지않는디렉터리' 명령을 내려보기 바랍니다.

finger를 통해 출력되는 정보를 변경하려면? (맨 위)

'chfn(1)' 명령을 이용하세요. /etc/master.passwd 파일을 편집하려면 'vipw(8)' 명령을 이용하면 됩니다.

인쇄와 스캔


맨페이지를 포스트스크립트로 인쇄하는 법 (맨 위)

Manpages are held in nroff(1) source in /usr/share/man/manX/manpage.X, where X is the section number (eg: 1 in the case of nroff). To convert them into PostScript one can use:
	groff -Tps -mandoc /usr/share/man/manX/manpage.X
For example to convert the ls(1) manpage into PostScript and send it directly to the default printer via lpr(1) you can use.
	groff -Tps -mandoc /usr/share/man/man1/ls.1 |lpr
If you wish to print on a different type of printer you may want to use the ghostscript package from pkgsrc.

Printing to a remote SMB printer from NetBSD (맨 위)

Configuring a HP JetDirect Card via BOOTP (맨 위)

If you have a JetDirect print server such as the JetDirect EX Plus, you can use BOOTP under NetBSD to configure the print server. The steps are: Create an entry in /etc/bootptab for the JetDirect server:
hp690c:\ 
        :hn:\ 
        :ht=ether:\ 
        :ip=192.168.0.10:\            <-- set to the desired IP of the JetDirect
        :ha=00.60.b0.1d.04.d5:\       <-- Set to the MAC address of the JetDirect
        :sm=255.255.255.0:\           <-- set to the desired netmask of the JetDirect
        :sa=192.168.0.5:\             <-- set to the tftp server address (same machine
                                          thats running TFTPD)
        :gw=192.168.0.1:\             <-- set to your gateway address
        :lg=192.168.0.5:\             <-- set to the log server address
        :T144="hpnp/hp690c.cfg":\     <-- name of the JetDirect config file
        :vm=rfc1048:
See bootptab(5) for more information on this file. Make sure that tftpd and bootp are enabled in /etc/inetd.conf. Note the argument to "-s" on the tftp line of /etc/inetd.conf. This is the tftpd(8) root directory. For the rest of this example it is assumed that the tftpd(8) root directory is set to /tftpboot. Next create a Network Printer Inferface (NPI) configuration file. In this example, the file is /tftpboot/hpnp/hp690c.cfg. This file should look something like:
name: printer name
location: Location of the Printer 
contact: Contact Person 
idle-timeout: 1800
banner: 0
If you made changed to /etc/inetd.conf, make sure inetd(8) re-reads inetd.conf(5) by doing kill -HUP `cat /var/run/inetd.pid`. When you reboot the JetDirect print server (or printer with HP JetDirect card), the server should get configured by BOOTP. On some printers, you may have to explicitly enable BOOTP configuration from the front panel.

Scanning under NetBSD (맨 위)

NetBSD supports various different SCSI scanners using the sane-backends scanning package. Frontends for accessing the API provided by that package are in the sane-frontends package, or it can be called directly by graphics tools such as the GIMP.

Note: in versions of NetBSD before 1.4.2 the in kernel ss(4) scanner driver may cause problems with sane-backends and some scanners - the solution is either to recompile a kernel without ss(4) and use the uk(4) device, or to upgrade to 1.4.2 or later.


Using removable media


Initializing and using floppy disks (맨 위)

PC-style floppy disks work mostly like other disk devices like hard disks, except that you need to low-level format them first.

To use an common 1440 KB floppy in the first floppy drive, first (as root) format it:

fdformat -f /dev/rfd0a
Then create a single partition on the disk using disklabel(8):
disklabel -rw /dev/rfd0a floppy3
Creating a small filesystem optimized for space:
newfs -m 0 -o space -i 16384 -c 80 /dev/rfd0a
Now the floppy disk can be mounted like any other disk.
Or if you already have a floppy disk with an MS-DOS filesystem on it that you just want to access from NetBSD, you can just do something like this:
mount -t msdos /dev/fd0a /mnt

However, rather than using floppies like normal (bigger) disks, it is often more convenient to bypass the filesystem altogether and just splat an archive of files directly to the raw device. E.g.:

tar cvfz /dev/rfd0a file1 file2 ...
A variation of this can also be done with MS-DOS floppies using the mtools package which has the benefit of not going through the kernel buffer cache and thus not being exposed to the danger of the floppy being removed while a filesystem is mounted on it.

How to use a ZIP disk (맨 위)

  1. See if your system has a ZIP drive:
    yui# dmesg | grep -i zip
    sd0 at atapibus0 drive 1: <IOMEGA  ZIP 100       ATAPI, , 14.A> type 0 direct removable
    
    Seems it has one, and it's recognized as sd0, just like any SCSI disk. The fact that the ZIP here is an ATAPI one doesn't matter - a SCSI ZIP will show up here, too. The ZIP is marked as "removable", which means you can eject it with "eject sd0".

  2. Insert ZIP disk

  3. Check out what partitions are on the ZIP:
    yui# disklabel sd0
    # /dev/rsd0d:
    type: ATAPI
     ...
    8 partitions:
    #        size   offset     fstype   [fsize bsize   cpg]
      d:   196608        0     unused        0     0         # (Cyl.    0 - 95)
      h:   196576       32      MSDOS                        # (Cyl.    0*- 95)
    disklabel: boot block size 0
    disklabel: super block size 0
    
    "d"
    is the whole disk, as usual on i386.
    "h"
    is what you want, and you can see it's a msdos filesystem even.
    Hence, use /dev/sd0h to access the zip's partition.

  4. Mount it:
    yui# mount -t msdos /dev/sd0h /mnt
    yui# 
    

  5. Access your files:
    yui# ls -la /mnt
    total 40809
    drwxr-xr-x   1 root  wheel     16384 Dec 31  1979 .
    drwxr-xr-x  28 root  wheel      1024 Aug  2 22:06 ..
    -rwxr-xr-x   1 root  wheel   1474560 Feb 23  1999 boot1.fs
    -rwxr-xr-x   1 root  wheel   1474560 Feb 23  1999 boot2.fs
    -rwxr-xr-x   1 root  wheel    548864 Feb 23  1999 boot3.fs
    -rwxr-xr-x   1 root  wheel  38271173 Feb 23  1999 netbsd19990223.tar.gz
    

  6. Unmount the ZIP:
    yui# umount /mnt
    yui#
    

  7. Eject the ZIP:
    yui# eject sd0
    yui#
    

Reading data CDs with NetBSD (맨 위)

Data CDs can contain anything from programs, sound files (mp3, wav), movies (mp3, quicktime) to source code, text files, etc. Before accessing these files, a CD must be mounted on a directory, much like harddisks are. Just as harddisks can use different filesystems (ffs, lfs, ext2fs, ...), there is a own filesystem for CDs, "cd9660". The NetBSD cd9660 filesystem can handle filesystems without and with Rockridge and Joliet extensions.

CD devices are named /dev/cd0a for both SCSI and IDE (ATAPI).

With this information, we can start:

  1. See if your system has some CD drive:
         # dmesg | grep ^cd
         cd0 at atapibus0 drive 0: <CD-R/RW RW8040A, , 1.12> type 5 cdrom removable
         cd0: 32-bit data port
         cd0: drive supports PIO mode 4, DMA mode 0
         cd0(pciide0:1:0): using PIO mode 0, DMA mode 0 (using DMA data transfers)
         
    We have one drive here, "cd0". It's an IDE/ATAPI drive, as it's found on atapibus0. Of course the drive (or better, it's medium) is removable, i.e. you can eject it, see below.

  2. Insert a CD

  3. Mount the CD manually:
         # mount -t cd9660 /dev/cd0a /mnt
         # 
         
    This command shouldn't print anything. It instructs the system to mount the CD found on /dev/cd0a on /mnt, using the "cd9660" filesystem. The mountpoint "/mnt" must be an existing directory.

  4. Check the contents of the CD:
         # ls /mnt
         INSTALL.html INSTALL.ps   TRANS.TBL    boot.catalog
         INSTALL.more INSTALL.txt  binary       installation
         # 
         
    Everything looks fine! This is a NetBSD CD, of course. :)

  5. Unmount the CD:
         # umount /mnt
         # 
         
    If the CD is still accessed (e.g. some other shell's still "cd"'d into it), this will not work. If you shut down the system, the CD will be unmounted automatically for you, there's nothing to worry about there.

  6. Making an entry in /etc/fstab:

    If you don't want to type the full "mount" command each time, you can put most of the values into a line in /etc/fstab:

         # Device        mountpoint      filesystem  mount options 
         /dev/cd0a       /cdrom          cd9660      rw,noauto    
         
    Make sure that the moutpoint - "/cdrom" in our example exists:

         # mkdir /cdrom
         # 
         
    Now you can mount the cd with the following command:
         # mount /cdrom
         #
         
    Access and unmount as before.

    The CD is not mounted at boot time due to the "noauto" mount option - this is useful as you'll probably not have a CD in the drive all the time. See mount(8) and mount_cd9660(8) for some other useful options.

  7. Eject the CD:
         # eject cd0
         # 
         
    If the CD is still mounted, it will be unmounted if possible, before being ejected.

Allowing normal users to access CDs (맨 위)

NetBSD only allows "root" to mount a filesystem. If you want any user to be able to do this, you have the following options:

Note: The user must own the mount point! So, for example:

        cd
        mkdir cdrom

Please also see mount(8) and, as an alternative, amd(8).

Using video CDs with NetBSD (맨 위)

To play MPEG Video streams as many DVD players can play them under NetBSD, mount the CD as you would do with any normal (data) CD (see above), then use the mtv package to play the mpeg files stored on the CD.

Using audio CDs with NetBSD (맨 위)

There are two ways to handle audio CDs:

  1. Tell the CD drive to play to the headphone or to a soundcard, to which CDROMs are usually connected internally. Use programs like xmcd, "kscd" from the kdemultimedia package, mixer programs like xmix, xmmix, the Curses based cam, or kmix, which is part of kdemultimedia.

    This usually works well on both SCSI and IDE (ATAPI) CDROMs, CDRW and DVD drives.

  2. To read ("rip") audio tracks in binary form without going through digital->analog conversion and back. There are several programs available to do this:

    • For ATAPI or SCSI CD-ROMs the cdd package can be used. To extract track 2 with cdd, type:

       # cdd -t 2 `pwd`

      This will put a file called track-02.cda in the current directory.

    • For SCSI CD-ROMS the tosha package can be used. To extract track 2 with tosha, you should be able to type:

       # tosha -d CD-ROM-device -t 2 -o track-02.cda

    • For most ATAPI, SCSI and several proprietary CDROM drives, the cdparanoia package can be used. With cdparanoia the data can be saved to a file or directed to standard output in WAV, AIFF, AIFF-C or raw format. Currently the -g option is required by the NetBSD version of cdparanoia. A hypothetical example of how to save track 2 as a WAV file is as follows:

       $ cdparanoia -g /dev/rcd0d 2 track-02.wav

      If you want to grab all files from a CD, cdparanoia's batch mode is useful:

       $ cdparanoia -g /dev/rcd0d -B
    The data can then be post-processed e.g. by encoding it into MP3 streams or by writing them to CD-Rs.

Using a CD-R writer with data CDs (맨 위)

The process of writing a CD consists of two steps: First, a "image" of the data must be generated, which can then be written to CD-R in a second step.

  1. Reading an pre-existing ISO image
         # dd if=/dev/rcd0a of=filename.iso bs=2k
         #
         
    Alternatively, you can create a new ISO image yourself:
  2. Generating the ISO image

    Put all the data you want to put on CD into one directory. Next you need to generate a disk-like ISO image of your data. The image stores the data in the same form as they're later put on CD, using the ISO 9660 format. The basic ISO9660 format only understands 8+3 filenames (max. eight letters for filename, plus three more for an extension). As this is not practical for Unix filenames, a so-called "Rockridge Extension" needs to be employed to get longer filenames. (A different set of such extension exists in the Microsoft world, to get their long filenames right; that's what's known as Joliet filesystem).

    The ISO image is created using the mkisofs command, which is part of the cdrecord package.

    Example: if you have your data in /usr/tmp/data, you can generate a ISO image file in /usr/tmp/data.iso with the following command:

         $ cd /usr/tmp
         $ mkisofs -o data.iso -r data
         Using NETBS000.GZ;1 for  data/binary/kernel/netbsd.INSTALL.gz (netbsd.INSTALL_TINY.gz)
         Using NETBS001.GZ;1 for  data/binary/kernel/netbsd.GENERIC.gz (netbsd.GENERIC_TINY.gz)
           5.92% done, estimate finish Wed Sep 13 21:28:11 2000
          11.83% done, estimate finish Wed Sep 13 21:28:03 2000
          17.74% done, estimate finish Wed Sep 13 21:28:00 2000
          23.64% done, estimate finish Wed Sep 13 21:28:03 2000
          ...
          88.64% done, estimate finish Wed Sep 13 21:27:55 2000
          94.53% done, estimate finish Wed Sep 13 21:27:55 2000
         Total translation table size: 0
         Total rockridge attributes bytes: 5395
         Total directory bytes: 16384
         Path table size(bytes): 110
         Max brk space used 153c4
         84625 extents written (165 Mb)
         $
         
    Please see the mkisofs(8) manpage for other options like noting publisher and preparer. The Bootable CD ROM How-To explains how to generate a bootable CD.

  3. Writing the ISO image to CD-R

    When you have the ISO image file, you just need to write it on a CD. This is done with the "cdrecord" command from the cdrecord package. Insert a blank CD-R, and off we go:

         # cdrecord -v dev=/dev/rcd0d data.iso
         ...
         #
         
    After starting the command, 'cdrecord' shows you a lot of information about your drive, the disk and the image you're about to write. It then does a 10 seconds countdown, which is your last chance to stop things - type ^C if you want to abort. If you don't abort, the process will write the whole image to the CD and return with a shell prompt.

    Note that cdrecord(8) works on both SCSI and IDE (ATAPI) drives.

  4. Test

    Mount the just-written CD and test it as you would do with any "normal" CD, see above.

Using a CD-R writer to create audio CDs (맨 위)

If you want to make a backup copy of one of your audio CDs, you can do so by extracting ("ripping") the audio tracks from the CD, and then writing them back to a blank CD. Of course this works fine if you extract single tracks from various CDs, creating your very own mix CD!

The steps involved are:

  1. Extract the audio tracks as described as in the Using audio CDs with NetBSD section, to get a couple of .wav files.

  2. Write the .wav files using cdrecord:

     # cdrecord -v dev=/dev/rcd0d -audio -pad *.wav 

Creating an audio CD from mp3s (맨 위)

If you have converted all your audio CDs to mp3 and now want to make a mixed CD for your (e.g.) your car, you can do so by first converting the .mp3 files back to .wav format, then write them as a normal audio CD.

The steps involved here are:

  1. Create .wav files from your .mp3 files:
     $ mpg123 -w foo.wav foo.mp3 
    Do this for all of the mp3 files that you want to have on your audio CD. The .wav filenames you use don't matter.

  2. Write the .wav files to CD as described under ``Using a CD-R writer with audio CDs''.

Copying a (data) CD with two drives (맨 위)

If you have both a CD-R and a CD-ROM drive in your machine, you can copy a data CD with the following command:
# cdrecord dev=/dev/rcd1d /dev/rcd0d
Here the CD-ROM (cd0) contains the CD you want to copy, and the CD-R (cd1) contains the blank disk. Note that this only works with computer disks that contain some sort of data, it does not work with audio CDs! In practice you'll also want to add something like "speed=8" to make things a bit faster.

Using CD-RW rewritables (맨 위)

You can treat a CD-RW drive like a CD-R drive in NetBSD, creating images with mkisofs(8) and writing them on a CD-RW medium with cdrecord(8).

If you want to blank a CD-RW, you can do this with cdrecord's "blank" option:

# cdrecord dev=/dev/rcd0d blank=fast
There are several other ways to blank the CD-RW, call cdrecord(8) with "blank=help" for a list. See the cdrecord(8) manpage for more information.

DVD support (맨 위)

Currently, NetBSD supports DVD media through the ISO 9660 also used for CD-ROMs. The new UDF filesystem also present on DVDs is not supported, but almost all DVDs contain ISO 9660 filesystems as well.

DVDs, DivX and many avi files be played with ogle or gmplayer.


General questions about NetBSD


What changed between NetBSD releases? (맨 위)

A relatively up-to-date list of all changes (including those in -current) is available.

There is also a CHANGES file in the top level directory of each release.

Is NetBSD a 64 bit operating system? (맨 위)

NetBSD runs on both 32 bit and 64 bit CPUs. On the alpha CPU the kernel and userland run in a mode known as LP64, where ints are 32 bit, and longs and pointers (and the address space) are 64 bit. The sparc64 port runs in both 32-bit and 64-bit configurations. A 64 bit kernel (LP64) supports 32-bit applications in 64-bit mode. A 32 bit kernel, which uses 32 bits for all of integers, pointers and long integers (IPL32) can not run 64 bit programs.

On other 64 bit capable CPUs, such as R4000 and newer MIPS (used by a number of ports) NetBSD runs in 32 bit mode though is in the process of being modified to 64 bit.

All NetBSD ports support 64 bit arithmetic, both in the kernel and in userland programs. In the kernel this is used for various counters and for FFS, which is the 64 bit 'Fast File System'.

Is NetBSD exportable? (맨 위)

Up to (and including) NetBSD 1.4.x, everything except the security distribution (i.e. secr.tgz) was exportable. The secr.tgz distribution file contained the libraries for crypt. Starting with NetBSD 1.5, crypto code is included in the NetBSD base distribution. Please refer to the NetBSD document on exporting restricted code or binaries.

For what is NetBSD used? (맨 위)

In the words of Chris G. Demetriou (cgd@NetBSD.org):
NetBSD, in general, is meant as a "stable research platform" -- that is,
a system that can be used for commercial, home, and research work...  what
_you_ do with it is up to you.  In general, those of us working on NetBSD
are trying to improve the system in whatever way we can -- support for more
hardware, stability, performance, documentation...
See our features page for an idea of what opportunities NetBSD provides you with!

Common (and less common) problems


/usr/bin/nroff: not found when running 'man' (맨 위)

You need to install the 'text' set. See your base install notes.

'Unable to lock mailbox: Permission denied' when reading mail (맨 위)

Check the permissions on the /var/mail directory. They should be 'drwxrwxrwt':
% ls -ld /var/mail
drwxrwxrwt  2 root  wheel  512 Nov  6 08:21 /var/mail
If they are not, as root run 'chmod 1777 /var/mail'.

netstat: kvm_read kvm_read: Bad address when running 'netstat -r' (맨 위)

This is nothing to worry about. Basically, the file /netbsd is not your current kernel. A number of programs (such as ps, who, systat etc.) and libkvm (kvm(3)), access /netbsd to learn what's going on in the kernel. So you can simply rename your current kernel to /netbsd to make this kind of error go away. Make sure that you are not overwriting a working kernel when you do this, though, unless that is exactly what you intend to do.

When I try 'netstat -r' I get an endless stream of question marks. What's wrong? (맨 위)

That's a mis-match between libkvm/netstat and /netbsd. Or it's that you're running a kernel that's not named /netbsd. Other symptoms of this problem are likely to be that who, ps, ifconfig, and systat will not work either. If you update your binaries and your kernel at the same time, then you should be OK.

w, ps, and netstat do not work after upgrading to a new kernel (맨 위)

One of two things. Either your currently booted kernel isn't named /netbsd or else you have a mismatch between your kernel and the binaries you are using. In the first case, simply making a link from your currently booted kernel to /netbsd will solve the problem.

In the second case, dynamically linked binaries can usually be fixed by upgrading libkvm to match your new kernel. Statically linked binaries need to be replaced with more recent versions. Since they are statically linked, if you are going to recompile them yourself, you need to rebuild libkvm.a before you rebuild the program in question.

Thanks to John Wittkowski (jpw@netscape.com), here is a list of most of the programs (besides /bin/ps) that depend on libkvm (all of these are in /usr/bin):

After changing kernels, 'ps' reports "proc size mismatch" (맨 위)

Like the previous three questions on this subject, the answer is most likely that your libkvm is out of sync with your kernel or binaries. To solve this problem, you can either get a binary distribution which matches your kernel, or you can build you own by following the instructions below:
If you get the "proc size mismatch" error and you determine
that you need to update your libs, here's what to do:

1. Get all the source code. If you're not willing to do this
   and recompile things than you'll have to find someone who
   will do it for you and you can try installing everything
   by hand.

2. Make sure that your include files are up to date. Do 
   this by:
      cd /usr/src
      make includes
   This will take a while. I had some trouble with this
   because some of the Makefiles didn't have the INSTALL
   variable defined. Whenever the "make includes" failed,
   I went to the last directory listed and added the
   following line to the Makefile:
      INSTALL=/usr/bin/install
   I had to do this several times before the make finished
   without any errors.

   (If you make sure that /usr/bin/make and all the files in
   /usr/share/mk are up to date first, the above difficulties
   can probably be avoided)

3. Rebuild the libkvm and install it:
      cd /usr/src/lib/libkvm
      make
      make install
   Note that in order to get the libkvm to compile on
   my system I had to add the following link:
      cd /usr/include/machine
      ln -s ../m68k/kcore.h kcore.h
   This may have been a quirk of my system so try 
   compiling without it first.

4. Then rebuild the binaries that are STATICALLY linked to
   libkvm. The only statically linked program that I am 
   aware of is "/bin/ps". To rebuild ps, simply:
      cd /usr/src/bin/ps
      make
      make install

5. You may or may not need to rebuild the binaries that
   are dynamically linked to libkvm. This is because (I
   think) if the major version number of the lib changes
   then the old binaries will expect the old version
   number and not work with the newer version of the lib.
   For example, my old libkvm was libkvm.so.4.0. The new
   one was libkvm.so.5.0. Without recompiling the 
   dynamically linked binaries, it would still complain
   about "proc size mismatch" (if the 4.0 lib was still
   there) or some lib missing error (if the 4.0 lib
   had been removed from /usr/lib). If the version minor
   number changes (4.0 to 4.1, for example), I think it
   will run with a warning and so you may not need to
   recompile all of these things.

   The dynamically linked binaries that I am aware of
   will give the  "proc size mismatch" error (if the 4.0
   lib was still there) or some lib missing error (if the
   4.0 lib had been removed from /usr/lib). If the version
   minor number changes (4.0 to 4.1, for example), I think
   it will run with a warning, and you may not need to
   recompile all of these things.

   The dynamically linked binaries that I am aware of
   are:
      /usr/bin/fstat
      /usr/bin/gdb
      /usr/bin/ipcs
      /usr/bin/netstat
      /usr/bin/nfsstat
      /usr/bin/systat
      /usr/bin/uptime (linked to /usr/bin/w)
      /usr/bin/vmstat
      /usr/bin/w
   Note that /usr/bin/uptime is a link to /usr/bin/w and
   will be set up properly when you do the "make install"
   for w.

   To recompile these, do the following:
      cd /usr/src/usr.bin/<cmd>
      make 
      make install
   For example, to recompile /usr/bin/vmstat:
      cd /usr/src/usr.bin/vmstat
      make
      make install
Much thanks to John Wittkowski (jpw@netscape.com) for providing such a detailed answer for this one.

A little background: the reason that these system utilities need to grovel through kernel memory to get information, including going through all the trouble mentioned above, is that this method also works on kernel crash dumps, which can be quite a useful feature when debugging kernels.

'hash map "Alias0":unsafe map file /etc/aliases: No such file or directory' is displayed (맨 위)

You can fix this by typing 'newaliases' as root.
Sendmail reports this when the aliases(5) file is not present. Note that sendmail(8) actually uses /etc/aliases.db (which is a fast lookup hash(3) map built from /etc/aliases), so the error message can be a little misleading. This should only really be noticed in NetBSD 1.3 to 1.4, other versions have a different /etc/sendmail.cf which instructs sendmail to automatically rebuild /etc/aliases.db as needed. If you are not running at least NetBSD 1.4.1 you should probably upgrade to a newer formal release.

How do I prevent portmap messages from showing up in shells, when logged in as root (맨 위)

Use sudo and never log in as root.

If you must log in as root, then you can edit your /etc/syslog.conf file and remove the necessary facilities to prevent the annoying messages. In most cases, it's sufficient to disable auth.debug in the line reading:

*.notice;auth.debug                                     root
This will eliminate those annoying portmap [pid]: connect from some.other.host ... messages. Be sure to kill -HUP the pid of your syslogd process.

You may also wish to look at the FAQ entry for using an xconsole.

How do I get umlauts displayed: (맨 위)

Here's a tip from the mail archives:
  1. Grab locale.tgz
  2. Unpack it in /: tar plzvxCf / locale.tgz
  3. In your shell, set LC_ALL=iso_8859_1 (make it permanent in .cshrc, .profile, ...)
  4. Restart your shell or re-login
  5. See your shell, vi, etc. accept all these umlauts from your keyboard: 唾闊鷺...

Other questions


Editing files under NetBSD (맨 위)

There are two obvious options in the base system:

There are a large number of editors available under the editors category in pkgsrc, including:

Adding a disk to an existing system (맨 위)

  1. Halt the system
  2. Connect the new drive
  3. If your machine has a PROM or BIOS that can list drives, check that the drive is recognised:
    • recent sparc: Press [STOP][A] before the boot starts, then at the "ok" prompt, probe-scsi.
    • i386 with adaptec BIOS: Press [CTRL][A] before the boot starts to enter the BIOS.
    • other: more details welcomed :)
  4. boot
  5. Check dmesg(8) output to confirm that the drive is recognized
  6. Write a disklabel(8) including the partitions using disklabel
    (if the disk doesn't have a disklabel yet, you'll probably do something like:
    disklabel -i -I sd1 # ignore any "sd1: no disk label"
    Partition 'c' is reserved for the entire NetBSD portion of a disk, and on some ports (notably i386), 'd' is similarly reserved for the entire disk. The following is a sample session setting the entire disk to be one filesystem 'e':
    	partition> e
    	Filesystem type [?] [unused]: 4.2BSD
    	Start offset [0c, 0s, 0M]: 
    	Partition size ('$' for all remaining) [0c, 0s, 0M]: $
     	e: 234375000         0     4.2BSD      0     0     0   # (Cyl.    0 - 232514*)
    	partition> W
    	Label disk [n]? y
    	partition> Q
    
    Inside disklabel -i you can use '?' for additional help.
  7. For each filesystem added, newfs <filesystem> (where <filesystem> is the partition's raw device, like /dev/rsd1e, /dev/rwd1f, ...)
  8. Put the filesystems into /etc/fstab
  9. fsck(8) them: fsck -p <filesystem>
  10. mount(8) them: mount -va

How to use soft updates (softdeps)? (맨 위)

Frank van der Linden (frank@wins.uva.nl) has brought Kirk McKusick's trickle sync + FFS soft update code into the main tree. As soft updates are still considered experimental, and due to the copyright on it, it needs to be enabled separately.

To use it, do the following:

  1. Update your sources to NetBSD-current as of Nov 15th 1999 or later. Not needed on NetBSD 1.5 and above, since soft updates are included there.
  2. Compile a new kernel with "options SOFTDEP" in your kernel config file.
  3. Run the new kernel.
  4. If it hasn't happened already, install the new include files from /sys/sys (i.e. at least do cd /usr/src/sys ; make includes). To be safe, just install them all (cd /usr/src ; make includes). This step is not needed for NetBSD 1.5 and above.
  5. At least recompile lib/libc, sbin/mount, sbin/mount_ffs, sbin/fsck_ffs, sbin/tunefs, and install them. This step is not needed for NetBSD 1.5 and above.
  6. If you have used tunefs(8) before to enable softdeps, boot to singleuser mode and disable them again: "tunefs -n disable /dev/rXd0x". Softdeps are now enabled via mount(8) options. This step is not needed for NetBSD 1.5 and systems later than 20000616.
  7. In /etc/fstab, add the "softdep" mount option to all filesystems that you want to use softdeps with. For example change the line reading
    /dev/wd0e    /usr    ffs     rw                      1 2
    
    to:
    /dev/wd0e    /usr    ffs     rw,softdep              1 2
    
  8. If your system still has it, remove "update=YES" from your /etc/rc.conf file. update(8) is no longer needed. Its work is now done in a more sophisticated way by a kernel thread - you can even disable update(8) if you don't want to enable soft updates on the filesystem because of this. This step is not needed for NetBSD 1.5 and above.
  9. Reboot
  10. Have fun!

Are there any measured improvements of softdep? (맨 위)

The fact that meta-data isn't immediately written to disk makes the system feel a lot faster. No numbers are available to show this at this moment.

Paul Vixie has run a benchmark on storing and retrieving (in random order) 75.000 files into a directory, on both a system with and without softdep. The results show that file access time for both creating and locating files in large directories are generally better on systems with soft dependencies. (The softdep system in this case was FreeBSD 4.2, the non-softdep system was BSD/OS 3.1. Similar behaviour will be visible on a NetBSD system with and without softdep).

How resilient is the Fast File System (FFS), FFS with softdeps and NetBSD's ext2fs implementation with respect to unclean shutdowns? (맨 위)

The FFS takes care to correctly order all metadata operations, as well as to ensure that all metadata operations precede operations on the data to which they refer, so that the file system may be guaranteed to be recoverable after a crash. The last N seconds of file data may not be recoverable, where N is the syncer interval, but the file system metadata will be. N is usually 30.

With softdeps running, you've got almost the same guarantee. With softdeps, you have the guarantee that you will get a consistent snapshot of the file system as it was at some particular point in time before the crash. So you don't know, as you did without softdeps, that, for example, if you did an atomic operation such as a rename of a lock file, the lock file will actually be there; but you do know that the directory it was in won't be trashed and you do know that ordering dependencies between that atomic operation and future atomic operations will have been preserved, so if you are depending on atomic operations to control, say, some database-like process (e.g. writing mail spool files in batches, gathering data from a transaction system, etc.) you can safely start back up where you appear to have left off.

NetBSD's ext2fs implementation gives you the traditional FFS guarantee about metadata (unlike the Linux implementation), so you can actually use it with more confidence than you can use the native ext2fs in Linux. The downside is that it's a bit slower, but that's because it actually does the right thing if the system crashes, instead of potentially eating your file system itself.

How much swap space (맨 위)

On older unix systems it was recommended to have twice as much swap space as RAM. This was because active pages in RAM had to have pages allocated in swap, effectively limiting the total virtual memory to the size of the swap space. On NetBSD this is no longer true, so total virtual memory is approximately swap + RAM.

Under NetBSD there are three primary uses for swap space:

  1. Additional virtual memory
    Less active pages containing modified data can be migrated to swap space allowing virtual memory to be larger than physical memory.

  2. An area for kernel core dumps
    This is then read by savecore(8), on boot. For this to work the primary swap partition must be slightly larger than the total RAM.

  3. For mfs(8) filesystems
    Classically mounted on /tmp in order to speed up any programs using /tmp, by adding the following to the fstab(5) file:
    	swap  /tmp  mfs  rw,-s=SIZE 0 0
    where SIZE is in 512byte blocks. The space required is taken from the swap space as the filesystem is used.

The 'correct' value for swap is dependent on the usage of the system, but for some general rules:

Adding more swap to a running system (맨 위)

Systems should be configured with sufficient swap space, as per the How much swap entry.

There are three ways to add swap to a configured system:

  1. Rebuild the system disk, using a larger swap partition.
    While arguably the cleanest solution, this obviously involves significant disruption.

  2. Add an additional swap partition.
    When you add a disk it is usually a good idea to include a small 'b' partition for additional swap, and add an entry of the form:
    	/dev/DISKb       none    swap sw 0 0
    to your /etc/fstab file to automatically enable on boot. (Where DISK is the disk name such as 'sd1' or 'wd2').

  3. Create a swap file.
    The quickest and simplest option is to create a file in an existing filesystem, and use it as additional swap space. While accessing this will be slightly slower than dedicated swap partitions (due to fragmentation and filesystem overhead), it is ideal for solving a temporary swap shortage.

    To add 10 MBytes of swap space is as easy as selecting a filesystem with sufficient free space and:

    	# dd if=/dev/zero bs=1m count=10 of=/somefilesystem/swap
    	# chmod 600 /somefilesystem/swap
    	# swapctl -a -p 1 /somefilesystem/swap
    The `dd(1)' command creates a 10 MByte file `/somefilesystem/swap'. This swap file needs to be chmod(1) 600 so that unprivileged users may not read its contents (swapctl(8) will reject world readable files). Then `swapctl(8)' command adds /somefilesystem/swap to the system swap space at priority 1. Priority 0 is the (default) highest priority, and since swapping to files is slightly slower we only want the system to use the file when conventional swap has all been used.

    To make swapping to that file permanent and enable it on every reboot, put something like the following into /etc/fstab:

    /somefilesystem/swap none swap sw,priority=1 0 0

Moving /usr from root to a different partition (맨 위)

  1. Make sure that the desired new location (e.g. /dev/sd0e) does not overlap any existing partitions. Check the output from disklabel(8).
  2. If it does not already contain a filesystem, run
    # newfs /dev/sd0e
  3. Mount it and copy across data:
    # mount /dev/sd0e /mnt
    # cd /usr
    # pax -rw -pe . /mnt
    # umount /mnt
  4. Edit /etc/fstab and add '/dev/sd0e /usr ffs rw 1 2' (change /dev/sd0e for your situation).
  5. Shutdown to single user mode and make new mountpoint:
    # shutdown now
    # mv /usr /usr.old
    # mkdir /usr
  6. Bring system up, test, and when all OK, 'rm -rf /usr.old'.

Rebuilding /dev (맨 위)

The /dev directory contains the necessary device files for accessing hardware and pseudo devices. If it becomes damaged, much strangeness can ensue.
To rebuild the /dev directory, you should first boot single-user (it should be possible to perform while multiuser, but not recommended), then:
  • mkdir /newdev
  • cd /newdev
  • cp /dev/M* .
  • sh MAKEDEV all
  • cd /
  • mv dev olddev; mv newdev dev
  • rm -r olddev

Connecting a UPS to a NetBSD system (맨 위)

Connecting one is trivial, but monitoring it such that the NetBSD can shut down cleanly when the power is about to fail requires a little more:
Simon J. Gerraty has a page on using a APC Smart-UPS. If you are writing your own software to talk to the UPS you will probably need to set the softcar flag via tcsetattr(). Wolfgang Rupprecht has researched the field briefly:

There two different types of UPS interfaces, sometimes both are available on the same UPS. The 9-pin connector on the UPS is never a wired up as a normal PC-style rs-232. At best its a three-wire rs-232 interface, with the pins rearranged just to keep things interesting. At worst its a contact closure signal that is not even at the rs-232 signaling voltages and one must use a funny cable with level-translators in it to convert the voltages to something the rs-232 port can even see transitions on. The signal from the latter type of interface can only send out a one-bit (normal / powerfail) signal. It must be run into some modem-control line such as DCD and is then detected via a program that checks the status of that modem control line. Unless one is careful, its possible to confuse the modem-control-line-only cable that come with some UPS's as a real rs-232 cable.

Poking around APC web page, and a few promising altavista hits revealed that they have 3 basic interfaces. Low end UPS's ("back UPS") have only the modem-control line type interface. The two high end lines ("Back UPS Pro", "Smart UPS") have both combination modem control line and 3-wire rs-232 signals available. In both cases one needs to use one of two special cables. The cable for the modem control line interface has transistors and diodes in it to do the level shifting (and power grabbing from some of the other wires). It's a real kludge, with the word UGLY coming to mind as the correct modifier. The second type of cable will get the UPS talking serially, but some of the 3-rd party docs indicated that the UPS will only talk if you send 2 stop bits. The protocols don't appear to be officially documented and the back-UPS pro and smart UPS appear to talk different serial line protocols. Only the back-UPS pro line appears to have any 3-rd party support, and many of the details of the protocol are only guessed at.

Competitors all seem to have similar offerings (modem control line only, and proprietary serial line protocols with special cables). In no case could I find someone with an openly documented standard.

Can NetBSD run without the secr.tgz distribution set installed? (맨 위)

Yes. The security distributions merely contained kerberized versions of utilities such as telnet in addition to DES decryption code in version prior to NetBSD 1.5. A standard NetBSD distribution was shipped with cryptographic encryption code which was sufficient for a working NetBSD system. Starting with NetBSD 1.5, there is no longer a seperate archive 'secr.tgz' for crypto code. If you simply are wondering if you can run without a secr.tgz distribution because you cannot find one, it can be found in the "<arch>/binary/security" subdirectory of the NetBSD release distribution tree in releases before 1.5.

What is single-user mode, why, and how? (맨 위)

'single-user' mode is when the kernel has booted, but only runs a single shell on the console. If you boot single-user only the root filesystem will be mounted, and it will be mounted read-only. Among the many uses for single-user mode are: You can enter single-user mode by running 'shutdown now' as root on a running system, or by booting the system with the '-s' flag (the method for doing this varies from port to port).

Once booted single-user you may find some of the following commands useful:

How to switch from single-user to multi-user (맨 위)

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

The system will boot up to multi-user mode, starting all kind of services, etc. Note that disks are not checked when going from single-user to multi-user mode!

How to mount a 'read-only' filesystem read/write? (맨 위)

Use mount(8)'s -u (update) switch: '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.

When is it safe to use fsck? (맨 위)

Only use fsck(8) on an unmounted or read-only filesystem. Running fsck(8) 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(8).

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.

How to read the boot messages? (맨 위)

The system message buffer can be displayed with dmesg(8). This is usually (in 1.4 and later) automatically stored in /var/run/dmesg.boot immediately after each boot. If kernfs (see mount_kernfs(8)) is enabled, as in install kernels, you can also more /kern/msgbuf.

How to shutdown the machine? (맨 위)

To drop back into single-user mode, use 'shutdown now'. To halt the machine, use 'shutdown -h now'. On some ports, you may need to use 'shutdown -p now' to actually power off the machine. Please see the shutdown(8) manual page for complete details.

How to reboot the machine? (맨 위)

Use 'shutdown -r now' or 'reboot'. See the shutdown(8) or reboot(8) manual pages for further details.

For what is /kern used? (맨 위)

It is used for mounting the kernfs filesystem. See the mount_kernfs(8) manual page.

For what is /proc used? (맨 위)

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 the mount_procfs(8) manual page.

This is normally used by creating a '/proc' directory as root, then adding the following to /etc/fstab (see fstab(5)):
/proc /proc procfs rw 0 0

After changing /etc/motd something reset it to its original contents (맨 위)

If you delete the header, the startup process will overwrite your changes on boot. This can be disabled by setting update_motd=NO in /etc/rc.conf, in which /etc/motd will not be touched at all, and you can change it at will.

Where to sell NetBSD related hardware? (맨 위)

For occasional items you can generally post to a given port's mailing list, and to netbsd-forsale@mono.org.
If you would be willing to donate any hardware to assist in the development of NetBSD you should check the Hardware contributions page, or contact core@NetBSD.org

Creating an MP3 (MPEG layer 3) file from an audio CD (맨 위)

Please note: these instructions have only been tested with the cdd package, and not the tosha and cdparanoia packages.

The basic steps in creating an MPEG layer 3 (MP3) file from an audio CD (using software from the NetBSD packages collection) are:

  1. Extract (rip) the audio data of the CD. See the ``Using audio CDs with NetBSD'' section for further instructions.

  2. Convert the CD audio format file to WAV format. You only need to perform this job if your ripping program (e.g. tosha, cdd) didn't already do the job for you!

    • Using the sox package, type:

      sox -s -w -c 2 -r 44100 -t cdr track-02.cda track-02.wav

      This will convert track-02.cda in raw CD format to track-02.wav in WAV format, using signed 16-bit words with 2 channels at a sampling rate of 44100kHz.

  3. Encode the WAV file into MP3 format.

    • Using the bladeenc package, type:

      bladeenc -128 -QUIT track-02.wav

      This will encode track-02.wav into track-02.mp3 in MP3 format, using a bit rate if 128kBit/sec. The documentation for bladeenc describes bit-rates in more detail.

    • Using the lame package, type:

      lame -p -o -v -V 5 -h track-02.wav track-02.mp3

      You may wish to use a lower quality, depending on your taste and hardware.

The resultant MP3 file can be played with any of the maplay, mpg123, or splay packages.

Starting a program at boot time (맨 위)

The Vixie cron(8) (used in NetBSD) special @reboot time specification can be used to start a given program at cron(8) startup time, which usually coincides with the system booting. This also allows users without root privileges to run commands automatically at startup.

Setting up a ccd drive (맨 위)

  1. disklabel all disks:
    create the partitions you want to concatenate, make sure there's an offset to the beginning (I think 16 sectors is more than enough - but I'm not sure). I don't know if the type matters, I've used "normal" 4.2BSD partitions.
  2. configure the ccd.
    For performance tuning you will have to experiment a little to find the best interleave. 48 works fine for me with two disks. AFAIK with 16 and some other numbers it can happen that all inodes will be on the same disk, which should be avoided for performance reasons. IIRC I got some problems, if the number of sectors of an component is not a multiple of the interleave.
  3. disklabel the ccd as you would do with a normal harddisk
  4. newfs the ccd.
  5. mount it.

See the ccd(4) and ccdconfig(8) manpages for more information.


홈페이지
최상위 문서로

(Contact us) $NetBSD: index.html,v 1.13 2006/06/22 15:49:21 jschauma Exp $
Copyright © 1994-2003 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.