Monthly Archive for gennaio, 2010

Man at work…

man at work

default runlevel in Ubuntu 9.10

Chi si fosse chiesto che fine aveva fatto in Ubuntu 9.10 il file che gestisce il default runlevel, eccolo accontentato! Fino a qualche distribuzione fa (credo la 6.10) il file che gestiva il default runlevel era /etc/inittab, successivamente è diventato /etc/event.d/rc-default, mentre con la versione 9.10 si è passati a /etc/init/rc-sysinit.conf

Di seguito un paste dei formati dei 3 file, con la riga dove viene indicato il default runlevel.

/etc/inittab (attualmente utilizzato dalle distro Red Hat like)

 # Default runlevel. The runlevels used by RHS are:
#   0 – halt (Do NOT set initdefault to this)
#   1 – Single user mode
#   2 – Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 – Full multiuser mode
#   4 – unused
#   5 – X11
#   6 – reboot (Do NOT set initdefault to this)
#
id:5:initdefault:

/etc/event.d/rc-default

 script
    runlevel –reboot || true

    if grep -q -w — "-s\|single\|S" /proc/cmdline; then
        telinit S
    elif [ -r /etc/inittab ]; then
        RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
        if [ -n "$RL" ]; then
        telinit $RL
        else
        telinit 2
        fi
    else
        telinit 2
    fi
end script

/etc/init/rc-sysinit.conf

 # Default runlevel, this may be overriden on the kernel command-line
# or by faking an old /etc/inittab entry
env DEFAULT_RUNLEVEL=2

# There can be no previous runlevel here, but there might be old
# information in /var/run/utmp that we pick up, and we don't want
# that.
#
# These override that
env RUNLEVEL=
env PREVLEVEL=