← Back to team overview

dhis2-users team mailing list archive

Re: DHIS2_HOME in ubuntu

 

This is one of the issues which we have addressed with the dhis2-tools
package.  It is a common problem that the tomcat gets started by the wrong
system user.  In your case it wouldn't start but in many cases I have seen
people circumvent the problem by just starting as the root user which is
worse.  So in the dhis2-tools you always start an instance with
'dhis2-startup <instance>' and that ensures that the correct user is
running the process.  In fact I completely removed the startup and shutdown
scripts from the bin directory to try to discourage accidentally starting
it incorrectly.

(Having said all of that, there is something a bit simplistic about our use
of DHIS2_HOME in that we use it as the base directory for configuration but
we also write stuff into it.  Not much as most things are now kept in the
database, but still a few things which require the directory to be
writable.  It would probably be neater to separate DHIS2_CONFIG from
DHIS2_DATA.  Where the former doesn't need to be writable but the latter
does.)


On 2 October 2013 10:10, Seid Hussein <seid.hisp@xxxxxxxxx> wrote:

> Thanks Lars,
>
> Now I have started switching to the dhis user while manipulating tomcat
>
>
> On Wed, Oct 2, 2013 at 11:35 AM, Lars Helge Øverland <larshelge@xxxxxxxxx>wrote:
>
>> Hi Seid,
>>
>> good it works but its better to follow Olav's advice and change to the
>> dhis user before starting tomcat ( su dhis ). You might run into trouble
>> later with your approach e.g. when uploading resources which will be saved
>> the filesystem.
>>
>> cheers
>>
>> Lars
>>
>>
>>
>> On Wed, Oct 2, 2013 at 9:33 AM, Seid Hussein <seid.hisp@xxxxxxxxx> wrote:
>>
>>> Hi all,
>>>
>>> Thanks for the replies. It was an issue of a write privilege and after I
>>> gave the user seid write privileges to the folder, it worked fine.
>>>
>>>
>>> Seid,
>>>
>>>
>>> On Wed, Oct 2, 2013 at 9:32 AM, Knut Staring <knutst@xxxxxxxxx> wrote:
>>>
>>>> Or move to /home/seid
>>>> On 2 Oct 2013 13:28, "Olav Poppe" <olav.poppe@xxxxxx> wrote:
>>>>
>>>>> Not an export on this, but I would guess that if you are running
>>>>> tomcat as user "seid", the "Directory /home/dhis/config" might not be
>>>>> writable as it belongs to the "dhis" user. So you could either try to start
>>>>> tomcat with user "dhis" instead, or make sure that the /home/dhis/config is
>>>>> writable by the "seid" user. And, like Jason says, make sure the
>>>>> hibernate.properties files is in the right folder.
>>>>>
>>>>> Olav
>>>>>
>>>>>
>>>>>
>>>>> 2. okt. 2013 kl. 05:35 skrev Jason Pickering <
>>>>> jason.p.pickering@xxxxxxxxx>:
>>>>>
>>>>> Here is your error it looks like
>>>>>
>>>>> * INFO  2013-10-02 00:13:31,396 Directory /home/dhis/config is not
>>>>> writeable (DefaultLocationManager.java [pool-2-thread-1])
>>>>> * INFO  2013-10-02 00:13:33,710 Could not read external configuration
>>>>> from file system
>>>>>
>>>>> Are you sure there is a hibernate.properties file in that location and
>>>>> the directory is writable?
>>>>>
>>>>> Regards,
>>>>> Jason
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Oct 1, 2013 at 11:39 PM, Seid Hussein <seid.hisp@xxxxxxxxx>wrote:
>>>>>
>>>>>> I'm using the main user which is seid. Do I need to start using the
>>>>>> user dhis?
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Seid Hussein <seid.hisp@xxxxxxxxx>
>>>>>> Date: Wed, Oct 2, 2013 at 12:38 AM
>>>>>> Subject: Re: [Dhis2-users] DHIS2_HOME in ubuntu
>>>>>> To: Olav Poppe <olav.poppe@xxxxxx>
>>>>>>
>>>>>>
>>>>>> I'm using the main user which is seid. Do I need to start using the
>>>>>> user dhis?
>>>>>>
>>>>>>
>>>>>> On Wed, Oct 2, 2013 at 12:32 AM, Olav Poppe <olav.poppe@xxxxxx>wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>> which Ubuntu user are you logged in with when you're starting tomcat?
>>>>>>>
>>>>>>> Olav
>>>>>>>
>>>>>>> > Den 1. okt. 2013 kl. 23:24 skrev Seid Hussein <seid.hisp@xxxxxxxxx
>>>>>>> >:
>>>>>>> >
>>>>>>> > Hi all,
>>>>>>> >
>>>>>>> > After setting setenv.sh and pointing both JAVA_HOME and DHIS2_HOME
>>>>>>> to their appropriate places, and setting appropriate JAVA_OPTS, but still I
>>>>>>> cannot still get DHIS to use the postgresql database rather than H2
>>>>>>> database.
>>>>>>> >
>>>>>>> > When I check catalina.out, it says that DHIS2_HOME points to the
>>>>>>> correct place but in the next line it says Directory /home/dhis/config is
>>>>>>> not writeable
>>>>>>> >
>>>>>>> >
>>>>>>> > to give you an idea,
>>>>>>> >
>>>>>>> > hibernate.properties file is located in /home/dhis/config
>>>>>>> >
>>>>>>> > and here's the content of setenv.sh which is located in
>>>>>>> /usr/share/tomcat7/bin
>>>>>>> >
>>>>>>> > export JAVA_HOME='/usr/lib/jvm/java-7-oracle'
>>>>>>> > export JAVA_OPTS='-Xmx2048m -Xms1024m -XX:MaxPermSize=500m
>>>>>>> -XX:PermSize=300m'
>>>>>>> > export DHIS2_HOME='/home/dhis/config'
>>>>>>> >
>>>>>>> > does anyone have any idea what i'm doing wrong?
>>>>>>> >
>>>>>>> > For reference I've attached catalina.out
>>>>>>> > <catalina.out>
>>>>>>> > _______________________________________________
>>>>>>> > Mailing list: https://launchpad.net/~dhis2-users
>>>>>>> > Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>>>>> > Unsubscribe : https://launchpad.net/~dhis2-users
>>>>>>> > More help   : https://help.launchpad.net/ListHelp
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mailing list: https://launchpad.net/~dhis2-users
>>>>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~dhis2-users
>>>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~dhis2-users
>>>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>
>>>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-users
>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References