# [SOLVED] can't start postgresql

## jody

Hi

After emerging both client and server of postgresql-9.0.3,

i eselected 9.0

```
eselect postgresql set-all 9.0

```

stopped the running postgresql-8.4 server and wanted to start the new one,

but this didn't work:

```
enki jody # /etc/init.d/postgresql-8.4 stop 

 * Caching service dependencies ...

 *  Cannot add provide 'net', as a service with the same name exists!     [ ok ]

 * Stopping PostgreSQL (this can take up to 92 seconds) ...

server stopped                                                            [ ok ]

enki jody # /etc/init.d/postgresql-9.0 start

 * Directory not found: /var/lib/postgresql/9.0/data

 * Please make sure that PGDATA points to the right path.

 * You can run 'emerge postgresql-server --config' to setup a new database cluster.

```

The directory '/var/lib/postgresql/9.0' does not exist - should it have been created by the installation?

Would it be ok to create symlink to  '/var/lib/postgresql/8.4'?

PGDATA is currently empty, it seems it has not been necessary for 8.4 to work - what should it be set to?.

I don't know what it means to 'create a new database cluster' - i simply want to use my current database.

What could that "net" service be that postgresql-8.4 is talking about?

I would be glad to get some help to get my database running with the new postgresql!

Thanks

  JodyLast edited by jody on Sat Feb 19, 2011 6:42 pm; edited 1 time in total

----------

## ok

Have you run:

```
emerge --config =dev-db/postgresql-server-9.0.3
```

?

----------

## jody

hi ok

i hadn't done this. Now i did but it seems not to have worked properly:

```
enki jody # emerge --config =dev-db/postgresql-server-9.0.3

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/9.0/static/creating-cluster.html

 *     http://www.postgresql.org/docs/9.0/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/9.0/data"

 * Are you ready to continue? (Y/n)

y

 * ERROR: dev-db/postgresql-server-9.0.3 failed:

 *   aborted

 * 

 * Call stack:

 *     ebuild.sh, line  56:  Called pkg_config

 *   environment, line 3554:  Called die

 * The specific snippet of code:

 *       [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted";

 * 

 * If you need support, post the output of 'emerge --info =dev-db/postgresql-server-9.0.3',

 * the complete build log and the output of 'emerge -pqv =dev-db/postgresql-server-9.0.3'.

 * This ebuild is from an overlay named 'gentoo': '/var/db/pkg/'

 * The complete build log is located at '/var/tmp/portage/dev-db/postgresql-server-9.0.3/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/dev-db/postgresql-server-9.0.3/temp/environment'.

 * S: '/var/tmp/portage/dev-db/postgresql-server-9.0.3/work/postgresql-server-9.0.3'

```

(i don't understand why it died - i *did* type a 'y'...)

If it had worked, how would i be able to work with my old database which i

thin is in "/var/lib/postgresql/8.4/data" ?

The output of  'emerge --info =dev-db/postgresql-server-9.0.3':

```
enki jody # emerge --info =dev-db/postgresql-server-9.0.3

Portage 2.1.9.25 (default/linux/x86/10.0/desktop/gnome, gcc-4.4.4, glibc-2.11.2-r3, 2.6.35-gentoo-r4 i686)

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

                        System Settings

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

System uname: Linux-2.6.35-gentoo-r4-i686-AMD_Turion-tm-_64_X2_Mobile_Technology_TL-60-with-gentoo-1.12.14

Timestamp of tree: Fri, 18 Feb 2011 10:15:01 +0000

app-shells/bash:     4.1_p9

dev-java/java-config: 2.1.11-r1

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

dev-util/cmake:      2.8.1-r2

sys-apps/baselayout: 1.12.14-r1

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.13, 2.65-r1

sys-devel/automake:  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.36.1 (sys-kernel/linux-headers)

ACCEPT_KEYWORDS="x86"

ACCEPT_LICENSE="*"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=i686 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb /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.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"

CXXFLAGS="-O2 -march=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

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

LANG="C"

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

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"

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

USE="X a52 aac acl acpi alsa apache2 autoipd automount avahi bash-completion berkdb branding bzip2 cairo cdparanoia cdr cgi cli consolekit cracklib crypt cups cxx dbus device-mapper dri dts dvd dvdr eds embedded emboss encode evo exif extras f77 fam ffmpeg fftw firefox flac fortran gcj gd gdbm gdu gif glut gnome gnome-keyring gnuplot gnutls gpm gstreamer gtk gtk2 guile hal iconv imagemagick ipv6 jpeg kde laptop latex lcms ldap libnotify mad mdnsresponder-compat mikmod mmx mmxext mng modules mp3 mp4 mpeg mpi mplayer mudflap nautilus ncurses networking nls nptl nptlonly nsplugin nvidia ogg opengl openmp oss pam pango pcre pdf perl png policykit postgres ppds pppd python qt3 qt3support qt4 quicktime readline sdl session spell sqlite sse sse2 sse3 ssl startup-notification svg sysfs tcpd tetex threads tiff tk truetype udev unicode usb vorbis win32codecs wma x264 x86 xcb xinerama xml xorg xulrunner xv xvid zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 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" CAMERAS="ptp2" 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" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

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

                        Package Settings

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

dev-db/postgresql-server-9.0.3 was built with the following:

USE="nls perl python xml -doc -pg_legacytimestamp (-selinux) -tcl -uuid" LINGUAS="-af -cs -de -es -fa -fr -hr -hu -it -ko -nb -pl -pt_BR -ro -ru -sk -sl -sv -tr -zh_CN -zh_TW"
```

The output of "emerge -pqv =dev-db/postgresql-server-9.0.3":

```
enki jody # emerge -pqv =dev-db/postgresql-server-9.0.3

[ebuild   R   ] dev-db/postgresql-server-9.0.3  USE="nls perl python xml -doc -pg_legacytimestamp (-selinux) -tcl -uuid" LINGUAS="-af -cs -de -es -fa -fr -hr -hu -it -ko -nb -pl -pt_BR -ro -ru -sk -sl -sv -tr -zh_CN -zh_TW" 

```

Do i need to set the PGDATA to my old data directory?

If yes would that leave my old database unharmed?

Thank You

  Jody

----------

## jody

I just noticed that i had eselected everything back to 8.4.

No i eselected to 9.0 and the 'emerge --config =dev-db/postgresql-server-9.0.3'

worked, and i could also start postgresql-9.0.

But now it seems that this server doesn't remember me or my old data base.

How can i fix that?

Thank You

  Jody

----------

## gerdesj

Not an expert but PostgreSQL is slotted nowadays. 

I think your data is still in your 8.x version system and you now have 9.x one which is clean.

You need to dump your data from 8 and migrate it to 9.

Have a look under /var/lib/postgresql/data.  Your old data is possibly there and you also have a 9.0/data directory.  I don't know, but you *might* get away with moving one to the other.

Postgres is a bit of a beast - it competes with the likes of Oracle n MS SQL so it must be treated with respect. (and manuals read!)

Cheers

Jon

----------

## titanofold

The database created and managed by 8.4 is not guaranteed to be compatible with 9.0. Major version bumps require a dump of the old database and a reload into the freshly created database. (Rather, 9.0 isn't guaranteed to be backwards compatible with 8.4 or older.)

The official documentation covers migration.

The ebuild does not automatically create a database cluster for you. That's something you have to do. As to why it fails to your answer, no idea. 'y' or 'Y' should work just fine.

Additionally, 8.4 and 9.0 can run at the same time. They just have to bind to different ports.

----------

## jody

gerdesj, titanofold

Thank you for your replies.

I dumped the db from 8.4, switched to 9.0 and imported it.

This went well.

I guess i had a wrong picture about what happens at a postgresql update.

Thanks again

  Jody

----------

