Gentoo Archives: gentoo-user

From: Gregory Shearman <zekeyg@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] pg_upgrade91 - You must have read and write access in the current directory
Date: Mon, 05 Dec 2011 22:26:31
Message-Id: 20111205222430.GA6582@pacific.net.au
1 In linux.gentoo.user, you wrote:
2 > On 12/05/11 21:56, Gregory Shearman wrote:
3 >>hmmm...
4 >>
5 >>Which directory are you running the command from? I ran mine from
6 >>/var/lib/postgresql which has the properties:
7 >>
8 >>drwxr-xr-x 4 postgres root
9 >>
10 >>I don't recall using the command "pg_upgrade91", but I see that it is a
11 >>symlink to /usr/lib/postgresql-9.1/bin/pg_upgrade
12 >>
13 >>This is the command that worked for me:
14 >>
15 >>pg_upgrade -u postgres -d /var/lib/postgresql/9.0/data -D \\
16 >>/var/lib/postgresql/9.1/data -b /usr/lib/postgresql-9.0/bin -B \\
17 >>/usr/lib/postgresql-9.1/bin
18 >>
19 >>For more information do (as postgres user)
20 >>
21 >>$ pg_upgrade --help
22 >>
23 > I definitely wasn't in that directory I just "su postgres" and run the command.
24 >
25 > I just recreate the databases by hand and populated them with backup data.
26
27 I see. That's a shame.
28
29 Usually, the HOME directory of the postgres user is set to
30 /var/lib/postgresql.
31
32 If you just do "su postgres" you'll remain in the directory from which
33 you ran the command.
34
35 What you *must* do is run:
36
37 $ su - postgres
38
39 Notice the '-'?
40
41 This makes the su to the user a *login*, so that you'll be in the HOME
42 directory of the postgres user.
43
44 Try it yourself. Do an 'ls' after "su postgres" and then do an 'ls'
45 after "su - postgres"
46
47 See "man su" for more information.
48
49 --
50 Regards,
51 Gregory.