This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Nominatim Setup - Failed to Open Stream

0

I'm trying to get nominatim up and running but am running into some problems. Here are the last few lines from my execution. Anyone run into this problem? Did I mess up the build steps?

    Loading word list
SET
SET
SET
SET
SET
SET
SET
SET
CREATE TABLE
 count 
-------
  1772
(1 row)

 count 
-------
     4
(1 row)

 count 
-------
    45
(1 row)

UPDATE 469
DROP TABLE
Load Data
........
Reanalysing database...
NOTICE:   no notnull values, invalid stats
ANALYZE
Oct 28, 2013 9:59:04 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.40.1
Oct 28, 2013 9:59:04 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Oct 28, 2013 9:59:04 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Oct 28, 2013 9:59:04 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Oct 28, 2013 9:59:04 AM org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SEVERE: Thread for task 1-read-replication-interval-init failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to open lock file /home/spbryfczynski/Documents/geocode/Nominatim/settings/download.lock.
        at org.openstreetmap.osmosis.core.util.FileBasedLock.initialize(FileBasedLock.java:53)
        at org.openstreetmap.osmosis.core.util.FileBasedLock.lock(FileBasedLock.java:68)
        at org.openstreetmap.osmosis.replication.v0_6.ReplicationDownloaderInitializer.run(ReplicationDownloaderInitializer.java:72)
        at java.lang.Thread.run(Thread.java:724)

Oct 28, 2013 9:59:04 AM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
        at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
        at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)
        at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:328)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:31)

sed: can't read /home/spbryfczynski/Documents/geocode/Nominatim/settings/configuration.txt: No such file or directory
sed: can't read /home/spbryfczynski/Documents/geocode/Nominatim/settings/configuration.txt: No such file or directory
PHP Warning:  file_get_contents(https://www.openstreetmap.org/api/0.6/node/2506472169/1): failed to open stream: Connection timed out in /home/spbryfczynski/Documents/geocode/Nominatim/utils/setup.php on line 540
PHP Notice:  Undefined offset: 1 in /home/spbryfczynski/Documents/geocode/Nominatim/utils/setup.php on line 542
PHP Warning:  file_get_contents(http://planet.openstreetmap.org/replication/minute/?C=M;O=D): failed to open stream: Connection timed out in /home/spbryfczynski/Documents/geocode/Nominatim/utils/setup.php on line 546
PHP Notice:  Undefined variable: aRepMatch in /home/spbryfczynski/Documents/geocode/Nominatim/utils/setup.php on line 558

asked 28 Oct '13, 14:29

sbryfcz's gravatar image

sbryfcz
56558
accept rate: 0%


2 Answers:

3

The import script cannot write to settings/download.lock for some reason. Most likely the user under which you are running the import script is not allowed to create a file in Nominatim/settings. This might happen, if you happen to run the script with sudo -u postgres or similar. The other possibility is that you have run the import script under a different user before, so that a stale settings/download.lock remained from this user and the current user is not allowed to change it. Simply delete the file in that case.

answered 28 Oct '13, 21:55

lonvia's gravatar image

lonvia
6.2k25789
accept rate: 40%

Thanks for the suggestions. It doesn't look like a settings/download.lock file exists so I'm guessing my issue is the first one. Unfortunately, I'm a bit unclear as to how to fix it. The script I'm running is simply

./utils/setup.php --osm-file greenland.osm.pbf --all

Does the setup script call the import script? I've given my user sudoer privledges so I don't have to log in as root. Thanks for the help.

(29 Oct '13, 14:56) sbryfcz

I was able to clear up the lock error but still am getting the following errors related to opening stream. I spun up a test VM and was able to get everything working. So maybe its something I need my IT group to clear up on the server. Any suggestions?

... Nov 04, 2013 2:53:33 PM org.openstreetmap.osmosis.core.Osmosis run INFO: Total execution time: 322 milliseconds. PHP Warning: file_get_contents(https://www.openstreetmap.org/api/0.6/node/2506472169/1): failed to open stream: Connection timed out in /home/spbryfczynski/Documents/Nominatim/utils/setup.php on line 540 ...more errors

(04 Nov '13, 20:07) sbryfcz

0

I ended up having to use curl for the file_get_contents methods (with urls). I added this function to the utils/setup.php file and then changed the file_get_contents calls to URLs to file_get_contents_curl. Things then worked.

function file_get_contents_curl($url) {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the $
      curl_setopt($ch, CURLOPT_URL, $url);
      $data = curl_exec($ch);
      curl_close($ch);
      return $data;
      }

answered 05 Nov '13, 14:21

sbryfcz's gravatar image

sbryfcz
56558
accept rate: 0%

Source code available on GitHub .