Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 235953 - net-irc/quassel - quasselcore init script doesn't work correctly with baselayout-1
Summary: net-irc/quassel - quasselcore init script doesn't work correctly with baselay...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Markus Ullmann (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-27 19:41 UTC by Mikko C.
Modified: 2008-08-30 19:03 UTC (History)
3 users (show)

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


Attachments
fixed script (quasselcore,668 bytes, text/plain)
2008-08-28 12:29 UTC, Mikko C.
Details
quasselcore.init.diff (quasselcore.init.diff,1.06 KB, patch)
2008-08-28 20:26 UTC, Daniel Pielmeier
Details | Diff
quassel-0.3.0.diff (quassel-0.3.0.diff,1.12 KB, patch)
2008-08-28 20:30 UTC, Daniel Pielmeier
Details | Diff
quassel-9999-r1.diff (quassel-9999-r1.diff,1.22 KB, patch)
2008-08-28 20:30 UTC, Daniel Pielmeier
Details | Diff
quasselcore.init.diff (quasselcore.init.diff,1.06 KB, patch)
2008-08-29 17:31 UTC, Daniel Pielmeier
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikko C. 2008-08-27 19:41:10 UTC
Recently this init script has been added to net-irc/quassel
The problem seems to be that it doesn't work correctly with baselayout-1.
Quasselcore is always launched as root, even if QUASSEL_USER is defined in /etc/conf.d/quasselcore

Changing "--user" with "--chuid" makes quasselcore launch as user, but it looks for the configuration in the wrong place: /root/ instead of /home/user/

Here's the output I get by removing "--background" and with "--chuid":

#
$ /etc/init.d/quasselcore start
#
* Caching service dependencies ... [ ok ]
#
* Starting Quassel Core ...
#
Unable to create Quassel data directory: /root/.quassel
#
2008-08-27 20:43:49 Warning: SslServer: SSL Certificate is either missing or has a wrong format!
#
Quassel Core will still work, but cannot provide SSL for client connections.
#
Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support.
#
2008-08-27 20:43:49 Warning: Core is currently not configured! Please connect with a Quassel Client for basic setup.
#
2008-08-27 20:43:49 Info: Listening for GUI clients on port 4242 using protocol version 5

As you can see it looks for /root/.quassel
Instead it should look for /home/user/.quassel

$ eix baselayout
[I] sys-apps/baselayout
     Available versions:  [P]1.11.15-r3 1.12.11.1 ~1.12.12 ~2.0.0 {bootstrap build static unicode}
     Installed versions:  1.12.11.1(08:23:46 21/06/2008)(unicode -bootstrap -build -static)

Reproducible: Always
Comment 1 Daniel Pielmeier gentoo-dev 2008-08-28 07:00:10 UTC
(In reply to comment #0)
> Changing "--user" with "--chuid" makes quasselcore launch as user, but it
> looks for the configuration in the wrong place: /root/ instead of /home/user/

Something came to my mind regarding this problem. Try to use --chuid and --user in combination:

--user ${QUASSEL_USER} --chuid ${QUASSEL_USER}

Maybe chuid really just changes to the specified ID but not the users environment.

But I don't think this is the problem. After digging into this a bit deeper. My guess is this is a bug in baselayout which does not change $HOME when using --chuid. There was also an ancient bug in Debian [1,2]. It states it was fixed in version 1.13.15. I don't know how the version of Debian is related to Gentoos version. Maybe Roy Marples (uberlord) can help us here.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=267784
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=295169
Comment 2 Mikko C. 2008-08-28 07:15:56 UTC
I tried your suggestion, but I get the same error as before.
Unable to create Quassel data directory: /root/.quassel
Comment 3 Roy Marples 2008-08-28 11:01:10 UTC
(In reply to comment #1)
> But I don't think this is the problem. After digging into this a bit deeper. My
> guess is this is a bug in baselayout which does not change $HOME when using
> --chuid. There was also an ancient bug in Debian [1,2]. It states it was fixed
> in version 1.13.15. I don't know how the version of Debian is related to
> Gentoos version.

You are correct - baselayout-1 does not set $HOME.
OpenRC does this correctly.
Comment 4 Daniel Pielmeier gentoo-dev 2008-08-28 11:32:23 UTC
(In reply to comment #3)
> You are correct - baselayout-1 does not set $HOME.
> OpenRC does this correctly.

Thanks for your reply. Is there any way to work around this in old start-stop-daemon? Many users still running stable Gentoo and thus using the old baselayout.

Or is it possible to do this in the init script by just using something like this:

HOME=/home/${QUASSEL_USER}
Comment 5 Mikko C. 2008-08-28 12:20:07 UTC
> Or is it possible to do this in the init script by just using something like
> this:
> 
> HOME=/home/${QUASSEL_USER}
> 

This works! :)
Thanks a lot Daniel.
Also "--chuid" is enough, "--user" isn't needed.
Comment 6 Daniel Pielmeier gentoo-dev 2008-08-28 12:25:45 UTC
(In reply to comment #5)
> This works! :)
> Thanks a lot Daniel.
> Also "--chuid" is enough, "--user" isn't needed.

Fine! Can you just attach the changed script here. I will take a look at it later and make it work with old baselayout and new openrc.
Comment 7 Mikko C. 2008-08-28 12:29:37 UTC
Created attachment 163987 [details]
fixed script

I don't remember if the --background option was in the stop part or not since I changed the script several times, please check it :)
Comment 8 Mikko C. 2008-08-28 12:31:31 UTC
reopened since this isn't fixed in portage yet :)
Comment 9 Daniel Pielmeier gentoo-dev 2008-08-28 20:26:11 UTC
Created attachment 164019 [details, diff]
quasselcore.init.diff

Attached init script should work with baselayout-1 and baselayout-2/openrc!
Comment 10 Daniel Pielmeier gentoo-dev 2008-08-28 20:30:11 UTC
Created attachment 164020 [details, diff]
quassel-0.3.0.diff

Changed quassel-0.3.0.ebuild removed complex checking for qt, qt-sql and aligned it to quassel-9999-r1.ebuild
Comment 11 Daniel Pielmeier gentoo-dev 2008-08-28 20:30:50 UTC
Created attachment 164022 [details, diff]
quassel-9999-r1.diff

Changed quassel-9999-r1.ebuild removed complex checking for qt, qt-sql and aligned it to quassel-0.3.0.ebuild
Comment 12 Daniel Pielmeier gentoo-dev 2008-08-29 08:19:52 UTC
(In reply to comment #9)
> Created an attachment (id=164019) [edit]
> quasselcore.init.diff
> Attached init script should work with baselayout-1 and baselayout-2/openrc!

start-stop-daemon from baselayout-1 also supports setting of environment variables:

-e|--env env-name
Set an environment variable whose name and value is env-name before starting executable. Example: -e HOME="/home/user" exports an environment variable whose name is HOME with value "/home/user".

So instead of setting HOME=/home/${QUASSEL_USER} separately we can do this in the start-stop-daemon command directly like adding the following to the start command:

--env HOME="/home/${QUASSEL_USER}"
Comment 13 Daniel Pielmeier gentoo-dev 2008-08-29 17:31:12 UTC
Created attachment 164069 [details, diff]
quasselcore.init.diff

updated script with --env
Comment 14 Mikko C. 2008-08-29 18:03:17 UTC
the last patch works as expected with baselayout-1
Comment 15 Markus Ullmann (RETIRED) gentoo-dev 2008-08-30 19:03:52 UTC
Added fixed initscript with revbumps to portage, keep up the good work guys ;)