PDA

View Full Version : start of wildfly-9.0.2 fails on F23, pid not available (yet)



gerritvds
17th December 2015, 10:06 AM
Gerrit van der Sanden
Newbie

Hi,

I have installed wildfly 9.0.2 on fedora 23 in a VirtualBox, according to the following instruction:
http://developer-should-know.tumblr.com/post/112230363742/how-to-install-wildfly-as-a-service-on-linux
In the output below, you can see the content of the relevant files.

The problem is
systemd[1]: wildfly.service: PID file /var/run/wildfly/wildfly.pid not readable (yet?) after start: No such file or directory

Can somebody please tell me what I'm doing wrong?

When I start the service, I get the output shown below:

424 15:12:24 gerrit@localhost: /etc/init.d> sudo systemctl start wildfly
Job for wildfly.service failed because a configured resource limit was exceeded. See "systemctl status wildfly.service" and "journalctl -xe" for details.
425 15:13:02 gerrit@localhost: /etc/init.d> systemctl status -l wildfly.service
wildfly.service - SYSV: WildFly startup script[/FONT]
Loaded: loaded (/etc/rc.d/init.d/wildfly)
Active: failed (Result: resources) since Wed 2015-12-16 15:13:02 CET; 19s ago
Docs: man:systemd-sysv-generator(8)
Process: 9205 ExecStart=/etc/rc.d/init.d/wildfly start (code=exited, status=0/SUCCESS)

Dec 16 15:12:30 localhost.localdomain systemd[1]: Starting SYSV: WildFly startup script...
Dec 16 15:12:30 localhost.localdomain runuser[9224]: pam_unix(runuser:session): session opened for user wildfly by (uid=0)
Dec 16 15:13:02 localhost.localdomain wildfly[9205]: Starting wildfly: [ OK ]
Dec 16 15:13:02 localhost.localdomain systemd[1]: wildfly.service: PID file /var/run/wildfly/wildfly.pid not readable (yet?) after start: No such file or directory
Dec 16 15:13:02 localhost.localdomain systemd[1]: Failed to start SYSV: WildFly startup script.
Dec 16 15:13:02 localhost.localdomain systemd[1]: wildfly.service: Unit entered failed state.
Dec 16 15:13:02 localhost.localdomain systemd[1]: wildfly.service: Failed with result 'resources'.
426 15:13:21 gerrit@localhost: /etc/init.d> l /opt
total 12
drwxr-xr-x. 3 root root 4096 Dec 14 10:04 google
drwxr-xr-x. 9 root root 4096 Dec 13 17:54 VBoxGuestAdditions-5.0.10
lrwxrwxrwx. 1 wildfly wildfly 24 Dec 15 16:22 wildfly -> /opt/wildfly-9.0.2.Final
drwxr-xr-x. 10 wildfly wildfly 4096 Oct 26 23:15 wildfly-9.0.2.Final
427 15:21:43 gerrit@localhost: /etc/init.d> cat /etc/default/wildfly.conf
# General configuration for the init.d scripts,
# not necessarily for JBoss AS itself.
# default location: /etc/default/wildfly


## Location of JDK
# JAVA_HOME="/usr/lib/jvm/default-java"
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-4.b17.fc23.x86_64/"


## Location of WildFly
JBOSS_HOME="/opt/wildfly"


## The username who should own the process.
JBOSS_USER=wildfly


## The mode WildFly should start, standalone or domain
JBOSS_MODE=standalone


## Configuration for standalone mode
JBOSS_CONFIG=standalone.xml


## Configuration for domain mode
# JBOSS_DOMAIN_CONFIG=domain.xml
# JBOSS_HOST_CONFIG=host-master.xml


## The amount of time to wait for startup
STARTUP_WAIT=30


## The amount of time to wait for shutdown
SHUTDOWN_WAIT=30


## Location to keep the console log
# JBOSS_CONSOLE_LOG="/var/log/wildfly/console.log"


## Additionals args to include in startup
# JBOSS_OPTS="--admin-only -b 172.0.0.1"
428 15:28:25 gerrit@localhost: /etc/init.d> cat /etc/init.d/wildfly
#!/bin/sh
#
# WildFly control script
#
# chkconfig: - 80 20
# description: WildFly startup script
# processname: wildfly
# pidfile: /var/run/wildfly/wildfly.pid
# config: /etc/default/wildfly.conf
#


# Source function library.
. /etc/init.d/functions


# Load Java configuration.
[ -r /etc/java/java.conf ] && . /etc/java/java.conf
export JAVA_HOME


# Load JBoss AS init.d configuration.
if [ -z "$JBOSS_CONF" ]; then
JBOSS_CONF="/etc/default/wildfly.conf"
fi


[ -r "$JBOSS_CONF" ] && . "${JBOSS_CONF}"


# Set defaults.


if [ -z "$JBOSS_HOME" ]; then
JBOSS_HOME=/opt/wildfly
fi
export JBOSS_HOME


if [ -z "$JBOSS_PIDFILE" ]; then
JBOSS_PIDFILE=/var/run/wildfly/wildfly.pid
fi
export JBOSS_PIDFILE


if [ -z "$JBOSS_CONSOLE_LOG" ]; then
JBOSS_CONSOLE_LOG=/var/log/wildfly/console.log
fi


if [ -z "$STARTUP_WAIT" ]; then
STARTUP_WAIT=30
fi


if [ -z "$SHUTDOWN_WAIT" ]; then
SHUTDOWN_WAIT=30
fi


if [ -z "$JBOSS_LOCKFILE" ]; then
JBOSS_LOCKFILE=/var/lock/subsys/wildfly
fi


# Startup mode of wildfly
if [ -z "$JBOSS_MODE" ]; then
JBOSS_MODE=standalone
fi


# Startup mode script
if [ "$JBOSS_MODE" = "standalone" ]; then
JBOSS_SCRIPT=$JBOSS_HOME/bin/standalone.sh
if [ -z "$JBOSS_CONFIG" ]; then
JBOSS_CONFIG=standalone.xml
fi
else
JBOSS_SCRIPT=$JBOSS_HOME/bin/domain.sh
if [ -z "$JBOSS_DOMAIN_CONFIG" ]; then
JBOSS_DOMAIN_CONFIG=domain.xml
fi
if [ -z "$JBOSS_HOST_CONFIG" ]; then
JBOSS_HOST_CONFIG=host.xml
fi
fi


prog='wildfly'


start() {
echo -n "Starting $prog: "
if [ -f $JBOSS_PIDFILE ]; then
read ppid < $JBOSS_PIDFILE
if [ `ps --pid $ppid 2> /dev/null | grep -c $ppid 2> /dev/null` -eq '1' ]; then
echo -n "$prog is already running"
failure
echo
return 1
else
rm -f $JBOSS_PIDFILE
fi
fi
mkdir -p $(dirname $JBOSS_CONSOLE_LOG)
cat /dev/null > $JBOSS_CONSOLE_LOG


mkdir -p $(dirname $JBOSS_PIDFILE)
chown $JBOSS_USER $(dirname $JBOSS_PIDFILE) || true


if [ ! -z "$JBOSS_USER" ]; then
if [ "$JBOSS_MODE" = "standalone" ]; then
if [ -r /etc/rc.d/init.d/functions ]; then
daemon --user $JBOSS_USER LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT -c $JBOSS_CONFIG $JBOSS_OPTS >> $JBOSS_CONSOLE_LOG 2>&1 &
else
su - $JBOSS_USER -c "LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT -c $JBOSS_CONFIG $JBOSS_OPTS" >> $JBOSS_CONSOLE_LOG 2>&1 &
fi
else
if [ -r /etc/rc.d/init.d/functions ]; then
daemon --user $JBOSS_USER LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT --domain-config=$JBOSS_DOMAIN_CONFIG --host-config=$JBOSS_HOST_CONFIG $JBOSS_OPTS >> $JBOSS_CONSOLE_LOG 2>&1 &
else
su - $JBOSS_USER -c "LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT --domain-config=$JBOSS_DOMAIN_CONFIG --host-config=$JBOSS_HOST_CONFIG $JBOSS_OPTS" >> $JBOSS_CONSOLE_LOG 2>&1 &
fi
fi
fi


count=0
launched=false


until [ $count -gt $STARTUP_WAIT ]
do
grep 'WFLYSRV0025:' $JBOSS_CONSOLE_LOG > /dev/null
if [ $? -eq 0 ] ; then
launched=true
break
fi
sleep 1
let count=$count+1;
done


touch $JBOSS_LOCKFILE
success
echo
return 0
}


stop() {
echo -n $"Stopping $prog: "
count=0;


if [ -f $JBOSS_PIDFILE ]; then
read kpid < $JBOSS_PIDFILE
let kwait=$SHUTDOWN_WAIT


# Try issuing SIGTERM
kill -15 $kpid
until [ `ps --pid $kpid 2> /dev/null | grep -c $kpid 2> /dev/null` -eq '0' ] || [ $count -gt $kwait ]
do
sleep 1
let count=$count+1;
done


if [ $count -gt $kwait ]; then
kill -9 $kpid
fi
fi
rm -f $JBOSS_PIDFILE
rm -f $JBOSS_LOCKFILE
success
echo
}


status() {
if [ -f $JBOSS_PIDFILE ]; then
read ppid < $JBOSS_PIDFILE
if [ `ps --pid $ppid 2> /dev/null | grep -c $ppid 2> /dev/null` -eq '1' ]; then
echo "$prog is running (pid $ppid)"
return 0
else
echo "$prog dead but pid file exists"
return 1
fi
fi
echo "$prog is not running"
return 3
}


case "$1" in
start)
start
;;
stop)
stop
;;
restart)
$0 stop
$0 start
;;
status)
status
;;
*)
## If no parameters are given, print which are avaiable.
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
429 15:29:10 gerrit@localhost: /etc/init.d>[/FONT]

angryfirelord
21st December 2015, 02:52 PM
I think you're either missing a file or the wildfly configuration isn't pointing to a file to write to. The key line is this:


wildfly.service: PID file /var/run/wildfly/wildfly.pid not readable (yet?) after start: No such file or directory

Can you check and see if /var/run/wildfly/wildfly.pid exists?

gerritvds
21st December 2015, 04:02 PM
Thank you for your response!

As you can see in the output below, the PID file doesn't exist before wildfly is started, and it still doesn't exist after an attempt is made to start the service. It seems that for some reason the service does not have the permission to write the PID file, but I can't find the reason.

On this forum I see that there are more services, other than wildfly, that get the same error. However, I haven't seen a solution for any of them.

479 15:49:30 gerrit@localhost: ~> ls -l /var/run/wildfly/
total 0
480 15:50:02 gerrit@localhost: ~> systemctl status -l wildfly.service
● wildfly.service - SYSV: WildFly startup script
Loaded: loaded (/etc/rc.d/init.d/wildfly)
Active: failed (Result: resources) since Mon 2015-12-21 15:09:39 CET; 40min ago
Docs: man:systemd-sysv-generator(8)
Process: 761 ExecStart=/etc/rc.d/init.d/wildfly start (code=exited, status=0/SUCCESS)

Dec 21 15:09:31 localhost.localdomain systemd[1]: Starting SYSV: WildFly startup script...
Dec 21 15:09:32 localhost.localdomain runuser[825]: pam_unix(runuser:session): session opened for user wildfly by (uid=0)
Dec 21 15:09:39 localhost.localdomain wildfly[761]: Starting wildfly: [ OK ]
Dec 21 15:09:39 localhost.localdomain systemd[1]: wildfly.service: PID file /var/run/wildfly/wildfly.pid not readable (yet?) after start: No such file or directory
Dec 21 15:09:39 localhost.localdomain systemd[1]: Failed to start SYSV: WildFly startup script.
Dec 21 15:09:39 localhost.localdomain systemd[1]: wildfly.service: Unit entered failed state.
Dec 21 15:09:39 localhost.localdomain systemd[1]: wildfly.service: Failed with result 'resources'.
481 15:50:07 gerrit@localhost: ~> ls -l /var/run/wildfly/
total 0
482 15:50:17 gerrit@localhost: ~> systemctl start wildfly.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or other units.
Authenticating as: Gerrit van der Sanden (gerrit)
Password:
==== AUTHENTICATION COMPLETE ===
Job for wildfly.service failed because a configured resource limit was exceeded. See "systemctl status wildfly.service" and "journalctl -xe" for details.
483 15:51:01 gerrit@localhost: ~> ls -l /var/run/wildfly/
total 0
484 15:51:13 gerrit@localhost: ~>

gerritvds
21st December 2015, 09:32 PM
I did the same installation on Ubuntu (same java and wildfly versions and same procedure) and it works fine there. That means that the problem is either in F23 or in the file
/opt/wildfly/bin/init.d/wildfly-init-redhat.sh
(for Ubuntu there is another script, namely wildfly-init-debian.sh).

angryfirelord
22nd December 2015, 05:14 AM
That's certainly possible. Is there anything else in init.d that's wildfly related? There should be some kind of shell script in there. Can you also post the contents of the systemd service? I think that command would be systemctl cat wildfly.service.

gerritvds
22nd December 2015, 11:24 AM
Below you can see the output of 'systemctl cat wildfly.service'. As for the contents of init.d, I don't think there is anything else there related to wildfly (the file saved_wildfly is created by me because I added a few echo statements). In the installation procedure I used the script I mentioned is copied to init.d, as per


cp /opt/wildfly/bin/init.d/wildfly-init-redhat.sh /etc/init.d/wildfly


This is the requested output:


611 11:10:11 gerrit@localhost: /etc/init.d> systemctl cat wildfly.service
# /run/systemd/generator.late/wildfly.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/rc.d/init.d/wildfly
Description=SYSV: WildFly startup script
Before=multi-user.target multi-user.target multi-user.target graphical.target shutdown.target livesys-late.ser
After=livesys.service
Conflicts=shutdown.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=no
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/etc/rc.d/init.d/wildfly start
ExecStop=/etc/rc.d/init.d/wildfly stop
ExecReload=/etc/rc.d/init.d/wildfly reload
612 11:10:30 gerrit@localhost: /etc/init.d> l
total 60
-rw-r--r--. 1 root root 14118 Dec 7 14:17 functions
-rwxr-xr-x. 1 root root 6674 Oct 29 22:30 livesys
-rwxr-xr-x. 1 root root 1054 Oct 29 22:29 livesys-late
-rwxr-xr-x. 1 root root 2989 Dec 7 14:17 netconsole
-rwxr-xr-x. 1 root root 6727 Dec 7 14:17 network
-rw-r--r--. 1 root root 1160 Oct 19 09:13 README
-rwxr-xr-x. 1 root root 4132 Dec 21 20:54 saved_wildfly
-rwxr-xr-x. 1 root root 4335 Dec 21 21:08 wildfly
613 11:11:12 gerrit@localhost: /etc/init.d>

angryfirelord
22nd December 2015, 05:27 PM
It looks like the copy command copied the wildfly folder to the wrong directory or the service was created pointing to the wrong folder. The systemd service references the rc.d folder, so that would explain why it can't start it. I'll bet on your Ubuntu machine the service points to /etc/init.d.

Let's see if we can get away with the easy option. Copy the wildfly script into a new folder under /etc/rc.d/init.d.


cp /opt/wildfly/bin/init.d/wildfly-init-redhat.sh /etc/rc.d/init.d/wildfly

Hopefully nothing else references /etc/init.d directly. If it does, then the systemd service will have to be edited and the rc.d path will need to be removed.

gerritvds
22nd December 2015, 06:15 PM
But the directories are linked:


677 18:12:50 gerrit@localhost: /etc> l init.d
lrwxrwxrwx. 1 root root 11 Nov 24 12:58 init.d -> rc.d/init.d
678 18:13:23 gerrit@localhost: /etc>

angryfirelord
24th December 2015, 04:07 AM
Right, I forgot about that. So I think in that case the service itself is probably good. Unfortunately, I'm running out of ideas!

One thing I did notice in your config file is that the JBOSS_USER is set to wildfly. Do you have a user called wildfly and does it have the right permissions to get what it needs? If it doesn't have access to write to /var/run/wildfly, then that would trigger an error.

gerritvds
24th December 2015, 11:10 AM
Yes, the user wildfly is created, see the instructions in
http://developer-should-know.tumblr.com/post/112230363742/how-to-install-wildfly-as-a-service-on-linux

See also this output:


691 10:57:22 gerrit@localhost: /run> l /var/run
lrwxrwxrwx. 1 root root 6 Oct 29 22:21 /var/run -> ../run
692 11:00:48 gerrit@localhost: /run> l /run | grep wild
drwxr-xr-x. 2 wildfly wildfly 40 Dec 24 10:55 wildfly
693 11:00:58 gerrit@localhost: /run> systemctl start wildfly
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or other units.
Authenticating as: Gerrit van der Sanden (gerrit)
Password:
==== AUTHENTICATION COMPLETE ===
Job for wildfly.service failed because a configured resource limit was exceeded. See "systemctl status wildfly.service" and "journalctl -xe" for details.
694 11:03:13 gerrit@localhost: /run> l /run | grep wild
drwxr-xr-x. 2 wildfly wildfly 40 Dec 24 11:01 wildfly
695 11:06:02 gerrit@localhost: /run>

Thanks anyway for taking a look at this problem. I will continue on Ubuntu until this problem is solved in Fedora.

angryfirelord
24th December 2015, 05:09 PM
Ok, I'll give it a try when I get some free time. I suspect that the script was targeted for RHEL and somewhere in some Fedora release something was changed that's causing the problem. If you're feeling adventurous, you can install the RC of version 10 and see if that helps.