psycopg2.ProgrammingError: permission denied to create role

Bug #514486 reported by near
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Invalid
Undecided
Unassigned

Bug Description

Hello,

On a fresh karmic, i tried to install launchpad. I followed this tutorial: https://dev.launchpad.net/Getting. Everything went well, except for these lines :

No handlers could be found for logger "bzr"
bzr: ERROR: Not a branch: "http://bazaar.launchpad.net/~launchpad-pqm/shipit/trunk/".
bzr: ERROR: Not a branch: "http://bazaar.launchpad.net/~launchpad-pqm/canonical-identity-provider/trunk/".

After this, i tried to follow the tutorial (https://dev.launchpad.net/Running). launchpad-database-setup worked, but make schema returns me the following error:

2010-01-29 20:21:37 INFO Applying patch-2207-28-0.sql
2010-01-29 20:21:37 INFO Applying comments.sql
* Setting up full text indexes
* Security setup
Traceback (most recent call last):
  File "security.py", line 414, in <module>
    sys.exit(main(options))
  File "security.py", line 180, in main
    reset_permissions(con, config, options)
  File "security.py", line 235, in reset_permissions
    % (quote_identifier(username), ' '.join(role_options)))
  File "security.py", line 138, in execute
    return self.__dict__['_cursor'].execute(cmd)
psycopg2.ProgrammingError: permission denied to create role

make[1]: *** [create] Error 1
make[1]: Leaving directory `/home/launchpad/launchpad/lp-branches/devel/database/schema'
make: *** [schema] Error 2

Sorry if i put this bug in the wrong place.

near (near)
description: updated
Revision history for this message
Curtis Hovey (sinzui) wrote :

I think this step from the wiki was not completed

    ./utilities/launchpad-database-setup $USER

When $USER is probably your user name.

You can read about the precise setup:
    https://dev.launchpad.net/DatabaseSetup

Changed in launchpad:
status: New → Incomplete
Revision history for this message
near (near) wrote :

Thanks for the quick answer.

I did that step:

$ ./utilities/launchpad-database-setup launchpad
Creating Launchpad database for launchpad
Using postgres 8.3
 * Stopping PostgreSQL 8.3 database server [ OK ]
Purging postgresql data...
Re-creating postgresql database...
Creating new cluster (configuration: /etc/postgresql/8.3/main, data: /var/lib/postgresql/8.3/main)...
Moving configuration file /var/lib/postgresql/8.3/main/postgresql.conf to /etc/postgresql/8.3/main...
Moving configuration file /var/lib/postgresql/8.3/main/pg_hba.conf to /etc/postgresql/8.3/main...
Moving configuration file /var/lib/postgresql/8.3/main/pg_ident.conf to /etc/postgresql/8.3/main...
Configuring postgresql.conf to use port 5432...
Applying postgresql configuration changes...
patching file /etc/postgresql/8.3/main/pg_hba.conf

##
## Launchpad configuration
##
# Enable launchpad full text searching in database
search_path='$user,public,ts2'
add_missing_from=false
#enable_seqscan=false
log_statement='none'
log_line_prefix='[%t] %q%u@%d '
fsync = off

max_fsm_relations=2000

 * Starting PostgreSQL 8.3 database server [ OK ]
Waiting 10 seconds for postgresql to come up...
Creating postgresql user launchpad

Looks like everything went ok.
Now run "make schema" at the top level of the launchpad tree.
$

Revision history for this message
Curtis Hovey (sinzui) wrote : Re: [Bug 514486] Re: psycopg2.ProgrammingError: permission denied to create role

On Fri, 2010-01-29 at 22:03 +0000, near wrote:

> $ ./utilities/launchpad-database-setup launchpad
> Creating Launchpad database for launchpad

...

> * Starting PostgreSQL 8.3 database server [ OK ]
> Waiting 10 seconds for postgresql to come up...
> Creating postgresql user launchpad

I have seen this disaster before. your user CANNOT be named "launchpad".
It conflicts with other identities that are setup.

Revision history for this message
William Grant (wgrant) wrote :

The postgres user 'launchpad' is used by Launchpad for other purposes. You will have to use a different username.

Revision history for this message
near (near) wrote :

Okay thanks ; maybe the wiki or launch-database-setup script should be updated regarding this. I'll try this right away.

$ diff /tmp/launchpad-database-setup utilities/launchpad-database-setup
8,11d7
< if [ "$USER" = "launchpad" ]; then
< echo "You can't use 'launchpad' as a database username. Exiting..."
< exit 1
< fi

Revision history for this message
near (near) wrote :

New error:

make[1]: Entering directory `/home/launchpad/launchpad/lp-branches/devel/database/schema'
* If this fails you need to run as the postgresql superuser
* eg. sudo -u postgres make create

* Creating database "launchpad_empty".
Traceback (most recent call last):
  File "../../utilities/pgmassacre.py", line 288, in <module>
    sys.exit(main())
  File "../../utilities/pgmassacre.py", line 254, in main
    con = connect()
  File "../../utilities/pgmassacre.py", line 28, in connect
    return psycopg2.connect("dbname=%s" % dbname)
psycopg2.OperationalError: FATAL: role "launchpad" does not exist

make[1]: *** [create] Error 1
make[1]: Leaving directory `/home/launchpad/launchpad/lp-branches/devel/database/schema'
make: *** [schema] Error 2

Maybe should i restart from the beginning?

Revision history for this message
near (near) wrote :

Haha, i can't checkout the repository now...

Logging bzr into Launchpad (it's okay if this errors)...
Making local branch of Launchpad trunk, this may take a while...
The authenticity of host 'bazaar.launchpad.net (91.189.90.11)' can't be established.
RSA key fingerprint is 9d:38:3a:63:b1:d5:6f:c4:44:67:53:49:2e:ee:fc:89.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bazaar.launchpad.net,91.189.90.11' (RSA) to the list of known hosts.
Permission denied (publickey).
bzr: ERROR: Connection closed: Unexpected end of message. Please check connectivity and permissions, and report a bug if problems persist.
ERROR: Unable to create local copy of Rocketfuel trunk
$

Revision history for this message
near (near) wrote :

Okay fixed it, it looks like it's now mandatory to have a public key registered in order to checkout the repository. Back in a few minutes after rockfuel-setup finishes...

Revision history for this message
near (near) wrote :

I deleted everything in the folder and ran all commands again. I got the following error for make schema:

* Creating database "launchpad_empty".
Traceback (most recent call last):
  File "../../utilities/pgmassacre.py", line 288, in <module>
    sys.exit(main())
  File "../../utilities/pgmassacre.py", line 254, in main
    con = connect()
  File "../../utilities/pgmassacre.py", line 28, in connect
    return psycopg2.connect("dbname=%s" % dbname)
psycopg2.OperationalError: FATAL: role "launchpad" does not exist

make[1]: *** [create] Error 1
make[1]: Leaving directory `/home/launchpad/launchpad/lp-branches/devel/database/schema'
make: *** [schema] Error 2

Is it an issue if the (system) user i'm using is launchpad?

Revision history for this message
Curtis Hovey (sinzui) wrote :

Yes. rocketfuel and the code is a development instance. it is desgined to run as you. Using your system user and a standard launchpad user, you can setup the same development instance that we have used for years to create launchpad.

Revision history for this message
near (near) wrote :

make schema worked! Thank you for the quick support. Please write something about this on https://dev.launchpad.net/Getting.

Curtis Hovey (sinzui)
Changed in launchpad:
status: Incomplete → Invalid
Revision history for this message
Richie Ward (richies) wrote :

You could prevent this bug easily with an if statement.

Revision history for this message
Niels Huylebroeck (red15) wrote :

Bounced into this issue today after much hair pulling and cursing, really why not a simple if statement (or even some documentation adjustments on https://dev.launchpad.net/Running )

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.