Finding and stopping a running netldi on the machine
If starting a netldi fails with bind(...) failed with Address already in use, another netldi is already using that port. Often it belongs to a different GT image or GemStone installation on the same machine. The steps below find that process, show how it was started, and stop it cleanly.
The port number is in the netldi log excerpt (e.g. Using OS translation of service name gs64ldi to port ...). -n -P show raw addresses and port numbers. Only lines in the LISTEN state matter; any other lines are client connections.
stopnetldi and stopstone look for servers through the lock files in $GEMSTONE_GLOBAL_DIR. If the server was started with a different GEMSTONE or GEMSTONE_GLOBAL_DIR (setup scripts often use a per-workspace one), they report
"Server ... is not running"
even though it is. The shell snippet below reads the environment the process was launched with and stores it in the page variable gemstoneEnv. The Pharo snippet after it extracts gemstoneHome and gemstoneGlobalDir from that output. Run both, in order.
"Parse the shell output into page variables used by the stop snippet below" | env | env := (gemstoneEnv lines collect: [ :each | (each copyUpTo: $=) -> (each copyAfter: $=) ]) asDictionary. gemstoneHome := env at: 'GEMSTONE'. gemstoneGlobalDir := env at: 'GEMSTONE_GLOBAL_DIR' ifAbsent: [ '/opt/gemstone' ]. env
Lepiter passes gemstoneHome and gemstoneGlobalDir from step 2 to the snippet below as environment variables (it does this for any string page variable whose name appears in a shell script). gslist -l lists the servers registered there. The snippet also stops the stone, since it would clash on its name too; if no stone is running, stopstone just reports that. Use these commands instead of kill: they shut the servers down cleanly and remove the lock files. Check the gslist output first: this stops whatever is on the port, even your current installation.
Run step 1 again; it should print nothing. To start the old servers again later, use the step 3 snippet with the last three lines replaced by startnetldi -g gs64ldi and startstone gs64stone. Run that before stopping the servers, or set gemstoneHome and gemstoneGlobalDir yourself: once the netldi is stopped, step 2 can't find them.