Discussion:
Installing Postgresql on Linux Friendlyarm
Xiang Gan
2014-09-22 08:22:45 UTC
Permalink
Hi,

I'm newbie here so I'm sorry if this is posted in wrong place.

I tried to install Postgresql 9.2.9 on Linux Friendlyarm. The Postgresql
was cross compiled (use arm-linux-gcc 4.4.3) successfully on my desktop Ubuntu. Then it was moved to
Linux Friendlyarm environment. When I tried to start the Postgresql server, however,
it gives me the following errors:

LOG: could not create IPv4 socket: Permission denied
WARNING: could not create listen socket for "127.0.0.1"
FATAL: could not create any TCP/IP sockets


The kernel info. of my Linux friendlyarm is as follows:
Linux FriendlyARM 2.6.35.7-FriendlyARM #1 PREEMPT Thu Mar 1 17:38:57 HKT 2012 arm7l GNU/Linux.

Anyone could provide some help about this?
Thanks in advance!

Gerry
Adrian Klaver
2014-09-22 13:15:36 UTC
Permalink
Post by Xiang Gan
Hi,
I'm newbie here so I'm sorry if this is posted in wrong place.
I tried to install Postgresql 9.2.9 on Linux Friendlyarm. The Postgresql
was cross compiled (use arm-linux-gcc 4.4.3) successfully on my desktop
Ubuntu. Then it was moved to
Linux Friendlyarm environment. When I tried to start the Postgresql server, however,
LOG: could not create IPv4 socket: Permission denied
WARNING: could not create listen socket for "127.0.0.1"
FATAL: could not create any TCP/IP sockets
Linux FriendlyARM 2.6.35.7-FriendlyARM #1 PREEMPT Thu Mar 1 17:38:57 HKT
2012 arm7l GNU/Linux.
Anyone could provide some help about this?
The user you are running Postgres as does not the permissions to create
an IPv4 socket. I know nothing about Linux FriendlyArm, so I don't know
where to go from here. I would say ask the FriendlyArm forum, but I see
you have already done that.
Post by Xiang Gan
Thanks in advance!
Gerry
--
Adrian Klaver
***@aklaver.com
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Xiang Gan
2014-09-23 02:26:00 UTC
Permalink
OK. So a stupid question, whether there is any possibility to run Postgresql as root? (I know this is forbidden generally. But what I find out is that in Linux FriendlyArm environment, root could create socket while non-root user does not have such privilege)

Kind regards,
Gerry
Post by Xiang Gan
Hi,
I'm newbie here so I'm sorry if this is posted in wrong place.
I tried to install Postgresql 9.2.9 on Linux Friendlyarm. The Postgresql
was cross compiled (use arm-linux-gcc 4.4.3) successfully on my desktop
Ubuntu. Then it was moved to
Linux Friendlyarm environment. When I tried to start the Postgresql server, however,
LOG: could not create IPv4 socket: Permission denied
WARNING: could not create listen socket for "127.0.0.1"
FATAL: could not create any TCP/IP sockets
Linux FriendlyARM 2.6.35.7-FriendlyARM #1 PREEMPT Thu Mar 1 17:38:57 HKT
2012 arm7l GNU/Linux.
Anyone could provide some help about this?
The user you are running Postgres as does not the permissions to create
an IPv4 socket. I know nothing about Linux FriendlyArm, so I don't know
where to go from here. I would say ask the FriendlyArm forum, but I see
you have already done that.
Post by Xiang Gan
Thanks in advance!
Gerry
--
Adrian Klaver
***@aklaver.com
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Tom Lane
2014-09-23 02:39:22 UTC
Permalink
Post by Xiang Gan
OK. So a stupid question, whether there is any possibility to run Postgresql as root? (I know this is forbidden generally. But what I find out is that in Linux FriendlyArm environment, root could create socket while non-root user does not have such privilege)
So, it's not so much FriendlyArm as StupidAndUselessArm? What sort of nut
would think that all network services should run as root?

The short answer to your question is that if you're so inclined, you
can easily find and dike out the no-root check in the server source
code. But the Postgres project never has and never will publish a
version with that check removed or compromised in any way, and we will
not provide support if you have any problems running the server that way.
We do not believe it's advisable to run network-accessible services
as root.

regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Abelard Hoffman
2014-09-23 06:29:06 UTC
Permalink
Post by Xiang Gan
Post by Xiang Gan
OK. So a stupid question, whether there is any possibility to run
Postgresql as root? (I know this is forbidden generally. But what I find
out is that in Linux FriendlyArm environment, root could create socket
while non-root user does not have such privilege)
Typically, applications open the port as root and then change to low
privilege for the actual service.
See also this thread:

http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l
Vick Khera
2014-09-23 13:55:40 UTC
Permalink
On Tue, Sep 23, 2014 at 2:29 AM, Abelard Hoffman
Post by Abelard Hoffman
Typically, applications open the port as root and then change to low
privilege for the actual service.
http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l
Postgres does not use a privileged port, so this is not necessary.
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Xiang Gan
2014-09-25 06:34:33 UTC
Permalink
Finally, I managed to run Postgresql in Linux FriendlyARM environment. It seems that Postgresql server starts to work, however, it prints out some WARNING info. during the start. The error info. is as follows:

LOG: could not resolve "localhost": Temporary failure in name resolution
LOG: disabling statistics collector for lack of working socket
WARNING: autovacuum not started because of misconfiguration
HINT: Enable the "track_counts" option.


So the above log indicates that autovacuum failed to start mainly due to the problem that "localhost" cannot be resolved as 127.0.0.1? But I can ping localhost from command line without any problem. My /etc/hosts file reads as:
127.0.0.1 localhost.localdomain localhost

In addition, options "autovacuum" and "track_counts" are turned on by default in postgresql.conf file. But in database, with command "show autovacuum", its value is shown as "on" while with command "show track_counts", its value is shown as "off".

Could anyone provide some hints about how to handle this kind of problem?

Kind regards,
Gerry
Post by Xiang Gan
OK. So a stupid question, whether there is any possibility to run Postgresql as root? (I know this is forbidden generally. But what I find out is that in Linux FriendlyArm environment, root could create socket while non-root user does not have such privilege)
So, it's not so much FriendlyArm as StupidAndUselessArm? What sort of nut
would think that all network services should run as root?

The short answer to your question is that if you're so inclined, you
can easily find and dike out the no-root check in the server source
code. But the Postgres project never has and never will publish a
version with that check removed or compromised in any way, and we will
not provide support if you have any problems running the server that way.
We do not believe it's advisable to run network-accessible services
as root.

regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Adrian Klaver
2014-09-25 13:58:00 UTC
Permalink
Post by Xiang Gan
LOG: could not resolve "localhost": Temporary failure in name resolution
LOG: disabling statistics collector for lack of working socket
WARNING: autovacuum not started because of misconfiguration
HINT: Enable the "track_counts" option.
127.0.0.1 localhost.localdomain localhost
In addition, options "autovacuum" and "track_counts" are turned on by default in postgresql.conf file. But in database, with command "show autovacuum", its value is shown as "on" while with command "show track_counts", its value is shown as "off".
There is a cascading effect. The statistics collector needs a working
socket and autovacuum needs a working statistics collector, in
particular track_counts. You fix the socket/networking issues the other
issues should resolve.
Post by Xiang Gan
Could anyone provide some hints about how to handle this kind of problem?
Well this going to depend greatly on what you did to get to this phrase
'I managed to run Postgresql in Linux FriendlyARM environment.'.

So a detailed explanation on how you got Postgres to sort of start would
be in order.
Post by Xiang Gan
Kind regards,
Gerry
--
Adrian Klaver
***@aklaver.com
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Loading...