# [SOLVED] PostgreSQL  invalid value for parameter "port": ""

## K1LL3R DO6

I tried to start postgresql today but I can't.

I re-emerge postgresql-server and postgresql-base but didn't work.

```

/etc/init.d/postgresql-8.4 start

 * Starting PostgreSQL ...

waiting for server to start...could not start server

FATAL:  invalid value for parameter "port": ""                      [ !! ]

```

The init script shows

```

start() {

    checkconfig || return 1

    ebegin "Starting PostgreSQL"

    if [ -f "$PGDATA/postmaster.pid" ] ; then

        rm -f "$PGDATA/postmaster.pid"

    fi

    local retval

    su -l ${PGUSER} \

        -c "env PGDATA=\"${PGDATA}\" PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} /usr/lib/postgresql-8.4/bin/pg_ctl start ${WAIT_FOR_START} -t ${START_TIMEOUT} -s -o '--silent-mode=true ${PGOPTS}'"

    retval=$?

    if [[ $retval != 0 ]] ; then

        eend $retval

        return $retval

    fi

    # The following is to catch the case of an already running server

    # in which pg_ctl doesn't know to which server it connected to and

    # falsely reports the server as 'up'

    sleep 2

    if [ ! -f "$PGDATA/postmaster.pid" ] ; then

        eerror "The PID file doesn't exist but pg_ctl reported a running server."

        eerror "Please check whether there is another server running on the same port or read the log-file."

        eend 1

        return 1

    fi

    local pid=$(grep "^[0-9]\+" "$PGDATA/postmaster.pid")

    ps -p "${pid}" &> /dev/null

    eend $?

}

```

emerge --info

```

Portage 2.1.8.3 (default/linux/x86/10.0/desktop, gcc-4.3.4, glibc-2.11.2-r0, 2.6.31-gentoo-r6 i686)

=================================================================

System uname: Linux-2.6.31-gentoo-r6-i686-Genuine_Intel-R-_CPU_T1350_@_1.86GHz-with-gentoo-1.12.13

Timestamp of tree: Fri, 29 Oct 2010 23:30:01 +0000

app-shells/bash:     4.1_p7

dev-java/java-config: 2.1.11

dev-lang/python:     2.5.4-r3, 2.6.5-r3, 3.1.2-r4

dev-util/cmake:      2.8.1-r2

sys-apps/baselayout: 1.12.13

sys-apps/sandbox:    2.3-r1

sys-devel/autoconf:  2.13, 2.65-r1

sys-devel/automake:  1.5, 1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:  2.20.1-r1

sys-devel/gcc:       4.3.4, 4.4.4-r2

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.10

sys-devel/make:      3.81-r2

virtual/os-headers:  2.6.30-r1

ACCEPT_KEYWORDS="x86"

ACCEPT_LICENSE="* -@EULA dlj-1.1"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests collision-protect distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"

GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/ "

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en es"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X a52 aac acl acpi alsa apm avi berkdb bluetooth branding bzip2 cairo cdparanoia cdr cli consolekit cracklib crypt ctype cups cxx dbus dga directfb divx dri dts dvd dvdr dvdread emboss encode exif fam ffmpeg firefox flac fortran gdbm gif gmedia gnome gnutls gpm gtk hal iconv imagemagick imlib ipv6 java jpeg lcms libcaca libnotify live lm_sensors lzo mad mikmod mmx mng modules mp3 mp4 mpeg mplayer msn mudflap ncurses nls nptl nptlonly nsplugin offensive ogg oggvorbis openal opengl openmp pam pango pcre pdf perl pmu png posix postgres ppds pppd python qt3support quicktime readline realmedia rss rtc scanner sdl session sndfile spell srt sse sse2 ssl startup-notification svg sysfs tcl tcpd theora tiff tk truetype type1 unicode usb vcd vhosts vorbis wifi win32codecs wmp x264 x86 xanim xcb xcomposite xinerama xml xorg xulrunner xv xvid xvmc zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop          empty extplug file hooks iec958 ioplug          ladspa lfloat linear meter mulaw multi          null plug rate route share shm softvol          mmap_emul" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en es" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel vesa vmware" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

```

postgresql.conf http://pastebin.ca/1976804

pg_hba.conf http://pastebin.ca/1976805

I need help pleaseLast edited by K1LL3R DO6 on Sun Oct 31, 2010 9:10 pm; edited 1 time in total

----------

## Ant P.

Post the conf.d file.

----------

## K1LL3R DO6

conf.d/postgresql-8.4

```

# PostgreSQL's Database Directory

PGDATA="/var/lib/postgresql/8.4/data"

# PostgreSQL User

PGUSER="postgres"

# PostgreSQL Group

PGGROUP="postgres"

# Extra options to run postmaster with, e.g.:

# -N is the maximal number of client connections

# -B is the number of shared buffers and has to be at least 2x the value for -N

# Please read the man-page to postmaster for more options. Many of these options

# can be set directly in the configuration-file.

#PGOPTS="-N 512 -B 1024"

# Pass extra environment variables 

# If you have to export environment variables for the database process,

# this can be done here.

#PG_EXTRA_ENV=""

# SERVER SHUTDOWN:

# The server will receive 3 signals in the worst case:

# 1. SIGTERM

#  This signals the server to ignore new connections and to

#  wait for all clients to end their transactions before shutting down.

#  Use WAIT_FOR_DISCONNECT to control how much time the clients

#  should have until the next signal is being sent.

# 2. SIGINT

#  Tell the server to forcefully disconnect all clients.

#  Terminating a client results in a rollback of the open transactions for this client.

#  Use WAIT_FOR_CLEANUP to determine how much time the server has

#  for cleanup.

# 3. SIGQUIT

#  This will terminate the server immediately and results in a recovery run for the next start.

# Wait for clients to disconnect

WAIT_FOR_DISCONNECT=30

# Time the server has to clean up

WAIT_FOR_CLEANUP=60

# Time the server has to quit (with a recover-run on next startup)

# Set to 0 to deactivate it

WAIT_FOR_QUIT=60

# Comment this out if you don't want to wait for the server to

# startup before continuing.  For example, if this server is a 

# PITR log shipping based replication standby

WAIT_FOR_START="-w"

```

----------

## K1LL3R DO6

Well, it's fixed. In my case, it's for development, not production, so I did:

```

emerge -C postgresql-base and postgresql-server

rm -rf /var/lib/postgresql/8.4/data /etc/init.d/postgresql-8.4 /etc/conf.d/postgresql-8.4

emerge -av postgresql-server

emerge --config =dev-db/postgresql-server-8.4.4-r1

```

I saw /etc/conf.d/postgresql-8.4 and it's a bit different from that I had before. I don't know why conf.d/postgresql-8.4 wasn't updated when I updated the server.   :Confused: 

Maybe it's not the best solution to the problem, but I need it now.

Best regards,

Alejandro

----------

## titanofold

You've probably discarded the updated conf and committed the init.

In the new conf, PGPORT is a user definable variable that the init relies upon to tell the server to which port it should bind.

The easiest and quickest solution was not to do what you did and unmerge the server and rebuild everything, but to simply:

```
# cp /usr/portage/dev-db/postgresql-server/files/postgresql.conf-8.4 /etc/conf.d/postgresql-8.4
```

----------

