10.65. Util-linux-2.12r

The Util-linux package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages.

10.65.1. FHS compliance notes

The FHS recommends using the /var/lib/hwclock directory instead of the usual /etc directory as the location for the adjtime file. To make the hwclock program FHS-compliant, run the following:

sed -i 's@etc/adjtime@var/lib/hwclock/adjtime@g' \
    hwclock/hwclock.c
mkdir -pv /var/lib/hwclock

10.65.2. Installation of Util-linux

Util-linux fails to compile against newer versions of Linux kernel headers. The following patch properly fixes this issue:

patch -Np1 -i ../util-linux-2.12r-cramfs-1.patch

The following patch fixes build issues with GCC 4.1.1:

patch -Np1 -i ../util-linux-2.12r-gcc4_fixes-1.patch

The following patch fixes swapon.c - it tries to find the variable R_OK, but the header that has R_OK is not included:

patch -Np1 -i ../util-linux-2.12r-missing_header-1.patch

Prepare Util-linux for compilation:

CC="gcc ${BUILD64}" ./configure

Compile the package:

make HAVE_KILL=yes HAVE_SLN=yes

The meaning of the make parameters:

HAVE_KILL=yes

This prevents the kill program (already installed by Procps) from being built and installed again.

HAVE_SLN=yes

This prevents the sln program (a statically linked version of ln already installed by Glibc) from being built and installed again.

This package does not come with a test suite.

Install the package and move the logger binary to /bin as it is needed by the CLFS-Bootscripts package:

make HAVE_KILL=yes HAVE_SLN=yes install
mv -v /usr/bin/logger /bin

10.65.3. Contents of Util-linux

Installed programs: agetty, arch, blockdev, cal, cfdisk, chkdupexe, col, colcrt, colrm, column, ctrlaltdel, cytune, ddate, dmesg, elvtune, fdformat, fdisk, flock, fsck.cramfs, fsck.minix, getopt, hexdump, hwclock, ipcrm, ipcs, isosize, line, logger, look, losetup, mcookie, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap, more, mount, namei, pg, pivot_root, ramsize (link to rdev), raw, rdev, readprofile, rename, renice, rev, rootflags (link to rdev), script, setfdprm, setsid, setterm, sfdisk, swapoff (link to swapon), swapon, tailf, tunelp, ul, umount, vidmode (link to rdev), whereis, and write

Short Descriptions

agetty

Opens a tty port, prompts for a login name, and then invokes the login program

arch

Reports the machine's architecture

blockdev

Allows users to call block device ioctls from the command line

cal

Displays a simple calendar

cfdisk

Manipulates the partition table of the given device

chkdupexe

Finds duplicate executables

col

Filters out reverse line feeds

colcrt

Filters nroff output for terminals that lack some capabilities, such as overstriking and half-lines

colrm

Filters out the given columns

column

Formats a given file into multiple columns

ctrlaltdel

Sets the function of the Ctrl+Alt+Del key combination to a hard or a soft reset

cytune

Tunes the parameters of the serial line drivers for Cyclades cards

ddate

Gives the Discordian date or converts the given Gregorian date to a Discordian one

dmesg

Dumps the kernel boot messages

elvtune

Tunes the performance and interactivity of a block device

fdformat

Low-level formats a floppy disk

fdisk

Manipulates the partition table of the given device

flock

Acquires a file lock and then executes a command with the lock held

fsck.cramfs

Performs a consistency check on the Cramfs file system on the given device

fsck.minix

Performs a consistency check on the Minix file system on the given device

getopt

Parses options in the given command line

hexdump

Dumps the given file in hexadecimal or in another given format

hwclock

Reads or sets the system's hardware clock, also called the Real-Time Clock (RTC) or Basic Input-Output System (BIOS) clock

ipcrm

Removes the given Inter-Process Communication (IPC) resource

ipcs

Provides IPC status information

isosize

Reports the size of an iso9660 file system

line

Copies a single line

logger

Enters the given message into the system log

look

Displays lines that begin with the given string

losetup

Sets up and controls loop devices

mcookie

Generates magic cookies (128-bit random hexadecimal numbers) for xauth

mkfs

Builds a file system on a device (usually a hard disk partition)

mkfs.bfs

Creates a Santa Cruz Operations (SCO) bfs file system

mkfs.cramfs

Creates a cramfs file system

mkfs.minix

Creates a Minix file system

mkswap

Initializes the given device or file to be used as a swap area

more

A filter for paging through text one screen at a time

mount

Attaches the file system on the given device to a specified directory in the file-system tree

namei

Shows the symbolic links in the given pathnames

pg

Displays a text file one screen full at a time

pivot_root

Makes the given file system the new root file system of the current process

ramsize

Sets the size of the RAM disk in a bootable image

raw

Used to bind a Linux raw character device to a block device

rdev

Queries and sets the root device, among other things, in a bootable image

readprofile

Reads kernel profiling information

rename

Renames the given files, replacing a given string with another

renice

Alters the priority of running processes

rev

Reverses the lines of a given file

rootflags

Sets the rootflags in a bootable image

script

Makes a typescript of a terminal session

setfdprm

Sets user-provided floppy disk parameters

setsid

Runs the given program in a new session

setterm

Sets terminal attributes

sfdisk

A disk partition table manipulator

swapoff

Disables devices and files for paging and swapping

swapon

Enables devices and files for paging and swapping and lists the devices and files currently in use

tailf

Tracks the growth of a log file. Displays the last 10 lines of a log file, then continues displaying any new entries in the log file as they are created

tunelp

Tunes the parameters of the line printer

ul

A filter for translating underscores into escape sequences indicating underlining for the terminal in use

umount

Disconnects a file system from the system's file tree

vidmode

Sets the video mode in a bootable image

whereis

Reports the location of the binary, source, and man page for the given command

write

Sends a message to the given user if that user has not disabled receipt of such messages