So I gathered more problem data.  I'll send you a complete strace.

Interesting findings are:

The debconf frontend is receiving netrekd output, vis:

18:26:50.928785 read(8, "/usr/games/netrekd already runni"..., 4096) = 36
18:26:51.337009 write(7, "20 Unsupported command \"/usr/gam"..., 124) = 124
18:26:51.337740 read(8, "GET netrek-server-vanilla/start_"..., 4096) = 40

The postinst is running twice.

/sbin/start-stop-daemon is running twice.

netrekd is failing the second time, since netrekd is already running,
and this is presumably translated into the exit code of 128.

More details, from an older, briefer, strace:

# strace -o netrek-server-vanilla.log -ff -tt -e trace=process apt-get
install netrek-server-vanilla

Analysis:

# grep "= 20" netrek-server-vanilla.log.*
netrek-server-vanilla.log.8185:18:05:31.713671 waitpid(8186, [{WIFEXITED(s) && WEXITSTATUS(s) == 20}], 0) = 8186
netrek-server-vanilla.log.8186:18:05:32.716516 waitpid(8216, [{WIFEXITED(s) && WEXITSTATUS(s) == 20}], 0) = 8216

# grep exec netrek-server-vanilla.log.8216
18:05:32.475662 execve("/var/lib/dpkg/info/netrek-server-vanilla.postinst", ["/var/lib/dpkg/info/netrek-server"..., "configure", ""], [/* 27 vars */]) = 0

Shows that the postinst which was pid 8216 returned 20.

# grep waitpid *|grep -v ECHILD|grep -v "== 0"|grep -v "WNOHANG) = 0"
netrek-server-vanilla.log.8155:18:05:33.529676 waitpid(8185, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], WNOHANG) = 8185
netrek-server-vanilla.log.8164:18:05:29.628314 waitpid(8165, [{WIFEXITED(s) && WEXITSTATUS(s) == 2}], 0) = 8165
netrek-server-vanilla.log.8175:18:05:30.107804 waitpid(8176, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0) = 8176
netrek-server-vanilla.log.8181:18:05:30.335249 waitpid(8183, 0xbfb59ff8, 0) = ? ERESTARTSYS (To be restarted)
netrek-server-vanilla.log.8185:18:05:31.713671 waitpid(8186, [{WIFEXITED(s) && WEXITSTATUS(s) == 20}], 0) = 8186
netrek-server-vanilla.log.8186:18:05:32.716516 waitpid(8216, [{WIFEXITED(s) && WEXITSTATUS(s) == 20}], 0) = 8216

Shows that no processes after 8216 exited badly.  So we look at what the
postinst forks.

# grep clone *8216
18:05:32.491265 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7e4b6f8) = 8217
18:05:32.509873 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7e4b6f8) = 8218
18:05:32.520091 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7e4b6f8) = 8219
18:05:32.544409 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7e4b6f8) = 8220
18:05:32.554564 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7e4b6f8) = 8222

Therefore it forked 8217, 8218, 8219, 8220, and 8222.  What did the
postinst see as exit status?

# grep wait *8216|grep -v ECHILD
18:05:32.508963 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG) = 8217
18:05:32.518481 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG) = 8218
18:05:32.535303 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 8219
18:05:32.553460 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG) = 8220
18:05:32.570311 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 8222

Nothing unusual.  What are these processes, what did they exec?

# grep exec *8217 *8218 *8219 *8220 *8222
netrek-server-vanilla.log.8217:18:05:32.492441 execve("/bin/chown", ["chown", "-R", "games:", "/var/lib/netrek-server-vanilla"], [/* 28 vars */]) = 0
netrek-server-vanilla.log.8218:18:05:32.511048 execve("/bin/chmod", ["chmod", "2755", "/var/lib/netrek-server-vanilla"], [/* 28 vars */]) = 0
netrek-server-vanilla.log.8219:18:05:32.521517 execve("/usr/sbin/update-rc.d", ["update-rc.d", "netrek-server-vanilla", "defaults"], [/* 28 vars */]) = 0
netrek-server-vanilla.log.8222:18:05:32.555782 execve("/usr/sbin/invoke-rc.d", ["invoke-rc.d", "netrek-server-vanilla", "start"], [/* 28 vars */]) = 0

Odd, 8220 didn't exec.  Ah, because it immediately forked 8221, "which
invoke-rc.d"

Looking now at the postinst, the chown and chmod worked, the update-rc.d
worked, the invoke-rc.d worked, and so it points at the lines below that
as being a cause ...

# Source debconf library.
. /usr/share/debconf/confmodule

# Check user's answer
db_get netrek-server-vanilla/start_on_boot
if [ "$RET" = "true" ]; then
        /usr/sbin/update-rc.d netrek-server-vanilla defaults > /dev/null
fi

# Do not add the DEBHELPER stuff, we are doing the above ourselves.
exit 0

-- 
server runs as root unecessarily
https://bugs.launchpad.net/bugs/272338
You received this bug notification because you are a member of Netrek
Server Team, which is a direct subscriber.

Status in Netrek Server: In Progress

Bug description:
The server runs as root, but it does not need to.

To run as non-root, the packaging should create a username to operate within, and chmod /var/lib/netrek-server-vanilla, and the init.d script should use the created username.  A username of netrek is suggested.