Caveat: rootless

Sometimes I work on my server. I have been trying to automate the map-rendering job for the geofiction site I built, that until now I’ve had to run manually. The problem I ran into comes down to permissions. Who knew that even the infamous Linux ‘root’ user is sometimes not the right person for the job? Emphasis added to the excerpt of the log file, below.

...
INFO: Total execution time: 16621 milliseconds.
Stopping renderd (via systemctl): renderd.service.
osm2pgsql version 0.95.0-dev (64 bit id space)

Using lua based tag processing pipeline with script ~/src/openstreetmap-carto/openstreetmap-carto.lua
Using projection SRS 3857 (Spherical Mercator)
Osm2pgsql failed due to ERROR: Connection to database failed: FATAL:  role "root" does not exist
...

It took me all day to figure this out. Not that I was working on it, exactly. Art and I went to town, did our shopping, came home, ate dinner. All the while, I was cogitating on this problem, and how it matched up with the results I was(n’t) seeing. And then, sitting there, it clicked.

These are the more pleasing moments of computer work – when a seemingly intractable problem presents itself and you work it through in your mind and you solve it. After it clicked, I came and opened the log file and saw the error, above, and it was an easy fix to the bash script.
picture