[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ezjail] rcorder errors?

Michiel Detailleur wrote:
>> Any funny file, symlink or whatever in /usr/local/etc/ezjail? What's
>> the output of the following (assuming that ezjail_prefix=/usr/local):
>>   cd /usr/local/etc/ezjail; ls | xargs rcorder
> Hmm...:
> # cd /usr/local/etc/ezjail; ls | xargs rcorder
> rcorder: could not open log@: No such file or directory
> <snip>
> # ls -la /usr/local/etc/ezjail
> <snip>
> lrwxr-xr-x  1 root  wheel    14 Dec 22 15:07 log@ -> ../var/run/log
> I removed that log link and now the error is gone, but how did it get
> there in the first place? :s

I have often had the same error after an unclean shutdown of a jail
(especially image jails) or of the host system, or where there's then an
issue with devfs and/or /var not mounting properly or at the right time
inside the jail etc.

The @log link is created by /etc/rc.d/jail. It seems the link is suppoed
to get created/used at jail startup in order to feed messages to the
/var/log/jail_[name]_console.log files on the host system.

        # Transitional symlink for old binaries
        if [ ! -L "${_devdir}/log" ]; then
                __pwd="`pwd`"               <--- NB ??
                cd "${_devdir}"
                ln -sf ../var/run/log log
                cd "$__pwd"

On the host system /usr/local/etc/ezjail is the wrong location for it. It
should show up as:

/usr/jails/[jail_name]/dev/log ->  ../var/run/log

It seems that when the /dev/log link to the jail's /var/run/log socket
can't be created, the link is created by /etc/rc.d/jail in the wrong $PWD.
At that point during the start up of the jail I guess $PWD is in
/usr/local/etc/ezjail so @log ends up there.

I assumed this was a problem with the /etc/rc.d/jail start up script not
"intelligently failing" (it could check that the link it was trying to
create was created in the proper location then continue but spew an error
if needed) or ensuring timely mounting of a jail's devfs (so the /dev/log
link to the /var/run/log socket could be made when needed). I concluded it
was an rcorder and/or /etc/rc.d/jail problem and not an ezjail issue :-)

I could be wrong. In any case could the /usr/local/etc/rc.d/ezjail script
compensate for the error? Or are there "upstream" patches to
/etc/rc.d/jail needed?  Would it be more "robust" for jails to have their
own separate /var directories or ensure that /var is present *before* the
/dev/log link is created?

Or (as per the syslogd man page) is /dev/log even required?  Are there
still "old binaries" that need it to be there? (lsof says nothing is using
/dev/log on my systems). If not, can we prevent the creation of /dev/log
(other than by editing /etc/rc.d/jail)?

Sorry for the longish answer but it's been bugging me for a while :)