[Q] Where to place a 'chkfsys'?

I’m try to do a conditional ‘chkfsys’ at startup and I wonder where to
place it …

I tried it in /etc/rc.d/rc.local, but as soon as a ‘chkfsys’ runs in
this file, the machine doesn’t start up correctly anymore. It
complains about

“Unable to run rc.sysinit, starting shell”

even if ‘chkfsys’ is only started with the ‘-f’ option.

What I want at startup in an automatic process is:

chkfsys -Pr /

Under QNX4 this was quit easy: a simple ‘chkfsys’ in the ‘sysinit’.
but with QNX6 I have to kill and restart my harddisk driver – at
least according to the docs.

Unfortunately some files are always ‘busy’, even after a regular
shutdown, such as ‘/var/spool/output/lpd.lock’ and ‘/var/log/syslog’,
so I think, that an automatic procedure is absolutely mandantory for
us.

Any ideas?

TIA,

:Karsten.


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

Karsten.Hoffmann@mbs-software.de wrote:

I’m try to do a conditional ‘chkfsys’ at startup and I wonder where to
place it …

Am I the only one with this problem?


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

I’ve tried to put this in the rc.sysinit file, as well. Same results,
sometimes the processor starts up fine, other times it won’t. That kind of
behavior is unacceptable for an embedded system, but I do see a need for the
chkfsys. The utility has to run without user interaction and has to have
predictable results. I don’t know how to achieve that, either.

David Kuechenmeister

<Karsten.Hoffmann@mbs-software.de> wrote in message
news:aqsudg$9rg$2@mbs-software.de

Karsten.Hoffmann@mbs-software.de > wrote:
I’m try to do a conditional ‘chkfsys’ at startup and I wonder where to
place it …

Am I the only one with this problem?


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

From an email I received last night:

Daryl Low [dlo*w@qnx.com], writes

Gack! I can’t post to this group (IS says it’s been deprecated, but

others seem to be able to). Could you please repost my response:

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

Daryl/David,

I have also encountered this problem.

I can’t see how placing chkfsys at the end of rc.sysinit will work, as
this file must invoke tinit or a shell. Also, syslogd will be running, so
that the chkfsys will corrupt any syslogs open.

Daryl, could you please elaborate on your boot image suggestion?

Thanks a lot,
Robert.

On Thu, 14 Nov 2002, David Kuechenmeister wrote:

From an email I received last night:

Daryl Low [dlo*> w@qnx.com> ], writes

Gack! I can’t post to this group (IS says it’s been deprecated, but

others seem to be able to). Could you please repost my response:

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

Robert Muil <rmuil@optushome.com.au> wrote:

Daryl, could you please elaborate on your boot image suggestion?

Though I’m neither Daryl nor David, here’s waht we actually do in our
boot images.

Probably there’s a more intelligent way, but it works :slight_smile:. From my point
of view it would be best, if ‘diskboot’ would do the job …


HTH,

Karsten.

Here’s my build file:

The build file for qnx RTP booting on a PC

[virtual=x86,bios +compress] boot = {

Reserve 64k of video memory to handle multiple video cards

startup-bios -s64k

PATH is the safe path for executables (confstr(_CS_PATH…))

LD_LIBRARY_PATH is the safe path for libraries (confstr(_CS_LIBPATH))

i.e. This is the path searched for libs in setuid/setgid executables.

PATH=/proc/boot:/bin:/usr/bin LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll procnto-instr
}

[+script] startup-script = {

To save memory make everyone use the libc in the boot image!

For speed (less symbolic lookups) we point to libc.so.2 instead of libc.so

procmgr_symlink …/…/proc/boot/libc.so.2 /usr/lib/ldqnx.so.2

devb-eide blk auto=partition dos exe=all cam &

waitfor /dev/hd0t79

chkfsys -q -r -P -m /dev/hd0t79

slay devb-eide

Default user programs to priorty 10, other scheduler (pri=10o)

Tell “diskboot” this is a hard disk boot (-b1)

Tell “diskboot” to use DMA on IDE drives (-D1)

Start 4 text consoles buy passing “-n4” to “devc-con” (-o)

By adding “-e” linux ext2 filesystem will be mounted as well.

[pri=10o] PATH=/proc/boot diskboot -b1 -D1 -odevc-con,-n4
}

Include the current “libc.so”. It will be created as a real file using

it’s internal “SONAME”, with “libc.so” being a symlink to it. The symlink

will point to the last “libc.so.*” so if an earlier libc is needed

(e.g. libc.so.1) add it before the this line.

libc.so

Include all tie files for the default filesystems

libcam.so
io-blk.so
cam-disk.so
fs-qnx4.so
fs-dos.so
fs-ext2.so
cam-cdrom.so
fs-cd.so

These programs only need to be run once from the boot image.

“data=uip” will waste less memory as the ram from the boot

image will be used directly without making a copy of the data

(i.e. as the default “data=cpy” does). When they have been

run once, they will be unlinked from /proc/boot.

[data=uip]
seedres
pci-bios
diskboot
slogger
fesh
devc-con
slay

[data=cpy]
chkfsys
devb-eide

These files will be unlinked after the system has started

to release the memory back to the system. They are only

needed during boot. If needed later on, they will be loaded

from the boot device.

unlink_list={
/proc/boot/devb-*
/proc/boot/chkfsys
}

\


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld