<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pastbedti.me &#187; unprivileged</title>
	<atom:link href="http://www.pastbedti.me/tag/unprivileged/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pastbedti.me</link>
	<description>About ruby, rails, postgresql and stuff....</description>
	<lastBuildDate>Wed, 01 Jun 2011 20:09:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Running couchdb under an unprivileged user account.</title>
		<link>http://www.pastbedti.me/2009/04/running-couchdb-under-an-unprivileged-user-account/</link>
		<comments>http://www.pastbedti.me/2009/04/running-couchdb-under-an-unprivileged-user-account/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 18:23:55 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[unprivileged]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=423</guid>
		<description><![CDATA[When helping a friend last night with couchdb a got stuck when trying to start it as an unprivileged user. The error messages you get from couchdb is far from easy to understand. This is my way of solving it. 1234567$ couchdb kernel-poll not supported; &#34;K&#34; parameter ignored Apache CouchDB 0.9.0 (LogLevel=info) is starting. {&#34;init [...]]]></description>
			<content:encoded><![CDATA[<p>When helping a friend last night with couchdb a got stuck when trying to start it as an unprivileged user. The error messages you get from couchdb is far from easy to understand. </p>
<p>This is my way of solving it.<br />
<span id="more-423"></span></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ couchdb<br />
kernel-poll not supported; &quot;K&quot; parameter ignored<br />
Apache CouchDB 0.9.0 (LogLevel=info) is starting.<br />
{&quot;init terminating in do_boot&quot;,{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}<br />
<br />
Crash dump was written to: erl_crash.dump<br />
init terminating in do_boot ()</div></td></tr></tbody></table></div>
<p>Even with debug turned on it&#8217;s pretty hard to understand.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kernel-poll not supported; &quot;K&quot; parameter ignored<br />
Apache CouchDB 0.9.0 (LogLevel=debug) is starting.<br />
Configuration Settings [&quot;./couchdb/local.ini&quot;]:<br />
&nbsp; [Couch] BindAddress=&quot;127.0.0.1&quot;<br />
&nbsp; [Couch] ConsoleStartupMsg=&quot;Apache CouchDB is starting.&quot;<br />
&nbsp; [Couch] DbRootDir=&quot;/home/mathias/couchdb&quot;<br />
&nbsp; [Couch] DocumentRoot=&quot;/home/mathias/couchdb/www&quot;<br />
&nbsp; [Couch] LogFile=&quot;/home/mathias/couchdb/couch.log&quot;<br />
&nbsp; [Couch] LogLevel=&quot;debug&quot;<br />
&nbsp; [Couch] Port=&quot;5984&quot;<br />
&nbsp; [Couch] UtilDriverDir=&quot;/usr/local/lib/couchdb/erlang/lib/couch-0.8.1-incubating/priv/lib&quot;<br />
&nbsp; [Couch Query Servers] javascript=&quot;/usr/local/bin/couchjs /usr/local/share/couchdb/server/main.js&quot;<br />
&nbsp; [couchdb] database_dir=&quot;/home/mathias/couchdb&quot;<br />
&nbsp; [couchdb] view_index_dir=&quot;/home/mathias/couchdb&quot;<br />
&nbsp; [httpd] bind_address=&quot;127.0.0.1&quot;<br />
&nbsp; [httpd] port=&quot;5984&quot;<br />
&nbsp; [log] level=&quot;debug&quot;<br />
[error] [&lt;0.41.0&gt;] {error_report,&lt;0.21.0&gt;,<br />
&nbsp; &nbsp; {&lt;0.41.0&gt;,crash_report,<br />
&nbsp; &nbsp; &nbsp;[[{pid,&lt;0.41.0&gt;},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{registered_name,couch_server},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{error_info,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{exit,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{badarg,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[{erlang,list_to_integer,[undefined]},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {couch_server,init,1},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {gen_server,init_it,6},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {proc_lib,init_p_do_apply,3}]},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{initial_call,{couch_server,init,['Argument__1']}},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{ancestors,[couch_primary_services,couch_server_sup,&lt;0.1.0&gt;]},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{messages,[]},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{links,[&lt;0.36.0&gt;]},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{dictionary,[]},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{trap_exit,false},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{status,running},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{heap_size,233},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{stack_size,23},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{reductions,113}],<br />
&nbsp; &nbsp; &nbsp; []]}}<br />
{&quot;init terminating in do_boot&quot;,{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}<br />
<br />
Crash dump was written to: erl_crash.dump<br />
init terminating in do_boot ()</div></td></tr></tbody></table></div>
<p>When running things as unprivileged users the usual problems are that you do not have access to read/write files or binding to the lower ports A.K.A. &#8220;well known ports&#8221;.  With that in mind I located the original config files for couchdb with the plan of copying or overriding them. </p>
<p>My config files where located under <strong>/usr/local/etc/couchdb/</strong></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ ls -lsa /usr/local/etc/couchdb/<br />
4 -rw-r--r-- 1 root root 2626 2009-04-10 11:58 default.ini<br />
4 -rw-r--r-- 1 root root &nbsp;847 2009-04-10 14:17 local.ini</div></td></tr></tbody></table></div>
<p>Reading the documentation I found out that local.ini is just for overriding stuff and local.ini will never be overwritten by any upgrades. The config files contain lots of settings, but my aim is just to get it to start so I focus on the things that I think is the problem and thats all the PATH settings. </p>
<p>In my  unprivileged users home folder I created a folder named couchdb to hold my config and datafiles. I also created a www folder inside it. </p>
<p>After that I create my local.ini to override my settings:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ cat couchdb/local.ini <br />
<br />
[couchdb]<br />
database_dir = ./couchdb<br />
view_index_dir = ./couchdb<br />
<br />
[httpd]<br />
port = 5984<br />
bind_address = 127.0.0.1<br />
<br />
[log]<br />
level = info<br />
file=./couchdb/couch.log</div></td></tr></tbody></table></div>
<p>When our new config is in place we can try to start couchdb again.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ couchdb -C ./couchdb/local.ini -p ./couchdb/couch.pid -b<br />
Apache CouchDB has started, time to relax.</div></td></tr></tbody></table></div>
<p><strong>-C</strong> means use configuration FILE (chainable, does not reset system default). If we do not want to use the system config at all we can use a lowercase -c but we want to keep our overridden config as small as possible right now.</p>
<p><strong>-p</strong> is the path to our pid file and <strong>-b</strong> tells couchdb to spawn in the background.</p>
<p>If you are on your local machine you can just launch your browser and point it to <a href="http://127.0.0.1:5984/">http://127.0.0.1:5984/</a></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">{&quot;couchdb&quot;:&quot;Welcome&quot;,&quot;version&quot;:&quot;0.9.0&quot;}</div></td></tr></tbody></table></div>
<p>or you can access the admin gui trough: <a href="http://127.0.0.1:5984/_utils/index.html">http://127.0.0.1:5984/_utils/index.html</a>.</p>
<p>After I started to write this blogpost I did found a page on the Couchdb wiki that explains Error messages and solutions and here it is: <a href="http://wiki.apache.org/couchdb/Error_messages">http://wiki.apache.org/couchdb/Error_messages</a>.</p>
<p>Happy haxxing! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/04/running-couchdb-under-an-unprivileged-user-account/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

