installing TCP programs when RPC programs are running
Today, cupsys failed to start after its installation because a RPC
service (rpc.statd) was already listening on TCP port 631.
I wondered how portmap assigned such a port, and looked it up in glibc.
portmap uses svctcp_create to create such a socket. svctcp_create
calls bindresvport to get a socket on a priviledged port. The port is
choosen between 600 and 1023, starting with port = (__getpid () % 424)
+ 600, then checking each port until an unused port is found (it wraps
around at 1023).
This causes random errors -- like on my system -- when a RPC service is
already listening and you install a program which should listen on a
This won't happen if you reboot your system, since RPC programs are
registered after TCP/UDP daemons.
I see no obvious solution to this:
- you can't know in advance which port will be needed when new packages
- you can't move a RPC service to another port when you notice you need
The best option would be for RPC services to ue a "port pool", not
overlapping standard ports, but this might be impossible.
For now, it would be nice to document this behavior, but it wouldn't
help the admin much if all daemons produce a different error message.
Loïc Minier <email@example.com>