postgres: nie można zainstalować postgresql-contrib-9.1

1

Moja wersja systemu to Ubuntu 13.10 64bit.

Napotkałem ten problem, konfigurując PostgreSQL w aplikacji Rails.

Najpierw pobiegłem rake db:migrate i pokazał błąd:

-- enable_extension("hstore")
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.1/extension/hstore.control": No such file or directory
: CREATE EXTENSION IF NOT EXISTS "hstore"/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `async_exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/home/user/rails/bdfzer-sso/db/migrate/20140405014358_set_up_hstore.rb:3:in `change'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:595:in `exec_migration'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
ActiveRecord::StatementInvalid: PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
: CREATE EXTENSION IF NOT EXISTS "hstore"
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `async_exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/home/user/rails/bdfzer-sso/db/migrate/20140405014358_set_up_hstore.rb:3:in `change'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:595:in `exec_migration'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `async_exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/home/user/rails/bdfzer-sso/db/migrate/20140405014358_set_up_hstore.rb:3:in `change'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:595:in `exec_migration'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Po przeszukaniu znalazłem post na SO wskazujący, że mogę uruchomić

sudo apt-get install postgresql-contrib-9.1

Ale wtedy mam to, co mam

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package postgresql-contrib-9.1 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  postgresql-9.1

E: Package 'postgresql-contrib-9.1' has no installation candidate
Hao
źródło
Zgaduję, że nie powinieneś nawet próbować go zainstalować, na podstawie komunikatu o błędzie. A nawet jeśli tak, to prawdopodobnie chcesz mieć najnowsze Postgres. Ponadto należy do Super User.
Denis de Bernardy
Czy faktycznie używasz PostgreSQL 9.1?
Craig Ringer
Tak. Bieganie 9.1
Hao
Prawdopodobnie musisz dodać odpowiednie repozytorium do swojego sources.list plik i / lub uruchom apt-get update. Pakiet powinien być dostępny. Widzieć: packages.ubuntu.com/saucy/postgresql-contrib-9.1
Erwin Brandstetter