Documente Academic
Documente Profesional
Documente Cultură
7
1. Preface
2. Introduction
2.1. What is CRUX?
2.2. Why use CRUX?
2.3. License
2.3.1. Packages
2.3.2. Build Scripts
2.3.3. NO WARRANTY
3. Installing CRUX
3.1. Supported Hardware / Requirements
3.2. Installing From CD-ROM
3.3. Upgrading From CD-ROM
3.4. Alternative Installation Methods
3.4.1. Building Your Own Bootkernel
3.4.2. Network Installation
4. The Package System
4.1. Introduction
4.2. Using the Package System
4.2.1. Installing a Package
4.2.2. Upgrading a Package
4.2.3. Removing a Package
4.2.4. Querying the Package Database
4.3. Package management frontend: prt-get
4.4. Creating Packages
4.5. Adjusting/Configuring the Package Build Process
4.6. Package Guidelines
4.6.1. General
4.6.2. Directories
4.6.3. Remove Junk Files
4.6.4. Pkgfile
4.6.4.1. Pkgfile header
5. The Ports System
5.1. Introduction
5.1.1. What is a Port?
5.1.2. What is the Ports System?
5.1.3. Port collections
5.1.3.1. The official collection 'core', 'opt' and 'xorg'
5.1.3.2. The user contributed collection 'contrib'
5.1.3.3. The individual collections from CRUX users
5.2. Using the Ports System
5.2.1. Synchronizing Your Local Ports Structure
5.2.2. Listing Local Ports
5.2.3. Listing Version Differences
5.2.4. Building and Installing Packages
5.2.5. Enabling the 'contrib' collection
5.2.6. Additional tools
5.2.6.1. Building ports as unprivileged user
5.2.6.2. Useful scripts
6. Configuration
6.1. Initialization Scripts
6.1.1. Runlevels
6.1.2. Layout
6.1.3. Configuration Variables in /etc/rc.conf
6.1.4. Generating locales
6.1.5. Network Configuration
6.2. Passwords
6.3. Upgrading the Kernel
7. Appendix
7.1. Troubleshooting
7.2. GRUB installation
7.2.1. Precaution
7.2.2. Installation
7.2.2.1. Automatic setup using grub-install
7.2.2.2. Manual setup
1. Preface
Per Lidn wrote this handbook. RobertMcMeekin converted it to DocBook, the CRUX team made a Wiki
version. Numerous others have given feedback and improvement suggestions.
2. Introduction
2.1. What is CRUX?
CRUX is a lightweight, i686-optimized Linux distribution targeted at experienced Linux users. The primary
focus of this distribution is "keep it simple", which it reflects in a simple tar.gz-based package system, BSDstyle initscripts, and a relatively small collection of trimmed packages. The secondary focus is utilization of
new Linux features and recent tools and libraries. CRUX also has a ports system which makes it easy to
install and upgrade applications.
A somewhat experienced Linux user who wants a clean and solid Linux distribution as the
foundation of your installation.
A person who prefers editing configuration files with an editor to using a GUI.
Someone who does not hesitate to download and compile programs from the source.
2.3. License
2.3.1. Packages
Since CRUX is a Linux distribution, it contains software written by a lot of different people. Each software
package comes with its own license, chosen by its author(s). To find out how a particular package is
licensed, have a look at its source code.
2.3.3. NO WARRANTY
CRUX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use it at
YOUR OWN RISK.
3. Installing CRUX
3.1. Supported Hardware / Requirements
Packages on the official CRUX ISO image are compiled with optimization for i686 (PentiumPro/Celeron/Pentium-II or better) processors. Do not try to install it on an i586 (Pentium, AMD K6/K6II/K6-III) or lower processor, since it simply will not work. To install CRUX on an i586 system you need to
download the i586 version of the CRUX ISO image.
A minimum of 160MB system memory is required to install CRUX from CD-ROM. It is possible to perform
a custom chroot installation with only 16MB of RAM.
The kernel used during installation, i.e. when booting from the CRUX ISO image (El Torito), is compiled
with the following disk controllers and USB support:
Subsystem
IDE
SATA
ServerWorks Frodo/Apple K2, Intel PIIX/ICH, Promise, Silicon Image, VIA, VITESSE VSC7174
SCSI
USB
USB device filesystem, EHCI HCD (USB 2.0) support, UHCI (Intel PIIX4, VIA, ...) support,
OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support, USB Mass Storage support, USB Human
Interface Device (full HID) support, HID input layer support
In order to install CRUX, your disk controller must be present in the list above. If your hardware is not
supported or you have other problems installing CRUX, you might find a solution in Section "Alternative
Installation Methods".
Download the CRUX ISO image (crux-2.7.iso). To ensure that the download was successful,
examine its checksum using md5sum.
$ md5sum crux-2.7.iso
Compare the output with the file crux-2.7.md5sum, which can be found in the same directory as the ISO
image on the download site. If the checksums match, the download was successful and you can continue by
burning the ISO image to a CD.
The ISO image is bootable, just insert the newly burned CD and reboot your computer. Press Enter
at the boot prompt (you might have to adjust the root= parameter, depending on your hardware
configuration).
Create (if necessary) and format the partition(s) you want CRUX to be installed on.
$ fdisk /dev/hd?
$ mkfs.???? /dev/hd??
$ mkswap /dev/hd??
Note
Please keep in mind that SATA harddisks are usually detected as SCSI devices. The first SATA disk is called
/dev/sda instead of /dev/hda. For more information about harddisk naming conventions please refer to the
Linux Partition HOWTO.
The amount of disk space required depends on how many packages are selected to install. It is recommended
to have at least a 1G root partition (CRUX will use about 200MB-500MB, depending on your
configuration).
CRUX supports all the filesystems supported as root filesystems by the linux kernel: ext2, ext3, ext4, JFS,
reiserfs and XFS. Further, it is highly recommended to separate the system data from user data, i.e. use a
separate partition for /home (and possibly /var) since that will make your life a lot easier the day you want to
upgrade/reinstall/remove your system.
Note
Make sure that any BIOS Virus Protection option is DISABLED as this option may prevent fdisk from
writing new partitions correctly.
If you want the installation to span more than one partition, mount those partitions as well. For example, if
you want to have a different partition for /home or /var, then do:
$ mkdir /mnt/var
$ mount /dev/hd?? /mnt/var
$ swapon /dev/hd??
Type setup to start the package installation script. The script will ask where you mounted your new
root partition and which packages you want to install. Select the packages you wish to install; it is
recommended to install all the packages from core.
After the packages have finished installing, the setup script will display an installation log. Make sure the
last line in the log says 0 error(s).
If you missed/forgot to install certain packages, you can just mount the CRUX CD-ROM and use pkgadd to
install them.
Screenshots of setup
$
$
$
$
$
Now it's time to compile your kernel and do basic system configuration. The kernel compilation
requires that you chroot into your new CRUX installation.
Note
There is a short-cut command for creating the chroot environment: setup-chroot. This will execute all these
steps at once.
$ passwd
$
$
$
$
$
$
Edit /etc/fstab to configure your filesystem(s). Editors vim and nano are available.
Edit /etc/rc.conf to configure font, keyboard, timezone, hostname and services. See Section
"Configuration Variables in /etc/rc.conf" for details about /etc/rc.conf.
Generate locales for your system. See section "Generating locales" for more information.
cd /usr/src/linux-2.6.35.x
make menuconfig
make all
make modules_install
cp arch/x86/boot/bzImage /boot/vmlinuz
cp System.map /boot
Edit /etc/lilo.conf to boot the kernel you just compiled and run lilo to make the new system bootable.
Remove the CRUX CD-ROM from your drive and reboot from harddisk.
If you plan to use GRUB (which is included in the ISO) make sure you read the installation notes in the
appendix of this document.
Download the CRUX ISO image (crux-2.7.iso). To ensure that the download was successful,
examine its checksum using md5sum.
$ md5sum crux-2.7.iso
Compare the output with the file crux-2.7.md5sum, which can be found in the same directory as the ISO
image on the download site. If the checksums match, the download was successful and you can continue by
burning the ISO image to a CD.
The ISO image is bootable, just insert the newly burned CD and reboot your computer. Press Enter
at the boot prompt (you might have to adjust the root= parameter, depending on your hardware
configuration).
If your installation spans over more than one partition, mount these partitions as well. For example, if you
have a different partition for /var, then do:
$ mount /dev/hd?? /mnt/var
$ swapon /dev/hd??
Type setup to start the package installation script. The script will ask you where you mounted your
root partition and which packages you want to upgrade. To avoid running in to trouble, it is a good
idea to upgrade all packages (e.g. a new version of some library isn't 100% backwards compatible).
Note
The setup script uses the /etc/pkgadd.conf of the target system to determine which files to upgrade, and
which files to not upgrade. The files that are not upgraded are put in /var/lib/pkg/rejected/ (Section
"Upgrading a Package").
When the setup script has upgraded the selected packages an upgrade log will be displayed. Make sure the
last line in the log says 0 error(s). If you missed/forgot to install certain packages, you can just mount
the CRUX CD-ROM and use pkgadd to install them (e.g. pkgadd /mnt/crux/opt/package#1.01.pkg.tar.gz).
$
$
$
$
$
Now it's time to compile your kernel. The kernel compilation requires that you chroot into your
CRUX installation.
Note
There is a short-cut command for creating the chroot environment: setup-chroot. This will execute all these
steps at once.
Generate locales for your system. See section "Generating locales" for more information.
udev reads files in /sys/* and /proc/*. Make sure that those pseudo filesystems are enabled in your kernel
configuration and available during system-startup. Also note that unlike devfsd, udev doesn't automatically
mount /dev/pts. Terminal applications such as xterm(1) will not work if you forget to mount it. If you want
udev to detect your connected USB hardware you'll need the USB-Filesystem mounted on /proc/bus/usb. We
highly recommend you check your fstab file:
# <dev>
[..]
devpts
sysfs
proc
usb
<dir>
/dev/pts
/sys
/proc
/proc/bus/usb
devpts
sysfs
proc
usbfs
defaults
defaults
defaults
defaults
0
0
0
0
0
0
0
0
Edit /etc/lilo.conf to boot the kernel you just compiled and run lilo to make the new system bootable.
Remove the CRUX CD-ROM from your drive and reboot from harddisk.
If you plan to use GRUB (which is included in the ISO) make sure you read the installation notes in the
appendix of this document.
Build a new kernel with support for your hardware. Use the kernel configuration used by the existing
bootkernel as a starting point (you can find it here) and add the hardware support you need. If the
kernel gets too big it is safe to remove SCSI and USB drivers (unless you need them of course), but
do not remove any filesystem related options.
Go into the mkbootfloppy directory and execute the mkbootfloppy script (as root). This script
requires one argument, the kernel image you want to place on the floppy image. Before you do this,
make sure you do not have anything mounted on /mnt since the mkbootfloppy script will use that as
a mount point.
$ cd mkbootfloppy
$ ./mkbootfloppy /path/to/linux/kernel/arch/i386/boot/bzImage
1440+0 records in
1440+0 records out
$ dd if=boot.img of=/dev/fd0
Insert both the floppy disk and the CRUX CD into the system you want to install CRUX on and
reboot.
Install CRUX.
When installing a package the package manager will ensure that no previously installed files are overwritten.
If conflicts are found, an error message will be printed and pkgadd will abort without installing the package.
The error message will contain the names of the conflicting files. Example:
$ pkgadd bash#2.05-1.pkg.tar.gz
bin/sh
usr/man/man1/sh.1.gz
pkgadd error: listed file(s) already installed (use -f to ignore and overwrite)
To force the installation and overwrite the conflicting files, you can use the option -f (or --force). Example:
$ pkgadd -f bash#2.05-1.pkg.tar.gz
The package system allows a file to be owned by exactly one package. When forcing an installation the
ownership of the conflicting files will be transferred to the package that is currently being installed.
Directories can however be owned by more then one package.
Warning
It is often not a good idea to force the installation unless you really know what you are doing. If a package
conflicts with already installed files it could be a sign that the package is broken and installs unexpected
files. Use this option with extreme care, preferably not at all.
As earlier, the package file itself does not contain any meta data. Instead, the package manager uses the
package filename to determine the package name and version. Thus, when installing a package file named
bash#2.05-1.pkg.tar.gz, the package manager will interpret this as a package named bash at version 2.05-1.
If pkgadd is unable to interpret the filename (e.g. # is missing or the filename does not end with .pkg.tar.gz)
an error message will be printed and pkgadd will abort without installing the package.
This will replace the previously installed bash package with the new one. If you have not previously
installed bash, pkgadd will print an error message. The package system does not care about the version
number of the package in that you can upgrade version 2.05-1 with version 2.04-1 (or even with version
2.05-1 itself). The installed package will be replaced with the specified package.
Upgrading a package is equivalent to executing pkgrm followed by pkgadd with one (big) exception. When
upgrading a package (with pkgadd -u) you have the option to prevent some of the already installed files
from getting replaced. This is typically useful when you want to preserve configuration and log files.
When executing pkgadd the file /etc/pkgadd.conf will be read. This file can contain rules describing how
pkgadd should behave when doing upgrades. A rule is built out of three fragments; event, pattern and
action. The event describes in what kind of situation this rule applies. Currently only one type of event is
supported, that is UPGRADE. The pattern is a filename pattern expressed as a regular expression and the
action applicable to the UPGRADE event is YES or NO. More than one rule of the same event type is
allowed, in which case the first rule will have the lowest priority and the last rule will have the highest
priority. Example:
#
# /etc/pkgadd.conf: pkgadd(8) configuration
#
UPGRADE
^etc/.*$
NO
UPGRADE
UPGRADE
UPGRADE
^var/log/.*$
^etc/X11/.*$
^etc/X11/xorg.conf$
NO
YES
NO
# End of file
The above example will cause pkgadd to never upgrade anything in /etc/ or /var/log/ (subdirectories
included), except files in /etc/X11/ (subdirectories included), unless it is the file /etc/X11/xorg.conf. The
default rule is to upgrade everything, rules in this file are exceptions to that rule.
Note
A pattern should never contain an initial / since you are referring to the files in the package, not the files
on the disk.
If pkgadd finds that a specific file should not be upgraded, it will install it under /var/lib/pkg/rejected/. Files
in this directory are never added to the package database. The user is then free to examine, use and/or
remove that file manually. Another option is to use rejmerge. For each rejected file found in
/var/lib/pkg/rejected/, rejmerge will display the difference between the installed version and the rejected
version. The user can then choose to keep the installed version, upgrade to the rejected version or perform a
merge of the two. Example (using the above /etc/pkgadd.conf):
$ pkgadd -u bash#2.05-1.pkg.tar.gz
pkgadd: rejecting etc/profile, keeping existing version
$ ls /var/lib/pkg/rejected/
etc/
$ ls /var/lib/pkg/rejected/etc/
profile
Warning
This will remove all files owned by the package, no questions asked. Think twice before doing it and make
sure that you did not misspell the package name since that could remove something completely different
(e.g. think about what could happen if you misspelled glib as glibc).
Description
-i, --installed
Examples:
$ pkginfo -i
audiofile 0.2.3-1
autoconf 2.52-1
automake 1.5-1
<...>
xmms 1.2.7-1
zip 2.3-1
zlib 1.1.4-1
$ pkginfo -l bash
bin/
bin/bash
bin/sh
etc/
etc/profile
usr/
usr/man/
usr/man/man1/
usr/man/man1/bash.1.gz
usr/man/man1/sh.1.gz
$ pkginfo -l grep#2.5-1.pkg.tar.gz
usr/
usr/bin/
usr/bin/egrep
usr/bin/fgrep
usr/bin/grep
usr/man/
usr/man/man1/
usr/man/man1/egrep.1.gz
usr/man/man1/fgrep.1.gz
usr/man/man1/grep.1.gz
$ pkginfo -o bin/ls
e2fsprogs usr/bin/lsattr
fileutils bin/ls
modutils
sbin/lsmod
Dependency handling
Build logging
In reality you do not include all those comments, thus the real Pkgfile for grep(1) looks like this:
# Description: GNU grep, egrep and fgrep
# URL:
http://www.gnu.org/software/grep/grep.html
# Maintainer: Per Lidn, per at fukt dot bth dot se
name=grep
version=2.4.2
release=1
source=(ftp://ftp.ibiblio.org/pub/gnu/$name/$name-$version.tar.gz)
build() {
cd $name-$version
./configure --prefix=/usr --disable-nls
make
make DESTDIR=$PKG install
rm -rf $PKG/usr/info
}
Note
The build() function in the example above is just an example of how grep is built. The contents of the
function can differ significantly if the program is build in some other way, e.g. does not use autoconf.
When the build() function has been executed, the $PKG directory will be made into a package named
<name>#<version>-<release>.pkg.tar.gz. Before the package creation is completed, pkgmk will check the
content of the package against the .footprint file. If this file does not exist, it will be created and the test will
be skipped. The .footprint file will contain a list of all files that should be in the package if the build was
successful or a list of all the files that were installed in $PKG (if the .footprint did not already exist). If there
is a mismatch the test will fail and an error message will be printed. You should not write the .footprint file
by hand. Instead, when a package has been upgraded and you need to update the contents of the .footprint
file you simply do pkgmk -uf. This test ensures that a rebuild of the package turned out as expected.
If the package built without errors it's time to install it by using pkgadd and try it out. I highly recommend
looking at the Pkgfile in another package(s), since looking at examples is a great way to learn.
CFLAGS, CXXFLAGS - these settings control optimization and architecture options for package
compiles. It is best NOT to change these unless you absolutely know what you're doing!
PKGMK_SOURCE_MIRRORS - this setting defines locations from which pkgmk will attempt to
fetch source archives
PKGMK_SOURCE_DIR - this setting defines where pkgmk will store (if downloading) and use
source archives when building
PKGMK_PACKAGE_DIR - this setting defines where pkgmk will create package files once the
build process is complete
PKGMK_WORK_DIR - this setting defines a work area pkgmk will use to build the package
This setting instructs pkgmk to attempt to fetch all source archives from
http://fileserver.intranet/crux/sources/ before falling back to the source URL specified in the Pkgfile.
Multiple URLS can be separated by spaces.
PKGMK_SOURCE_DIR="/usr/ports/srcfiles"
This example instructs pkgmk to store and find source archives in /usr/ports/srcfiles. An example benefit of
this setup would be the ability to store /usr/ports/srcfiles on an NFS server on your local network for use by
multiple crux installations. PKGMK_PACKAGE_DIR can be set and used the same way.
PKGMK_WORK_DIR="/usr/ports/work/$name"
This example instructs pkgmk to use /usr/ports/work/$name as a work area for building the specified
package. Building the grep package would result in the work area being /usr/ports/work/grep. An
alternative would be to use a tmpfs as your work directory.
There are a few more settings which can be found in the pkgmk.conf man page.
4.6.1. General
The name of a package should always be lowercase (e.g. name=eterm and not name=Eterm). In case
the package is added to the CRUX ports system the exact same name should be use for the name of
the directory in the ports structure, i.e. /usr/ports/???/eterm.
Do not combine several separately distributed programs/libraries into one package. Make several
packages instead.
4.6.2. Directories
In general packages should install files in these directories. Exceptions are of course allowed if there
is a good reason. But try to follow the following directory structure as close as possible.
Directory
Description
/usr/bin/
/usr/sbin/
/usr/lib/
Libraries
/usr/include/
Header files
/usr/lib/<prog>/
/usr/man/
Man pages
/usr/share/<prog>/
Data files
/usr/etc/<prog>/
Configuration files
/etc/
/opt directory is reserved for manually compiled/installed applications. Packages should never place
anything there.
/usr/libexec/ is not used in CRUX, thus packages should never install anything there. Use
/usr/lib/<prog>/ instead.
Packages should not contain junk files. This includes info pages and other online documentation,
man pages excluded (e.g. usr/doc/*, README, *.info, *.html, etc).
Files related to NLS (national language support), always use --disable-nls when available.
4.6.4. Pkgfile
Do not add new variables to the Pkgfile. Only in very few cases does this actually improve the
readability or the quality of the package. Further, the only variables that are guranteed to work with
future versions of pkgmk are name, version, release, and source. Other names could be in
conflict with internal variables in pkgmk.
Use the $name and $version variables to make the package easier to update/maintain. For example,
source=(http://xyz.org/$name-$version.tar.gz) is better than source=(http://xyz.org/myprog1.0.3.tar.gz) since the URL will automatically updated when you modify the $version variable.
Remember that source is an array, i.e. always do source=(...) and not source=...
Meaning
Description
Maintainer
Packager
URL
Depends on
can be omitted if there are no dependencies; Packager can be omitted if the maintainer and
packager are the same person.
Depends on
Example header
#
#
#
#
#
The -u option means update, and tells ports to contact the ports repository and download new and updated
ports. The output from this execution is something like this:
Updating
Updating
...
Updating
Updating
...
Updating
Updating
...
Finished
The output reveals which files are downloaded, updated and deleted.
ncurses/
net-tools/
sendmail/
shadow/
bash/
bc/
bin86/
bindutils/
binutils/
bison/
bzip2/
coreutils/
cpio/
curl/
db/
dcron/
dhcpcd/
diffutils/
e2fsprogs/
ed/
expat/
file/
filesystem/
findutils/
flex/
gawk/
gcc/
glibc/
grep/
groff/
grub/
gzip/
hdparm/
hotplug/
httpup/
iptables/
jfsutils/
kbd/
less/
libstdc++-compat/
libtool/
libusb/
lilo/
m4/
make/
man/
man-pages/
mktemp/
module-init-tools/
nasm/
netkit-base/
netkit-ftp/
netkit-telnet/
nfs-utils/
openssh/
openssl/
patch/
pciutils/
perl/
pkg-config/
pkgutils/
portmap/
ports/
ppp/
procps/
prt-get/
psmisc/
rc/
rdate/
readline/
reiserfsprogs/
rsync/
sed/
slocate/
strace/
sysfsutils/
sysklogd/
sysvinit/
tar/
tcp_wrappers/
tcsh/
time/
traceroute/
udev/
unzip/
usbutils/
util-linux/
vim/
wget/
which/
xfsprogs/
zip/
zlib/
You can also use ports with the -l option to list all local ports. Example:
$ ports -l
core/autoconf
core/automake
core/bash
core/bc
core/bin86
core/bindutils
core/binutils
...
If you are looking for a specific package, it might be easier to use this approach (e.g. ports -l | grep
sendmail) to find out if the package is available and if so in which category it is located.
Name
glibc
gtk
Port
2.3.6-3
2.8.12-1
Installed
2.3.6-2
2.8.11-1
If no version differences were found, i.e. the system is in sync with the ports structure, the output will
simply be:
$ ports -d
No differences found
$ pkgmk -d
The -d option means download missing source files and tells pkgmk to download the source(s) specified in
the Pkgfile (in case the source is already downloaded this option is ignored). When the download is
completed the package will be built. If the package was built successfully you can use pkgadd to install or
upgrade it. Example:
$ pkgadd gawk#3.1.5-3.pkg.tar.gz
To make life a bit easier these two steps can be made into one by using the options -i (for install) or -u (for
upgrade). Example:
$ pkgmk -d -i
or
$ pkgmk -d -u
This will download, build and then install/upgrade the package. Note that the package will only be
installed/upgraded if the build is successful.
To let prt-get know that you want it to use the contrib tree too, edit /etc/prt-get.conf and uncomment the line
prtdir /usr/ports/contrib (i.e. remove the hashmark in the beginning of the line. After that, it should
look like this:
###
### prt-get conf
###
# note: the order matters: the package found first is used
prtdir /usr/ports/core
prtdir /usr/ports/opt
# the folloing line enables the user maintained contrib collection
prtdir /usr/ports/contrib
Now, run ports -u and you're ready to use the ports from contrib.
$ fakeroot pkgmk -d
You can also make prt-get to use fakeroot. There is manual on the CRUX website describing how to
achieve that.
5.2.6.2. Useful scripts
Reagarding package and ports management there are many tasks which can be done in several steps with the
CRUX standard tools introduced above. The port prt-utils in the opt repository contains a collection of such
scripts. The usage of these scripts is documented in the corresponding man pages. In the documentation
section of the CRUX website is an overview of all the scripts in prt-utils.
6. Configuration
6.1. Initialization Scripts
6.1.1. Runlevels
The following runlevels are used in CRUX (defined in /etc/inittab).
Runlevel
Description
Halt
1 (S)
Single-user Mode
Multi-user Mode
3-5
(Not used)
Reboot
6.1.2. Layout
The initialization scripts used in CRUX follow the BSD-style (as opposed to the SysV-style) and have the
following layout.
File
Description
/etc/rc
/etc/rc.single
/etc/rc.modules
/etc/rc.multi
/etc/rc.local
/etc/rc.shutdown
/etc/rc.conf
System configuration
/etc/rc.d/
Variable
FONT
Description
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
SYSLOG
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 identd sshd sendmail)
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 only configures the lo device and a
static IP adress for eth0, you have to add additional ip(8) commands if you want to setup other network
devices (eth0, eth1, etc). Example:
#!/bin/sh
#
# /etc/rc.d/net: start/stop network
#
case $1 in
start)
# loopback
/sbin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host
/sbin/ip link set lo up
# ethernet
/sbin/ip addr add 192.168.1.100/24 dev eth0 broadcast +
/sbin/ip link set eth0 up
# default route
/sbin/ip route add default via 192.168.1.1
;;
stop)
/sbin/ip route del default
/sbin/ip link set eth0 down
/sbin/ip addr del 192.168.1.100/24 dev eth0
/sbin/ip link set lo down
/sbin/ip addr del 127.0.0.1/8 dev lo
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 [start|stop|restart]"
;;
esac
# End of file
if you want to configure your system to be a DHCP client you use the dhcpcd(8) command (instead of
ip(8)). Example:
#!/bin/sh
#
# /etc/rc.d/net: start/stop network
#
case $1 in
start)
# loopback
/sbin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host
/sbin/ip link set lo up
# ethernet
/sbin/dhcpcd -t 10
;;
stop)
/sbin/dhcpcd -x
/sbin/ip link set lo down
/sbin/ip addr del 127.0.0.1/8 dev lo
;;
restart)
$0 stop
$0 start
;;
*)
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
esac
# End of file
6.2. Passwords
CRUX uses MD5SUM passwords by default. This can be turned off if you instead want to use the traditional
DES passwords. Note, however, that DES passwords are considered less secure. To disable MD5SUM
passwords change the MD5_CRYPT_ENAB variable in /etc/login.defs to no.
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 MD5SUM version of the crypt function (this version is backwards compatible and understands
DES passwords as well).
7. Appendix
7.1. Troubleshooting
Many common problems are answered in the FAQ document, so if you experience problems please check
whether http://crux.nu/Main/Faq contains answers to your questions already.
If you have further questions, there's a dedicated mailing list for CRUX, and an IRC channel. Actual
information about these can be found on the Community page of our wiki.
7.2.2. Installation
7.2.2.1. Automatic setup using grub-install
After installation you should create your own boot menu:
#
#
#
#
For more information about setting up your own grub boot menu file:
http://www.gnu.org/software/grub/manual/grub.html#Configuration
After making your boot menu you should run grub-install like so:
# grub-install /dev/sdX
(Of course, you can choose another location as described above but this guide assumes that you use
/boot/grub. Normally you need only the files stage1 and stage2. Please read the grub documentation if you
don't know why: http://www.uruk.org/orig-grub/ and http://www.gnu.org/software/grub/manual/grub.html)
Now it's time to create your own "boot menu":
#
#
#
#
For more information about setting up your own grub boot menu file:
http://www.gnu.org/software/grub/manual/grub.html#Configuration
Last but not least, install/enable the boot manager:
# # If the boot partition is mounted, you must specify --stage2, like below.
# # Otherwise, you may remove this.
# # Run grub
# grub
grub> root (hdX,Y)
grub> setup --stage2=/boot/grub/stage2 (hdX)
grub> quit