Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Postgresql upgrade
Date: Sat, 29 Jul 2017 10:17:37
Message-Id: 3923cf88-ec90-125f-ae4c-106cf172e946@gmail.com
In Reply to: [gentoo-user] Postgresql upgrade by Mick
1 On 29/07/2017 11:59, Mick wrote:
2 > It seems this is one of these things I keep forgetting how to perform
3 > correctly, despite taking notes and reading the documentation. I thought I
4 > had upgraded postgresql from 9.5.7 to 9.6.3-r1 a couple of weeks ago.
5 >
6 > Today depclean asked me to remove 9.5.7 and after a moment's hesitation I went
7 > along with it. To my surprise I got this at the end of it:
8 >
9 > [snip...]
10 > <<< dir /usr/include/postgresql-9.5/server/catalog
11 > <<< dir /usr/include/postgresql-9.5/server/bootstrap
12 > <<< dir /usr/include/postgresql-9.5/server/access
13 > <<< dir /usr/include/postgresql-9.5/server
14 > <<< dir /usr/include/postgresql-9.5/libpq
15 > <<< dir /usr/include/postgresql-9.5/internal/libpq
16 > <<< dir /usr/include/postgresql-9.5/internal
17 > <<< dir /usr/include/postgresql-9.5/informix/esql
18 > <<< dir /usr/include/postgresql-9.5/informix
19 > <<< dir /usr/include/postgresql-9.5
20 > --- !empty dir /usr/include
21 > --- !empty dir /usr/bin
22 > --- !empty dir /usr
23 > --- !empty dir /etc/postgresql-9.5
24 > --- !empty dir /etc/pam.d
25 > --- !empty dir /etc/init.d
26 > --- !empty dir /etc/conf.d
27 > --- !empty dir /etc
28 > Unsetting 9.5 as default...done.
29 > Setting 9.6 as the default...ln: failed to create symbolic link
30 > '/usr/include/libpq-fe.h': File exists
31 > !!! Error: Unable to create link! postgresql-9.6/libpq-fe.h ->
32 > /usr/include/libpq-fe.h
33 > exiting
34 >>>> Regenerating /etc/ld.so.cache...
35 > Packages installed: 1321
36 > Packages in world: 216
37 > Packages in system: 44
38 > Required packages: 1321
39 > Number removed: 1
40 >
41 >
42 > Looking at /usr/include/ I see this:
43 >
44 > lrwxrwxrwx 1 root root 29 Jul 16 13:56 postgres_ext.h ->
45 > postgresql-9.5/postgres_ext.h
46 > lrwxrwxrwx 1 root root 14 Jul 29 10:34 postgresql -> postgresql-9.6
47 > drwxr-xr-x 6 root root 4096 Jul 16 13:55 postgresql-9.6
48 >
49 > Although the old /usr/include/postgresql-9.5 directory and file postgres_ext.h
50 > have been removed, the symlink is still pointint to the old file, rather than
51 > having been replaced with a symlink to
52 > /usr/include/postgresql-9.6/postgres_ext.h:
53 >
54 > $ ls -la /usr/include/postgresql-9.6/postgres_ext.h
55 > -rw-r--r-- 1 root root 2151 Jul 16 13:54
56 > /usr/include/postgresql-9.6/postgres_ext.h
57 >
58 >
59 > I'm trying to understand why this might have happened. Which process/action
60 > is responsible for setting this symlink?
61 >
62 > Also, the entry run by depclean above also confused me:
63 >
64 > Unsetting 9.5 as default...done.
65 > Setting 9.6 as the default...
66 >
67 > How is the default version of postgresql being set in a system? What specific
68 > actions do these two entries entail? I thought with openrc at least it is a
69 > matter of setting up the latest postgresql version to start up in rc-update.
70 >
71 > I've replaced the symlink with the live postgresql manually for now - I hope I
72 > haven't borked the database ...
73 >
74
75
76
77 postgresql is slotted, so various headers files and such need symlinks
78 installed so postgresql uses the correct versioned file. You have 2
79 versions, which one is correct? - the one the symlink points to.
80
81 Installing 9.6 on a host with 9.5 present does only that - installs it.
82 It doesn't run it or set it as default, it only installs it. To run it
83 or set it as default is an extra step that you decide yourself when you
84 want to do it.
85
86 depcleaning 9.5 removes the default version, so the obvious thing for
87 the code to do is set 9.6 as the new default. Maybe the ebuild does it,
88 maybe it's eselect. Doesn't matter, because something should have
89 removed those stale symlinks and didn't. This is a reportable bug
90
91 Meanwhile fix the symlinks to what they should be using "ln -sfn" and
92 all will be good in the world.
93
94 --
95 Alan McKinnon
96 alan.mckinnon@×××××.com

Replies

Subject Author
Re: [gentoo-user] Postgresql upgrade Mick <michaelkintzios@×××××.com>