Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info.

Newbie Guide To A/UX (Apple UNIX)

From Higher Intellect Wiki
Revision as of 15:22, 21 April 2019 by Netfreak (talk | contribs)
Jump to navigation Jump to search

This will be a compilation of information designed to help first time A/UX users, or anyone not fully familiar with the workings of UNIX, to get A/UX (Apple UNIX) installed and configured.

Installation

Getting Started

A/UX requires a 68K based Macintosh with an FPU and PMMU. It will not run on any PowerBook or LC models. I recommend using a Motorola 68040 based system for the best performance. The A/UX 3.0.1 installer will work without modification on systems such as the Macintosh Quadra 700 but some of the newer Quadra models may require an 040 enabler.

The installers and patches can be found on a number of sites including Mac Garden, Macintosh Repository, Winworld, etc. We also keep an A/UX archive on preterhuman.net which has been online since 2001 and is accessible via Hotline/KDX protocol using URL hl.preterhuman.net. The following process will get you up to the latest A/UX 3.1.1 release, though be warned you should only run this version on 32-bit clean Macs or you'll have stability issues.

  1. Burn the A/UX 3.0.1 CD image (don't try to mount it first - may corrupt the non-Mac side of the image) to a blank CD
  2. Write the A/UX 3.0.1 installer boot disk to a floppy disk
  3. Boot from the disk with the install CD already in the drive. Perform the install.
  4. Burn the A/UX 3.1 CD image to a blank CD, or you may also find a StuffIt archive of the contents of this update on preterhuman.net's server. May be referred to as AWS 95 Software Upgrade. Run this while logged in as root.
  5. Write the AWS 95 Tune-Up 2.0 disk to a floppy, or extract the image and run it as root. Note that you probably can't run the installer from the same volume as you're installing to.

Notes

  • If you're using a disk larger than 4GB, you may want to install the LaCie SilverLining driver as some Mac hardware may not work properly if the bootable MacPartition exists too far away from the start of the disk. Keep the first 16K assigned to the Apple disk driver and the SilverLining utility will add 64K after it for its driver. Version 5.8.3 seems to work just fine with an 8GB disk in a Macintosh Quadra 700 and can be found in the preterhuman.net Hotline/KDX server.
  • The A/UX easy install can do all the disk partitioning for you but if you choose to make your own layout, you'll want to make your HFS partitions on the disk prior to launching the A/UX installer as the custom partition options for some reason are missing HFS.
  • If you pre-partition the A/UX slices outside of the A/UX installer, they also must be formatted as the installer will try to mount them. It is probably easier just to make your A/UX slices using the HD SC utility inside the A/UX installer. This formats them as you create them.

Configuration

Assign IP address

Once you've done your initial A/UX install, run "newconfig" in a root shell and you will be prompted to configure the Ethernet address details. Your onboard Macintosh Ethernet adapter will likely show up as something like ae0 or ao0. Do NOT try messing with the MacTCP control panel on the Mac side.

Enable networking in /etc/inittab

Edit the /etc/inittab file and make the following line modifications for the networking related options you wish to enable:

nfs0:2:wait:/etc/portmap	#Set to "wait" for networking
net9:2:respawn:/etc/inetd	#Set to "respawn" for networking
net6:2:wait:/etc/syslogd	#Set to "wait" to run a syslog daemon

Assign default network route

After you've assigned an IP address to your network adapter, you'll probably want to assign a default route so you can reach outside networks. Replace "192.168.0.1" in the below line with your actual router gateway.

echo /usr/etc/route add default 192.168.0.1 1 >> /etc/rc

This ensures the route is persistent after a reboot.

Adding nameserver

Like a Linux system, A/UX will use /etc/resolv.conf to store nameservers for domain resolution. This file does not exist by default so you can use the following to add a public DNS resolver:

echo nameserver 8.8.8.8 > /etc/resolv.conf

Adding modules to the kernel

As noted in the section about configuring your network adapter, "newconfig" is used to configure the UNIX kernel for your hardware. You can also use the command to add modules to your kernel. See the examples below:

! adds both the nfs and debugger modules to your kernel
/etc/newconfig -v nfs debugger

! removes debugger module from your kernel
/etc/newconfig -v nodebugger

Running NCSA HTTPd

While compiling a copy of Apache HTTPd might be a more logical option, you can install a pre-compiled version of NCSA HTTPd 1.4.1 found on the old jagubox server (now available at ftp://ftp.atlas.altexxa.net/software/mac/unix/httpd-1.4.1-aux.bin.tar.gz) and serve HTTP with A/UX.

[[email protected]]:/usr/local/etc/httpd$ httpd -v
NCSA httpd version NCSA/1.4.1.
  1. Extract the contents of the tar.gz archive into /usr/local/etc/httpd, or you can store it elsewhere and drop a symlink pointing to your custom location (all the configs expect it at /usr/local/etc/httpd though so might as well put it there)
  2. Change permissions on the contents of the directory so non-root users can read/execute.
  3. Create a logs directory in httpd, and it will probably need to be non-root writable unless you change ownership to the user account you'll assign to HTTPd.
  4. Create an htdocs directory in httpd as this is where the DocumentRoot will be, or create the directory elsewhere and note the location for the conf file edits.
  5. Go into the conf directory and create access.conf, httpd.conf and srm.conf as copies of the existing files with "-dist" at the end of the filename.
  6. Set access.conf to use your correct DocumentRoot path if you've chosen something other than /usr/local/etc/httpd/htdocs
  7. Set httpd.conf lines "User nobody" and "Group sys" or choose another group if you'd like (User nobody should already be set but the existing group line didn't work for me out of the box). You'll also need to update the directory configs if you picked something non-standard. Might also want to define your server name here too.
  8. Set srm.conf for the correct DocumentRoot and other directory paths if you chose something non-standard.
  9. Try starting the service by executing "/usr/local/etc/httpd/httpd" as root, and it should spawn the processes under user "nobody"
  10. To have it start automatically on startup, include a variation of the above line in your /etc/rc file or browse further down this page for instructions on using inittab and an rc.local file to start custom services.

Customization

Using bash shell

You can obtain a compiled binary of the bash shell (also includes info for compiling yourself) from a jagubox mirror (http://polysoft.fr/jagubox/AA.new_files/bash-aux.bin.tar.gz). Place the binary in /bin, perform a "chmod 755", perform a "chown bin", edit the /etc/shells file to include the path /bin/bash as a known shell. Edit the /etc/passwd file and change your desired user account line to use /bin/bash as the shell (instead of /bin/csh for example). Establish a new shell connection and you should be dropped into the bash shell.

User shell profile tweaks

The two changes I wanted to make to my shell profile include adding /usr/local/Gnu (used by the gcc package from jagubox) plus /lib to the path config and also tweaking my shell prompt to be a little more Linux-like. In my case I simply used the Mac side text editor to open the ".profile" file in my A/UX user directory and add to the PATH line. Below is what I've used for my shell prompt.

# OLD
# PS1="`hostname`.$LOGNAME $prmp"
# NEW
PS1="[[email protected]`hostname`]:\w$prmp"

(the above config produces the below prompt with the bash shell)
[[email protected]]:/usr/bin$

Compatible additions to Mac system folder

The "Mac" side of A/UX only went as high as system version 7.0.1. You cannot upgrade this, but you can add elements from other system versions or third party extensions to make the Mac side of things more convenient. Here's a few things you may find convenient to add to your A/UX user's system folder:

  • WindowShade - this control panel from System 7.5 allows you to collapse Mac windows via title bar and appears to work fine
  • DOS Mounter 95 - supports the use of DOS formatted disks as this was not included with the Mac system software until around System 7.5
  • Apple Menu Options - this control panel from System 7.5 allows you to expand a directory tree via the Apple menu for convenient menu browsing
  • Moire v3.0/4.0 - popular Macintosh screensaver which seems to work without any issue
  • DiskLight (Norton 3.2.1) - this may only indicate read/write on HFS volumes though

For A/UX 2.0.1

  • After Dark (2.0u and later) - some displays don't have enough memory to work so the default (low memory) one comes up
  • ATM 2.0.3
  • BlackOut (1.21) - Login screen compatible
  • Desktop Manager (2.0.1)
  • Disinfectant INIT (2.7)
  • DiskTools (3.0)
  • Facade (1.x)
  • Font Porter
  • FMbackup 1.4 (prevents having to totally rebuild Desktop when A/UX crashes)
  • GateKeeper (1.2.5) - For some reason, "Show Log" doesn't work although log entries _are_ made. Chris Johnson knows about this and is looking into it.
  • MacsBug (6.2.x)
  • Moire (3.22) - even works under login screen
  • Suitcase (1.2.6) - the latest version, 1.2.12, doesn't (if you have ATM, you can use Font Porter instead which automatically installs Font suitcases) << ED: well, now I hear that 1.2.6 may not even work... I'll keep you all posted >>
  • Windows (2.1)

Disable graphical login screen

If you want to revert to a full screen text window for your A/UX login instead of the default graphical system, simply changing the attributes of /etc/macgetty so it is not executable will accomplish this as it will fall back to the text version. To launch the traditional Macintosh environment from the full text mode, run "mac32"

Disable autologin

The console will automatically login as the root user by default. You can disable this by removing the file located at "/mac/sys/Login System Folder/Preferences/Autologin" and you'll be prompted with the login screen from now on.

Enable AppleDouble on filesystem

What is AppleDouble? Essentially this is how Apple handles dual fork files on a non-HFS filesystem. Depending on the type of file, a Mac file may have both a resource fork and data fork. This doesn't automatically translate on the A/UX filesystem and it may cause a problem for you depending on your requirements. The following can be placed in /etc/profile for setting globally or placed in an individual user's .profile:

TBFILEFORMAT=1
export TBFILEFORMAT

Mounting extra filesystems during boot

The "fsentry" command is used to update /etc/fstab with any non-default file systems you want to add to your workstation. See the below example:

! fsentry -p 2 -t (type) (block-device) (mount-point)
! type being 4.2 for UFS, 5.2 for SVFS, nfs for NFS
! example below mounts UFS slice 3 of device c405d0 to /usr
fsentry -p 2 -t 4.2 /dev/dsk/c405d0s3 /usr

Increasing Finder memory allocation

A portion of your total system memory will be allocated to the Macintosh Finder for console users logged in to the system. Running in 32-bit mac32 mode, this seems to cap itself at 16MB by default (A/UX 3.0.1 and later) assuming your system has more than that installed (in my case total RAM was 20MB, later upgraded to 68MB). You want to leave A/UX with a large enough chunk of ram to reduce excessive swap use, but if your system has more than 64MB RAM you might want to give the Finder more than 16MB. This is easily done with either of these methods:

  • Login to the Mac console as root and change the option in the Memory control panel from 16M to your desired amount
  • Use the 'TBMEMORY' environment variable. You can set it's "value" equal to the amount of memory you wish to use. For example, TBMEMORY=24m; export TBMEMORY (in .profile for ksh or sh or /etc/profile) or setenv TBMEMORY 24m (in .login for csh) configures Finder for 24M.

Create rc.local to start custom services

While you could just add your services to /etc/rc, we're going to have inittab execute a new rc.local script which will start service such as HTTPd.

1. Edit /etc/inittab and add this line to the file:

lcl0:2:wait:/etc/rc.local 1>/dev/syscon 2>&1                    # Local stuff

2. Create new file /etc/rc.local (make sure its executable) and use the below example which is configured to start NCSA HTTPd in its default location:

#!/bin/sh
:
: rc.local
:

# Push line discipline/set the device so it will print
/etc/line_sane 1
echo " "
echo "Entering rc.local..."
set `/bin/who -r`
if [ "$7" = 2 ]
then
        echo "\tRunning NCSA HTTPd"
        /usr/local/etc/httpd/httpd -d /usr/local/etc/httpd
        sleep 3
fi

echo "Leaving rc.local..."

Kernel Tuning Parameters

Work in progress. These kernel parameters may help with performance. Not for systems with minimal RAM. If NBUF is set too high and SBUFSIZE is still default 4096, this could eat too much of your system memory. Use "pstat -m" and "swap -l" to look at process stats, memory usage and if your system is using swap or not.

NBUF         =       2048
NPROC        =        200
NREGION      =        600
MAXUP        =         75
NCLIST       =        400
NFILE        =       7500
NINODE       =       7500
NCALL        =        500
NMBUFS       =       2000

You can compare these values with what your system currently has active by using kconfig along with grep to give you more relevant output:

[[email protected]]:~$ kconfig -a | grep BUF
NBUF         =         -1
NPBUF        =         64
NMBUFS       =       5000
SBUFSIZE     =       4096

How do you actually change these? As root, run "kconfig -n /unix" and paste the parameter lines you wish to apply to your kernel. Once you're done, hit Control-D on the keyboard to escape back to your shell prompt. Reboot and verify via "kconfig -a" that your parameters have saved.

Notes

  • NMBUFS seems to be default to 1000 in some earlier A/UX versions but 3.1.1 on my system shows this number is now 5000:
[[email protected]]:~$ netstat -m
101/5000 mbufs in use:
        1 mbufs allocated to packet headers
        40 mbufs allocated to socket structures
        55 mbufs allocated to protocol control blocks
        3 mbufs allocated to routing table entries
        2 mbufs allocated to interface addresses
0/128 mapped pages in use
0 interface pages allocated
753 Kbytes allocated to network (1% in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines
  • NBUF is set to -1 at least in my 3.1.1 installation, so its actual value seems to just be based on the amount of total RAM installed. The actual setting can also be adjusted in the Memory control panel as root.

Helpful Commands

Uncompress a .Z archive

The stock A/UX install doesn't include gzip/gunzip and tar will not extract Z files. A number of the A/UX files online such as via jagubox mirror will be in .gz format, so here is how you would extract the gzip archive (http://polysoft.fr/jagubox/Utilities/gzip-124.bin.tar.Z) using zcat and tar:

# zcat gzip-124.bin.tar.Z | tar -xvf -
x gunzip, 52780 bytes, 104 tape blocks
x gunzip.1.Z, 8187 bytes, 16 tape blocks
x gzexe, 3858 bytes, 8 tape blocks
x gzexe.1.Z, 1050 bytes, 3 tape blocks
gzip linked to gunzip
gzip.1.Z linked to gunzip.1.Z
zcat linked to gunzip
zcat.1.Z linked to gunzip.1.Z
x zcmp, 2006 bytes, 4 tape blocks
x zcmp.1.Z, 679 bytes, 2 tape blocks
zdiff linked to zcmp
zdiff.1.Z linked to zcmp.1.Z
x zforce, 1010 bytes, 2 tape blocks
x zforce.1.Z, 565 bytes, 2 tape blocks
x zgrep, 1339 bytes, 3 tape blocks
x zgrep.1.Z, 805 bytes, 2 tape blocks
x zmore, 1074 bytes, 3 tape blocks
x zmore.1.Z, 2708 bytes, 6 tape blocks
x znew, 3508 bytes, 7 tape blocks
x znew.1.Z, 833 bytes, 2 tape blocks

Drop the extracted gzip/gunzip binaries into somewhere like /usr/bin and set permissions so normal users can run them.

Uncompress a .gz archive

First do the above process for extracting the gzip binary downloaded from a jagubox mirror. Copy the binaries such as gzip/gunzip to a convenient path such as /usr/bin. Any user should now be able to uncompress .gz archives:

# gunzip telnet-aux.tar.gz

The following should also do both the tar/gz at once:

gzip -dc <filename.tar.gz> | tar xvfmo -

Reread /etc/inittab with init

This might be helpful if you make a change to your /etc/inittab settings and want to have the system recognize it.

init Q

Terminate all Mac applications including Finder

This isn't an A/UX command but a keystroke that may help if your Mac environment has crashed. Press "COMMAND-CONTROL-E" and A/UX will attempt to quit all applications and logout of the Mac environment.

Using netstat

View the routing table

This is done using "netstat -r" in this example:

[[email protected]]:~$ netstat -r
Routing tables
Destination      Gateway            Flags     Refs     Use  Interface
localhost        localhost          UH          3       36  lo0
default          10.16.1.1          UG          0        0  ao0
10.16.1          apollo             U           3      104  ao0

View all open sockets

Similar to other *nix systems, this is done using "netstat -a" in this example:

[[email protected]]:~$ netstat -a
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp        0      0  localhost.1033         localhost.sunrpc       TIME_WAIT
tcp        0      0  apollo.telnet          10.16.1.59.64060       ESTABLISHED
tcp        0      0  *.time                 *.*                    LISTEN
tcp        0      0  *.daytime              *.*                    LISTEN
tcp        0      0  *.chargen              *.*                    LISTEN
tcp        0      0  *.discard              *.*                    LISTEN
tcp        0      0  *.echo                 *.*                    LISTEN
tcp        0      0  *.finger               *.*                    LISTEN
tcp        0      0  *.uucp                 *.*                    LISTEN
tcp        0      0  *.exec                 *.*                    LISTEN
tcp        0      0  *.login                *.*                    LISTEN
tcp        0      0  *.shell                *.*                    LISTEN
tcp        0      0  *.telnet               *.*                    LISTEN
tcp        0      0  *.ftp                  *.*                    LISTEN
tcp        0      0  *.sunrpc               *.*                    LISTEN
(snip)

View all processes

Similar to other *nix systems, "ps -ef" will show all processes in the below example. You can also utilize grep to find specifics in the output.

[[email protected]]:~$ ps -ef
     UID   PID  PPID  C    STIME TTY      TIME COMMAND
    root     0     0  0 16:00:41 ?        0:00 swapper
    root     1     0  0 16:00:41 ?        0:01 /etc/init
    root     2     0  0 16:00:41 ?        0:00 vhand
    root     3     0  0 16:00:41 ?        0:00 kmemd
    root     4     0  0 16:00:41 ?        0:00 asiod
    root     5     0  0 16:00:41 ?        0:00 asiod
    root     6     0  0 16:00:41 ?        0:00 asiod
    root     7     0  0 16:00:41 ?        0:00 asiod
    root     8     0  0 16:00:41 ?        0:00 syncd
    root   142     1  0 16:01:09 ?        0:00 /etc/inetd
    root    11     1  0 16:00:42 ?        0:00 /etc/fidd
    root   147     1  0 16:01:12 console  0:01 /etc/macgetty
    root   132     1  0 16:01:08 ?        0:00 /usr/lib/errdemon
    root   150   147  0 16:01:13 console  0:00 sh -c /mac/bin/startmac -o minimal -m8
    root   137     1  0 16:01:08 ?        0:00 /etc/portmap
    root   140     1  0 16:01:09 ?        0:00 /etc/cron
    root   151   150  0 16:01:13 console  0:09 /mac/bin/startmac -o minimal -m8m -s /
    root   152   151  1 16:01:23 console  0:28 /mac/sys/Login System Folder/Login
    root   153   142  1 16:01:58 p0       0:00 in.telnetd a10013b.64060
netfreak   154   153  0 16:01:58 p0       0:01 -bash
netfreak   174   154 13 16:16:30 p0       0:00 ps -ef

View process usage

Use the pstat command to view statistical information and memory usage from processes.

[[email protected]]:~$ pstat -m
8291 buffers: 0 busy, 0 wanted, 778 done, 7512 nodev
129 out of 144 UFS inodes active
27 out of 100 processes active
78 out of 102 files active

Total memory = 69604K, currently free = 25592K

Getting Newer Software Packages

Even the latest version of A/UX is ancient at this point and you may want to replace some of the included software with slightly newer versions. Since this is a newbie guide, we're going to focus more on pre-compiled binaries or other easy to compile software. The old jagubox server was a great source for this sort of stuff but you can still find some information at http://www.nleymann.de/appleAUX/AppleAUXMain.htm

tar 1.13

The version of tar included in A/UX 3.1.1 has some limitations which may or may not annoy you. The source plus a compiled binary can be found at ftp://ftp.atlas.altexxa.net/software/mac/unix/tar-1.13.tar.gz so just do the following:

  1. Backup your current /usr/bin/tar binary
  2. Download/extract the tar-1.13 archive and find the newer binary located at ./tar-1.13/bin/tar
  3. Copy the new tar to /usr/bin, chown it to "bin" and chmod +rx

lynx 2.8.3rel.1

A/UX doesn't come with lynx in the first place. If you want to do text web browsing, this is for you. Download the compiled binary at ftp://ftp.atlas.altexxa.net/software/mac/unix/lynx-2.8.3.rel1.tar.gz and do the following:

  1. Create /usr/local/gnu (yes with a lowercase "g" and you may already have a directory named "Gnu" here) as this compiled binary is configured to use only that location
  2. Assuming you don't also already have paths /usr/local/gnu/bin and /usr/local/gnu/lib, create those too. Don't forget to add +rx for non-root users
  3. Extract the lynx archive, copy ./lynx-2.8.3.rel1/bin/lynx to /usr/local/gnu/bin and copy ./lynx-2.8.3.rel1/lib/lynx.cfg to /usr/local/gnu/lib
  4. Either add /usr/local/gnu/bin to your shell search path or take a shortcut with adding a symlink to /usr/local/gnu/bin/lynx in /usr/bin or something
  5. Execute "lynx" in your shell

Rob Braun's /usr/local dump

If you're interested in getting a giant archive of /usr/local with a bunch of compiled stuff, grab ftp://ftp.atlas.altexxa.net/software/mac/unix/robbraun/aux-usr.local-10172010.tar.bz2 (tar will try overwriting your existing /usr/local so if you don't want to do that, grab the newer tar first as it supports -C flag). What's in this archive? apache-2.2.16, bash-3.2.48, curl-7.21.2, gawk-3.0.6, glib-2.16.6, grep-2.4.2, libpng-1.4.4, libxml2-2.7.7, make-3.79.1, ncurses-5.7, openssh-5.6p1, openssl-1.0.0a, patch-2.5.9, perl5.005_4, readline-6.1, rsync-2.6.9, subversion-1.6.13, tiff-3.8.2, wget-1.6, zlib-1.2.5 plus a whole lot more.

Compiling A/UX Software

Installing GCC

Since this is a newbie guide, this will only discuss GCC 2.7.2 from the old jagubox server as it is packaged specifically for A/UX. Download the archive ftp://ftp.atlas.altexxa.net/software/mac/unix/gcc-2.7.2.bin.tar.gz to your workstation and extract it. As root, execute the "install-gcc-aux" script. On my Quadra 700 the install script took more than 30 minutes or so. As mentioned earlier on this page, you'll probably need to update your user profile PATH attributes for /usr/local/Gnu.

Compiler Options

(from http://www.nleymann.de/appleAUX/) Make sure that the "-g" option is switched off. The debugging options produces objects files which are 10-100 times bigger than the optimized versions. This will usually result in an "out of memory" message from the linker. "-g" is the standard option used by the gnu configure scripts! Use something like 'CFLAGS="-O" ./configure <other options>'

Apache

Notes from a comp.unix.aux thread indicate "CFLAGS= -O2 -DPEM_AUTH -DDBM_AUTH" should be used for compiling Apache (plus the dist modifications used on NCSA HTTPd)

/bin/sh vs. /bin/ksh

(from http://www.nleymann.de/appleAUX/) The standard /bin/sh which comes with A/UX is broken and causes the confiure scripts to terminate. As a simple workaround replace /bin/sh with /bin/ksh in the configure scripts.