COMPAT_SVR4(8) NetBSD System Manager's Manual COMPAT_SVR4(8) NNAAMMEE ccoommppaatt__ssvvrr44 - setup procedure for running SVR4/iBCS2 binaries DDEESSCCRRIIPPTTIIOONN NetBSD supports running SVR4/iBCS2 binaries. This code has been tested on i386 and sparc systems. Most programs should work, but not ones that use or depend on: kernel internal data structures the /proc filesystem the pty subsystem the ticotsord loopback rpc mechanism (nis uses this) sound and video interfaces threads (ttsession uses threads) the streams administrative driver The SVR4 compatibility feature is active for kernels compiled with the COMPAT_SVR4 option enabled. Since support for ELF executables is includ- ed only if the kernel is compiled with the EXEC_ELF32 or EXEC_ELF64 op- tions enabled, kernels which include COMPAT_SVR4 should also typically include EXEC_ELF32 (for 32-bit ELF support) and/or EXEC_ELF64 (for 64-bit ELF support). Most SVR4 programs are dynamically linked. This means that you will also need the shared libraries that the program depends on and the runtime linker. Also, you will need to create a "shadow root" directory for SVR4 binaries on your NetBSD system. This directory is named /emul/svr4. Any file operations done by SVR4 programs run under NetBSD will look in this directory first. So, if a SVR4 program opens, for example, /etc/passwd, NetBSD will first try to open /emul/svr4/etc/passwd, and if that does not exist open the 'real' /etc/passwd file. It is recommended that you in- stall SVR4 packages that include configuration files, etc under /emul/svr4, to avoid naming conflicts with possible NetBSD counterparts. Shared libraries should also be installed in the shadow tree. The simplest way to setup your system for SVR4 binaries is: 1. Make the necessary directories: (me@netbsd) mkdir -p /emul/svr4/{dev,etc} (me@netbsd) mkdir -p /emul/svr4/usr/{bin,lib} (me@netbsd) mkdir -p /emul/svr4/usr/openwin/{bin,lib} 2. Copy files from an svr4 system: (me@svr4) cd /usr/lib (me@svr4) tar -cf - . | \ rsh netbsd 'cd /emul/svr4/usr/lib; tar -xpf -' If you are running openwindows: (me@svr4) cd /usr/openwin/lib (me@svr4) tar -cf - . | \ rsh netbsd 'cd /emul/svr4/usr/openwin/lib; tar -xpf -' 3. Setup the configuration files and devices: (me@netbsd) cd /usr/share/examples/emul/svr4/etc (me@netbsd) cp netconfig nsswitch.conf /emul/svr4/etc (me@netbsd) cp SVR4_MAKEDEV /emul/svr4/dev (me@netbsd) cd /emul/svr4/dev; ./SVR4_MAKEDEV all An alternative method is to mount a whole SVR4 partition in /emul/svr4 and then override with other mounts /emul/svr4/etc and /emul/svr4/dev. BBUUGGSS Many system calls are still not emulated. The streams emulation is incom- plete (socketpair does not work yet). Most SVR4 executables can not handle directory offset cookies > 32 bits. More recent ones, compiled for large file support (Solaris 2.6 and up) can. With older programs, you will see the message "svr4_getdents: dir offset too large for emulated program" when this happens. Currently, this can only happen on NFS mounted filesystems, mounted from servers that re- turn offsets with information in the upper 32 bits. These errors should rarely happen, but can be avoided by mounting this filesystem with offset translation enabled. See the --XX option to mount_nfs(8). The --22 option to mount_nfs(8) will also have the desired effect, but is less preferable. NetBSD July 6, 1996 2