Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 560790 - net-irc/unrealircd-3.2.10.4: won't start with initscript, starts fine by itself
Summary: net-irc/unrealircd-3.2.10.4: won't start with initscript, starts fine by itself
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Nathan Phillip Brink (binki) (RETIRED)
URL:
Whiteboard:
Keywords: NeedPatch
Depends on:
Blocks:
 
Reported: 2015-09-18 18:53 UTC by Raymond Jennings
Modified: 2016-08-20 21:27 UTC (History)
2 users (show)

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


Attachments
emerge --info (einfo.txt,5.89 KB, text/plain)
2015-09-18 18:58 UTC, Raymond Jennings
Details
strace log (ulog,184.50 KB, text/plain)
2015-09-22 15:42 UTC, Raymond Jennings
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Raymond Jennings 2015-09-18 18:53:21 UTC
The unrealircd init script cannot start unrealircd, but I can start it just fine from the command line directly.

#/etc/init.d/unrealircd start
 * Starting unrealircd ...
 * start-stop-daemon: failed to start `/usr/bin/unrealircd'               [ !! ]
 * ERROR: unrealircd failed to start

#unrealircd
WARNING: You are running UnrealIRCd as root and it is not
         configured to drop priviliges. This is _very_ dangerous,
         as any compromise of your UnrealIRCd is the same as
         giving a cracker root SSH access to your box.
         You should either start UnrealIRCd under a different
         account than root, or set IRC_USER in include/config.h
         to a nonprivileged username and recompile.
 _   _                      _ ___________  _____     _ 
| | | |                    | |_   _| ___ \/  __ \   | |
| | | |_ __  _ __ ___  __ _| | | | | |_/ /| /  \/ __| |
| | | | '_ \| '__/ _ \/ _` | | | | |    / | |    / _` |
| |_| | | | | | |  __/ (_| | |_| |_| |\ \ | \__/\ (_| |
 \___/|_| |_|_|  \___|\__,_|_|\___/\_| \_| \____/\__,_|
                           v3.2.10.4
                     using TRE 0.8.0 (BSD)
                     using OpenSSL 1.0.2d 9 Jul 2015
                     using zlib 1.2.8

* Loading IRCd configuration ..
* Configuration loaded without any problems ..
* Initializing SSL.
* Dynamic configuration initialized .. booting IRCd.
---------------------------------------------------------------------


Reproducible: Always
Comment 1 Raymond Jennings 2015-09-18 18:57:02 UTC
I suspect some sort of permissions problem.

/var/log/syslog:
Sep 18 11:54:20 metalhead /etc/init.d/unrealircd[28728]: start-stop-daemon: failed to start `/usr/bin/unrealircd'
Sep 18 11:54:20 metalhead /etc/init.d/unrealircd[28714]: ERROR: unrealircd failed to start

/var/log/daemon:
Sep 18 11:54:20 metalhead /etc/init.d/unrealircd[28728]: start-stop-daemon: failed to start `/usr/bin/unrealircd'
Sep 18 11:54:20 metalhead /etc/init.d/unrealircd[28714]: ERROR: unrealircd failed to start

/var/log/auth:
Sep 18 11:54:20 metalhead start-stop-daemon: pam_unix(start-stop-daemon:session): session opened for user unrealircd by root(uid=0)

ls -l /etc/unrealircd:
drwxr-x--- 2 root       unrealircd  4096 Sep 18 11:40 aliases
-rw------- 1 root       unrealircd  1175 Sep 18 11:39 badwords.channel.conf
-rw------- 1 root       unrealircd  1183 Sep 18 11:39 badwords.message.conf
-rw------- 1 root       unrealircd  1121 Sep 18 11:39 badwords.quit.conf
-rw-r----- 1 root       unrealircd  1844 Sep 18 11:39 dccallow.conf
-rw------- 1 root       unrealircd 52526 Sep 18 11:39 help.conf
-rw-r----- 1 unrealircd root        1021 Sep 18 11:40 server.cert.crt
-rw-r----- 1 unrealircd root         737 Sep 18 11:40 server.cert.csr
-rw-r----- 1 unrealircd root         887 Sep 18 11:40 server.cert.key
-rw-r----- 1 unrealircd root        1909 Sep 18 11:40 server.cert.pem
lrwxrwxrwx 1 root       root          15 Sep 18 11:40 server.key.pem -> server.cert.key
-rw------- 1 root       unrealircd  5597 Sep 18 11:39 spamfilter.conf
lrwxrwxrwx 1 root       unrealircd    19 Sep 18 11:40 tmp -> /var/lib/unrealircd
-rw------- 1 root       unrealircd 20425 Sep 18 11:43 unrealircd.conf
Comment 2 Raymond Jennings 2015-09-18 18:58:37 UTC
Created attachment 412218 [details]
emerge --info
Comment 3 Raymond Jennings 2015-09-22 15:41:59 UTC
Removing the "--user" part of the initscript made it work...
Comment 4 Raymond Jennings 2015-09-22 15:42:46 UTC
Created attachment 412590 [details]
strace log

Choked on bad permissions, couldn't write to /var/log/unrealircd
Comment 5 Raymond Jennings 2015-09-22 15:45:59 UTC
I deleted /var/log/unrealircd and reinstalled.  Everything worked.

Suggested fix:  When installing, verify correct permissions on /var/log/unrealircd if it already exists.
Comment 6 sebaFlame 2016-05-09 22:07:35 UTC
I had the same symptoms. To make it run as user unrealircd I did.
$ USE="-ipv6" emerge -v unrealircd

$ uname -sr
Linux 4.4.8-hardened-r1
$ grep IPV6 /usr/src/linux/.config
CONFIG_IPV6=m
# CONFIG_IPV6_ROUTER_PREF is not set
# CONFIG_IPV6_OPTIMISTIC_DAD is not set
# CONFIG_IPV6_MIP6 is not set
# CONFIG_IPV6_ILA is not set
# CONFIG_IPV6_VTI is not set
CONFIG_IPV6_SIT=m
# CONFIG_IPV6_SIT_6RD is not set
CONFIG_IPV6_NDISC_NODETYPE=y
# CONFIG_IPV6_TUNNEL is not set
# CONFIG_IPV6_GRE is not set
# CONFIG_IPV6_MULTIPLE_TABLES is not set
# CONFIG_IPV6_MROUTE is not set
# CONFIG_NF_DEFRAG_IPV6 is not set
# CONFIG_NF_CONNTRACK_IPV6 is not set
# CONFIG_NF_DUP_IPV6 is not set
# CONFIG_NF_REJECT_IPV6 is not set
CONFIG_NF_LOG_IPV6=m
Comment 7 Raymond Jennings 2016-05-10 19:35:34 UTC
(In reply to sebaFlame from comment #6)
> I had the same symptoms. To make it run as user unrealircd I did.
> $ USE="-ipv6" emerge -v unrealircd
> 
> $ uname -sr
> Linux 4.4.8-hardened-r1
> $ grep IPV6 /usr/src/linux/.config
> CONFIG_IPV6=m
> # CONFIG_IPV6_ROUTER_PREF is not set
> # CONFIG_IPV6_OPTIMISTIC_DAD is not set
> # CONFIG_IPV6_MIP6 is not set
> # CONFIG_IPV6_ILA is not set
> # CONFIG_IPV6_VTI is not set
> CONFIG_IPV6_SIT=m
> # CONFIG_IPV6_SIT_6RD is not set
> CONFIG_IPV6_NDISC_NODETYPE=y
> # CONFIG_IPV6_TUNNEL is not set
> # CONFIG_IPV6_GRE is not set
> # CONFIG_IPV6_MULTIPLE_TABLES is not set
> # CONFIG_IPV6_MROUTE is not set
> # CONFIG_NF_DEFRAG_IPV6 is not set
> # CONFIG_NF_CONNTRACK_IPV6 is not set
> # CONFIG_NF_DUP_IPV6 is not set
> # CONFIG_NF_REJECT_IPV6 is not set
> CONFIG_NF_LOG_IPV6=m

IPV6 issues sound like a separate bug from the permissions problem I found.

Could you file a new bug about this?
Comment 8 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2016-08-20 20:02:56 UTC
What I’m going to bet happened is you tried to run unrealircd manually as root prior to trying to use the initscripts. As files are created with the owner/group of the process creating them, this would have created the ircd.log file with the wrong ownership information.

I’ve added an elog to unrealircd-4.0.5 warning against this, but I’m not really sure if this is something that can be fixed as it is user error :-p. Could add some automatic perms fixing to the initscript, but I think the script is already complicated enough… Oh, I know, I can just precreate the logfile and tunefile in pkg_postinst() with the correct owner. Then the file will already exist and running unrealircd incorrectly as root won’t create it wrong. I’ll change that shortly…
Comment 9 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2016-08-20 21:27:43 UTC
I’ve put the precreation strategy in the tree. So now you should be able to install unrealircd, run it as root, realize your mistake and kill it, and then switch to launching it with the initscripts with no problem (other than needing to set up the config properly of course).