What is difference between /etc/rc called programs and ones called after login prompt shows up

Aryeh Friedman aryeh.friedman at gmail.com
Sat Aug 23 20:38:15 UTC 2008


On Sat, Aug 23, 2008 at 8:27 AM, Garrett Cooper <yanefbsd at gmail.com> wrote:
> On Sat, Aug 23, 2008 at 3:34 AM, Aryeh Friedman
> <aryeh.friedman at gmail.com> wrote:
>> What is difference between /etc/rc.d called programs and ones called
>> after login prompt shows up?
>>
>> The reason for asking is sysutils/fusefs-kmod gives an error if any
>> mounts are attempted in /etc/rc but if the exactly the same command is
>> issued by a user's .login/.xsession/etc. it works without problem
>> (assuming proper permissions of course).
>>
>> a) Can anyone think of a reason why this would happen (the maintainer
>> is non-responive)
>> b) Is it possible to force something to run after /etc/rc exits but
>> before init calls getty?
>
> a) Bad credentials? Dependencies not started (yet)?
> b) You can enforce ordering, if that's what you want. See:
> http://www.freebsd.org/doc/en/articles/rc-scripting/

a) I use a custom /etc/rc thus I can place the mount command anywhere
I want.  No matter where I place I get the same error it is *ONLY*
after /etc/rc terminates.... I am

b) I load fuse.ko in /boot/loader.con (copied it from
/usr/local/modules to /boot/modules) here is dmesg proof it is loaded:

> dmesg|grep fuse
fuse4bsd: version 0.3.9-pre1, FUSE ABI 7.8
fuse4bsd: compiled against kernel config /usr/obj/usr/src/sys/MONSTER


c) See a additionally to prove all the above here is my /etc/rc (the
last 2 lines where added just to prove the point):

#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin

swapon -a
fsck -p
mount -rw /
mount -a
hostname flosoft.no-ip.biz
ifconfig re0 192.168.2.2
ifconfig lo0 127.0.0.1
route add default 192.168.2.1
named
cupsd
noip2
ntpdate pool.ntp.org
sendmail -bd -q1m
apachectl start
moused -t auto -p /dev/ums0
vidcontrol -m on
mount /mnt/win_c
mount /mnt/win_d

Here is /etc/fstab (set up as recommended in the docs for
sysutils/fusefs-ntfs [which I am the co-maintainer of]):

# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad8s2b             none            swap    sw              0       0
/dev/ad8s2a             /               ufs     rw              1       1
/dev/ad8s2e             /tmp            ufs     rw              2       2
/dev/ad8s2f             /usr            ufs     rw              2       2
/dev/ad8s2d             /var            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
proc            /proc   procfs  rw 0 0
linproc         /compat/linux/proc      linprocfs       rw 0 0
/dev/ad8s1              /mnt/win_c            ntfs-3g rw,late         0       0
/dev/da0s1              /mnt/win_d            ntfs-3g rw,late         0       0

The patch to mount recommended in the fusefs-ntfs docs has been
applied.   In order to show that the mount commands work post call to
getty but not before:

When the above /etc/rc is run:

swapon: adding /dev/ad8s2b as swap device
/dev/ad8s2a: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad8s2a: clean, 164555 free (3603 frags, 20119 blocks, 1.4% fragmentation)
/dev/ad8s2e: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad8s2e: clean, 253254 free (54 frags, 31650 blocks, 0.0% fragmentation)
/dev/ad8s2f: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad8s2f: clean, 210848941 free (53253 frags, 26349461 blocks, 0.0% fragmenta
tion)
/dev/ad8s2d: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad8s2d: clean, 1970559 free (551 frags, 246251 blocks, 0.0% fragmentation)
re0: link state changed to DOWN
add net default: gateway 192.168.2.1
re0: link state changed to UP
23 Aug 09:02:00 ntpdate[48]: step time server 216.184.20.83 offset 0.794898 sec
pid 54 (limits), uid 0: exited on signal 11 (core dumped)
[Sat Aug 23 09:02:01 2008] [warn] (2)No such file or directory: Failed to enable
 the 'httpready' Accept Filter
fuse: failed to exec mount program: No such file or directory
fuse: failed to mount file system: Unknown error: 0
fuse: failed to exec mount program: No such file or directory
fuse: failed to mount file system: Unknown error: 0

FreeBSD/i386 (flosoft.no-ip.biz) (ttyv0)

login:

Here is the .login for root and the .xsession for my main user account
(I use xdm):

> more ~root/.login
# $FreeBSD: src/etc/root/dot.login,v 1.22 2000/07/15 03:25:14 rwatson Exp $
#
# .login - csh login script, read by login shell, after `.cshrc' at login.
#
# see also csh(1), environ(7).
#

# Uncomment to display a random cookie each login:
# [ -x /usr/games/fortune ] && /usr/games/fortune -s

echo Mounting C:
mount /mnt/win_c
echo Mounting D:
mount /mnt/win_d

> more ~aryeh/.xsession
sudo mount /mnt/win_c&
sudo mount /mnt/win_d&
mixer 100
mixer pcm 100
xfce4-session

Sudo is configured to allow 'aryeh' to no password access.   And
finally proof that the two methods do in fact work:

> df -k
Filesystem  1024-blocks     Used     Avail Capacity  Mounted on
/dev/ad8s2a      507630   178520    288500    38%    /
devfs                 1        1         0   100%    /dev
/dev/ad8s2e      507630     1124    465896     0%    /tmp
/dev/ad8s2f   443581998 21884342 386211098     5%    /usr
/dev/ad8s2d     4040654    99570   3617832     3%    /var
procfs                4        4         0   100%    /proc
linprocfs             4        4         0   100%    /usr/compat/linux/proc
/dev/fuse0     20972824 20196712    776112    96%    /mnt/win_c
/dev/fuse1    244196348  2463792 241732556     1%    /mnt/win_d

Thus it is clear that the *ONLY* difference between the /etc/rc calls
and the post getty calls is when they are made.   Thus the orginal
question (i.e. I have verified this happens on any fusefs-* file
system).   I have attempted to call stuff via alternate methods like
such as calling the mount_* directly and using equiv programs that
have different names for each fusefs-* and did so with and without
having the enteries in /etc/fstab


>
> -Garrett
>


More information about the freebsd-hackers mailing list