Error when sh start after chkfsys

bridged with qdn.public.neutrino
Post Reply
Martin Dussault

Error when sh start after chkfsys

Post by Martin Dussault » Thu Dec 18, 2003 3:46 pm

Hi

In our boot process we call a sysinit.sh file from /etc/rc.d/rc.local. In
this sysinit file we do a chkfsys command before starting our process then
we get those errors:

sh: j_init: tcgetpgrp() failed: Inapropriate I/O control operation
sh: warning won't have full job control

What we want to do is to start some process when the PC start, but if the
was not shutdown properly some files are corrupted this is why we want to
make a chkfsys before starting those process.

Thank you for any help

Warren Deitch

Re: Error when sh start after chkfsys

Post by Warren Deitch » Fri Dec 19, 2003 12:52 am

I had a problem running chkfsys at startup -- here is my solution to
THAT part of the problem.

Running chkfsys does a CLOSE on all open files on that file system.
Doing a chkfsys on the same file system as the script being run does not
work -- chkfsys closes the script !

Because of other drivers being started and also getting upset about
their files being closed under them, I was forced to do the checkfsys
much earlier. Some people suggested making a special boot image. My
solution only modifies the /etc/system/sysinit file.

I copy a modified sysinit file to /dev/shmem and run it from there. I
have this running on all my user sites.


Modifications to /etc/system/sysinit




# Start the pipe manager. It is needed for sub-shelling...
if ! test /dev/pipe -ef /dev/pipe; then
if pipe; then
typeset -i i=0
while test $i -lt 60 -a ! /dev/pipe -ef /dev/pipe ; do
sleep 1;
let i=i+1;
done
unset i
fi
if ! test /dev/pipe -ef /dev/pipe; then
print Unable to start pipe manager...
exec sh
exec fesh
fi
fi




# Start of additions -------------------------------------------------

# A way of running chkfsys at startup

if test 0$SAFEMODE -eq 0; then
if [ $# -eq 0 ]
then
# boot image does not pass parameters !!! Keep it that way please

if test 0$VERBOSE -ge 1; then
echo "About to copy $0 to /dev/shmem"
fi
cp -v $0 /dev/shmem
exec /dev/shmem/$(basename $0) ramdisk
fi

if test 0$VERBOSE -ge 1; then
echo "Running $0 from /dev/shmem. About to chkfsys"
fi
# Now running from ram disk -- not the file system being checked
/sbin/chkfsys -uP /
fi


# End of additions -----------------------------------------------------



# Start the POSIX message queue/named semaphore manager
mqueue





Martin Dussault wrote:
Hi

In our boot process we call a sysinit.sh file from /etc/rc.d/rc.local. In
this sysinit file we do a chkfsys command before starting our process then
we get those errors:

sh: j_init: tcgetpgrp() failed: Inapropriate I/O control operation
sh: warning won't have full job control

What we want to do is to start some process when the PC start, but if the
was not shutdown properly some files are corrupted this is why we want to
make a chkfsys before starting those process.

Thank you for any help

Guest

Re: Error when sh start after chkfsys

Post by Guest » Fri Dec 19, 2003 1:58 am

mdussault@icstriplex.ca sed in <brsie5$hrd$1@inn.qnx.com>:
In our boot process we call a sysinit.sh file from /etc/rc.d/rc.local. In
this sysinit file we do a chkfsys command before starting our process then
Old answer in QDN newsgroup:

Newsgroups: qdn.public.neutrino
Subject: Re: [Q] Where to place a 'chkfsys'?
Date: Thu, 14 Nov 2002 10:40:34 -0500
Message-ID: <ar0foe$emc$1@inn.qnx.com>
References: <aqnmk5$kfi$1@mbs-software.de> <aqsudg$9rg$2@mbs-software.de> <aqtsv2$fjt$1@inn.qnx.com>
Xref: inn.qnx.com qdn.public.neutrino:32

From: Daryl Low <d*l*o*w$qnx.com>

Nope, this is a known problem. The chkfsys utility throws a special
devctl() to devb-* that makes it close all open files and re-mount the
file system. Unfortunately, this also closes the FD to rc.sysinit. The
only workarounds I can think of are to either execute chkfsys from your
boot image (ifs image) or make it the last item on rc.sysinit, not
crossing a stdio.h buffer boundary.

Daryl Low

Warren Deitch

Re: Error when sh start after chkfsys

Post by Warren Deitch » Fri Dec 19, 2003 4:27 am

Because of other drivers being started and also getting upset about
their files being closed under them, I was forced to do the checkfsys
much earlier. Some people suggested making a special boot image. My
solution only modifies the /etc/system/sysinit file.

I copy a modified sysinit file to /dev/shmem and run it from there. I
have this running on all my user sites.


Modifications to /etc/system/sysinit




# Start the pipe manager. It is needed for sub-shelling...
if ! test /dev/pipe -ef /dev/pipe; then
if pipe; then
typeset -i i=0
while test $i -lt 60 -a ! /dev/pipe -ef /dev/pipe ; do
sleep 1;
let i=i+1;
done
unset i
fi
if ! test /dev/pipe -ef /dev/pipe; then
print Unable to start pipe manager...
exec sh
exec fesh
fi
fi




# Start of additions -------------------------------------------------

# A way of running chkfsys at startup

if test 0$SAFEMODE -eq 0; then
if [ $# -eq 0 ]
then
# boot image does not pass parameters !!! Keep it that way please

if test 0$VERBOSE -ge 1; then
echo "About to copy $0 to /dev/shmem"
fi
cp -v $0 /dev/shmem
exec /dev/shmem/$(basename $0) ramdisk
fi

if test 0$VERBOSE -ge 1; then
echo "Running $0 from /dev/shmem. About to chkfsys"
fi
# Now running from ram disk -- not the file system being checked
/sbin/chkfsys -uP /
fi


# End of additions -----------------------------------------------------



# Start the POSIX message queue/named semaphore manager
mqueue



kabe@sra-tohoku.co.jp wrote:
mdussault@icstriplex.ca sed in <brsie5$hrd$1@inn.qnx.com>:


In our boot process we call a sysinit.sh file from /etc/rc.d/rc.local. In
this sysinit file we do a chkfsys command before starting our process then


Old answer in QDN newsgroup:

Newsgroups: qdn.public.neutrino
Subject: Re: [Q] Where to place a 'chkfsys'?
Date: Thu, 14 Nov 2002 10:40:34 -0500
Message-ID: <ar0foe$emc$1@inn.qnx.com
References: <aqnmk5$kfi$1@mbs-software.de> <aqsudg$9rg$2@mbs-software.de> <aqtsv2$fjt$1@inn.qnx.com
Xref: inn.qnx.com qdn.public.neutrino:32

From: Daryl Low <d*l*o*w$qnx.com

Nope, this is a known problem. The chkfsys utility throws a special
devctl() to devb-* that makes it close all open files and re-mount the
file system. Unfortunately, this also closes the FD to rc.sysinit. The
only workarounds I can think of are to either execute chkfsys from your
boot image (ifs image) or make it the last item on rc.sysinit, not
crossing a stdio.h buffer boundary.

Daryl Low

Bill Caroselli

Re: Error when sh start after chkfsys

Post by Bill Caroselli » Mon Dec 22, 2003 2:40 pm

Warren Deitch <warren.deitch@transcore.com.au> wrote:

WD > Modifications to /etc/system/sysinit


WD > # Start of additions -------------------------------------------------

WD > # A way of running chkfsys at startup

WD > if test 0$SAFEMODE -eq 0; then
WD > if [ $# -eq 0 ]
WD > then
WD > # boot image does not pass parameters !!! Keep it that way please

WD > if test 0$VERBOSE -ge 1; then
WD > echo "About to copy $0 to /dev/shmem"
WD > fi
WD > cp -v $0 /dev/shmem
WD > exec /dev/shmem/$(basename $0) ramdisk
WD > fi

WD > if test 0$VERBOSE -ge 1; then
WD > echo "Running $0 from /dev/shmem. About to chkfsys"
WD > fi
WD > # Now running from ram disk -- not the file system being checked
WD > /sbin/chkfsys -uP /
WD > fi


WD > # End of additions -----------------------------------------------------

Very nice.

Post Reply

Return to “qdn.public.neutrino”