Weird, email got blocked. Tryin web interface.

On Sep 23, 2008, at 5:54 PM, James Cameron wrote:

>Why might you have missed this?  A removal of the package before
>anything is created in /var/lib/netrek-server-vanilla results in the
>/var/lib/netrek-server-vanilla directory being removed.  But if anything
>is created inside this directory, the package removal does not remove
>the directory.


I do not use dpkg directly?

Install with apt-get

root at ubuntu-8:/etc/apt/sources.list.d# apt-get install netrek-server-vanilla
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
 libgmp3c2
The following NEW packages will be installed:
 libgmp3c2 netrek-server-vanilla
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 917kB/1353kB of archives.
After this operation, 3396kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
 netrek-server-vanilla
Install these packages without verification [y/N]? y
Get:1 http://ppa.launchpad.net hardy/main netrek-server-vanilla 2.13.0ubuntu0.4 [917kB]
Fetched 917kB in 10s (87.1kB/s)
Preconfiguring packages ...
debconf (developer): starting /tmp/netrek-server-vanilla.config.219461 configure
Selecting previously deselected package libgmp3c2.
(Reading database ... 13344 files and directories currently installed.)
Unpacking libgmp3c2 (from .../libgmp3c2_2%3a4.2.2+dfsg-1ubuntu2_i386.deb) ...
Selecting previously deselected package netrek-server-vanilla.
Unpacking netrek-server-vanilla (from .../netrek-server-vanilla_2.13.0ubuntu0.4_i386.deb) ...
Setting up libgmp3c2 (2:4.2.2+dfsg-1ubuntu2) ...

Setting up netrek-server-vanilla (2.13.0ubuntu0.4) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place

Confirm we are games:games

root at ubuntu-8:/etc/apt/sources.list.d# ls -dl /var/lib/netrek-server-vanilla/
drwxr-sr-x 5 games games 4096 Sep 23 23:29 /var/lib/netrek-server-vanilla/

Start netrek server

root at ubuntu-8:/etc/apt/sources.list.d# /etc/init.d/netrek-server-vanilla start
Starting /usr/games/netrekd...
netrekd: Vanilla Netrek Listener 2.14.0 started, pid 22038,
netrekd: logging to /var/lib/netrek-server-vanilla/log

Confirm write perms and process

root at ubuntu-8:/etc/apt/sources.list.d# ls -l /var/lib/netrek-server-vanilla/
total 20
drwxr-xr-x 7 games games 4096 Sep 23 23:29 blog
drwxr-xr-x 3 games games 4096 Sep 23 23:29 ip
-rw------- 1 games games  609 Sep 23 23:32 log
-rw-r--r-- 1 games games    6 Sep 23 23:32 netrekd.pid
-rw-r--r-- 1 games games    0 Sep 23 18:25 planets
drwxr-xr-x 3 games games 4096 Sep 23 23:29 www

root at ubuntu-8:/etc/apt/sources.list.d# ps -ef | grep netrek
games    22038     1  0 23:32 pts/1    00:00:00 /usr/games/netrekd

Stop netrek server, confirm, check /var/lib/netrek-server/vanilla

root at ubuntu-8:/etc/apt/sources.list.d# /etc/init.d/netrek-server-vanilla stop
Stopped /usr/games/netrekd (pid 22038).
root at ubuntu-8:/etc/apt/sources.list.d# ps -ef | grep netrek
root     22058 21849  0 23:33 pts/1    00:00:00 grep netrek
root at ubuntu-8:/etc/apt/sources.list.d# ls -l /var/lib/netrek-server-vanilla/
total 20
drwxr-xr-x 7 games games 4096 Sep 23 23:29 blog
drwxr-xr-x 3 games games 4096 Sep 23 23:29 ip
-rw------- 1 games games  609 Sep 23 23:32 log
-rw-r--r-- 1 games games    6 Sep 23 23:32 netrekd.pid
-rw-r--r-- 1 games games    0 Sep 23 18:25 planets
drwxr-xr-x 3 games games 4096 Sep 23 23:29 www

Use apt-get to remove and purge netrek-server-vanilla

root at ubuntu-8:/etc/apt/sources.list.d# apt-get remove --purge netrek-server-vanilla
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
 libgmp3c2
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
 netrek-server-vanilla*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 2687kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 13474 files and directories currently installed.)
Removing netrek-server-vanilla ...
Purging configuration files for netrek-server-vanilla ...
debconf (developer): frontend started
debconf (developer): frontend running, package name is netrek-server-vanilla
debconf (developer): starting /var/lib/dpkg/info/netrek-server-vanilla.postrm purge
debconf (developer): <-- PURGE
debconf (developer): --> 0
dpkg - warning: while removing netrek-server-vanilla, directory `/var/lib/netrek-server-vanilla' not empty so not removed.

I believe the above warning is the proper and documented behavior (I
commented in IRC about it)

Ok, so lets re-install via apt-get

root at ubuntu-8:/etc/apt/sources.list.d# apt-get install netrek-server-vanilla
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
 netrek-server-vanilla
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/917kB of archives.
After this operation, 2687kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
 netrek-server-vanilla
Install these packages without verification [y/N]? y
Preconfiguring packages ...
debconf (developer): starting /tmp/netrek-server-vanilla.config.221441 configure
Selecting previously deselected package netrek-server-vanilla.
(Reading database ... 13357 files and directories currently installed.)
Unpacking netrek-server-vanilla (from .../netrek-server-vanilla_2.13.0ubuntu0.4_i386.deb) ...
Setting up netrek-server-vanilla (2.13.0ubuntu0.4) ...

Check ownership of /var/lib/netrek-server-vanilla

root at ubuntu-8:/etc/apt/sources.list.d# ls -dl /var/lib/netrek-server-vanilla/
drwxr-sr-x 5 games games 4096 Sep 23 23:38 /var/lib/netrek-server-vanilla/

root at ubuntu-8:/etc/apt/sources.list.d# ls -l /var/lib/netrek-server-vanilla/
total 20
drwxr-xr-x 7 games games 4096 Sep 23 23:38 blog
drwxr-xr-x 3 games games 4096 Sep 23 23:38 ip
-rw------- 1 games games  609 Sep 23 23:32 log
-rw-r--r-- 1 games games    6 Sep 23 23:32 netrekd.pid
-rw-r--r-- 1 games games    0 Sep 23 18:25 planets
drwxr-xr-x 3 games games 4096 Sep 23 23:38 www

Start netrek again, checking files, perms, etc...
root at ubuntu-8:/etc/apt/sources.list.d# /etc/init.d/netrek-server-vanilla start
Starting /usr/games/netrekd...
netrekd: Vanilla Netrek Listener 2.14.0 started, pid 22213,
netrekd: logging to /var/lib/netrek-server-vanilla/log
root at ubuntu-8:/etc/apt/sources.list.d# ls -dl /var/lib/netrek-server-vanilla/
drwxr-sr-x 5 games games 4096 Sep 23 23:40 /var/lib/netrek-server-vanilla/

root at ubuntu-8:/etc/apt/sources.list.d# ls -l /var/lib/netrek-server-vanilla/
total 20
drwxr-xr-x 7 games games 4096 Sep 23 23:38 blog
drwxr-xr-x 3 games games 4096 Sep 23 23:38 ip
-rw------- 1 games games 1218 Sep 23 23:40 log
-rw-r--r-- 1 games games    6 Sep 23 23:40 netrekd.pid
-rw-r--r-- 1 games games    0 Sep 23 18:25 planets
drwxr-xr-x 3 games games 4096 Sep 23 23:38 www

root at ubuntu-8:/etc/apt/sources.list.d# ps -ef | grep netrek
games    22213     1  0 23:40 pts/1    00:00:00 /usr/games/netrekd
root     22221 21849  0 23:40 pts/1    00:00:00 grep netrek

I'll try your dpkg direct way as well.

-- 
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.