NetBSD/i386 Frequently Asked Questions
- Accessing Microsoft partitions
- Booting NetBSD or DOS/Windows/other via a menu
- Adding NetBSD to the Windows NT/2000/2003/XP boot menu
- Installing NetBSD on a disk which currently is entirely used by DOS/Windows
- dosboot.com resets the machine after loading the kernel
- How to get a DOS prompt if you have WinME installed, and all you have is a Win98 CD and no floppy to boot from
- IRQ 2 and IRQ 9
- Problems with 'ne1: device time out'
- USB problem 'uhci0: couldn't map interrupt'
- My monitor goes into DPMS mode after "setting tty flags"
- PCMCIA modem does not appear to work
- Installing on VIA EPIA hardware
Getting along with other operating systems
Accessing Microsoft partitions (top)
NetBSD supports a number of different filesystems (for a complete list see fstab(5)) including FAT, FAT32, NTFS4 and NTFS5 from Microsoft. Currently only read support works reliably for NTFS filesystems. Long filenames are supported on both FAT and NTFS.
To access another filesystem you have to set up a
disklabel, which tells the system where to find the
data on the disk. With a correct
disklabel you are
mount it for use with NetBSD.
Setting up the disklabel
- Determine the disk containing the filesystem
If you only have a single disk it will be wd0 or sd0, depending on whether you have IDE or SCSI. If you have multiple disks you should check the output of
dmesg | moreto determine the name of the desired disk.
- Determine the size and offset of the partition.
fdiskand you will see the size and offset of the partitions which could be something like:
NetBSD disklabel disk geometry: cylinders: 16938 heads: 15 sectors/track: 63 (945 sectors/cylinder) BIOS disk geometry: cylinders: 1023 heads: 240 sectors/track: 63 (15120 sectors/cylinder) Partition table: 0: sysid 7 (OS/2 HPFS or NTFS or QNX2 or Advanced UNIX) start 63, size 3190257 (1557 MB), flag 0x80 beg: cylinder 0, head 1, sector 1 end: cylinder 210, head 239, sector 63 1: sysid 169 (NetBSD) start 3193155, size 4096575 (2000 MB), flag 0x0 beg: cylinder 211, head 45, sector 1 end: cylinder 482, head 29, sector 63 2: sysid 6 (Primary 'big' DOS, 16-bit FAT (> 32MB)) start 7302960, size 4596480 (2244 MB), flag 0x0 beg: cylinder 483, head 0, sector 1 end: cylinder 786, head 239, sector 63 3: sysid 15 (Ext. partition - LBA) start 11899440, size 4097520 (2000 MB), flag 0x0 beg: cylinder 787, head 0, sector 1 end: cylinder 1023, head 239, sector 63
The example is from a disk with 4 partitions:
0. Windows NT 4.0 NTFS4 partition
1. NetBSD ffs partition
2. MS-DOS FAT partition
3. Windows 2000 NTFS5 inside an "extended" partition
If the disk contains only MS-DOS partitions NetBSD will automatically generate a 'fake' disklabel containing an entry for the first MS-DOS partition.
The output could look something like this:
# disklabel wd0physical disk information
8 partitions: # size offset fstype [fsize bsize cpg] a: 410130 3193155 4.2BSD 1024 8192 16 # (Cyl. 3379 - 3812) b: 409185 3603285 swap # (Cyl. 3813 - 4245) c: 4096575 3193155 unused 0 0 # (Cyl. 3379 - 7713) d: 16006410 0 unused 0 0 # (Cyl. 0 - 16937) e: 3274425 4012470 4.2BSD 2048 16384 32 # (Cyl. 4246 - 7710)
If your needed fstypes already are defined (i.e. MSDOS) you can skip down to partition mounting.
If you do this before the NetBSD installation is up and running, you may want to use the mbrlabel(8) utility to synthesize a temporary in-core disklabel describing all the fdisk partitions on a disk. You can then use that information for creating a new disklabel consisting of the BSD and other-OS partitions.
- Prepare to edit the disklabel
If you prefer to use an editor other than vi, type
setenv EDITOR <YOUR_EDITOR>, e.g.,
setenv EDITOR pico.
- Edit the disklabel with
disklabel -e <DISKNAME>
Go down to the bottom of the disklabel and you are ready to edit your labels.
You need two things:
- The next unused partition letter (e.g., 'f').
- The 'start/size' value from fdisk (e.g., '63').
Add a new line at the bottom that for NTFS reads:
<PARTITION>: <SIZE> <OFFSET> NTFS
A suitable entry for the above example would be (fsize, bsize and cpg are blank):
f: 3190257 63 NTFS
Add another line for MSDOS:
<PARTITION>: <SIZE> <OFFSET> MSDOS
From the example the entry would be:
g: 4596480 7302960 MSDOS
Note on partitions: NetBSD/i386 currently only supports eight partitions per disk ('a' - 'h') and the 'number of partitions' line directly above the partition table should be greater or equal to the number of partitions defined.
- Save and check the disklabel
Exit the editor, type
disklabel <DISKNAME>, and confirm your new partition is visible.
Every disk partition has a device entry in
The form of such an entry is
/dev/ followed by
the disk name, followed by the partition letter. In the above
example, the device entry for the NTFS and MS-DOS partitions would
- Create a mountpoint for each partition
mkdir <MOUNTPOINT>, e.g.,
- Mount the filesystems
mount -t <TYPE> <DEVICE> <MOUNTPOINT>, e.g.,
mount -t msdos /dev/wd0g /msdosand
mount -t ntfs /dev/wd0f /nt4
- Check all is OK
ls <MOUNTPOINT>, e.g.,
- Set filesystems to be automatically mounted at boot
If you want NetBSD to automatically mount the filesystems every time it boots, you should edit
/etc/fstaband add lines of the form:
<DEVICE> <MOUNTPOINT> msdos rw <DEVICE> <MOUNTPOINT> ntfs ro
Again, in the above example this would be:
/dev/wd0g /msdos msdos rw /dev/wd0f /nt4 ntfs ro
Booting NetBSD or DOS/Windows/other via a menu (top)
This assumes you have already partitioned your disk, and installed both NetBSD and whichever other OS you intend to use.
- run 'fdisk -i -c /usr/mdec/mbr_bootsel' to install the bootmenu
- run 'fdisk -B' afterwards to interactively configure it (this step is not optional)
See also the fdisk(8) manpage.
Adding NetBSD to the Windows NT/2000/2003/XP boot menu (top)
Method 1) Use the NetBSD mbr code
Use the NetBSD mbr code which allows you to override options at boot time if required. This requires a working, bootable NetBSD installation. The NetBSD mbr code is installed in an empty file using the fdisk command in NetBSD.
In this example, Windows Server 2003 is on disk 0 and a NetBSD 4.0 installation is on disk 1.
devel# rm -f nbmbr devel# touch nbmbr devel# fdisk -BF -c mbr_ext ./nbmbr fdisk: primary partition table invalid, no magic in sector 0 fdisk: Cannot determine the number of heads Update the bootcode from /usr/mdec/mbr_ext? [n] y Boot selector configuration: Timeout value (0 to 3600 seconds, -1 => never): [-1..3600 default: 10] Select the default boot option. Options are: 0: The first active partition 1: Harddisk 0 2: Harddisk 1 3: Harddisk 2 4: Harddisk 3 5: Harddisk 4 6: Harddisk 5 7: Harddisk 6 8: Harddisk 7 Default boot option: [0..8 default: 0] 2 We haven't written the MBR back to disk yet. This is your last chance. Should we write new partition table? [n] y
Copy nbmbr onto drive C: and add the following to the end of C:\boot.ini
c:\nbmbr="NetBSD disk 1"
boot.ini is hidden by default. To edit it, open drive C: from My Computer and choose "Folder Options..." on the Tools menu. Then click on the View tab and ensure the checkbox alongside "Hide protected operating system files (Recommended)" is unticked. Click on OK. You will then be able to see and double-click on boot.ini to edit it.
Method 2) Use bootpart to copy the existing code to bootblock
Within Windows, get bootpart from http://www.winimage.com/bootpart.htm and extract the files from the zip archive onto your harddisk. Go to a command prompt and navigate to the directory containing bootpart.exe. A session transcript is below. In this example, Windows Server 2003 is on disk 0 and a NetBSD 4.0 installation is on disk 1.
First run bootpart and determine the partition number (which are counted consecutively spanning disk numbers). Remember that NetBSD uses partition type a9 (in hex):
C:\bootpa26>bootpart Boot Partition 2.60 for WinNT/2K/XP (c)1995-2005 G. Vollant (email@example.com) WEB : http://www.winimage.com and http://www.winimage.com/bootpart.htm Add partition in the Windows NT/2000/XP Multi-boot loader Run "bootpart /?" for more information Physical number of disk 0 : b4dab4da 0 : C:* type=7 (HPFS/NTFS), size= 19580368 KB, Lba Pos=63 Physical number of disk 1 : 7f4c256b 1 : D:* type=a9 , size= 39121456 KB, Lba Pos=63
We want to boot partition 1, so:
C:\bootpa26>bootpart 1 \nbboot "NetBSD disk 1" Boot Partition 2.60 for WinNT/2K/XP (c)1995-2005 G. Vollant (firstname.lastname@example.org) WEB : http://www.winimage.com and http://www.winimage.com/bootpart.htm Add partition in the Windows NT/2000/XP Multi-boot loader Run "bootpart /?" for more information Physical number of disk 0 : b4dab4da 0 : C:* type=7 (HPFS/NTFS), size= 19580368 KB, Lba Pos=63 Physical number of disk 1 : 7f4c256b 1 : D:* type=a9 , size= 39121456 KB, Lba Pos=63 C:\nbboot written C:\BOOT.INI updated
This creates a bootblock called nbboot in the root in drive C: and adds an entry to boot.ini called "NetBSD disk 1"
Method 3) Use grub4dos
The advantages of this method are that you have the wider array of grub options open to you, plus the kernel can be loaded from NTFS (if that is appropriate to your needs; usually you'd just load it from the root of your NetBSD installation). For instance, you might like to have a NetBSD recovery or installation kernel handy for troubleshooting even on a machine without a full NetBSD installation.
Download the latest version of grub4dos from http://sourceforge.net/projects/grub4dos and extract the files from the zip archive. Copy grldr to C:\ on Windows and then create c:\menu.lst (this can be created under Windows or NetBSD - the line endings are OK either way) similar to the following:
timeout=5 console terminal Title NetBSD on disk 1 (chainloader) root(hd1,0) chainloader +1 Title NetBSD install kernel kernel --type=netbsd /NETBSD_INSTALL_LARGE.gz
Non-MULTIBOOT kernels (such as the install kernels) need --type=netbsd. MULTIBOOT kernels must not have this option.
Finally, in a similar way to that described in method 1), add a suitable line to C:\boot.ini, e.g.:
Installing NetBSD on a disk which currently is entirely used by DOS/Windows (top)
Note: this only applies to FAT filesystems.
If you have an installation where DOS/Windows currently occupies the whole disk, if there is space left on the drive you can make the DOS/Windows partition smaller and then create a second partition to use with NetBSD.
The steps involved in this are
dosboot.com resets the machine after loading the kernel (top)
If dosboot.com resets the machine immediately after loading the kernel, make sure you do not have "himem.sys" loaded. Be sure to check your "config.sys"!
How to get a DOS prompt if you have WinME installed, and all you have is a Win98 CD and no floppy to boot from (top)
The Windows 98 CD is a fine way to get a (real!) MS-DOS prompt if your machine has Windows Millennium Edition (Windows ME) installed, and if booting from floppy is not an option, as is often the case with modern laptops. You can press shift+F5 to not load any drivers like "highmem.sys" (see above) when asked if you want to start with or without CD-ROM support. You can then access your C: drive where you've put tools like "dosboot.com" (available from ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-5.0/i386/installation/misc/dosboot.com) and a kernel before.
Specific hardware issues
IRQ 2 and IRQ 9 (top)
On IBM AT and later machines (which includes all PCs capable of running NetBSD) IRQ 2 is mapped to IRQ 9 for various hardware reasons. On cards which feature a setting of "IRQ 2", you should select IRQ 9 in NetBSD kernel configuration files.
Problems with '
ne1: device time out' (top)
Old style ISA cards are configured for a specific address and IRQ. NetBSD can autodetect the address, but does not have a clean way to check for the IRQ, so the autoconfiguration tables contains entries for the most common values. If the address matches but the IRQ does not the device will timeout when used. This does not affect other busses such as PCI, EISA, or ISA-PnP.
If you have this problem, you have three options:
- Change the settings on a card to match one of the entries in the kernel (src/sys/arch/i386/conf/GENERIC). Some use jumpers, and others have a DOS program, usually provided with the card.
- Compile a new kernel to match the card settings.
- Buy a different card - in modern PCI PCs an ISA network card can seriously impact the performance of other devices - a PCI card such as an fxp(4) (Intel EtherExpress Pro), or tlp(4) (Tulip or clone) is recommended.
- Manually change the kernel settings with ddb(4).
- Boot the kernel with '
-d' (Hit the space bar before boot countdown reaches 0), then type '
boot netbsd -d'.
x/xla loc,100. Record the offsets of fields with
0x280in them. There are three ISA network cards in the GENERIC kernel with this address.
- Change the locations to the correct address for your cards:
w/l loc+<offset> <address>.
- Change the IRQs to match your cards:
w/l loc+<offset>+0x10 <irq>.
- Continue booting.
- Boot the kernel with '
USB problem '
uhci0: couldn't map interrupt' (top)
This can be caused by the "Allocate interrupt for USB" option being disabled in the BIOS, possibly under the "PNP & PCI Setup". When enabled you will usually see the 'Serial Controller' listed with an IRQ on the BIOS screen just before it starts booting NetBSD.
My monitor goes into DPMS mode after "setting tty flags" (top)
At least one person has reported that their video card appears to not be probed correctly by the kernel. Specifically, after "setting tty flags" is printed, the screen goes black and the monitor goes into power-saving mode. The reported cause is that some video cards use the same I/O memory as what DOS calls COM4; for this reason, NetBSD's com3 (which corresponds to DOS's COM4) is disabled in the GENERIC kernel.
PCMCIA modem does not appear to work (top)
If you have a PCMCIA modem that does not appear to work, make sure you are using the com(4) device in hardware flow control mode. Many PCMCIA modems only work when using hardware flow control.
Installing on VIA EPIA hardware (top)
The NetBSD bootloader is currently broken on certain systems using the VIA C3 CPU, most notably the VIA EPIA range of ITX boards. In the early stages of boot the screen will go out of sync and the system will hang. This will happen on NetBSD versions newer than 1.6.2. This is documented in PR/26007.
A workaround is to use the bootloader from 1.6.2 until PR/26007 is resolved.
You can work around this in either of two ways:
If you have a spare system:
Move the hard drive to another motherboard
Install NetBSD 3.x
Run the 1.6.2 version of installboot. For an ide drive
installboot > /usr/mdec1.6/biosboot.sym /dev/rwd0a
Move the hard drive to the Epia motherboard
If you do not have a spare system you need to install 1.6.2 first:
Install minimal 1.6.2 (Only Kernel + Base + etc)
Log in as root and insert the 3.0.1 CD
# mkdir /cdrom # mount /dev/cd0a /cdrom # mv /netbsd /netbsd.1.6.2 # cp /cdrom/i386/binary/kernel/netbsd-INSTALL.gz /netbsd # shutdown -r now
The 3.0.1 install kernel should now be booting from the harddrive (make sure you're not booting the CD again!)
When the installer asks: “Do you want to update the bootcode in the Master Boot Record to the latest version of the NetBSD bootcode?” answer “NO”
When the installer asks: “Would you like to install the normal set of bootblocks or serial bootblock?” answer “g: Use existing bootblocks”
The vintage 1.6.2 can be found at ftp://ftp.NetBSD.org/pub/NetBSD-archive/NetBSD-1.6.2/i386/.
Disk issues with old machines
Using large drives on machines with a 540MB BIOS limit (top)
Enter a geometry of 1024/16/63 in the BIOS and be sure to have your boot partition within the first 540M (so that the kernel can be loaded by BIOS routines). NetBSD will then be able to use the whole disk.
How to determine a "correct" disk geometry (top)
NetBSD uses the PC BIOS to load the boot program. In order for this to work, both NetBSD and the BIOS must agree on the disk geometry (at least the part containing the boot partition).
The BIOS in PCs can only cope with a certain number of cylinders, heads, and sectors per disk (see table). (This includes BIOSes on SCSI cards).
Since modern drives' real geometry cannot fit within these limitations, a modern BIOS will 'translate' the geometry by picking fictitious values that multiply out to the same total size (or slightly less).
If a disk has a valid DOS MBR partition, (created by DOS, Windows, pfdisk, or similar) it will contain the "correct" BIOS geometry. NetBSD will use this as the BIOS geometry during sysinst. Unfortunately, on an empty disk, or one without the MBR set up properly, NetBSD will get the BIOS geometry wrong. Ideally, this information should be passed in from the boot program, but there is no certain method of determining the mapping of BIOS disk to NetBSD disk.
One method of determining the "correct" translated geometry is to use 'pfdisk':
- Download pfdisk from ftp.NetBSD.org (or a mirror), in /pub/NetBSD/NetBSD-5.0/i386/installation/misc/pfdisk.exe.
- Run '
pfdisk 0' (0 is the first disk, 1 the second, etc).
- Type '
- Record geometry, reboot, and use for NetBSD.
(This limits drives to 8GBytes, at least from the BIOS' perspective).
- The wscons documentation. NetBSD's platform-independent workstation console driver.
- port-i386 mailing list
- Netbooting NetBSD/i386 - booting from floppies or DOS partitions.
- Power Management for Laptops
- General NetBSD Documentation - for questions not specific to NetBSD/i386.
- Reed Media's Laptops and NetBSD list