Your message dated Sat, 14 Apr 2012 17:49:43 +0100
with message-id <[email protected]>
and subject line Re: Bug#542953: sysvinit: fixes for GNU/kFreeBSD
has caused the Debian Bug report #542953,
regarding sysvinit: fixes for GNU/kFreeBSD
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
542953: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542953
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: sysvinit
Version: 2.87dsf-2
Severity: important
Tags: patch

Since insserv is enabled by default, it is not possible to do GNU/kFreeBSD
specific initialisation in a dedicated script and ensure it is done at 
the right moment due to dependencies issue. This is especially true for
mtab.sh, which makes the system no bootable if /etc/mtab has not been yet
changed to a symlink, by mounting an empty tmpfs over /dev.

The patch below fixes the problem by having different initialisation on 
Linux and GNU/kFreeBSD. In case the systems is unknown, it switches to 
doing nothing by default, which is probaby the safest option. It also 
correctly detects available filesystem on GNU/kFreeBSD.


diff -u sysvinit-2.87dsf/debian/initscripts/lib/init/mount-functions.sh 
sysvinit-2.87dsf/debian/initscripts/lib/init/mount-functions.sh
--- sysvinit-2.87dsf/debian/initscripts/lib/init/mount-functions.sh
+++ sysvinit-2.87dsf/debian/initscripts/lib/init/mount-functions.sh
@@ -46,12 +46,31 @@
        elif [ "$1" = tmpfs ]
        then # always accept tmpfs, to mount /lib/init/rw before /proc
                FSTYPE=$1
-       elif grep -E -qs "$1\$" /proc/filesystems
-       then
-               FSTYPE=$1
-       elif grep -E -qs "$2\$" /proc/filesystems
-       then
-               FSTYPE=$2
+       else 
+               case "$KERNEL" in 
+                       Linux)
+                               if grep -E -qs "$1\$" /proc/filesystems
+                               then
+                                       FSTYPE=$1
+                               elif grep -E -qs "$2\$" /proc/filesystems
+                               then
+                                       FSTYPE=$2
+                               fi
+                               ;;
+                       GNU/kFreeBSD)
+                               if kldstat -q -m "$1"
+                               then
+                                       FSTYPE=$1
+                               elif kldstat -q -m "$2"
+                               then
+                                       FSTYPE=$2
+                               fi
+                               ;;
+                       *)
+                               # On unknown systems, use the first FS type
+                               FSTYPE=$1
+                               ;;
+               esac
        fi
 
        if [ ! "$FSTYPE" ]
diff -u sysvinit-2.87dsf/debian/initscripts/etc/init.d/mtab.sh 
sysvinit-2.87dsf/debian/initscripts/etc/init.d/mtab.sh
--- sysvinit-2.87dsf/debian/initscripts/etc/init.d/mtab.sh
+++ sysvinit-2.87dsf/debian/initscripts/etc/init.d/mtab.sh
@@ -63,7 +63,7 @@
        fi
 }
 
-do_start () {
+do_start_linux () {
        DO_MTAB=""
        MTAB_PATH="$(readlink -f /etc/mtab || :)"
        case "$MTAB_PATH" in
@@ -160,6 +160,30 @@
        exec 0<&9 9<&-
 }
 
+do_start_kfreebsd () {
+       # On GNU/kFreeBSD mount does not update /etc/mtab, so
+       # we need to use a symlink
+       if [ "$(readlink -f /etc/mtab)" != "/proc/mounts" ] ; then
+               echo "Warning: replacing /etc/mtab with a symlink to 
/proc/mounts."
+               rm -f /etc/mtab
+               ln -s /proc/mounts /etc/mtab
+       fi
+}
+
+do_start () {
+       case "$KERNEL" in 
+               "Linux")
+                       do_start_linux
+                       ;;
+               "GNU/kFreeBSD")
+                       do_start_kfreebsd
+                       ;;
+               *)
+                       # Doing nothing is the safest option
+                       ;;
+       esac
+}
+
 case "$1" in
   start|"")
        do_start
diff -u sysvinit-2.87dsf/debian/initscripts/etc/init.d/mountkernfs.sh 
sysvinit-2.87dsf/debian/initscripts/etc/init.d/mountkernfs.sh
--- sysvinit-2.87dsf/debian/initscripts/etc/init.d/mountkernfs.sh
+++ sysvinit-2.87dsf/debian/initscripts/etc/init.d/mountkernfs.sh
@@ -19,6 +19,8 @@
 
 [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
 
+KERNEL="$(uname -s)"
+
 do_start () {
        #
        # Get some writable area available before the root is checked
@@ -32,19 +34,37 @@
        # Make pidfile omit directory for sendsigs
        mkdir /lib/init/rw/sendsigs.omit.d/
 
-       #
-       # Mount proc filesystem on /proc
-       #
-       domount proc "" /proc proc -onodev,noexec,nosuid
-
-       #
-       # Mount sysfs on /sys
-       #
-       # Only mount sysfs if it is supported (kernel >= 2.6)
-       if grep -E -qs "sysfs\$" /proc/filesystems
-       then
-               domount sysfs "" /sys sysfs -onodev,noexec,nosuid
-       fi
+       case "$KERNEL" in 
+               "Linux")
+                       #
+                       # Mount proc filesystem on /proc
+                       #
+                       domount proc "" /proc proc -onodev,noexec,nosuid
+
+                       #
+                       # Mount sysfs on /sys
+                       #
+                       # Only mount sysfs if it is supported (kernel >= 2.6)
+                       if grep -E -qs "sysfs\$" /proc/filesystems
+                       then
+                               domount sysfs "" /sys sysfs 
-onodev,noexec,nosuid
+                       fi
+                       ;;
+               "GNU/kFreeBSD")
+                       #
+                       # Mount proc filesystem on /proc
+                       #
+                       domount linprocfs "" /proc linprocfs
+
+                       #
+                       # Mount sys filesystem on /sys
+                       #
+                       domount linsysfs "" /sys linsysfs
+                       ;;
+               *)
+                       # Doing nothing is the safest option
+                       ;;
+       esac
 
        # Mount /var/run and /var/lock as tmpfs if enabled
        if [ yes = "$RAMRUN" ] ; then
diff -u sysvinit-2.87dsf/debian/initscripts/etc/init.d/mountdevsubfs.sh 
sysvinit-2.87dsf/debian/initscripts/etc/init.d/mountdevsubfs.sh
--- sysvinit-2.87dsf/debian/initscripts/etc/init.d/mountdevsubfs.sh
+++ sysvinit-2.87dsf/debian/initscripts/etc/init.d/mountdevsubfs.sh
@@ -27,7 +27,7 @@
 . /lib/lsb/init-functions
 . /lib/init/mount-functions.sh
 
-do_start () {
+do_start_linux () {
        #
        # Mount a tmpfs on /dev/shm
        #
@@ -42,39 +42,57 @@
        # mount devpts if it is compiled in (older devfs didn't require it
        # to be compiled in at all).
        #
-       if [ "$KERNEL" = Linux ]
+       #
+       # Since kernel 2.5.something, devfs doesn't include
+       # a standard /dev/pts directory anymore. So if devfs
+       # is mounted on /dev we need to create that directory
+       # manually.
+       #
+       if [ ! -d /dev/pts ]
        then
-               #
-               # Since kernel 2.5.something, devfs doesn't include
-               # a standard /dev/pts directory anymore. So if devfs
-               # is mounted on /dev we need to create that directory
-               # manually.
-               #
-               if [ ! -d /dev/pts ]
+               if grep -qs '/dev devfs' /proc/mounts
                then
-                       if grep -qs '/dev devfs' /proc/mounts
-                       then
-                               mkdir --mode=755 /dev/pts
-                               [ -x /sbin/restorecon ] && /sbin/restorecon 
/dev/pts
-                       fi
+                       mkdir --mode=755 /dev/pts
+                       [ -x /sbin/restorecon ] && /sbin/restorecon /dev/pts
                fi
-               if [ -d /dev/pts ]
+       fi
+       if [ -d /dev/pts ]
+       then
+               if [ ! -c /dev/ptmx ]
                then
-                       if [ ! -c /dev/ptmx ]
+                       mknod --mode=666 /dev/ptmx c 5 2
+                       ES=$?
+                       if [ "$ES" != 0 ]
                        then
-                               mknod --mode=666 /dev/ptmx c 5 2
-                               ES=$?
-                               if [ "$ES" != 0 ]
-                               then
-                                       log_warning_msg "Failed making node 
/dev/ptmx with error code ${ES}."
-                               fi
-                               [ -x /sbin/restorecon ] && /sbin/restorecon 
/dev/ptmx
+                               log_warning_msg "Failed making node /dev/ptmx 
with error code ${ES}."
                        fi
-                       domount devpts "" /dev/pts devpts 
-onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
+                       [ -x /sbin/restorecon ] && /sbin/restorecon /dev/ptmx
                fi
+               domount devpts "" /dev/pts devpts 
-onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
        fi
 }
 
+do_start_kfreebsd () {
+       #
+       # Mount /dev/fd
+       #
+       domount fdescfs "" /dev/fd fdescfs
+}
+
+do_start () {
+       case "$KERNEL" in 
+               "Linux")
+                       do_start_linux
+                       ;;
+               "GNU/kFreeBSD")
+                       do_start_kfreebsd
+                       ;;
+               *)
+                       # Doing nothing is safe
+                       ;;
+       esac
+}
+
 case "$1" in
   "")
        echo "Warning: mountdevsubfs should be called with the 'start' 
argument." >&2


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 7.2-1-amd64
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages sysvinit depends on:
ii  initscripts                  2.87dsf-2 scripts for initializing and shutt
ii  libc0.1                      2.9-25      GNU C Library: Shared libraries
ii  sysv-rc                      2.87dsf-2 System-V-like runlevel change mech
ii  sysvinit-utils               2.87dsf-2 System-V-like utilities

sysvinit recommends no packages.

sysvinit suggests no packages.

-- no debconf information



--- End Message ---
--- Begin Message ---
On Mon, Apr 09, 2012 at 10:50:43PM +0200, Robert Millan wrote:
> I gave a quick look at this bug report.  I think the problem reported
> in 2009 is no longer present.  In particular:
> 
>   - The premise [1] doesn't seem to be true anymore. Perhaps what we
> were missing is "X-Start-Before" support, which we're using now:
> 
>   $ grep X-Start-Before: /etc/init.d/freebsd-utils -H
>   /etc/init.d/freebsd-utils:# X-Start-Before:    mtab
> 
>   - I've been using Debian GNU/kFreeBSD in my main workstation for
> about 6 months and haven't observed any problems related to this.
> 
> initscript still has a few (minor) issues with GNU/kFreeBSD support,
> but they're mostly aesthetical.  I'll prepare a report (and patch)
> when I have some free time.
> 
> [1] "it is not possible to do GNU/kFreeBSD specific initialisation in
> a dedicated script and ensure it is done at the right moment due to
> dependencies issue"

OK, I'll close this particular bug then.  If you want to file a
new one with any cleanup patches when you have time, that would
be great.


Thanks,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.


--- End Message ---
_______________________________________________
Pkg-sysvinit-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-sysvinit-devel

Reply via email to