Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 284437 - emerge --config =dev-db/postgresql-server-8.4.1 fails in initdb
Summary: emerge --config =dev-db/postgresql-server-8.4.1 fails in initdb
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 285475
  Show dependency tree
 
Reported: 2009-09-10 08:55 UTC by Dirk Olmes
Modified: 2009-10-26 12:41 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
configure --with-libraries (postgresql-server-8.4.1.ebuild.diff,578 bytes, patch)
2009-09-15 08:58 UTC, sf
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Olmes 2009-09-10 08:55:12 UTC
With postgresql-server 8.4.1 becoming stable I emerged it (new slot). Trying to initialize a new 8.4 database fails initdb with the following error message:

cassiopeia# emerge --config =dev-db/postgresql-server-8.4.1


Configuring pkg...

 * You can pass options to initdb by setting the PG_INITDB_OPTS variable.
 * More information can be found here:
 *     http://www.postgresql.org/docs/8.4/static/creating-cluster.html
 *     http://www.postgresql.org/docs/8.4/static/app-initdb.html
 * Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable.
 *
 * You can change the directory where the database cluster is being created by setting
 * the PGDATA variable.
 *
 * PG_INITDB_OPTS is currently set to:
 *     ""
 * and the database cluster will be created in:
 *     "/var/lib/postgresql/8.4/data"
 * Are you ready to continue? (Y/n)

 * Checking system parameters...
 * Checking whether your system supports at least 128 connections...
 * Passed.
 * Creating the data directory ...
 * Initializing the database ...
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.
The default database encoding has accordingly been set to LATIN1.
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/postgresql/8.4/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 28MB
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/8.4/data/base/1 ... initdb: input file "/usr/share/postgresql-8.3/postgres.bki" does not belong to PostgreSQL 8.4.1
Check your installation or specify the correct path using the option -L.
initdb: removing contents of data directory "/var/lib/postgresql/8.4/data"
 *
 * You can use the '//etc/init.d/postgresql-8.4' script to run PostgreSQL instead of 'pg_ctl'.
 *

Note how initdb references "/usr/share/postgresql-8.3/postgres.bki".

I tried running initdb manually, fails with the same error message.

Reproducible: Always

Steps to Reproduce:
1. emerge --config =dev-db/postgresql-server-8.4.1




cassiopeia# emerge --info
Portage 2.1.6.13 (default/linux/x86/2008.0, gcc-4.3.2, glibc-2.9_p20081201-r2, 2.6.30-gentoo-r6 i686)
=================================================================
System uname: Linux-2.6.30-gentoo-r6-i686-Intel-R-_Core-TM-2_CPU_T7400_@_2.16GHz-with-gentoo-1.12.11.1
Timestamp of tree: Wed, 09 Sep 2009 23:45:01 +0000
distcc 3.1 i686-pc-linux-gnu [disabled]
ccache version 2.4 [disabled]
app-shells/bash:     3.2_p39
dev-java/java-config: 2.1.8-r1
dev-lang/python:     2.6.2-r1
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.63-r1
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -msse3 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
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 /etc/udev/rules.d"
CXXFLAGS="-march=prescott -O2 -pipe -msse3 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
LANG="en_US"
LC_ALL="en_US"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j3"
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"
USE="X a52 aac acl acpi alsa backendonly berkdb bzip2 cdr cli cracklib crypt cups dri dts dvd fam flac fortran gcc-libffi gdbm gif gpm gtk ibmacpi iconv ieee1394 ipod ipv6 isdnlog jce jpeg jpeg2k lm_sensors mad mp3 mudflap ncurses nls nptl nptlonly nsplugin objc objc++ ogg opengl openmp pam pch pcre perl pmu png pppd python quicktime readline reflection sdl session smp spl sqlite sse ssl subversion svg sysfs tcpd tiff truetype unicode v4l vorbis x86 xml xorg 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 mmap_emul mulaw multi null plug rate route share shm softvol" 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="radeon vesa fbdev"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 sf 2009-09-10 13:38:22 UTC
initdb fails even if you run it from the command line. You have to add

-L /usr/share/postgresql-8.4


Comment 2 Holger Hoffstätte 2009-09-10 13:42:01 UTC
As mentioned in bug#276125 comments #14, #15 you need to eselect the new
installation before emerging the server, since the ebuild uses eselect for
figuring out certain paths which are built into the binaries. Doing so
automatically would probably be wrong, so it is probably easier to simply abort
building -server unless the right version has been eselected. Maybe there is
another way to build -server without relying on the setting of eselect.
Comment 3 Dirk Olmes 2009-09-10 15:04:27 UTC
I got it working now:
- eselect postgresql 8.4
- emerge postgresql-base and postgresql-server-8.4.1
- emerge --config

Now that I understand how the eselect stuff works I would have expected the build to abort if the right postgres version wasn't selected. Building a package that doesn't work is not my preferred way of doing it.
Comment 4 Gregory SACRE 2009-09-10 18:22:14 UTC
I have to admit that this does not sound like a solution to me.
I would expect to eselect a package only when you want to switch to it, not to emerge it in a new slot.
Or at least, as said by Dirk Olmes, a warning at the beginning of the emerge.
Comment 5 Chris Ribble 2009-09-10 23:40:01 UTC
(In reply to comment #3)
> I got it working now:
> - eselect postgresql 8.4
> - emerge postgresql-base and postgresql-server-8.4.1
> - emerge --config
> 
> Now that I understand how the eselect stuff works I would have expected the
> build to abort if the right postgres version wasn't selected. Building a
> package that doesn't work is not my preferred way of doing it.
>

Can you please post the exact commands that you used? I still can not get this to work.

Comment 6 Dirk Olmes 2009-09-11 00:19:20 UTC
(In reply to comment #5)
> Can you please post the exact commands that you used? I still can not get this
> to work.

I assume you have postgresql-8.3.x installed ...

(s)boromir# eselect postgresql list
Available postgresql installations
  8.3 <-S<-*                    base-8.3.8 server-8.3.8

Now emerge =dev-db/postgresql-base-8.4.1

This will give you

(s)boromir# eselect postgresql list
Available postgresql installations
  8.3 <-S<-*                 base-8.3.8 server-8.3.8
  8.4                        base-8.4.1

Then eselect postgresql 8.4 and emerge =dev-db/postgresql-server-8.4.1

After that, emerge --config =dev-db/postgresql-server-8.4.1 should work properly
Comment 7 Mark Nowiasz 2009-09-14 08:24:11 UTC
(In reply to comment #6)

> After that, emerge --config =dev-db/postgresql-server-8.4.1 should work
> properly

Unfortunately, it doesn't work for me... I have eselected 8.4.1 before --config, and emerge --config tried to access /usr/share/postgresql-8.3/postgres.bki which didn't exist anymore (due to a --depclean).

After ln -s postgresql-8.4/ postgresql-8.3
it finally worked for me (well, that's a kind of un-solution, IMHO) :-/

Comment 8 Dirk Olmes 2009-09-14 08:29:52 UTC
(In reply to comment #7)
> (In reply to comment #6)
> 
> > After that, emerge --config =dev-db/postgresql-server-8.4.1 should work
> > properly
> 
> Unfortunately, it doesn't work for me... I have eselected 8.4.1 before
> --config, and emerge --config tried to access
> /usr/share/postgresql-8.3/postgres.bki which didn't exist anymore (due to a
> --depclean).

just running emerge --config is not enough, you have to emerge postgresql-base and postgresql-server again. 
Comment 9 sf 2009-09-15 08:58:44 UTC
Created attachment 204169 [details, diff]
configure --with-libraries

configure needs to be told about the correct library path.

The patch solves the problem for me.

This should probably applied to other versions as well.
Comment 10 sf 2009-09-30 11:57:12 UTC
Anyone care to fix this bug? Or is something wrong with my patch?
Comment 11 Patrick Lauer gentoo-dev 2009-10-03 21:28:40 UTC
(In reply to comment #10)
> Anyone care to fix this bug? Or is something wrong with my patch?
> 
I haven't been able to reproduce the error yet, so I don't want to blindly apply a patch which doesn't do anything for me.
Comment 12 sf 2009-10-05 09:17:54 UTC
Steps to reproduce:

(If you have 8.3 already installed you can skip step 1. It does not matter whether 8.4 is already installed or not)

1. emerge dev-db/postgresql-server:8.3
2. eselect postgresql set-all 8.3
3. emerge dev-db/postgresql-server:8.4
4. strings /usr/lib/postgresql-8.4/bin/*|grep 'postgresql-8\.3'

The last command lists the references to directories from 8.3. This list should be empty, otherwise, e.g. as in this bug report, /usr/lib/postgresql-8.4/bin/init uses /usr/share/postgresql-8.3/postgres.bki.

If postgres were not split in base and server packages the build script would find everything in its build directory. But now the files which are built in base can only be found in the live filesystem. Without my patch (or the ugly eselect-postgresql-hack) the server build finds (and uses!) the files of 8.3.
Comment 13 Johan Bergström 2009-10-08 11:21:10 UTC
(In reply to comment #12)
> Steps to reproduce:
> 
> (If you have 8.3 already installed you can skip step 1. It does not matter
> whether 8.4 is already installed or not)
> 
> 1. emerge dev-db/postgresql-server:8.3
> 2. eselect postgresql set-all 8.3
> 3. emerge dev-db/postgresql-server:8.4
> 4. strings /usr/lib/postgresql-8.4/bin/*|grep 'postgresql-8\.3'
> 
> The last command lists the references to directories from 8.3. This list should
> be empty, otherwise, e.g. as in this bug report,
> /usr/lib/postgresql-8.4/bin/init uses /usr/share/postgresql-8.3/postgres.bki.
> 
> If postgres were not split in base and server packages the build script would
> find everything in its build directory. But now the files which are built in
> base can only be found in the live filesystem. Without my patch (or the ugly
> eselect-postgresql-hack) the server build finds (and uses!) the files of 8.3.
> 

I've also had this. Experienced it myself a while ago, and can confirm that above steps indeed gives you the 'wrong' paths which present themselves in pkg_config() for 8.4.1.
Comment 14 Johan Bergström 2009-10-08 13:16:34 UTC
...and the patch fixes these errors for me :-) Good job, Stephan!
Comment 15 Patrick Lauer gentoo-dev 2009-10-22 19:54:56 UTC
At last, it should be fixed in -r1.
Please reopen if it still causes issues.
Comment 16 sf 2009-10-26 12:41:48 UTC
Works for me. Thanks