I get an error saying socket bind failed for: /var/run/renderd/renderd.sock if i am a regular user else everything works fine?

user1615664 picture user1615664 · May 31, 2013 · Viewed 8k times · Source

I am trying to manually build a map server as per instructions on switch2osm.org. I have configured everything. I have a database mayank owned by user mayank and I am trying to use renderd but i get this error socket bind failed for: /var/run/renderd/renderd.sock. Now if i switch to root and do the same it runs perfectly no direct permission issues because i have changed the owner for the directories recursively. But there might be some intermediate permission issues. I can not run it as root since I am using psql and my owner for the database mayank is my user mayank and this results in no tiles being renderd. And i don't want to reinstall my os but seriously understand the reason for this problem. Please help I am new to openstreetmaps and Linux. Below is the exact codes for my process:

mayank@DC050:~$ renderd
socket bind failed for: /var/run/renderd/renderd.sock
mayank@DC050:~$ sudo renderd
sudo: /var/lib/sudo owned by uid 1000, should be uid 0
[sudo] password for mayank: 
mayank@DC050:~$ 

mayank@DC050:~$ renderd -f -c /usr/local/etc/renderd.conf
renderd[9178]: Rendering daemon started
renderd[9178]: Initiating reqyest_queue
iniparser: syntax error in /usr/local/etc/renderd.conf (8):
-> ;[renderd01]
iniparser: syntax error in /usr/local/etc/renderd.conf (15):
-> ;[renderd02]
iniparser: syntax error in /usr/local/etc/renderd.conf (33):
-> ;** config options used by mod_tile, but not renderd **
iniparser: syntax error in /usr/local/etc/renderd.conf (42):
-> ;[style2]
iniparser: syntax error in /usr/local/etc/renderd.conf (49):
-> ;** config options used by mod_tile, but not renderd **
renderd[9178]: Parsing section renderd
renderd[9178]: Parsing render section 0
renderd[9178]: Parsing section mapnik
renderd[9178]: Parsing section default
renderd[9178]: config renderd: unix socketname=/var/run/renderd/renderd.sock
renderd[9178]: config renderd: num_threads=4
renderd[9178]: config renderd: num_slaves=0
renderd[9178]: config renderd: tile_dir=/var/lib/mod_tile
renderd[9178]: config renderd: stats_file=/var/run/renderd/renderd.stats
renderd[9178]: config mapnik:  plugins_dir=/usr/local/lib/mapnik/input
renderd[9178]: config mapnik:  font_dir=/usr/local/lib64/mapnik/fonts
renderd[9178]: config mapnik:  font_dir_recurse=1
renderd[9178]: config renderd(0): Active
renderd[9178]: config renderd(0): unix socketname=/var/run/renderd/renderd.sock
renderd[9178]: config renderd(0): num_threads=4
renderd[9178]: config renderd(0): tile_dir=/var/lib/mod_tile
renderd[9178]: config renderd(0): stats_file=/var/run/renderd/renderd.stats
renderd[9178]: config map 0:   name(default) file(/home/mayank/src/mapnik-style/osm.xml) uri(/osm_tiles/) htcp() host(localhost)
renderd[9178]: Initialising unix server socket on /var/run/renderd/renderd.sock
socket bind failed for: /var/run/renderd/renderd.sock

Below is as root but no tiles are generated by this process probably because of the database thing

renderd -f -c /usr/local/etc/renderd.conf
renderd[9347]: Rendering daemon started
renderd[9347]: Initiating reqyest_queue
iniparser: syntax error in /usr/local/etc/renderd.conf (8):
-> ;[renderd01]
iniparser: syntax error in /usr/local/etc/renderd.conf (15):
-> ;[renderd02]
iniparser: syntax error in /usr/local/etc/renderd.conf (33):
-> ;** config options used by mod_tile, but not renderd **
iniparser: syntax error in /usr/local/etc/renderd.conf (42):
-> ;[style2]
iniparser: syntax error in /usr/local/etc/renderd.conf (49):
-> ;** config options used by mod_tile, but not renderd **
renderd[9347]: Parsing section renderd
renderd[9347]: Parsing render section 0
renderd[9347]: Parsing section mapnik
renderd[9347]: Parsing section default
renderd[9347]: config renderd: unix socketname=/var/run/renderd/renderd.sock
renderd[9347]: config renderd: num_threads=4
renderd[9347]: config renderd: num_slaves=0
renderd[9347]: config renderd: tile_dir=/var/lib/mod_tile
renderd[9347]: config renderd: stats_file=/var/run/renderd/renderd.stats
renderd[9347]: config mapnik:  plugins_dir=/usr/local/lib/mapnik/input
renderd[9347]: config mapnik:  font_dir=/usr/local/lib64/mapnik/fonts
renderd[9347]: config mapnik:  font_dir_recurse=1
renderd[9347]: config renderd(0): Active
renderd[9347]: config renderd(0): unix socketname=/var/run/renderd/renderd.sock
renderd[9347]: config renderd(0): num_threads=4
renderd[9347]: config renderd(0): tile_dir=/var/lib/mod_tile
renderd[9347]: config renderd(0): stats_file=/var/run/renderd/renderd.stats
renderd[9347]: config map 0:   name(default) file(/home/mayank/src/mapnik-style/osm.xml) uri(/osm_tiles/) htcp() host(localhost)
renderd[9347]: Initialising unix server socket on /var/run/renderd/renderd.sock
renderd[9347]: Created server socket 5
renderd[9347]: Renderd is using mapnik version 2.0.3
renderd[9347]: Unable to open font directory: /usr/local/lib64/mapnik/fonts
Running in foreground mode...
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[9347]: Starting stats thread
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[9347]: Using web mercator projection settings
renderd[9347]: Using web mercator projection settings
renderd[9347]: Using web mercator projection settings
renderd[9347]: Using web mercator projection settings

Answer

Empty_Mind picture Empty_Mind · Mar 5, 2015

I came across almost the same problem you had. As far as i see there may be two causes behind this. Try run again with

sudo -u 'username' renderd -f -c /usr/local/etc/renderd.conf

after applying one of suggested solutions. Substitute 'username' for name of user running renderd:

Cause #1 missing writing rights

You probably have no writing rights to /var/run/renderd/renderd.sock file.

Solution for you would be changing owner of the directory :

sudo chown 'username' /var/run/renderd

and / or changing owner of the file by typing

sudo chown 'username' /var/run/renderd/renderd.sock

,where 'username' stands for user which will be runnning renderd.

Cause #2 missing directory

I have got almost identical error message as you.

In my case I was missing the /var/run/renderd directory. Solution in my case was creating /var/run/renderd directory and then changing its owner:

sudo mkdir /var/run/renderd
sudo chown 'username' /var/run/renderd

,where 'username' is user, which will be runnng renderd.