A relatively up-to-date list of all changes (including those in NetBSD-current) is available.
There is also a CHANGES
file
in the top level directory of each release, and maintained online for
previous
and the
next
release.
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 amd64 and sparc64 ports 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'.
Up to (and including) NetBSD 1.4.x, everything except the security distribution (i.e. secr.tgz) was exportable from the US. 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.
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!
You can use the useradd(8) command to add users on recent NetBSD
release, older releases can install the
sysutils/user
package
to get the same functionality. Editing /etc/passwd
will not
work. If you want to edit the password database, use vipw(8). See
also pwd_mkdb(8) for more information.
finger
? (top)
Use the chfn(1) and chsh(1) commands, or use
vipw(8) to edit /etc/master.passwd
This covers a number of possible problems:
/etc/ttys
(see ttys(5)). To be able to login directly
as root across the network (not recommended) you will need to
add 'secure
' to the end of every network terminal line. For
those who prefer not to have to edit each line you can (as root)
type:
cd /etc cp ttys ttys.orig cat ttys.orig | sed 's/network$/network secure/' > ttys |
/etc/group
for any attempt to su(1) to root. If it is empty (wheel:*:0:) then
anyone with the correct password can su to root. Otherwise it should be
a comma separated (no spaces!) list of the permitted
accounts.Type "ls -l /usr/bin/su
". The first 'word' on the
output should be '-r-sr-xr-x'. If it is anything else (such as
'-r-xr-xr-x'). Type (as root) "chmod 4555 /usr/bin/su
".
The 's' in that position
indicates it is a 'setuid' binary, which in this case allows 'su' to
run with root privileges.
This problem can be caused by not giving the '-p' (preserve permissions) flag to tar when extracting the distribution. If this was the case then re-extract all the tarfiles (except etc.tar.gz) as various other utilities will also be broken.
For example, to add /usr/X11R6/bin to your path, edit the file .login in your home directory and add the following:
set path = ( /usr/X11R6/bin $path ) |
This only works for the C-shell csh(1), and derivatives such as
shells/tcsh
.
For sh(1) and derivatives (like shells/bash2
), the correct syntax is:
PATH=/usr/X11R6/bin:$PATH export PATH |
You can set something for all users running csh(1) or shells/tcsh
by adding it to one of the following files:
/etc/csh.cshrc
.cshrc
in the user's home directory./etc/csh.login
/etc/csh.cshrc
, but before any .login
in the user's home directory./etc/csh.logout
.logout
in
the user's home directory.
This depends on the type of shell you are using:
set -E
'.
This can be added to the /.profile
file so you
always have command line editing in single-user mode.
shells/tcsh
, or
shells/bash2
from
the NetBSD packages
collection, both of which have filename completion and
command line editing enabled by default.shells/pdksh
for other operating
systems. The KSH-93 is also available in
shells/ast-ksh
.shells/bash2
.shells/tcsh
.shells
category.
NetBSD uses the 'LANG
' environment variable determine which
language to use for error messages and suchlike. This can be set in csh
or tcsh with the command 'setenv LANG XX
' where XX is
the two letter country code. For a list of supported codes type 'ls
/usr/share/nls
'.
Please note: Only certain messages have been translated. To
test, set the LANG
variable and type
cd /a_directory_that_does_not_exist |
Man pages 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) man page 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 print/ghostscript
package
from pkgsrc.
Please see this page for details.
If you have a JetDirect print server such as the JetDirect EX Plus, you can use
dhcpd(8) under NetBSD to configure the print server. The steps are:
Create an entry in /etc/dhcpd.conf
for the JetDirect server:
options jd-tftp-cfg code 144 = string; options jd-tftp-server code 150 = string; allow bootp; # [...] host hp690c { fixed-address hp690c; # set to the DNS name or address of the JetDirect hardware ethernet 00:60:b0:00:11:22; # set to the MAC address of the JetDirect option log-servers servername; # set to the DNS name or address of log server option jd-tftp-server servername; # set to the DNS name or address of tftp server option jd-tftp-cfg "hpnp/hp690c.cfg"; # name of the JetDirect config file } |
See dhcpd.conf(5) for more information on this file.
Make sure that tftpd
is 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
.
Make sure that dhcpd
is enabled in /etc/rc.conf
.
Next create a Network Printer Interface (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 DHCP.
On some printers, you may have to explicitly enable BOOTP/DHCP configuration
from the front panel.
The "burst" page is a function of the host with the locally attached printer,
or in this case, the dedicated hardware emulating lpd(8). When NetBSD is used
as a remote spooler, with rm, it never adds an additional burst page.
The JetDirect's "burst" page is an unusual feature in a dedicated device.
HP (TM)
actually calls it a "trailer".
You can disable it as above, by setting banner: 0
, or simply telnet
to port 23 of the device, and issue the command banner 0
, then
quit
.
Some JetDirect units may need their firmware upgraded to add the
banner
command.
You will need to use the appropriate JetDirect network management
tools available from HP to do this.
You may need to set the SNMP read and write community strings to
known values in order to perform this upgrade.
To set these, use the following lines in the NPI configuration
file.
get-community-name: read-password set-community-name: write-password |
(See the above section on configuring the JetDirect cards with DHCP.) Just be aware of the security ramifications of leaving these entries in a publicly available (via TFTP) configuration file...
NetBSD supports various different SCSI scanners using the
graphics/sane-backends
scanning package.
Frontends for accessing the API provided by that package are in the
graphics/sane-frontends
package, or it can
be called directly by graphics tools such as the
graphics/gimp
.
Note: in versions of NetBSD before 1.4.2 the in kernel ss(4)
scanner driver may cause problems with graphics/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.
You need to install the 'text' set, text.tgz. See your base install notes.
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 -r
' (top)
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.
netstat -r
' I get an endless stream of question marks. What's wrong? (top)
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 (top)
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
):
fstat
gdb
ipcs
netstat
nfsstat
systat
uptime
vmstat
w
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.
/etc/aliases
: No such file or directory' is displayed (top)
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.
portmap
messages from showing up in shells, when logged in as root (top)
Use security/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
.
Per default, NetBSD 1.6 has already numerous locales installed. You can find
them in /usr/share/locales
. Choose the locale most suitable for your
location and set the LC_ALL environment variable accordingly. Note that it is
not sufficient to set LC_ALL to, say, ``de_DE'', but that you should
use the full locale, such as ``de_DE.ISO8859-15''.
For older versions of NetBSD, here's a tip from the mail archives:
tar plzvxCf / locale.tgz
[STOP][A]
before the boot
starts, then at the "ok
" prompt, probe-scsi
.[CTRL][A]
before
the boot starts to enter the BIOS.disklabel -i -I sd1 # ignore any "sd1: no disk label" |
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 |
disklabel -i
you can use '?' for additional help.
newfs <filesystem>
(where <filesystem> is the partition's raw device,
like /dev/rsd1e, /dev/rwd1f, ...)
/etc/fstab
fsck -f <filesystem> |
mount -va |
Frank van der Linden (frank@wins.uva.nl) has brought Kirk McKusick's trickle sync + FFS soft update code into the main tree.
To use it, do the following:
options SOFTDEP
" in your kernel
config file. This option is enabled in GENERIC kernels./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 |
/dev/wd0e /usr ffs rw,softdep 1 2 |
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).
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.
/dev/sd0e
)
does not overlap any existing partitions.
Check the output from disklabel(8).# newfs /dev/sd0e |
# mount /dev/sd0e /mnt |
# cd /usr |
# pax -rw -pe . /mnt |
# umount /mnt |
/etc/fstab
and add
'/dev/sd0e /usr ffs rw 1 2
' (change /dev/sd0e
for your situation).
# shutdown now |
# mv /usr /usr.old |
# mkdir /usr |
rm -rf
/usr.old
'.
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.
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.
/kern
used? (top)
It is used for mounting the kernfs filesystem. See the mount_kernfs(8) manual page.
/proc
used? (top)
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
As /proc
in NetBSD is intended for process-related data only,
other entries known from linux are not present. This can be changed by
adding the "linux
" mount option to the file system flags,
though:
/proc /proc procfs rw,-olinux 0 0
Since the topic of swap encryption pops up from time to time, this information could be useful for some people who are interested in encrypting their swap space but are not sure how to set it up.
Currently there is one limitation, cgd devices are created with disklabel containing only one slice marked as 4.2BSD which is not suitable for swapping into. This is the reason why using cgd drive as a swap device is not straightforward. Roland Dowdeswell is looking into this and it should be resolved in the near future.
A real world example: Our swap device wd0b will be configured as cgd1, using 256 bit aes-cbc key. Step by step instructions follows:
1) generate a paramsfile for the cgd device. the default file would be /etc/cgd/wd0b but i will use /etc/cgd/swap for better illustration: # cgdconfig -g -V none -k randomkey aes-cbc > /etc/cgd/swap 2) configure the cgd device over wd0b, (make sure wd0b is not used as a swap device at this moment): # cgdconfig cgd1 /dev/wd0b /etc/cgd/swap 3) edit disklabel for cgd1, we need to create a valid swap slice. save the disklabel to a file: # disklabel -e -I cgd1 # /dev/rcgd1d: type: cgd disk: cgd label: default label flags: bytes/sector: 512 sectors/track: 2048 tracks/cylinder: 1 sectors/cylinder: 2048 cylinders: 128 total sectors: 263655 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 4 partitions: # size offset fstype [fsize bsize cpg/sgs] d: 263655 0 4.2BSD 0 0 0 # (Cyl. 0 - 128*) create a swap slice and change label (that's not really necessary, just for our information): # /dev/rcgd1d: type: cgd disk: cgd label: swap flags: bytes/sector: 512 sectors/track: 2048 tracks/cylinder: 1 sectors/cylinder: 2048 cylinders: 128 total sectors: 263655 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 4 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 263655 0 swap # (Cyl. 0 - 128*) and save it to a file: # disklabel cgd1 > /etc/cgd/swap.disklabel 4) set up the cgd device to be configured automatically at boot. add the following line into your /etc/cgd/cgd.conf: cgd1 /dev/wd0b /etc/cgd/swap 5) now we need to restore our disklabel to the newly created cgd device at boot time. create /etc/rc.conf.d/cgd with this simple function: swap_device="cgd1" swap_disklabel="/etc/cgd/swap.disklabel" start_postcmd="cgd_swap" cgd_swap() { if [ -f $swap_disklabel ]; then disklabel -R -r $swap_device $swap_disklabel fi } 6) add the cgd device into /etc/fstab as a swap device: /dev/cgd1a none swap sw 0 0 |
That's all. Now you can activate your swap partition with 'swapctl -a /dev/cgd1a' or just reboot.
What you see above is a setup from my laptop.
Device 1K-blocks Used Avail Capacity Priority /dev/cgd1a 131827 8828 122999 7% 0 |
'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:
fsck
your filesystem due to suspected
corruption./etc
.
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:
fsck -p ; mount -va
set -E
TERM=vt220 ; export TERM
sh /etc/rc.d/network start
sh /etc/netstart
.
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!
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
.
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.
Use 'shutdown -r now
' or 'reboot
'. See the
shutdown(8) or reboot(8) manual pages for further details.
To start programs at system boot time, any commands can be added to
/etc/rc.local
, which will be ran at the end of the boot
process.
As an alternative mostly for non-root users, the Vixie cron(8) (used in NetBSD)'s 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.
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:
swap /tmp mfs rw,-s=SIZE 0 0 |
The 'correct' value for swap is dependent on the usage of the system, but for some general rules:
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:
/dev/DISKb none swap sw 0 0 |
/etc/fstab
file to automatically enable on boot.
(Where DISK
is the disk name such as 'sd1' or 'wd2').
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 |
According to a
post by Simon Burge on the tech-kern list, it is possible to greatly improve
the performance of small-memory machines by tweaking the virtual memory settings.
While it is in your best interests to read his entire post and decide for yourself
what your settings should be, the gist is that you'll want to run sysctl -w
vm.anonmax=95
. According to the sysctl(3) page, this changes "The percentage
of physical memory which will be reclaimed from other types of memory usage to
store anonymous application data."
There are two obvious options in the base system:
ed
is a very simplistic text editor. It has a command
mode, (active when first started) and an input mode. Its primary
advantages are it is available even in single-user mode with
only the '/' filesystem mounted, and will work even without a
correct terminal type set. It is worth gaining a basic
understanding of ed(1) - enough to fix fstab(5) and rc.conf(5)
files in an emergency.vi
retains the command and input modes of ex(1), but
adds a full screen visual interface. vi is the only screen
editor available in the base install, and requires a valid
terminal type to run.editors/vilearn
- in pkgsrc and highly recommended.
There are a large number of editors available under the
editors
category in pkgsrc, including:
editors/joe
editors/joe
will be
familiar to people who have used Borland IDEs.
editors/pico
mail/pine
mail package.
editors/nedit
editors/emacs
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 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, it is possible to confuse the modem-control-line-only cables that come with some UPSs 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 UPSs ("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.
/etc/motd
something reset it to its original contents (top)
If you delete the header of /etc/motd
, 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.
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 finance-exec@NetBSD.org.
Disk striping can either be done with RAIDframe or ccd(4) in NetBSD. Here is how to use ccd(4):
See the ccd(4) and ccdconfig(8) man pages for more information.
Install the pkgsrc/sysutils/pcvt-utils package. It provides fed and fontedit: two font editors that can also be used on the fonts in /usr/share/wscons/fonts.