Skip to content

ERROR: could not open extension control file "/usr/share/postgresql/9.4/extension/postgis.control": No such file or directory #5

Closed

Description

@ubergesundheit

Hi,

I tried to run CREATE EXTENSION postgis; on the image mdillon/postgis:9.4 from the docker hub. It complained that it couldn't find the file /usr/share/postgresql/9.4/extension/postgis.control

running bash inside the container reveals that in fact this file exists!

I already tried the following things:

  • building from this repository
  • changing ownership of /usr/share/postgresql/9.4/extension/ to the postgres user (RUN chown -R postgres:postgres /usr/share/postgresql/9.4/extension/)

Could you please look into this?

Cheers

Activity

  1. md5 commented on Feb 13, 2015

    @md5
    Contributor

    How did you run the CREATE EXTENSION statement? Did you connect to the container with psql or did you do something else?

  2. ubergesundheit commented on Feb 13, 2015

    @ubergesundheit
    ContributorAuthor

    I am using fig (http://fig.sh) for running a ruby on rails app which uses postgis. When I am running fig run app rake db:migrate rails tries to create the posgis extension with CREATE EXTENSION postgis; which then fails.

  3. md5 commented on Feb 13, 2015

    @md5
    Contributor

    I just tested this successfully:

    $ docker pull mdillon/postgis:9.4
    # Time passes...
    $ docker run -d --name some-postgis -e POSTGRES_PASSWORD=p mdillon/postgis:9.4
    4825867790a1583c8bd9c58498ed876197795166855c513fca501d7c78a53f83
    $ docker run -it --link some-postgis:postgres --rm postgres \
       sh -c 'exec env PGPASSWORD="$POSTGRES_ENV_POSTGRES_PASSWORD" \
                 psql -h "$POSTGRES_PORT_5432_TCP_ADDR" 
                         -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres'
    psql (9.4.0, server 9.4.1)
    Type "help" for help.
    postgres=# create database postgis;
    CREATE DATABASE
    postgres=# \c postgis
    psql (9.4.0, server 9.4.1)
    You are now connected to database "postgis" as user "postgres".
    postgis=# create extension postgis;
    CREATE EXTENSION
    
  4. md5 commented on Feb 13, 2015

    @md5
    Contributor

    Can you post your fig.yml? It might also be relevant to find out what version of Fig you're using, but probably not.

  5. ubergesundheit commented on Feb 13, 2015

    @ubergesundheit
    ContributorAuthor

    fig --version returns fig 1.0.0

    my fig.yml is

    db:
      image: mdillon/postgis:9.4
      ports:
        - "5432"
      environment:
        - POSTGRES_PASSWORD=yoloswag
    
    app:
      build: .
      links:
        - db
      environment:
        - RAILS_ENV=production
        - DEVISE_SECRET_KEY=swaghettiYolonaise
        - SECRET_KEY_BASE=swaghettiYolonaise
        - OAUTH_FACEBOOK_KEY=swaghettiYolonaise
        - OAUTH_FACEBOOK_SECRET=swaghettiYolonaise
        - OAUTH_TWITTER_KEY=swaghettiYolonaise
        - OAUTH_TWITTER_SECRET=swaghettiYolonaise
        - OAUTH_GOOGLE_KEY=swaghettiYolonaise
        - OAUTH_GOOGLE_SECRET=swaghettiYolonaise
        - HOSTNAME=localhost:3000
        - SMTP_HOST=smtp.mandrillapp.com
        - SMTP_PORT=25
        - SMTP_USER=SOMEUSER
        - SMTP_PASSWORD=SOMEPASS
        - [email protected]
        - SENTRY_DSN=http://localhost

    the dockerfile for the app installs postgresql-client

  6. md5 commented on Feb 13, 2015

    @md5
    Contributor

    I can't see anything there that would affect whether or not the extension control file would be found or readable by the Postgres process.

    Any chance you could post the exact error you get back when you run fig run app rake db:migrate? You may also want to look at what fig logs db has to say after the failure.

  7. ubergesundheit commented on Feb 14, 2015

    @ubergesundheit
    ContributorAuthor

    the error rails produces:

    == 20140418190245 CreateFeatures: migrating ===================================
    -- enable_extension("postgis")
    rake aborted!
    StandardError: An error has occurred, this and all later migrations canceled:
    
    PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.4/extension/postgis.control": No such file or directory
    : CREATE EXTENSION IF NOT EXISTS "postgis"/usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `async_exec'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `block in exec_no_cache'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
    /usr/local/bundle/gems/activesupport-4.1.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `exec_no_cache'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:656:in `block in method_missing'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:628:in `block in say_with_time'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:628:in `say_with_time'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:648:in `method_missing'
    /usr/src/app/db/migrate/20140418190245_create_features.rb:3:in `change'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:602:in `exec_migration'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:586:in `block (2 levels) in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:585:in `block in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:584:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:759:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/transactions.rb:208:in `transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:1044:in `ddl_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:959:in `block in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:955:in `each'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:955:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:814:in `up'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:792:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
    ActiveRecord::StatementInvalid: PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.4/extension/postgis.control": No such file or directory
    : CREATE EXTENSION IF NOT EXISTS "postgis"
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `async_exec'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `block in exec_no_cache'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
    /usr/local/bundle/gems/activesupport-4.1.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `exec_no_cache'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:656:in `block in method_missing'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:628:in `block in say_with_time'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:628:in `say_with_time'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:648:in `method_missing'
    /usr/src/app/db/migrate/20140418190245_create_features.rb:3:in `change'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:602:in `exec_migration'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:586:in `block (2 levels) in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:585:in `block in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:584:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:759:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/transactions.rb:208:in `transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:1044:in `ddl_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:959:in `block in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:955:in `each'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:955:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:814:in `up'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:792:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
    PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.4/extension/postgis.control": No such file or directory
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `async_exec'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `block in exec_no_cache'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
    /usr/local/bundle/gems/activesupport-4.1.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `exec_no_cache'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:656:in `block in method_missing'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:628:in `block in say_with_time'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:628:in `say_with_time'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:648:in `method_missing'
    /usr/src/app/db/migrate/20140418190245_create_features.rb:3:in `change'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:602:in `exec_migration'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:586:in `block (2 levels) in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:585:in `block in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:584:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:759:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/transactions.rb:208:in `transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:1044:in `ddl_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:959:in `block in migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:955:in `each'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:955:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:814:in `up'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/migration.rb:792:in `migrate'
    /usr/local/bundle/gems/activerecord-4.1.9/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
    Tasks: TOP => db:migrate
    (See full trace by running task with --trace)
    

    and fig logs db

    ...
    db_1 | LOG:  received smart shutdown request
    db_1 | LOG:  autovacuum launcher shutting down
    db_1 | LOG:  shutting down
    db_1 | LOG:  database system is shut down
    db_1 | LOG:  database system was shut down at 2015-02-14 00:01:24 UTC
    db_1 | LOG:  autovacuum launcher started
    db_1 | LOG:  database system is ready to accept connections
    db_1 | ERROR:  could not open extension control file "/usr/share/postgresql/9.4/extension/postgis.control": No such file or directory
    db_1 | STATEMENT:  CREATE EXTENSION IF NOT EXISTS "postgis"
    
  8. md5 commented on Feb 14, 2015

    @md5
    Contributor

    And you said you were able to confirm that /usr/share/postgresql/9.4/extension/postgis.control exists with that exact path? Could you provide the output of docker exec $CONTAINERID ls -l /usr/share/postgresql/9.4/extension/postgis.control?

  9. md5 commented on Feb 14, 2015

    @md5
    Contributor

    BTW, you probably don't want that ports: "5432". That's exposing your container Postgres on the Docker host's IP with a random port. The linked container will work directly with port 5432 inside the container with the ports declaration.

  10. ubergesundheit commented on Feb 14, 2015

    @ubergesundheit
    ContributorAuthor

    It seems fig doesn't recognize changes in the fig yml. Earlier I had image: postgres and now it starts the postgres image :| After I changed the name of the db to postgis fig recognized the different image. It now works

    Sorry I've bothered you :( This is a flaw in fig.

  11. md5 commented on Feb 14, 2015

    @md5
    Contributor

    Glad you figured it out. Since we took the time to debug it, it may be worth seeing if the issue has been reported at https://github.com/docker/fig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions