Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 222865 - www-servers/resin-3.1.6 init script does not work due to incorrect ownership on /usr/share/resin
Summary: www-servers/resin-3.1.6 init script does not work due to incorrect ownership ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Krzysztof Pawlik (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-19 22:28 UTC by Maurice Volaski
Modified: 2008-06-09 21:50 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Proposed fix (resin.patch,1.23 KB, patch)
2008-05-21 22:16 UTC, Jose Quinteiro
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maurice Volaski 2008-05-19 22:28:10 UTC
www-servers/resin-3.1.6 init script does not work due to incorrect ownership on /usr/share/resin. 

The basic bug is that when resin is started by the supplied init script it cannot create the directory /usr/share/resin/admin because /usr/share/resin is owned by root and that prevents resin from fully starting up. 

(This bug had previously been filed here, closed by my mistake as upstream. I can't find the original bug report.)

Resin will start up and work fine when it is run on the command line without start, but that just may be a quirk in how resin launches itself.

This bug can simply be fixed by having the ebuild set ownership on /usr/share/resin to resin:resin.

(However, it's not clear to me why there are two resin directories supplied by Gentoo, namely /usr/share/resin and /usr/lib/resin. Since resin is creating stuff in /usr/share/resin, it seems resin has some natural association with this directory despite Gentoo's apparently addition of /usr/lib/resin.)
Comment 1 Maurice Volaski 2008-05-19 23:43:36 UTC
I admit that now I'm confused as to what's caused by Resin here or Gentoo's configuration. I suggest following the resolution of bug http://bugs.caucho.com/view.php?id=2682 and then making sure that Gentoo is compatible with the supplied fix.
Comment 2 Jose Quinteiro 2008-05-20 05:13:00 UTC
Yep, this is a problem.  As Scott Ferguson explained in the resin-interest mailing list, Resin expects to be able to write to the resin.root directory.  The Gentoo init script does not set resin.root, so it defaults to /usr/share/resin.

The Gentoo ebuild moves the Resin /ROOT webapp to /var/lib/resin/webapps, so it's reasonable to assume that Gentoo means /var/lib/resin to be resin.root.  This is achieved by passing "-root-directory /var/lib/resin" in the init script.  

However, when you do this, the logs are no longer written to /var/log/resin, but rather to /var/lib/resin/log{,s}.  The watchdog and JVM logs can be redirected to /var/log/resin by adding "-log-directory /var/log/resin" to the init script.    The symlinks to /var/log/resin in the ebuild can probably go, too.

The access log has to be hard-coded in resin.conf, unfortunately.  Line 268 has to be changed to read "<access-log path="/var/log/resin/access.log".  I don't think Resin exposes the value of log.directory in resin.conf.  I'll ask on the ML to make sure, though.

To summarize:

/etc/init.d/resin

        local cmdline="${JAVA_HOME}/bin/java -jar /usr/share/resin/lib/resin.jar \
                -conf /etc/resin/resin.conf \
                -resin-home /usr/lib/resin \
                -root-directory /var/lib/resin \
                -log-directory /var/log/resin \
                ${extraArgs} ${@}"

/etc/resin/resin.conf

<access-log path="/var/log/resin/access.log

/usr/portage/www-servers/resin/resin-3.1.6.ebuild, remove:

    dosym /var/log/resin ${RESIN_HOME}/logs
    dosym /var/log/resin ${RESIN_HOME}/log


HTH,
Jose.
Comment 3 Krzysztof Pawlik (RETIRED) gentoo-dev 2008-05-20 07:12:55 UTC
/sur/share/resin is where the JAR files live, /usr/lib{,64}/resin contains libexec and basic directory structure, config files are in /etc/resin. /usr/share/resin can not be modified in runtime, that's why it's owned by root:root. Hardcoding /usr/lib/resin is not a solution (mainly due to multilib requirements). This bug manifests itself only with default configuration, if you set it up properly it'll work just fine.

I'll try to improve the default configuration file.
Comment 4 Maurice Volaski 2008-05-20 20:21:08 UTC
Right now, resin wants to make an admin directory in /usr/share/resin, so either /usr/share/resin should be owned by resin and modifiable, contrary to what you are saying above, or it should be putting admin in another place (but where?) or admin should already be put there by Gentoo. It won't run unless admin is there (even though it doesn't put anything in it).

I've also noticed that the symlink to /var/lib/resin/webapps in /usr/lib/resin doesn't work. Resin expects it in /usr/share/resin.

It's also not clear why there are two log directories. Resin puts the access.log in the logs directory. But I manually symlinked both log directories to my own place and so it puts all the log files there.
Comment 5 Jose Quinteiro 2008-05-21 22:16:36 UTC
Created attachment 153881 [details, diff]
Proposed fix

If you pass it -root-directory like I said above, Resin creates an admin directory under /var/lib/resin.  That directory has the correct permissions.  There's no need to torque anything under /usr/share at all.
Comment 6 Maurice Volaski 2008-05-21 23:37:36 UTC
That change seems a bit premature to me. I suggest waiting until Scott provides whatever fix is he's going to provide for the bug on his end and then doing what needs to be done on this end.  
Comment 7 Jose Quinteiro 2008-05-21 23:45:12 UTC
I disagree. Resin 3.1 does not work at all as installed by Gentoo right now.

Scott said:

"Thanks.  The log fix is a good one.  Actually, though, we could also  
add the log-directory to the resin.conf since the watchdog reads the  
resin.conf."

http://maillist.caucho.com/pipermail/resin-interest/2008-May/002553.html

1) There is no fix for the /usr/share/admin thing because it's not a bug.

2) Doesn't sound like Scott's made up his mind yet about what to do with the log settings.  I made a suggestion, but the ML appears to have eaten it.  I'll resend it tomorrow.  In any case, it's easy enough to remove/improve the access log fix later if Scott provides a better solution.
Comment 8 Maurice Volaski 2008-05-21 23:52:53 UTC
The /usr/share/admin thing is the bug here. That's what's preventing from it from running. If it can't create admin, it gives up. But Scott gave this bug to himself, which means what, I'm not sure. Perhaps that he intends to change the default location of resin.root to /var/lib/resin? So your fix would work, but eventually become redundant.
Comment 9 Jose Quinteiro 2008-05-22 00:02:47 UTC
(In reply to comment #8)
> The /usr/share/admin thing is the bug here. That's what's preventing from
> it from running. If it can't create admin, it gives up. But Scott gave this
> bug to himself, which means what, I'm not sure.

Perhaps he means to fix the default Resin install to give appropriate permissions to /usr/share/resin.

> Perhaps that he intends to change the default location of resin.root to
> /var/lib/resin?

Doubtful.  That's a Gentooism.  Probably violates the FHS or sumthin'.

> So your fix would work, but eventually become redundant. 

My fix will not be redundant as long as Gentoo puts resin.root in a Gentoo-specific place.
Comment 10 Krzysztof Pawlik (RETIRED) gentoo-dev 2008-06-09 21:50:05 UTC
Fixed in 3.1.6-r1 by specifying valid root-directory, I've tested with default configuration and everything (including admin app) works.