CRUX : Home

Home :: Documentation :: Download :: Development :: Community :: Wiki :: Ports :: Bugs :: Links :: About

Configuration

Initialization Scripts

Runlevels

The following runlevels are used in CRUX (defined in /etc/inittab).

RunlevelDescription
0Halt
1 (S)Single-user Mode
2Multi-user Mode
3-5(Not used)
6Reboot

Layout

The initialization scripts used in CRUX follow the BSD-style (as opposed to the SysV-style) and have the following layout.

FileDescription
/etc/rcSystem boot script
/etc/rc.singleSingle-user startup script
/etc/rc.modulesModule initialization script
/etc/rc.multiMulti-user startup script
/etc/rc.localLocal multi-user startup script (empty by default)
/etc/rc.shutdownSystem shutdown script
/etc/rc.confSystem configuration
/etc/rc.d/Service start/stop script directory

Modify /etc/rc.modules, /etc/rc.local and /etc/rc.conf according to your needs.

Configuration Variables in /etc/rc.conf

The following configuration variables are found in /etc/rc.conf.

Variable Description
FONT

Specifies which console font to load at system startup. The contents of this variable will be passed as argument to setfont(1). The available fonts are located in /usr/share/kbd/consolefonts/.

Example: FONT=default

KEYMAP

Specifies which console keyboard map to load at system startup. The contents of this variable will be passed as argument to loadkeys(1). The available keyboard maps are located in /usr/share/kbd/keymaps/.

Example: KEYMAP=sv-latin1

TIMEZONE

Specifies the timezone used by the system. The available zone description files are located in /usr/share/zoneinfo/.

Example: TIMEZONE=Europe/Stockholm

HOSTNAME

Specifies the hostname.

Example: HOSTNAME=pluto

SYSLOG

Specifies the system logging daemon(s) to run at startup.

Example: SYSLOG=sysklogd

SERVICES

Specifies which services to start at system startup. The services specified in this array must have a matching start/stop script in /etc/rc.d/. When entering multi-user mode the specified scripts will be called in the specified order with the argument start. At system shutdown or when entering single-user mode these scripts will be called in the reverse order with the argument stop.

Example: SERVICES=(crond lo net sshd)

Generating locales

Starting with CRUX 2.5, glibc does not contain all possible locales anymore, thus you'll have to generate the locales you need/use. The following example is a typical setup for swedish users, replace sv_SE* with the locale you want:

 # localedef -i sv_SE -f ISO-8859-1 sv_SE
 # localedef -i sv_SE -f ISO-8859-1 sv_SE.ISO-8859-1
 # localedef -i sv_SE -f UTF-8 sv_SE.UTF-8 

Network Configuration

The network configuration is found in the service script /etc/rc.d/net. To enable this service you need to add net to the SERVICES array in /etc/rc.conf. By default this service script configures a dynamic IP address. Example:

#!/bin/sh
#
# /etc/rc.d/net: start/stop network interface
#

# Connection type: "DHCP" or "static"
TYPE="DHCP"

# For "static" connections, specify your settings here:
# To see your available devices run "ip link".
DEV=enp11s0
ADDR=192.168.1.100
MASK=24
GW=192.168.1.1

# Optional settings:
DHCPOPTS="-h `/bin/hostname` -t 10"

case $1 in
        start)
                if [ "${TYPE}" = "DHCP" ]; then
                        /sbin/dhcpcd ${DHCPOPTS}
                else
                        /sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast +
                        /sbin/ip link set ${DEV} up
                        /sbin/ip route add default via ${GW}
                fi
                ;;
        stop)
                if [ "${TYPE}" = "DHCP" ]; then
                        /sbin/dhcpcd -x
                else
                        /sbin/ip route del default
                        /sbin/ip link set ${DEV} down
                        /sbin/ip addr del ${ADDR}/${MASK} dev ${DEV}
                fi
                ;;
        restart)
                $0 stop
                $0 start
                ;;
        *)
                echo "Usage: $0 [start|stop|restart]"
                ;;
esac

# End of file

if you want to configure your system to use a static IP address, specify TYPE=static and the correct interface. You will also need to configure DNS settings in /etc/resolv.conf. Example:

#!/bin/sh
#
# /etc/rc.d/net: start/stop network interface
#

# Connection type: "DHCP" or "static"
TYPE="static"

# For "static" connections, specify your settings here:
# To see your available devices run "ip link".
DEV=enp11s0
ADDR=192.168.1.100
MASK=24
GW=192.168.1.1

# Optional settings:
DHCPOPTS="-h `/bin/hostname` -t 10"

case $1 in
        start)
                if [ "${TYPE}" == "DHCP" ]; then
                        /sbin/dhcpcd ${DHCPOPTS}
                else
                        /sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast +
                        /sbin/ip link set ${DEV} up
                        /sbin/ip route add default via ${GW}
                fi
                ;;
        stop)
                if [ "${TYPE}" == "DHCP" ]; then
                        /sbin/dhcpcd -x
                else
                        /sbin/ip route del default
                        /sbin/ip link set ${DEV} down
                        /sbin/ip addr del ${ADDR}/${MASK} dev ${DEV}
                fi
                ;;
        restart)
                $0 stop
                $0 start
                ;;
        *)
                echo "Usage: $0 [start|stop|restart]"
                ;;
esac

# End of file
#
# /etc/resolv.conf: resolver configuration file
#

search <your internal domain>
nameserver <your DNS server>

# End of file

Note

CRUX releases prior to 2.3 used ifconfig(8) and route(8) commands for network initialization; below we provide the previous templates as a reference.

Manual ip configuration (CRUX < 2.3):

#!/bin/sh
#
# /etc/rc.d/net: start/stop network
#

case $1 in
start)
        /sbin/ifconfig lo 127.0.0.1
        /sbin/ifconfig eth0 195.38.1.140 netmask 255.255.255.224
        /sbin/ifconfig eth1 192.168.0.1 netmask 255.255.255.0
        /sbin/route add default gw 195.38.1.129
        ;;
stop)
        /sbin/ifconfig eth1 down
        /sbin/ifconfig eth0 down
        /sbin/ifconfig lo down
        ;;
restart)
        $0 stop
        $0 start
        ;;
*)
        echo "usage: $0 [start|stop|restart]"
        ;;
esac

# End of file

DHCP Configuration (CRUX < 2.3):

#!/bin/sh
#
# /etc/rc.d/net: start/stop network
#

case $1 in
start)
        /sbin/ifconfig lo 127.0.0.1
        /sbin/dhcpcd eth0 [add additional options if needed]
        ;;
stop)
        killall -q /sbin/dhcpcd
        /sbin/ifconfig lo down
        ;;
restart)
        $0 stop
        $0 start
        ;;
*)
        echo "usage: $0 [start|stop|restart]"
        ;;
esac

# End of file

Passwords

CRUX uses SHA512 passwords by default. To change the password encryption method set the ENCRYPT_METHOD variable in /etc/login.defs to DES, MD5 or SHA256.

Furthermore, when compiling programs that use the crypt(3) function to authenticate users you should make sure that these programs are linked against the libcrypt library (i.e. use -lcrypt when linking) which contains the SHA512 version of the crypt function (this version is backwards compatible and understands DES passwords as well).

Upgrading the Kernel

The kernel source, which is found in /usr/src/linux-4.14.xx/ is not installed using pkgadd. If you decide to upgrade your kernel you can safely do so by manually replacing the kernel source with a newer version (or place it somewhere else). This will not make the package database inconsistent (since it's not installed with pkgadd) nor will it affect the kernel headers found in /usr/include/linux and /usr/include/asm since these are not symlinks to the kernel source, but instead contain copies of the headers.