problem with systemctl / insserv during the first boot.

985 views
Skip to first unread message

David Belgini

unread,
Jan 23, 2013, 1:33:51 PM1/23/13
to kiwi-...@googlegroups.com

Hello,

I'm new here and I need some help... 

I have an Opensuse 12.2 image that was created through kiwi.

This image has an own service that do some configurations and install others services during the first boot.

All the script run without problem, except the line “systemctl enable mwocr.service” that retun:

 

mwocr.service is not a native service, redirecting to /sbin/chkconfig.

Executing /sbin/chkconfig mwocr on insserv: pushd() can not change to directory //etc/init.d: No such file or directory

/sbin/insserv failed, exit code 1

 

After the first boot I can execute same command without error….

Robert Schweikert

unread,
Jan 23, 2013, 1:54:53 PM1/23/13
to kiwi-...@googlegroups.com, Frederic Crozat
How does mwocr.service get onto the system and where is the file located?

This is not really a kiwi problem, but we'll try to help.

Copying Frederic the systemd expert.

Robert

--
Robert Schweikert MAY THE SOURCE BE WITH YOU
SUSE-IBM Software Integration Center LINUX
Tech Lead
rjsc...@suse.com
rsch...@ca.ibm.com
781-464-8147

David Belgini

unread,
Jan 23, 2013, 2:28:19 PM1/23/13
to kiwi-...@googlegroups.com, Frederic Crozat
Yes! Everything are in the same logical partition.
I have the script "install_first_boot" that run only once in the first startup.
I have the problem in this script when it try to set the mwocr to start automatically in the boot!
You can find attached the both scripts.

David Belgini

unread,
Jan 23, 2013, 2:31:03 PM1/23/13
to kiwi-...@googlegroups.com, Frederic Crozat
/etc/init.d/mwocr

#! /bin/sh
### BEGIN INIT INFO
# Provides:          MWOCR
# Required-Start:    $postgresql
# Required-Stop:
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: MWOCR Sentry
# Description:       Service with allow sentry to work.
### END INIT INFO

. /etc/rc.status
rc_reset

case "$1" in
    start)
        echo -n "Starting MWOCR"
        sh /sentry/ocr64/service.sh start
        rc_status -v
        ;;
    stop)
        echo -n "Stoping MWOCR"
        sh /sentry/ocr64/service.sh stop
        rc_status -v
        ;;
    restart)
        sh /sentry/ocr64/service.sh stop
        sh /sentry/ocr64/service.sh start
        rc_status
        ;;
    status)
        echo -n "Checking MWOCR"
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|status}"
        exit 1
        ;;
esac

David Belgini

unread,
Jan 23, 2013, 2:31:49 PM1/23/13
to kiwi-...@googlegroups.com, Frederic Crozat
/etc/init.d/install_first_boot

#! /bin/sh
### BEGIN INIT INFO
# Provides:          First_Boot
# Required-Start:    $local_fs $network $remote_fs $syslog $time $sshd
# Required-Stop:
# Default-Start:     3 5
# Default-Stop:      0 1 2 4 6
# Short-Description: SmartCapture install script
# Description:       Service with allow sentry to work.
### END INIT INFO

. /etc/rc.status
rc_reset

logFile=/var/log/Sentry_Install.log

TesteExec ()
{
if [ $? -ne 0 ];
 then
  echo $1
  #exit 1
fi
}

OCRSetup ()
{
 if [ -d /sentry/ocr64/ ]
  then
   carmen=`find /sentry/ocr64/ARHungary | grep x86_64`
   mkdir /tmp/carmen
   tar xzf $carmen -C /tmp/carmen 2>&1 > /dev/null
   cd /tmp/carmen/
   echo y | ./_install_all-x86_64.sh
   rm -Rf /tmp/carmen
   /bin/ln -s /sentry/ocr64/service.sh /usr/local/bin/mwocr
  fi
}

case "$1" in
    start)
        echo -n " ** Intalando Sentry...."
        sequenceInstall ()
        {
        OCRSetup
systemctl start mwocr.service
        systemctl enable mwocr.service
        systemctl start tomcat.service
        systemctl enable tomcat.service
chkconfig install_first_boot off
cd /
find -type f | grep insserv
ls /sbin/
        rm -f $(find /etc/init.d/ | grep install_first)
        }
        sequenceInstall &> $logFile
rc_status -v
        ;;
    *)
        echo "Usage: $0 {start}"
        exit 1
        ;;
esac


Em quarta-feira, 23 de janeiro de 2013 17h28min19s UTC-2, David Belgini escreveu:

Robert Schweikert

unread,
Jan 23, 2013, 3:41:13 PM1/23/13
to kiwi-...@googlegroups.com
Hi,

Sorry for the top post, but posting below the script really makes little
sense.

Well you've only answered one of my questions, still do not know how
these scripts, install_first_boot and mwocr get into /etc/init.d in the
first place.

However, you have a fundamental issue. While systemd is compatible with
sysV init scripts it prefers unit files. This is why you get the
following message:

mwocr.service is not a native service, redirecting to /sbin/chkconfig

what you really want to create are unit files placed in the proper
location for systemd, see
http://0pointer.de/blog/projects/systemd-for-admins-3.html for some help
on converting sysV init script to systemd unit files.

You also get an error from chkconfig:

Executing /sbin/chkconfig mwocr on insserv: pushd() can not change to
directory //etc/init.d: No such file or directory

This indicates that /etc/init.d is not there, which is the reason for my
question, that you didn't care to answer. How do the scripts get into
the image?

And yes, after firstboot things are different, thus I would not
necessarily expect the same behavior.

Later
Reply all
Reply to author
Forward
0 new messages