1

Using stellar-quickstart, I am able to install, then start and sync stellar-core. However, my attempts to install stellar-horizon fail with the following message:

  Package stellar-horizon-postgres is not configured yet.

How to configure it? Thanks in advance. More info, if required:

alec@alec-MS-7596 ~/product $ sudo systemctl stop stellar-core
alec@alec-MS-7596 ~/product $ sudo systemctl mask stellar-core
Created symlink from /etc/systemd/system/stellar-core.service to /dev/null.
alec@alec-MS-7596 ~/product $ sudo apt-get update && sudo apt-get install stellar-horizon
Hit:1 https://deb.nodesource.com/node_8.x xenial InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease          
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]           
Hit:4 http://ppa.launchpad.net/jonathonf/vim/ubuntu xenial InRelease                  
Get:5 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]            
Hit:6 https://apt.stellar.org/public stable/ InRelease                                
Get:7 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]         
Hit:8 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease        
Fetched 325 kB in 1s (306 kB/s)                                                     
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
stellar-horizon is already the newest version (0.17.4-45).
0 upgraded, 0 newly installed, 0 to remove and 84 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up stellar-horizon-postgres (0.1-5) ...
2019/04/05 11:30:38 exec failed: pq: relation "gorp_migrations" already exists
dpkg: error processing package stellar-horizon-postgres (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of stellar-quickstart:
 stellar-quickstart depends on stellar-horizon-postgres; however:
  Package stellar-horizon-postgres is not configured yet.

dpkg: error processing package stellar-quickstart (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                   Errors were encountered while processing:
 stellar-horizon-postgres
 stellar-quickstart
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • It looks like you have an older copy of the Horizon database already installed. Is that true? – ire_and_curses Apr 5 at 16:03
  • Yes, this is correct. I checked the database, it has only one table, and the table has 0 rows. This observation, and the fact that the initial installation failed with the same message (Package stellar-horizon-postgres is not configured yet.), led me to decide not to remove the database. – Alec Missine Apr 5 at 16:31
  • 1
    The failure message above looks like an edge case bug around the fact that the migration table exists (and the installation assumes it shoudn't). If you don't have any data here, you could try removing the DB and trying again. – ire_and_curses Apr 5 at 18:05
  • 1
    You are absolutely right, ire_and_curses! Thanks a lot for the tip! :) – Alec Missine Apr 5 at 18:32
1

All it took was to drop the horizon database! Many thanks to ire_and_curses for the tip! Steps below outline the fix.

  458  sudo -u stellar psql -c 'DROP DATABASE horizon' postgres
  459  sudo apt-get update && sudo apt-get install stellar-horizon
  460  sudo -u stellar psql -d horizon
  462  sudo systemctl unmask stellar-core
  463  sudo systemctl start stellar-core
  464  sudo stellar-core-cmd info # wait for "state" : "Synced!"
  465  sudo systemctl start stellar-horizon
  466  sudo systemctl status stellar-horizon
1

@alec-missine, @ire_and_curses Thank you both for reporting this issue!

The stellar-horizon package does not create a horizon database, creating the horizon db is handled by the stellar-horizon-postgres package. This is by design.

The edge case you encountered exists because although the stellar-horizon package doesn't create the horizon db it does run the Horizon migrations as part of it's stellar-horizon.postinst configure maintainer script step. We do this to ensure seamless schema migrations during installs/upgrades of Horizon.

I believe that in this instance, you must have created a horizon database but not run stellar-horizon-cmd db init to create the db schema. When you installed the stellar-horizon package it would have attempted to run the migrations on an empty horizon db (creating the gorp_migrations table only).

When you subsequently installed the stellar-quickstart package the database already existed but not the schema which caused the installation of stellar-horizon-postgres to fail, cascading all the way back to the stellar-quickstart installation failure.

Going forwards, I have modified the stellar-horizon postinst script to check if the schema has been created prior to running db migrate up (#43), this should prevent this from occurring again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.