text
stringlengths
17
1.35M
# cciss ## NAME cciss - HP Smart Array block driver ## SYNOPSIS modprobe cciss [ cciss_allow_hpsa=1 ] ## DESCRIPTION **Note** : This obsolete driver was removed in Linux 4.14, as it is superseded by the hpsa(4) driver in newer kernels. **cciss** is a block driver for older HP Smart Array RAID controllers. **Options** _cciss_allow_hpsa=1_ : This option prevents the **cciss** driver from attempting to drive any controllers that the hpsa(4) driver is capable of controlling, which is to say, the **cciss** driver is restricted by this option to the following controllers: Smart Array 5300 Smart Array 5i Smart Array 532 Smart Array 5312 Smart Array 641 Smart Array 642 Smart Array 6400 Smart Array 6400 EM Smart Array 6i Smart Array P600 Smart Array P400i Smart Array E200i Smart Array E200 Smart Array E200i Smart Array E200i Smart Array E200i Smart Array E500 **Supported hardware** The **cciss** driver supports the following Smart Array boards: Smart Array 5300 Smart Array 5i Smart Array 532 Smart Array 5312 Smart Array 641 Smart Array 642 Smart Array 6400 Smart Array 6400 U320 Expansion Module Smart Array 6i Smart Array P600 Smart Array P800 Smart Array E400 Smart Array P400i Smart Array E200 Smart Array E200i Smart Array E500 Smart Array P700m Smart Array P212 Smart Array P410 Smart Array P410i Smart Array P411 Smart Array P812 Smart Array P712m Smart Array P711m **Configuration details** To configure HP Smart Array controllers, use the HP Array Configuration Utility (either **hpacuxe**(8) or **hpacucli**(8)) or the Offline ROM-based Configuration Utility (ORCA) run from the Smart Array's option ROM at boot time. ## FILES **Device nodes** The device naming scheme is as follows: Major numbers: 104 cciss0 105 cciss1 106 cciss2 105 cciss3 108 cciss4 109 cciss5 110 cciss6 111 cciss7 Minor numbers: b7 b6 b5 b4 b3 b2 b1 b0 |----+----| |----+----| | | | +-------- Partition ID (0=wholedev, 1-15 partition) | +-------------------- Logical Volume number The device naming scheme is: _/dev/cciss/c0d0_ Controller 0, disk 0, whole device _/dev/cciss/c0d0p1_ Controller 0, disk 0, partition 1 _/dev/cciss/c0d0p2_ Controller 0, disk 0, partition 2 _/dev/cciss/c0d0p3_ Controller 0, disk 0, partition 3 _/dev/cciss/c1d1_ Controller 1, disk 1, whole device _/dev/cciss/c1d1p1_ Controller 1, disk 1, partition 1 _/dev/cciss/c1d1p2_ Controller 1, disk 1, partition 2 _/dev/cciss/c1d1p3_ Controller 1, disk 1, partition 3 **Files in /proc** The files _/proc/driver/cciss/cciss[0-9]+_ contain information about the configuration of each controller. For example: $ **cd /proc/driver/cciss** ; $ **ls -l** ; total 0 -rw-r--r-- 1 root root 0 2010-09-10 10:38 cciss0 -rw-r--r-- 1 root root 0 2010-09-10 10:38 cciss1 -rw-r--r-- 1 root root 0 2010-09-10 10:38 cciss2 $ **cat cciss2** ; cciss2: HP Smart Array P800 Controller Board ID: 0x3223103c Firmware Version: 7.14 IRQ: 16 Logical drives: 1 Current Q depth: 0 Current # commands on controller: 0 Max Q depth since init: 1 Max # commands on controller since init: 2 Max SG entries since init: 32 Sequential access devices: 0 cciss/c2d0: 36.38GB RAID 0 **Files in /sys** _/sys/bus/pci/devices/_ dev _/cciss_ X _/c_ X _d_ Y _/model_ Displays the SCSI INQUIRY page 0 model for logical drive _Y_ of controller _X_. _/sys/bus/pci/devices/_ dev _/cciss_ X _/c_ X _d_ Y _/rev_ Displays the SCSI INQUIRY page 0 revision for logical drive _Y_ of controller _X_. _/sys/bus/pci/devices/_ dev _/cciss_ X _/c_ X _d_ Y _/unique_id_ Displays the SCSI INQUIRY page 83 serial number for logical drive _Y_ of controller _X_. _/sys/bus/pci/devices/_ dev _/cciss_ X _/c_ X _d_ Y _/vendor_ Displays the SCSI INQUIRY page 0 vendor for logical drive _Y_ of controller _X_. _/sys/bus/pci/devices/_ dev _/cciss_ X _/c_ X _d_ Y _/block:cciss!c_ X _d_ Y A symbolic link to _/sys/block/cciss!c_ X _d_ Y. _/sys/bus/pci/devices/_ dev _/cciss_ X _/rescan_ When this file is written to, the driver rescans the controller to discover any new, removed, or modified logical drives. _/sys/bus/pci/devices/_ dev _/cciss_ X _/resettable_ A value of 1 displayed in this file indicates that the "reset_devices=1" kernel parameter (used by **kdump**) is honored by this controller. A value of 0 indicates that the "reset_devices=1" kernel parameter will not be honored. Some models of Smart Array are not able to honor this parameter. _/sys/bus/pci/devices/_ dev _/cciss_ X _/c_ X _d_ Y _/lunid_ Displays the 8-byte LUN ID used to address logical drive _Y_ of controller _X_. _/sys/bus/pci/devices/_ dev _/cciss_ X _/c_ X _d_ Y _/raid_level_ Displays the RAID level of logical drive _Y_ of controller _X_. _/sys/bus/pci/devices/_ dev _/cciss_ X _/c_ X _d_ Y _/usage_count_ Displays the usage count (number of opens) of logical drive _Y_ of controller _X_. **SCSI tape drive and medium changer support** SCSI sequential access devices and medium changer devices are supported and appropriate device nodes are automatically created (e.g., _/dev/st0_ , _/dev/st1_ , etc.; see st(4) for more details.) You must enable "SCSI tape drive support for Smart Array 5xxx" and "SCSI support" in your kernel configuration to be able to use SCSI tape drives with your Smart Array 5xxx controller. Additionally, note that the driver will not engage the SCSI core at init time. The driver must be directed to dynamically engage the SCSI core via the _/proc_ filesystem entry, which the "block" side of the driver creates as _/proc/driver/cciss/cciss*_ at run time. This is because at driver init time, the SCSI core may not yet be initialized (because the driver is a block driver) and attempting to register it with the SCSI core in such a case would cause a hang. This is best done via an initialization script (typically in _/etc/init.d_ , but could vary depending on distribution). For example: for x in /proc/driver/cciss/cciss[0-9]* do echo "engage scsi" > $x done Once the SCSI core is engaged by the driver, it cannot be disengaged (except by unloading the driver, if it happens to be linked as a module.) Note also that if no sequential access devices or medium changers are detected, the SCSI core will not be engaged by the action of the above script. **Hot plug support for SCSI tape drives** Hot plugging of SCSI tape drives is supported, with some caveats. The **cciss** driver must be informed that changes to the SCSI bus have been made. This may be done via the _/proc_ filesystem. For example: echo "rescan" > /proc/scsi/cciss0/1 This causes the driver to: (1) query the adapter about changes to the physical SCSI buses and/or fiber channel arbitrated loop, and (2) make note of any new or removed sequential access devices or medium changers. The driver will output messages indicating which devices have been added or removed and the controller, bus, target, and lun used to address each device. The driver then notifies the SCSI midlayer of these changes. Note that the naming convention of the _/proc_ filesystem entries contains a number in addition to the driver name (e.g., "cciss0" instead of just "cciss", which you might expect). Note: _Only_ sequential access devices and medium changers are presented as SCSI devices to the SCSI midlayer by the **cciss** driver. Specifically, physical SCSI disk drives are _not_ presented to the SCSI midlayer. The only disk devices that are presented to the kernel are logical drives that the array controller constructs from regions on the physical drives. The logical drives are presented to the block layer (not to the SCSI midlayer). It is important for the driver to prevent the kernel from accessing the physical drives directly, since these drives are used by the array controller to construct the logical drives. **SCSI error handling for tape drives and medium changers** The Linux SCSI midlayer provides an error-handling protocol that is initiated whenever a SCSI command fails to complete within a certain amount of time (which can vary depending on the command). The **cciss** driver participates in this protocol to some extent. The normal protocol is a four-step process: (1) First, the device is told to abort the command. (2) If that doesn't work, the device is reset. (3) If that doesn't work, the SCSI bus is reset. (4) If that doesn't work, the host bus adapter is reset. The **cciss** driver is a block driver as well as a SCSI driver and only the tape drives and medium changers are presented to the SCSI midlayer. Furthermore, unlike more straightforward SCSI drivers, disk I/O continues through the block side during the SCSI error- recovery process. Therefore, the **cciss** driver implements only the first two of these actions, aborting the command, and resetting the device. Note also that most tape drives will not oblige in aborting commands, and sometimes it appears they will not even obey a reset command, though in most circumstances they will. If the command cannot be aborted and the device cannot be reset, the device will be set offline. In the event that the error-handling code is triggered and a tape drive is successfully reset or the tardy command is successfully aborted, the tape drive may still not allow I/O to continue until some command is issued that positions the tape to a known position. Typically you must rewind the tape (by issuing _mt -f_ _/dev/st0 rewind_ for example) before I/O can proceed again to a tape drive that was reset. * * *
# mem ## NAME mem, kmem, port - system memory, kernel memory and system ports ## DESCRIPTION _/dev/mem_ is a character device file that is an image of the main memory of the computer. It may be used, for example, to examine (and even patch) the system. Byte addresses in _/dev/mem_ are interpreted as physical memory addresses. References to nonexistent locations cause errors to be returned. Examining and patching is likely to lead to unexpected results when read-only or write-only bits are present. Since Linux 2.6.26, and depending on the architecture, the **CONFIG_STRICT_DEVMEM** kernel configuration option limits the areas which can be accessed through this file. For example: on x86, RAM access is not allowed but accessing memory-mapped PCI regions is. It is typically created by: mknod -m 660 /dev/mem c 1 1 chown root:kmem /dev/mem The file _/dev/kmem_ is the same as _/dev/mem_ , except that the kernel virtual memory rather than physical memory is accessed. Since Linux 2.6.26, this file is available only if the **CONFIG_DEVKMEM** kernel configuration option is enabled. It is typically created by: mknod -m 640 /dev/kmem c 1 2 chown root:kmem /dev/kmem _/dev/port_ is similar to _/dev/mem_ , but the I/O ports are accessed. It is typically created by: mknod -m 660 /dev/port c 1 4 chown root:kmem /dev/port ## FILES _/dev/mem_ _/dev/kmem_ _/dev/port_ * * *
# cpuid ## NAME cpuid - x86 CPUID access device ## DESCRIPTION CPUID provides an interface for querying information about the x86 CPU. This device is accessed by lseek(2) or pread(2) to the appropriate CPUID level and reading in chunks of 16 bytes. A larger read size means multiple reads of consecutive levels. The lower 32 bits of the file position is used as the incoming _%eax_ , and the upper 32 bits of the file position as the incoming _%ecx_ , the latter is intended for "counting" _eax_ levels like _eax=4_. This driver uses _/dev/cpu/CPUNUM/cpuid_ , where _CPUNUM_ is the minor number, and on an SMP box will direct the access to CPU _CPUNUM_ as listed in _/proc/cpuinfo_. This file is protected so that it can be read only by the user _root_ , or members of the group _root_. ## NOTES The CPUID instruction can be directly executed by a program using inline assembler. However this device allows convenient access to all CPUs without changing process affinity. Most of the information in _cpuid_ is reported by the kernel in cooked form either in _/proc/cpuinfo_ or through subdirectories in _/sys/devices/system/cpu_. Direct CPUID access through this device should only be used in exceptional cases. The _cpuid_ driver is not auto-loaded. On modular kernels you might need to use the following command to load it explicitly before use: $ modprobe cpuid There is no support for CPUID functions that require additional input registers. Early i486 CPUs do not support the CPUID instruction; opening this device for those CPUs fails with EIO. * * *
# ram ## NAME ram - ram disk device ## DESCRIPTION The _ram_ device is a block device to access the ram disk in raw mode. It is typically created by: mknod -m 660 /dev/ram b 1 1 chown root:disk /dev/ram ## FILES _/dev/ram_ * * *
# veth ## NAME veth - Virtual Ethernet Device ## DESCRIPTION The **veth** devices are virtual Ethernet devices. They can act as tunnels between network namespaces to create a bridge to a physical network device in another namespace, but can also be used as standalone network devices. **veth** devices are always created in interconnected pairs. A pair can be created using the command: # ip link add <p1-name> type veth peer name <p2-name> In the above, _p1-name_ and _p2-name_ are the names assigned to the two connected end points. Packets transmitted on one device in the pair are immediately received on the other device. When either device is down, the link state of the pair is down. **veth** device pairs are useful for combining the network facilities of the kernel together in interesting ways. A particularly interesting use case is to place one end of a **veth** pair in one network namespace and the other end in another network namespace, thus allowing communication between network namespaces. To do this, one can provide the **netns** parameter when creating the interfaces: # ip link add <p1-name> netns <p1-ns> type veth peer <p2-name> netns <p2-ns> or, for an existing **veth** pair, move one side to the other namespace: # ip link set <p2-name> netns <p2-ns> ethtool(8) can be used to find the peer of a **veth** network interface, using commands something like: # **ip link add ve_A type veth peer name ve_B** ; # Create veth pair # **ethtool -S ve_A** ; # Discover interface index of peer NIC statistics: peer_ifindex: 16 # **ip link | grep '^16:'** ; # Look up interface 16: ve_B@ve_A: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc ... * * *
# st ## NAME st - SCSI tape device ## SYNOPSIS **#include <sys/mtio.h>** **int ioctl(int** _fd_**, int** _request_ **[, (void *)**_arg3_**]);** **int ioctl(int** _fd_**, MTIOCTOP, (struct mtop *)**_mt_cmd_**);** **int ioctl(int** _fd_**, MTIOCGET, (struct mtget *)**_mt_status_**);** **int ioctl(int** _fd_**, MTIOCPOS, (struct mtpos *)**_mt_pos_**);** ## DESCRIPTION The **st** driver provides the interface to a variety of SCSI tape devices. Currently, the driver takes control of all detected devices of type β€œsequential-access”. The **st** driver uses major device number 9. Each device uses eight minor device numbers. The lowermost five bits in the minor numbers are assigned sequentially in the order of detection. In the 2.6 kernel, the bits above the eight lowermost bits are concatenated to the five lowermost bits to form the tape number. The minor numbers can be grouped into two sets of four numbers: the principal (auto-rewind) minor device numbers, _n_ , and the β€œno-rewind” device numbers, (_n_ + 128). Devices opened using the principal device number will be sent a **REWIND** command when they are closed. Devices opened using the β€œno-rewind” device number will not. (Note that using an auto-rewind device for positioning the tape with, for instance, mt does not lead to the desired result: the tape is rewound after the mt command and the next command starts from the beginning of the tape). Within each group, four minor numbers are available to define devices with different characteristics (block size, compression, density, etc.) When the system starts up, only the first device is available. The other three are activated when the default characteristics are defined (see below). (By changing compile- time constants, it is possible to change the balance between the maximum number of tape drives and the number of minor numbers for each drive. The default allocation allows control of 32 tape drives. For instance, it is possible to control up to 64 tape drives with two minor numbers for different options.) Devices are typically created by: mknod -m 666 /dev/st0 c 9 0 mknod -m 666 /dev/st0l c 9 32 mknod -m 666 /dev/st0m c 9 64 mknod -m 666 /dev/st0a c 9 96 mknod -m 666 /dev/nst0 c 9 128 mknod -m 666 /dev/nst0l c 9 160 mknod -m 666 /dev/nst0m c 9 192 mknod -m 666 /dev/nst0a c 9 224 There is no corresponding block device. The driver uses an internal buffer that has to be large enough to hold at least one tape block. Before Linux 2.1.121, the buffer is allocated as one contiguous block. This limits the block size to the largest contiguous block of memory the kernel allocator can provide. The limit is currently 128 kB for 32-bit architectures and 256 kB for 64-bit architectures. In newer kernels the driver allocates the buffer in several parts if necessary. By default, the maximum number of parts is 16. This means that the maximum block size is very large (2 MB if allocation of 16 blocks of 128 kB succeeds). The driver's internal buffer size is determined by a compile-time constant which can be overridden with a kernel startup option. In addition to this, the driver tries to allocate a larger temporary buffer at run time if necessary. However, run-time allocation of large contiguous blocks of memory may fail and it is advisable not to rely too much on dynamic buffer allocation before Linux 2.1.121 (this applies also to demand-loading the driver with kerneld or kmod). The driver does not specifically support any tape drive brand or model. After system start-up the tape device options are defined by the drive firmware. For example, if the drive firmware selects fixed-block mode, the tape device uses fixed-block mode. The options can be changed with explicit ioctl(2) calls and remain in effect when the device is closed and reopened. Setting the options affects both the auto-rewind and the nonrewind device. Different options can be specified for the different devices within the subgroup of four. The options take effect when the device is opened. For example, the system administrator can define one device that writes in fixed-block mode with a certain block size, and one which writes in variable-block mode (if the drive supports both modes). The driver supports **tape partitions** if they are supported by the drive. (Note that the tape partitions have nothing to do with disk partitions. A partitioned tape can be seen as several logical tapes within one medium.) Partition support has to be enabled with an ioctl(2). The tape location is preserved within each partition across partition changes. The partition used for subsequent tape operations is selected with an ioctl(2). The partition switch is executed together with the next tape operation in order to avoid unnecessary tape movement. The maximum number of partitions on a tape is defined by a compile-time constant (originally four). The driver contains an ioctl(2) that can format a tape with either one or two partitions. Device _/dev/tape_ is usually created as a hard or soft link to the default tape device on the system. Starting from Linux 2.6.2, the driver exports in the sysfs directory _/sys/class/scsi_tape_ the attached devices and some parameters assigned to the devices. **Data transfer** The driver supports operation in both fixed-block mode and variable-block mode (if supported by the drive). In fixed-block mode the drive writes blocks of the specified size and the block size is not dependent on the byte counts of the write system calls. In variable-block mode one tape block is written for each write call and the byte count determines the size of the corresponding tape block. Note that the blocks on the tape don't contain any information about the writing mode: when reading, the only important thing is to use commands that accept the block sizes on the tape. In variable-block mode the read byte count does not have to match the tape block size exactly. If the byte count is larger than the next block on tape, the driver returns the data and the function returns the actual block size. If the block size is larger than the byte count, an error is returned. In fixed-block mode the read byte counts can be arbitrary if buffering is enabled, or a multiple of the tape block size if buffering is disabled. Before Linux 2.1.121 allow writes with arbitrary byte count if buffering is enabled. In all other cases (before Linux 2.1.121 with buffering disabled or newer kernel) the write byte count must be a multiple of the tape block size. In Linux 2.6, the driver tries to use direct transfers between the user buffer and the device. If this is not possible, the driver's internal buffer is used. The reasons for not using direct transfers include improper alignment of the user buffer (default is 512 bytes but this can be changed by the HBA driver), one or more pages of the user buffer not reachable by the SCSI adapter, and so on. A filemark is automatically written to tape if the last tape operation before close was a write. When a filemark is encountered while reading, the following happens. If there are data remaining in the buffer when the filemark is found, the buffered data is returned. The next read returns zero bytes. The following read returns data from the next file. The end of recorded data is signaled by returning zero bytes for two consecutive read calls. The third read returns an error. **Ioctls** The driver supports three ioctl(2) requests. Requests not recognized by the **st** driver are passed to the **SCSI** driver. The definitions below are from _/usr/include/linux/mtio.h_ : **MTIOCTOP β€” perform a tape operation** This request takes an argument of type _(struct mtop *)_. Not all drives support all operations. The driver returns an **EIO** error if the drive rejects an operation. /* Structure for MTIOCTOP - mag tape op command: */ struct mtop { short mt_op; /* operations defined below */ int mt_count; /* how many of them */ }; Magnetic tape operations for normal tape use: **MTBSF** Backward space over _mt_count_ filemarks. **MTBSFM** Backward space over _mt_count_ filemarks. Reposition the tape to the EOT side of the last filemark. **MTBSR** Backward space over _mt_count_ records (tape blocks). **MTBSS** Backward space over _mt_count_ setmarks. **MTCOMPRESSION** Enable compression of tape data within the drive if _mt_count_ is nonzero and disable compression if _mt_count_ is zero. This command uses the MODE page 15 supported by most DATs. **MTEOM** Go to the end of the recorded media (for appending files). **MTERASE** Erase tape. With Linux 2.6, short erase (mark tape empty) is performed if the argument is zero. Otherwise, long erase (erase all) is done. **MTFSF** Forward space over _mt_count_ filemarks. **MTFSFM** Forward space over _mt_count_ filemarks. Reposition the tape to the BOT side of the last filemark. **MTFSR** Forward space over _mt_count_ records (tape blocks). **MTFSS** Forward space over _mt_count_ setmarks. **MTLOAD** Execute the SCSI load command. A special case is available for some HP autoloaders. If _mt_count_ is the constant **MT_ST_HPLOADER_OFFSET** plus a number, the number is sent to the drive to control the autoloader. **MTLOCK** Lock the tape drive door. **MTMKPART** Format the tape into one or two partitions. If _mt_count_ is positive, it gives the size of partition 1 and partition 0 contains the rest of the tape. If _mt_count_ is zero, the tape is formatted into one partition. From Linux 4.6, a negative _mt_count_ specifies the size of partition 0 and the rest of the tape contains partition 1. The physical ordering of partitions depends on the drive. This command is not allowed for a drive unless the partition support is enabled for the drive (see **MT_ST_CAN_PARTITIONS** below). **MTNOP** No opβ€”flushes the driver's buffer as a side effect. Should be used before reading status with **MTIOCGET**. **MTOFFL** Rewind and put the drive off line. **MTRESET** Reset drive. **MTRETEN** Re-tension tape. **MTREW** Rewind. **MTSEEK** Seek to the tape block number specified in _mt_count_. This operation requires either a SCSI-2 drive that supports the **LOCATE** command (device-specific address) or a Tandberg- compatible SCSI-1 drive (Tandberg, Archive Viper, Wangtek, ...). The block number should be one that was previously returned by **MTIOCPOS** if device-specific addresses are used. **MTSETBLK** Set the drive's block length to the value specified in _mt_count_. A block length of zero sets the drive to variable block size mode. **MTSETDENSITY** Set the tape density to the code in _mt_count_. The density codes supported by a drive can be found from the drive documentation. **MTSETPART** The active partition is switched to _mt_count_. The partitions are numbered from zero. This command is not allowed for a drive unless the partition support is enabled for the drive (see **MT_ST_CAN_PARTITIONS** below). **MTUNLOAD** Execute the SCSI unload command (does not eject the tape). **MTUNLOCK** Unlock the tape drive door. **MTWEOF** Write _mt_count_ filemarks. **MTWSM** Write _mt_count_ setmarks. Magnetic tape operations for setting of device options (by the superuser): **MTSETDRVBUFFER** Set various drive and driver options according to bits encoded in _mt_count_. These consist of the drive's buffering mode, a set of Boolean driver options, the buffer write threshold, defaults for the block size and density, and timeouts (only since Linux 2.1). A single operation can affect only one item in the list below (the Booleans counted as one item.) A value having zeros in the high-order 4 bits will be used to set the drive's buffering mode. The buffering modes are: **0** The drive will not report **GOOD** status on write commands until the data blocks are actually written to the medium. **1** The drive may report **GOOD** status on write commands as soon as all the data has been transferred to the drive's internal buffer. **2** The drive may report **GOOD** status on write commands as soon as (a) all the data has been transferred to the drive's internal buffer, and (b) all buffered data from different initiators has been successfully written to the medium. To control the write threshold the value in _mt_count_ must include the constant **MT_ST_WRITE_THRESHOLD** bitwise ORed with a block count in the low 28 bits. The block count refers to 1024-byte blocks, not the physical block size on the tape. The threshold cannot exceed the driver's internal buffer size (see DESCRIPTION, above). To set and clear the Boolean options the value in _mt_count_ must include one of the constants **MT_ST_BOOLEANS** , **MT_ST_SETBOOLEANS** , **MT_ST_CLEARBOOLEANS** , or **MT_ST_DEFBOOLEANS** bitwise ORed with whatever combination of the following options is desired. Using **MT_ST_BOOLEANS** the options can be set to the values defined in the corresponding bits. With **MT_ST_SETBOOLEANS** the options can be selectively set and with **MT_ST_DEFBOOLEANS** selectively cleared. The default options for a tape device are set with **MT_ST_DEFBOOLEANS**. A nonactive tape device (e.g., device with minor 32 or 160) is activated when the default options for it are defined the first time. An activated device inherits from the device activated at start-up the options not set explicitly. The Boolean options are: **MT_ST_BUFFER_WRITES**(Default: true) Buffer all write operations in fixed-block mode. If this option is false and the drive uses a fixed block size, then all write operations must be for a multiple of the block size. This option must be set false to write reliable multivolume archives. **MT_ST_ASYNC_WRITES**(Default: true) When this option is true, write operations return immediately without waiting for the data to be transferred to the drive if the data fits into the driver's buffer. The write threshold determines how full the buffer must be before a new SCSI write command is issued. Any errors reported by the drive will be held until the next operation. This option must be set false to write reliable multivolume archives. **MT_ST_READ_AHEAD**(Default: true) This option causes the driver to provide read buffering and read-ahead in fixed-block mode. If this option is false and the drive uses a fixed block size, then all read operations must be for a multiple of the block size. **MT_ST_TWO_FM**(Default: false) This option modifies the driver behavior when a file is closed. The normal action is to write a single filemark. If the option is true, the driver will write two filemarks and backspace over the second one. Note: This option should not be set true for QIC tape drives since they are unable to overwrite a filemark. These drives detect the end of recorded data by testing for blank tape rather than two consecutive filemarks. Most other current drives also detect the end of recorded data and using two filemarks is usually necessary only when interchanging tapes with some other systems. **MT_ST_DEBUGGING**(Default: false) This option turns on various debugging messages from the driver (effective only if the driver was compiled with **DEBUG** defined nonzero). **MT_ST_FAST_EOM**(Default: false) This option causes the **MTEOM** operation to be sent directly to the drive, potentially speeding up the operation but causing the driver to lose track of the current file number normally returned by the **MTIOCGET** request. If **MT_ST_FAST_EOM** is false, the driver will respond to an **MTEOM** request by forward spacing over files. **MT_ST_AUTO_LOCK**(Default: false) When this option is true, the drive door is locked when the device file is opened and unlocked when it is closed. **MT_ST_DEF_WRITES**(Default: false) The tape options (block size, mode, compression, etc.) may change when changing from one device linked to a drive to another device linked to the same drive depending on how the devices are defined. This option defines when the changes are enforced by the driver using SCSI-commands and when the drives auto-detection capabilities are relied upon. If this option is false, the driver sends the SCSI- commands immediately when the device is changed. If the option is true, the SCSI-commands are not sent until a write is requested. In this case, the drive firmware is allowed to detect the tape structure when reading and the SCSI-commands are used only to make sure that a tape is written according to the correct specification. **MT_ST_CAN_BSR**(Default: false) When read-ahead is used, the tape must sometimes be spaced backward to the correct position when the device is closed and the SCSI command to space backward over records is used for this purpose. Some older drives can't process this command reliably and this option can be used to instruct the driver not to use the command. The end result is that, with read-ahead and fixed-block mode, the tape may not be correctly positioned within a file when the device is closed. With Linux 2.6, the default is true for drives supporting SCSI-3. **MT_ST_NO_BLKLIMS**(Default: false) Some drives don't accept the **READ BLOCK LIMITS** SCSI command. If this is used, the driver does not use the command. The drawback is that the driver can't check before sending commands if the selected block size is acceptable to the drive. **MT_ST_CAN_PARTITIONS**(Default: false) This option enables support for several partitions within a tape. The option applies to all devices linked to a drive. **MT_ST_SCSI2LOGICAL**(Default: false) This option instructs the driver to use the logical block addresses defined in the SCSI-2 standard when performing the seek and tell operations (both with **MTSEEK** and **MTIOCPOS** commands and when changing tape partition). Otherwise, the device-specific addresses are used. It is highly advisable to set this option if the drive supports the logical addresses because they count also filemarks. There are some drives that support only the logical block addresses. **MT_ST_SYSV**(Default: false) When this option is enabled, the tape devices use the System V semantics. Otherwise, the BSD semantics are used. The most important difference between the semantics is what happens when a device used for reading is closed: in System V semantics the tape is spaced forward past the next filemark if this has not happened while using the device. In BSD semantics the tape position is not changed. **MT_NO_WAIT**(Default: false) Enables immediate mode (i.e., don't wait for the command to finish) for some commands (e.g., rewind). An example: struct mtop mt_cmd; mt_cmd.mt_op = MTSETDRVBUFFER; mt_cmd.mt_count = MT_ST_BOOLEANS | MT_ST_BUFFER_WRITES | MT_ST_ASYNC_WRITES; ioctl(fd, MTIOCTOP, mt_cmd); The default block size for a device can be set with **MT_ST_DEF_BLKSIZE** and the default density code can be set with **MT_ST_DEFDENSITY**. The values for the parameters are or'ed with the operation code. With Linux 2.1.x and later, the timeout values can be set with the subcommand **MT_ST_SET_TIMEOUT** ORed with the timeout in seconds. The long timeout (used for rewinds and other commands that may take a long time) can be set with **MT_ST_SET_LONG_TIMEOUT**. The kernel defaults are very long to make sure that a successful command is not timed out with any drive. Because of this, the driver may seem stuck even if it is only waiting for the timeout. These commands can be used to set more practical values for a specific drive. The timeouts set for one device apply for all devices linked to the same drive. Starting from Linux 2.4.19 and Linux 2.5.43, the driver supports a status bit which indicates whether the drive requests cleaning. The method used by the drive to return cleaning information is set using the **MT_ST_SEL_CLN** subcommand. If the value is zero, the cleaning bit is always zero. If the value is one, the TapeAlert data defined in the SCSI-3 standard is used (not yet implemented). Values 2–17 are reserved. If the lowest eight bits are >= 18, bits from the extended sense data are used. The bits 9–16 specify a mask to select the bits to look at and the bits 17–23 specify the bit pattern to look for. If the bit pattern is zero, one or more bits under the mask indicate the cleaning request. If the pattern is nonzero, the pattern must match the masked sense data byte. **MTIOCGET β€” get status** This request takes an argument of type _(struct mtget *)_. /* structure for MTIOCGET - mag tape get status command */ struct mtget { long mt_type; long mt_resid; /* the following registers are device dependent */ long mt_dsreg; long mt_gstat; long mt_erreg; /* The next two fields are not always used */ daddr_t mt_fileno; daddr_t mt_blkno; }; _mt_type_ The header file defines many values for _mt_type_ , but the current driver reports only the generic types **MT_ISSCSI1** (Generic SCSI-1 tape) and **MT_ISSCSI2**(Generic SCSI-2 tape). _mt_resid_ contains the current tape partition number. _mt_dsreg_ reports the drive's current settings for block size (in the low 24 bits) and density (in the high 8 bits). These fields are defined by **MT_ST_BLKSIZE_SHIFT** , **MT_ST_BLKSIZE_MASK** , **MT_ST_DENSITY_SHIFT** , and **MT_ST_DENSITY_MASK**. _mt_gstat_ reports generic (device independent) status information. The header file defines macros for testing these status bits: **GMT_EOF**(_x_) The tape is positioned just after a filemark (always false after an **MTSEEK** operation). **GMT_BOT**(_x_) The tape is positioned at the beginning of the first file (always false after an **MTSEEK** operation). **GMT_EOT**(_x_) A tape operation has reached the physical End Of Tape. **GMT_SM**(_x_) The tape is currently positioned at a setmark (always false after an **MTSEEK** operation). **GMT_EOD**(_x_) The tape is positioned at the end of recorded data. **GMT_WR_PROT**(_x_) The drive is write-protected. For some drives this can also mean that the drive does not support writing on the current medium type. **GMT_ONLINE**(_x_) The last open(2) found the drive with a tape in place and ready for operation. **GMT_D_6250**(_x_) **GMT_D_1600**(_x_) **GMT_D_800**(_x_) This β€œgeneric” status information reports the current density setting for 9-track Β½" tape drives only. **GMT_DR_OPEN**(_x_) The drive does not have a tape in place. **GMT_IM_REP_EN**(_x_) Immediate report mode. This bit is set if there are no guarantees that the data has been physically written to the tape when the write call returns. It is set zero only when the driver does not buffer data and the drive is set not to buffer data. **GMT_CLN**(_x_) The drive has requested cleaning. Implemented since Linux 2.4.19 and Linux 2.5.43. _mt_erreg_ The only field defined in _mt_erreg_ is the recovered error count in the low 16 bits (as defined by **MT_ST_SOFTERR_SHIFT** and **MT_ST_SOFTERR_MASK**). Due to inconsistencies in the way drives report recovered errors, this count is often not maintained (most drives do not by default report soft errors but this can be changed with a SCSI MODE SELECT command). _mt_fileno_ reports the current file number (zero-based). This value is set to -1 when the file number is unknown (e.g., after **MTBSS** or **MTSEEK**). _mt_blkno_ reports the block number (zero-based) within the current file. This value is set to -1 when the block number is unknown (e.g., after **MTBSF** , **MTBSS** , or **MTSEEK**). **MTIOCPOS β€” get tape position** This request takes an argument of type _(struct mtpos *)_ and reports the drive's notion of the current tape block number, which is not the same as _mt_blkno_ returned by **MTIOCGET**. This drive must be a SCSI-2 drive that supports the **READ POSITION** command (device- specific address) or a Tandberg-compatible SCSI-1 drive (Tandberg, Archive Viper, Wangtek, ... ). /* structure for MTIOCPOS - mag tape get position command */ struct mtpos { long mt_blkno; /* current block number */ }; ## RETURN VALUE **EACCES** An attempt was made to write or erase a write-protected tape. (This error is not detected during open(2).) **EBUSY** The device is already in use or the driver was unable to allocate a buffer. **EFAULT** The command parameters point to memory not belonging to the calling process. **EINVAL** An ioctl(2) had an invalid argument, or a requested block size was invalid. **EIO** The requested operation could not be completed. **ENOMEM** The byte count in read(2) is smaller than the next physical block on the tape. (Before Linux 2.2.18 and Linux 2.4.0 the extra bytes have been silently ignored.) **ENOSPC** A write operation could not be completed because the tape reached end-of-medium. **ENOSYS** Unknown ioctl(2). **ENXIO** During opening, the tape device does not exist. **EOVERFLOW** An attempt was made to read or write a variable-length block that is larger than the driver's internal buffer. **EROFS** Open is attempted with **O_WRONLY** or **O_RDWR** when the tape in the drive is write-protected. ## FILES _/dev/st*_ the auto-rewind SCSI tape devices _/dev/nst*_ the nonrewind SCSI tape devices ## NOTES β€’ When exchanging data between systems, both systems have to agree on the physical tape block size. The parameters of a drive after startup are often not the ones most operating systems use with these devices. Most systems use drives in variable-block mode if the drive supports that mode. This applies to most modern drives, including DATs, 8mm helical scan drives, DLTs, etc. It may be advisable to use these drives in variable-block mode also in Linux (i.e., use **MTSETBLK** or **MTSETDEFBLK** at system startup to set the mode), at least when exchanging data with a foreign system. The drawback of this is that a fairly large tape block size has to be used to get acceptable data transfer rates on the SCSI bus. β€’ Many programs (e.g., tar(1)) allow the user to specify the blocking factor on the command line. Note that this determines the physical block size on tape only in variable-block mode. β€’ In order to use SCSI tape drives, the basic SCSI driver, a SCSI-adapter driver and the SCSI tape driver must be either configured into the kernel or loaded as modules. If the SCSI- tape driver is not present, the drive is recognized but the tape support described in this page is not available. β€’ The driver writes error messages to the console/log. The SENSE codes written into some messages are automatically translated to text if verbose SCSI messages are enabled in kernel configuration. β€’ The driver's internal buffering allows good throughput in fixed-block mode also with small read(2) and write(2) byte counts. With direct transfers this is not possible and may cause a surprise when moving to the 2.6 kernel. The solution is to tell the software to use larger transfers (often telling it to use larger blocks). If this is not possible, direct transfers can be disabled. * * *
# intro ## NAME intro - introduction to special files ## DESCRIPTION Section 4 of the manual describes special files (devices). ## FILES /dev/* β€” device files ## NOTES **Authors and copyright conditions** Look at the header of the manual page source for the author(s) and copyright conditions. Note that these can be different from page to page! * * *
# lp ## NAME lp - line printer devices ## SYNOPSIS **#include <linux/lp.h>** ## CONFIGURATION **lp**[0–2] are character devices for the parallel line printers; they have major number 6 and minor number 0–2. The minor numbers correspond to the printer port base addresses 0x03bc, 0x0378, and 0x0278. Usually they have mode 220 and are owned by user _root_ and group _lp_. You can use printer ports either with polling or with interrupts. Interrupts are recommended when high traffic is expected, for example, for laser printers. For typical dot matrix printers, polling will usually be enough. The default is polling. ## DESCRIPTION The following ioctl(2) calls are supported: **int ioctl(int** fd**, LPTIME, int** arg**)** Sets the amount of time that the driver sleeps before rechecking the printer when the printer's buffer appears to be filled to _arg_. If you have a fast printer, decrease this number; if you have a slow printer, then increase it. This is in hundredths of a second, the default 2 being 0.02 seconds. It influences only the polling driver. **int ioctl(int** fd**, LPCHAR, int** arg**)** Sets the maximum number of busy-wait iterations which the polling driver does while waiting for the printer to get ready for receiving a character to _arg_. If printing is too slow, increase this number; if the system gets too slow, decrease this number. The default is 1000. It influences only the polling driver. **int ioctl(int** fd**, LPABORT, int** arg**)** If _arg_ is 0, the printer driver will retry on errors, otherwise it will abort. The default is 0. **int ioctl(int** fd**, LPABORTOPEN, int** arg**)** If _arg_ is 0, open(2) will be aborted on error, otherwise error will be ignored. The default is to ignore it. **int ioctl(int** fd**, LPCAREFUL, int** arg**)** If _arg_ is 0, then the out-of-paper, offline, and error signals are required to be false on all writes, otherwise they are ignored. The default is to ignore them. **int ioctl(int** fd**, LPWAIT, int** arg**)** Sets the number of busy waiting iterations to wait before strobing the printer to accept a just-written character, and the number of iterations to wait before turning the strobe off again, to _arg_. The specification says this time should be 0.5 microseconds, but experience has shown the delay caused by the code is already enough. For that reason, the default value is 0. This is used for both the polling and the interrupt driver. **int ioctl(int** fd**, LPSETIRQ, int** arg**)** This ioctl(2) requires superuser privileges. It takes an _int_ containing the new IRQ as argument. As a side effect, the printer will be reset. When _arg_ is 0, the polling driver will be used, which is also default. **int ioctl(int** fd**, LPGETIRQ, int *** arg**)** Stores the currently used IRQ in _arg_. **int ioctl(int** fd**, LPGETSTATUS, int *** arg**)** Stores the value of the status port in _arg_. The bits have the following meaning: LP_PBUSY inverted busy input, active high LP_PACK unchanged acknowledge input, active low LP_POUTPA unchanged out-of-paper input, active high LP_PSELECD unchanged selected input, active high LP_PERRORP unchanged error input, active low Refer to your printer manual for the meaning of the signals. Note that undocumented bits may also be set, depending on your printer. **int ioctl(int** fd**, LPRESET)** Resets the printer. No argument is used. ## FILES _/dev/lp*_ * * *
# fuse ## NAME fuse - Filesystem in Userspace (FUSE) device ## SYNOPSIS **#include <linux/fuse.h>** ## DESCRIPTION This device is the primary interface between the FUSE filesystem driver and a user-space process wishing to provide the filesystem (referred to in the rest of this manual page as the _filesystem_ _daemon_). This manual page is intended for those interested in understanding the kernel interface itself. Those implementing a FUSE filesystem may wish to make use of a user-space library such as _libfuse_ that abstracts away the low-level interface. At its core, FUSE is a simple client-server protocol, in which the Linux kernel is the client and the daemon is the server. After obtaining a file descriptor for this device, the daemon may read(2) requests from that file descriptor and is expected to write(2) back its replies. It is important to note that a file descriptor is associated with a unique FUSE filesystem. In particular, opening a second copy of this device, will not allow access to resources created through the first file descriptor (and vice versa). **The basic protocol** Every message that is read by the daemon begins with a header described by the following structure: struct fuse_in_header { uint32_t len; /* Total size of the data, including this header */ uint32_t opcode; /* The kind of operation (see below) */ uint64_t unique; /* A unique identifier for this request */ uint64_t nodeid; /* ID of the filesystem object being operated on */ uint32_t uid; /* UID of the requesting process */ uint32_t gid; /* GID of the requesting process */ uint32_t pid; /* PID of the requesting process */ uint32_t padding; }; The header is followed by a variable-size data portion (which may be empty) specific to the requested operation (the requested operation is indicated by _opcode_). The daemon should then process the request and if applicable send a reply (almost all operations require a reply; if they do not, this is documented below), by performing a write(2) to the file descriptor. All replies must start with the following header: struct fuse_out_header { uint32_t len; /* Total size of data written to the file descriptor */ int32_t error; /* Any error that occurred (0 if none) */ uint64_t unique; /* The value from the corresponding request */ }; This header is also followed by (potentially empty) variable-sized data depending on the executed request. However, if the reply is an error reply (i.e., _error_ is set), then no further payload data should be sent, independent of the request. **Exchanged messages** This section should contain documentation for each of the messages in the protocol. This manual page is currently incomplete, so not all messages are documented. For each message, first the struct sent by the kernel is given, followed by a description of the semantics of the message. **FUSE_INIT** struct fuse_init_in { uint32_t major; uint32_t minor; uint32_t max_readahead; /* Since protocol v7.6 */ uint32_t flags; /* Since protocol v7.6 */ }; This is the first request sent by the kernel to the daemon. It is used to negotiate the protocol version and other filesystem parameters. Note that the protocol version may affect the layout of any structure in the protocol (including this structure). The daemon must thus remember the negotiated version and flags for each session. As of the writing of this man page, the highest supported kernel protocol version is _7.26_. Users should be aware that the descriptions in this manual page may be incomplete or incorrect for older or more recent protocol versions. The reply for this request has the following format: struct fuse_init_out { uint32_t major; uint32_t minor; uint32_t max_readahead; /* Since v7.6 */ uint32_t flags; /* Since v7.6; some flags bits were introduced later */ uint16_t max_background; /* Since v7.13 */ uint16_t congestion_threshold; /* Since v7.13 */ uint32_t max_write; /* Since v7.5 */ uint32_t time_gran; /* Since v7.6 */ uint32_t unused[9]; }; If the major version supported by the kernel is larger than that supported by the daemon, the reply shall consist of only _uint32_t major_ (following the usual header), indicating the largest major version supported by the daemon. The kernel will then issue a new **FUSE_INIT** request conforming to the older version. In the reverse case, the daemon should quietly fall back to the kernel's major version. The negotiated minor version is considered to be the minimum of the minor versions provided by the daemon and the kernel and both parties should use the protocol corresponding to said minor version. **FUSE_GETATTR** struct fuse_getattr_in { uint32_t getattr_flags; uint32_t dummy; uint64_t fh; /* Set only if (getattr_flags & FUSE_GETATTR_FH) }; The requested operation is to compute the attributes to be returned by stat(2) and similar operations for the given filesystem object. The object for which the attributes should be computed is indicated either by _header- >nodeid_ or, if the **FUSE_GETATTR_FH** flag is set, by the file handle _fh_. The latter case of operation is analogous to fstat(2). For performance reasons, these attributes may be cached in the kernel for a specified duration of time. While the cache timeout has not been exceeded, the attributes will be served from the cache and will not cause additional **FUSE_GETATTR** requests. The computed attributes and the requested cache timeout should then be returned in the following structure: struct fuse_attr_out { /* Attribute cache duration (seconds + nanoseconds) */ uint64_t attr_valid; uint32_t attr_valid_nsec; uint32_t dummy; struct fuse_attr { uint64_t ino; uint64_t size; uint64_t blocks; uint64_t atime; uint64_t mtime; uint64_t ctime; uint32_t atimensec; uint32_t mtimensec; uint32_t ctimensec; uint32_t mode; uint32_t nlink; uint32_t uid; uint32_t gid; uint32_t rdev; uint32_t blksize; uint32_t padding; } attr; }; **FUSE_ACCESS** struct fuse_access_in { uint32_t mask; uint32_t padding; }; If the _default_permissions_ mount options is not used, this request may be used for permissions checking. No reply data is expected, but errors may be indicated as usual by setting the _error_ field in the reply header (in particular, access denied errors may be indicated by returning **-EACCES**). **FUSE_OPEN** **FUSE_OPENDIR** struct fuse_open_in { uint32_t flags; /* The flags that were passed to the open(2) */ uint32_t unused; }; The requested operation is to open the node indicated by _header- >nodeid_. The exact semantics of what this means will depend on the filesystem being implemented. However, at the very least the filesystem should validate that the requested _flags_ are valid for the indicated resource and then send a reply with the following format: struct fuse_open_out { uint64_t fh; uint32_t open_flags; uint32_t padding; }; The _fh_ field is an opaque identifier that the kernel will use to refer to this resource The _open_flags_ field is a bit mask of any number of the flags that indicate properties of this file handle to the kernel: **FOPEN_DIRECT_IO** Bypass page cache for this open file. **FOPEN_KEEP_CACHE** Don't invalidate the data cache on open. **FOPEN_NONSEEKABLE** The file is not seekable. **FUSE_READ** **FUSE_READDIR** struct fuse_read_in { uint64_t fh; uint64_t offset; uint32_t size; uint32_t read_flags; uint64_t lock_owner; uint32_t flags; uint32_t padding; }; The requested action is to read up to _size_ bytes of the file or directory, starting at _offset_. The bytes should be returned directly following the usual reply header. **FUSE_INTERRUPT** struct fuse_interrupt_in { uint64_t unique; }; The requested action is to cancel the pending operation indicated by _unique_. This request requires no response. However, receipt of this message does not by itself cancel the indicated operation. The kernel will still expect a reply to said operation (e.g., an _EINTR_ error or a short read). At most one **FUSE_INTERRUPT** request will be issued for a given operation. After issuing said operation, the kernel will wait uninterruptibly for completion of the indicated request. **FUSE_LOOKUP** Directly following the header is a filename to be looked up in the directory indicated by _header- >nodeid_. The expected reply is of the form: struct fuse_entry_out { uint64_t nodeid; /* Inode ID */ uint64_t generation; /* Inode generation */ uint64_t entry_valid; uint64_t attr_valid; uint32_t entry_valid_nsec; uint32_t attr_valid_nsec; struct fuse_attr attr; }; The combination of _nodeid_ and _generation_ must be unique for the filesystem's lifetime. The interpretation of timeouts and _attr_ is as for **FUSE_GETATTR**. **FUSE_FLUSH** struct fuse_flush_in { uint64_t fh; uint32_t unused; uint32_t padding; uint64_t lock_owner; }; The requested action is to flush any pending changes to the indicated file handle. No reply data is expected. However, an empty reply message still needs to be issued once the flush operation is complete. **FUSE_RELEASE** **FUSE_RELEASEDIR** struct fuse_release_in { uint64_t fh; uint32_t flags; uint32_t release_flags; uint64_t lock_owner; }; These are the converse of **FUSE_OPEN** and **FUSE_OPENDIR** respectively. The daemon may now free any resources associated with the file handle _fh_ as the kernel will no longer refer to it. There is no reply data associated with this request, but a reply still needs to be issued once the request has been completely processed. **FUSE_STATFS** This operation implements statfs(2) for this filesystem. There is no input data associated with this request. The expected reply data has the following structure: struct fuse_kstatfs { uint64_t blocks; uint64_t bfree; uint64_t bavail; uint64_t files; uint64_t ffree; uint32_t bsize; uint32_t namelen; uint32_t frsize; uint32_t padding; uint32_t spare[6]; }; struct fuse_statfs_out { struct fuse_kstatfs st; }; For the interpretation of these fields, see statfs(2). ## ERRORS **E2BIG** Returned from read(2) operations when the kernel's request is too large for the provided buffer and the request was **FUSE_SETXATTR**. **EINVAL** Returned from write(2) if validation of the reply failed. Not all mistakes in replies will be caught by this validation. However, basic mistakes, such as short replies or an incorrect _unique_ value, are detected. **EIO** Returned from read(2) operations when the kernel's request is too large for the provided buffer. _Note_ : There are various ways in which incorrect use of these interfaces can cause operations on the provided filesystem's files and directories to fail with **EIO**. Among the possible incorrect uses are: β€’ changing _mode & S_IFMT_ for an inode that has previously been reported to the kernel; or β€’ giving replies to the kernel that are shorter than what the kernel expected. **ENODEV** Returned from read(2) and write(2) if the FUSE filesystem was unmounted. **EPERM** Returned from operations on a _/dev/fuse_ file descriptor that has not been mounted. ## STANDARDS Linux. ## NOTES The following messages are not yet documented in this manual page: **FUSE_BATCH_FORGET** **FUSE_BMAP** **FUSE_CREATE** **FUSE_DESTROY** **FUSE_FALLOCATE** **FUSE_FORGET** **FUSE_FSYNC** **FUSE_FSYNCDIR** **FUSE_GETLK** **FUSE_GETXATTR** **FUSE_IOCTL** **FUSE_LINK** **FUSE_LISTXATTR** **FUSE_LSEEK** **FUSE_MKDIR** **FUSE_MKNOD** **FUSE_NOTIFY_REPLY** **FUSE_POLL** **FUSE_READDIRPLUS** **FUSE_READLINK** **FUSE_REMOVEXATTR** **FUSE_RENAME** **FUSE_RENAME2** **FUSE_RMDIR** **FUSE_SETATTR** **FUSE_SETLK** **FUSE_SETLKW** **FUSE_SYMLINK** **FUSE_UNLINK** **FUSE_WRITE** * * *
# mouse ## NAME mouse - serial mouse interface ## CONFIGURATION Serial mice are connected to a serial RS232/V24 dialout line, see ttyS(4) for a description. ## DESCRIPTION **Introduction** The pinout of the usual 9 pin plug as used for serial mice is: pin name used for 2 RX Data 3 TX -12 V, Imax = 10 mA 4 DTR +12 V, Imax = 10 mA 7 RTS +12 V, Imax = 10 mA 5 GND Ground This is the specification, in fact 9 V suffices with most mice. The mouse driver can recognize a mouse by dropping RTS to low and raising it again. About 14 ms later the mouse will send 0x4D ('M') on the data line. After a further 63 ms, a Microsoft- compatible 3-button mouse will send 0x33 ('3'). The relative mouse movement is sent as _dx_ (positive means right) and _dy_ (positive means down). Various mice can operate at different speeds. To select speeds, cycle through the speeds 9600, 4800, 2400, and 1200 bit/s, each time writing the two characters from the table below and waiting 0.1 seconds. The following table shows available speeds and the strings that select them: bit/s string 9600 *q 4800 *p 2400 *o 1200 *n The first byte of a data packet can be used for synchronization purposes. **Microsoft protocol** The **Microsoft** protocol uses 1 start bit, 7 data bits, no parity and one stop bit at the speed of 1200 bits/sec. Data is sent to RxD in 3-byte packets. The _dx_ and _dy_ movements are sent as two's- complement, _lb_ (_rb_) are set when the left (right) button is pressed: byte d6 d5 d4 d3 d2 d1 d0 1 1 lb rb dy7 dy6 dx7 dx6 2 0 dx5 dx4 dx3 dx2 dx1 dx0 3 0 dy5 dy4 dy3 dy2 dy1 dy0 **3-button Microsoft protocol** Original Microsoft mice only have two buttons. However, there are some three button mice which also use the Microsoft protocol. Pressing or releasing the middle button is reported by sending a packet with zero movement and no buttons pressed. (Thus, unlike for the other two buttons, the status of the middle button is not reported in each packet.) **Logitech protocol** Logitech serial 3-button mice use a different extension of the Microsoft protocol: when the middle button is up, the above 3-byte packet is sent. When the middle button is down a 4-byte packet is sent, where the 4th byte has value 0x20 (or at least has the 0x20 bit set). In particular, a press of the middle button is reported as 0,0,0,0x20 when no other buttons are down. **Mousesystems protocol** The **Mousesystems** protocol uses 1 start bit, 8 data bits, no parity, and two stop bits at the speed of 1200 bits/sec. Data is sent to RxD in 5-byte packets. _dx_ is sent as the sum of the two two's-complement values, _dy_ is send as negated sum of the two two's-complement values. _lb_ (_mb_ , _rb_) are cleared when the left (middle, right) button is pressed: byte d7 d6 d5 d4 d3 d2 d1 d0 1 1 0 0 0 0 lb mb rb 2 0 dxa6 dxa5 dxa4 dxa3 dxa2 dxa1 dxa0 3 0 dya6 dya5 dya4 dya3 dya2 dya1 dya0 4 0 dxb6 dxb5 dxb4 dxb3 dxb2 dxb1 dxb0 5 0 dyb6 dyb5 dyb4 dyb3 dyb2 dyb1 dyb0 Bytes 4 and 5 describe the change that occurred since bytes 2 and 3 were transmitted. **Sun protocol** The **Sun** protocol is the 3-byte version of the above 5-byte Mousesystems protocol: the last two bytes are not sent. **MM protocol** The **MM** protocol uses 1 start bit, 8 data bits, odd parity, and one stop bit at the speed of 1200 bits/sec. Data is sent to RxD in 3-byte packets. _dx_ and _dy_ are sent as single signed values, the sign bit indicating a negative value. _lb_ (_mb_ , _rb_) are set when the left (middle, right) button is pressed: byte d7 d6 d5 d4 d3 d2 d1 d0 1 1 0 0 dxs dys lb mb rb 2 0 dx6 dx5 dx4 dx3 dx2 dx1 dx0 3 0 dy6 dy5 dy4 dy3 dy2 dy1 dy0 ## FILES _/dev/mouse_ A commonly used symbolic link pointing to a mouse device. * * *
# ttyS ## NAME ttyS - serial terminal lines ## DESCRIPTION **ttyS[0-3]** are character devices for the serial terminal lines. They are typically created by: mknod -m 660 /dev/ttyS0 c 4 64 # base address 0x3f8 mknod -m 660 /dev/ttyS1 c 4 65 # base address 0x2f8 mknod -m 660 /dev/ttyS2 c 4 66 # base address 0x3e8 mknod -m 660 /dev/ttyS3 c 4 67 # base address 0x2e8 chown root:tty /dev/ttyS[0-3] ## FILES _/dev/ttyS[0-3]_ * * *
# loop ## NAME loop, loop-control - loop devices ## SYNOPSIS #include <linux/loop.h> ## DESCRIPTION The loop device is a block device that maps its data blocks not to a physical device such as a hard disk or optical disk drive, but to the blocks of a regular file in a filesystem or to another block device. This can be useful for example to provide a block device for a filesystem image stored in a file, so that it can be mounted with the mount(8) command. You could do $ **dd if=/dev/zero of=file.img bs=1MiB count=10** ; $ **sudo losetup /dev/loop4 file.img** ; $ **sudo mkfs -t ext4 /dev/loop4** ; $ **sudo mkdir /myloopdev** ; $ **sudo mount /dev/loop4 /myloopdev** ; See losetup(8) for another example. A transfer function can be specified for each loop device for encryption and decryption purposes. The following ioctl(2) operations are provided by the loop block device: **LOOP_SET_FD** Associate the loop device with the open file whose file descriptor is passed as the (third) ioctl(2) argument. **LOOP_CLR_FD** Disassociate the loop device from any file descriptor. **LOOP_SET_STATUS** Set the status of the loop device using the (third) ioctl(2) argument. This argument is a pointer to a _loop_info_ structure, defined in _< linux/loop.h>_ as: struct loop_info { int lo_number; /* ioctl r/o */ dev_t lo_device; /* ioctl r/o */ unsigned long lo_inode; /* ioctl r/o */ dev_t lo_rdevice; /* ioctl r/o */ int lo_offset; int lo_encrypt_type; int lo_encrypt_key_size; /* ioctl w/o */ int lo_flags; /* ioctl r/w (r/o before Linux 2.6.25) */ char lo_name[LO_NAME_SIZE]; unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ unsigned long lo_init[2]; char reserved[4]; }; The encryption type (_lo_encrypt_type_) should be one of **LO_CRYPT_NONE** , **LO_CRYPT_XOR** , **LO_CRYPT_DES** , **LO_CRYPT_FISH2** , **LO_CRYPT_BLOW** , **LO_CRYPT_CAST128** , **LO_CRYPT_IDEA** , **LO_CRYPT_DUMMY** , **LO_CRYPT_SKIPJACK** , or (since Linux 2.6.0) **LO_CRYPT_CRYPTOAPI**. The _lo_flags_ field is a bit mask that can include zero or more of the following: **LO_FLAGS_READ_ONLY** The loopback device is read-only. **LO_FLAGS_AUTOCLEAR**(since Linux 2.6.25) The loopback device will autodestruct on last close. **LO_FLAGS_PARTSCAN**(since Linux 3.2) Allow automatic partition scanning. **LO_FLAGS_DIRECT_IO**(since Linux 4.10) Use direct I/O mode to access the backing file. The only _lo_flags_ that can be modified by **LOOP_SET_STATUS** are **LO_FLAGS_AUTOCLEAR** and **LO_FLAGS_PARTSCAN**. **LOOP_GET_STATUS** Get the status of the loop device. The (third) ioctl(2) argument must be a pointer to a _struct loop_info_. **LOOP_CHANGE_FD**(since Linux 2.6.5) Switch the backing store of the loop device to the new file identified file descriptor specified in the (third) ioctl(2) argument, which is an integer. This operation is possible only if the loop device is read-only and the new backing store is the same size and type as the old backing store. **LOOP_SET_CAPACITY**(since Linux 2.6.30) Resize a live loop device. One can change the size of the underlying backing store and then use this operation so that the loop driver learns about the new size. This operation takes no argument. **LOOP_SET_DIRECT_IO**(since Linux 4.10) Set DIRECT I/O mode on the loop device, so that it can be used to open backing file. The (third) ioctl(2) argument is an unsigned long value. A nonzero represents direct I/O mode. **LOOP_SET_BLOCK_SIZE**(since Linux 4.14) Set the block size of the loop device. The (third) ioctl(2) argument is an unsigned long value. This value must be a power of two in the range [512,pagesize]; otherwise, an **EINVAL** error results. **LOOP_CONFIGURE**(since Linux 5.8) Setup and configure all loop device parameters in a single step using the (third) ioctl(2) argument. This argument is a pointer to a _loop_config_ structure, defined in _< linux/loop.h>_ as: struct loop_config { __u32 fd; __u32 block_size; struct loop_info64 info; __u64 __reserved[8]; }; In addition to doing what **LOOP_SET_STATUS** can do, **LOOP_CONFIGURE** can also be used to do the following: β€’ set the correct block size immediately by setting _loop_config.block_size_ ; β€’ explicitly request direct I/O mode by setting **LO_FLAGS_DIRECT_IO** in _loop_config.info.lo_flags_ ; and β€’ explicitly request read-only mode by setting **LO_FLAGS_READ_ONLY** in _loop_config.info.lo_flags_. Since Linux 2.6, there are two new ioctl(2) operations: **LOOP_SET_STATUS64** **LOOP_GET_STATUS64** These are similar to **LOOP_SET_STATUS** and **LOOP_GET_STATUS** described above but use the _loop_info64_ structure, which has some additional fields and a larger range for some other fields: struct loop_info64 { uint64_t lo_device; /* ioctl r/o */ uint64_t lo_inode; /* ioctl r/o */ uint64_t lo_rdevice; /* ioctl r/o */ uint64_t lo_offset; uint64_t lo_sizelimit; /* bytes, 0 == max available */ uint32_t lo_number; /* ioctl r/o */ uint32_t lo_encrypt_type; uint32_t lo_encrypt_key_size; /* ioctl w/o */ uint32_t lo_flags; i /* ioctl r/w (r/o before Linux 2.6.25) */ uint8_t lo_file_name[LO_NAME_SIZE]; uint8_t lo_crypt_name[LO_NAME_SIZE]; uint8_t lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ uint64_t lo_init[2]; }; **/dev/loop-control** Since Linux 3.1, the kernel provides the _/dev/loop-control_ device, which permits an application to dynamically find a free device, and to add and remove loop devices from the system. To perform these operations, one first opens _/dev/loop-control_ and then employs one of the following ioctl(2) operations: **LOOP_CTL_GET_FREE** Allocate or find a free loop device for use. On success, the device number is returned as the result of the call. This operation takes no argument. **LOOP_CTL_ADD** Add the new loop device whose device number is specified as a long integer in the third ioctl(2) argument. On success, the device index is returned as the result of the call. If the device is already allocated, the call fails with the error **EEXIST**. **LOOP_CTL_REMOVE** Remove the loop device whose device number is specified as a long integer in the third ioctl(2) argument. On success, the device number is returned as the result of the call. If the device is in use, the call fails with the error **EBUSY**. ## FILES _/dev/loop*_ The loop block special device files. ## EXAMPLES The program below uses the _/dev/loop-control_ device to find a free loop device, opens the loop device, opens a file to be used as the underlying storage for the device, and then associates the loop device with the backing store. The following shell session demonstrates the use of the program: $ **dd if=/dev/zero of=file.img bs=1MiB count=10** ; 10+0 records in 10+0 records out 10485760 bytes (10 MB) copied, 0.00609385 s, 1.7 GB/s $ **sudo ./mnt_loop file.img** ; loopname = /dev/loop5 **Program source** #include <fcntl.h> #include <linux/loop.h> #include <sys/ioctl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \ } while (0) int main(int argc, char *argv[]) { int loopctlfd, loopfd, backingfile; long devnr; char loopname[4096]; if (argc != 2) { fprintf(stderr, "Usage: %s backing-file\n", argv[0]); exit(EXIT_FAILURE); } loopctlfd = open("/dev/loop-control", O_RDWR); if (loopctlfd == -1) errExit("open: /dev/loop-control"); devnr = ioctl(loopctlfd, LOOP_CTL_GET_FREE); if (devnr == -1) errExit("ioctl-LOOP_CTL_GET_FREE"); sprintf(loopname, "/dev/loop%ld", devnr); printf("loopname = %s\n", loopname); loopfd = open(loopname, O_RDWR); if (loopfd == -1) errExit("open: loopname"); backingfile = open(argv[1], O_RDWR); if (backingfile == -1) errExit("open: backing-file"); if (ioctl(loopfd, LOOP_SET_FD, backingfile) == -1) errExit("ioctl-LOOP_SET_FD"); exit(EXIT_SUCCESS); } * * *
# extcap ## NAME extcap - The external capture interface ## DESCRIPTION The extcap (external capture) interface is a versatile plugin interface that allows external binaries to act as capture interfaces directly in Wireshark. It is used in scenarios, where the source of the capture is not a traditional capture model (live capture from an interface, from a pipe, from a file, etc). The typical example is connecting esoteric hardware of some kind to the main Wireshark application. Without extcap, a capture can always be achieved by directly writing to a capture file: the-esoteric-binary --the-strange-flag --interface=stream1 --file dumpfile.pcap & wireshark dumpfile.pcap but the extcap interface allows for such a connection to be easily established and configured using the Wireshark GUI. The extcap subsystem is made of multiple extcap binaries that are automatically called by the GUI in a row. In the following chapters we will refer to them as "the extcaps". Extcaps may be any binary or script within the _extcap/wireshark_ or _extcap/stratoshark_ directories. Please note that scripts need to be executable without prefacing a script interpreter before the call. WINDOWS USERS: Because of restrictions directly calling the script may not always work. In such a case, a batch file may be provided, which then in turn executes the script. Please refer to doc/extcap_example.py for more information. When Wireshark launches an extcap, it automatically adds its installation path (normally _C:\Program Files\Wireshark\_) to the DLL search path so that the extcap library dependencies can be found (it is not designed to be launched by hand). This is done on purpose. There should only be extcap programs (executables, Python scripts, ...) in the extcap folder to reduce the startup time and not have Wireshark trying to execute other file types. ## GRAMMAR ELEMENTS Grammar elements: arg (options) argument for CLI calling number Reference # of argument for other values, display order call Literal argument to call (--call=...) display Displayed name default Default value, in proper form for type range Range of valid values for UI checking (min,max) in proper form type Argument type for UI filtering for raw, or UI type for selector: integer unsigned long (may include scientific / special notation) double string (display a textbox) selector (display selector table, all values as strings) editselector (selector table which can be overridden, all values as strings) boolean (display checkbox) booleanflag (display checkbox) radio (display group of radio buttons with provided values, all values as strings) fileselect (display a dialog to select a file from the filesystem, value as string) multicheck (display a textbox for selecting multiple options, values as strings) table (display a table that is populated by the user, selections can be configured, values as commandlines arguments) password (display a textbox with masked text) timestamp (display a calendar) value (options) Values for argument selection arg Argument # this value applies to ## EXAMPLES Example 1: arg {number=0}{call=--channel}{display=Wi-Fi Channel}{type=integer}{required=true} arg {number=1}{call=--chanflags}{display=Channel Flags}{type=radio} arg {number=2}{call=--interface}{display=Interface}{type=selector} value {arg=0}{range=1,11} value {arg=1}{value=ht40p}{display=HT40+} value {arg=1}{value=ht40m}{display=HT40-} value {arg=1}{value=ht20}{display=HT20} value {arg=2}{value=wlan0}{display=wlan0} Example 2: arg {number=0}{call=--usbdevice}{USB Device}{type=selector} value {arg=0}{call=/dev/sysfs/usb/foo/123}{display=Ubertooth One sn 1234} value {arg=0}{call=/dev/sysfs/usb/foo/456}{display=Ubertooth One sn 8901} Example 3: arg {number=0}{call=--usbdevice}{USB Device}{type=selector} arg {number=1}{call=--server}{display=IP address for log server}{type=string}{validation=(?:\d{1,3}\.){3}\d{1,3}} flag {failure=Permission denied opening Ubertooth device} Example 4: arg {number=0}{call=--username}{display=Username}{type=string} arg {number=1}{call=--password}{display=Password}{type=password} Example 5: timestamp arg {number=0}{call=--start}{display=Start Time}{type=timestamp} arg {number=1}{call=--end}{display=End Time}{type=timestamp} Example 6: multicheck arg {number=0}{call=--device}{display=Device}{type=multicheck} value {arg=0}{value=USBDEV}{display=USB devices}{enabled=false} value {arg=0}{value=/dev/sysfs/usb/foo/123}{display=Ubertooth One sn 1234}{parent=USBDEV} value {arg=0}{value=/dev/sysfs/usb/foo/456}{display=Ubertooth One sn 8901}{parent=USBDEV} value {arg=0}{value=PCIDEV}{display=PCI devices}{enabled=false} value {arg=0}{value=/sys/devices/pci123}{display=Device 1}{parent=PCIDEV} value {arg=0}{value=/sys/devices/pci456}{display=Device 2}{parent=PCIDEV} ## TABLE FIELD The "table" field is a bit different, in that its values can have additional configuration options. The values can either be entered manually by the user, or a list of available values can be provided using the same API as "multicheck". Unlike most APIs, the value is provided using a commandline-like API, separated by spaces instead of comas. For instance, a configured "myparam" attribute where the user selected three values (1, 2 and 3) would receive: --myparam "1 2 3" If a "prefix" is configured to be "--p", it would receive the following: --myparam "--p 1 --p 2 --p 3" The values selected in a table field may have specific configuration options, if "configurable=true" for the "multicheck" field. In this case, the extcap will be called again when the user presses the configuration wheel that matches a value in the table, with the additional "--extcap-config-option-name <option_name> --extcap-config-option-value <option_value>" with no prefix. An extcap program should respond with an additional set of arguments, which will be opened in a popup. Once those are configured, the extcap might get the following, assuming for instance that an additional "param1" is requested when value is 1, and "param2" when value is 2. --myparam "--p 1 --param1 1 --p 2 --param2 true --p 3" ## SECURITY CONSIDERATIONS β€’ If you’re running Wireshark as root, we can’t save you. β€’ Dumpcap retains suid/setgid and group execute permissions for users in the β€œwireshark” group only. β€’ Third-party capture programs run with whatever privileges they’re installed with. β€’ If an attacker can write to a system binary directory, it’s game over. β€’ You can find your local extcap directory in _About β€Ί Folders_. ## NOTES **Extcap** is feature of **Wireshark**. The latest version of **Wireshark** can be found at https://www.wireshark.org. HTML versions of the Wireshark project man pages are available at https://www.wireshark.org/docs/man-pages. This page is part of the _wireshark_ (Interactively dump and analyze network traffic) project. Information about the project can be found at ⟨https://www.wireshark.org/⟩. If you have a bug report for this manual page, see ⟨https://gitlab.com/wireshark/wireshark/-/issues⟩. This page was obtained from the project's upstream Git repository ⟨https://gitlab.com/wireshark/wireshark.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-11.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is _not_ part of the original manual page), send a mail to [email protected] 2025-08-09 _EXTCAP_(4) * * *
# console_codes ## NAME console_codes - Linux console escape and control sequences ## DESCRIPTION The Linux console implements a large subset of the VT102 and ECMA-48 / ISO/IEC 6429 / ANSI X3.64 terminal controls, plus certain private-mode sequences for changing the color palette, character-set mapping, and so on. In the tabular descriptions below, the second column gives ECMA-48 or DEC mnemonics (the latter if prefixed with DEC) for the given function. Sequences without a mnemonic are neither ECMA-48 nor VT102. After all the normal output processing has been done, and a stream of characters arrives at the console driver for actual printing, the first thing that happens is a translation from the code used for processing to the code used for printing. If the console is in UTF-8 mode, then the incoming bytes are first assembled into 16-bit Unicode codes. Otherwise, each byte is transformed according to the current mapping table (which translates it to a Unicode value). See the **Character Sets** section below for discussion. In the normal case, the Unicode value is converted to a font index, and this is stored in video memory, so that the corresponding glyph (as found in video ROM) appears on the screen. Note that the use of Unicode (and the design of the PC hardware) allows us to use 512 different glyphs simultaneously. If the current Unicode value is a control character, or we are currently processing an escape sequence, the value will treated specially. Instead of being turned into a font index and rendered as a glyph, it may trigger cursor movement or other control functions. See the **Linux Console Controls** section below for discussion. It is generally not good practice to hard-wire terminal controls into programs. Linux supports a terminfo(5) database of terminal capabilities. Rather than emitting console escape sequences by hand, you will almost always want to use a terminfo-aware screen library or utility such as **ncurses**(3), tput(1), or reset(1). **Linux console controls** This section describes all the control characters and escape sequences that invoke special functions (i.e., anything other than writing a glyph at the current cursor location) on the Linux console. **Control characters** A character is a control character if (before transformation according to the mapping table) it has one of the 14 codes 00 (NUL), 07 (BEL), 08 (BS), 09 (HT), 0a (LF), 0b (VT), 0c (FF), 0d (CR), 0e (SO), 0f (SI), 18 (CAN), 1a (SUB), 1b (ESC), 7f (DEL). One can set a "display control characters" mode (see below), and allow 07, 09, 0b, 18, 1a, 7f to be displayed as glyphs. On the other hand, in UTF-8 mode all codes 00–1f are regarded as control characters, regardless of any "display control characters" mode. If we have a control character, it is acted upon immediately and then discarded (even in the middle of an escape sequence) and the escape sequence continues with the next character. (However, ESC starts a new escape sequence, possibly aborting a previous unfinished one, and CAN and SUB abort any escape sequence.) The recognized control characters are BEL, BS, HT, LF, VT, FF, CR, SO, SI, CAN, SUB, ESC, DEL, CSI. They do what one would expect: BEL (0x07, **^G**) beeps; BS (0x08, **^H**) backspaces one column (but not past the beginning of the line); HT (0x09, **^I**) goes to the next tab stop or to the end of the line if there is no earlier tab stop; LF (0x0A, **^J**) VT (0x0B, **^K**) FF (0x0C, **^L**) all give a linefeed, and if LF/NL (new-line mode) is set also a carriage return; CR (0x0D, **^M**) gives a carriage return; SO (0x0E, **^N**) activates the G1 character set; SI (0x0F, **^O**) activates the G0 character set; CAN (0x18, **^X**) SUB (0x1A, **^Z**) abort escape sequences; ESC (0x1B, **^[**) starts an escape sequence; DEL (0x7F) is ignored; CSI (0x9B) is equivalent to ESC [. **ESC- but not CSI-sequences** ESC c RIS Reset. ESC D IND Linefeed. ESC E NEL Newline. ESC H HTS Set tab stop at current column. ESC M RI Reverse linefeed. ESC Z DECID DEC private identification. The kernel returns the string ESC [ ? 6 c, claiming that it is a VT102. ESC 7 DECSC Save current state (cursor coordinates, attributes, character sets pointed at by G0, G1). ESC 8 DECRC Restore state most recently saved by ESC 7. ESC % Start sequence selecting character set ESC % @ Select default (ISO/IEC 646 / ISO/IEC 8859-1) ESC % G Select UTF-8 ESC % 8 Select UTF-8 (obsolete) ESC # 8 DECALN DEC screen alignment test - fill screen with E's. ESC ( Start sequence defining G0 character set (followed by one of B, 0, U, K, as below) ESC ( B Select default (ISO/IEC 8859-1 mapping). ESC ( 0 Select VT100 graphics mapping. ESC ( U Select null mapping - straight to character ROM. ESC ( K Select user mapping - the map that is loaded by the utility mapscrn(8). ESC ) Start sequence defining G1 (followed by one of B, 0, U, K, as above). ESC > DECPNM Set numeric keypad mode ESC = DECPAM Set application keypad mode ESC ] OSC Operating System Command prefix. ESC ] R Reset palette. ESC ] P Set palette, with parameter given in 7 hexadecimal digits _nrrggbb_ after the final P. Here _n_ is the color (0–15), and _rrggbb_ indicates the red/green/blue values (0–255). **ECMA-48 CSI sequences** CSI (or ESC [) is followed by a sequence of parameters, at most NPAR (16), that are decimal numbers separated by semicolons. An empty or absent parameter is taken to be 0. The sequence of parameters may be preceded by a single question mark. However, after CSI [ (or ESC [ [) a single character is read and this entire sequence is ignored. (The idea is to ignore an echoed function key.) The action of a CSI sequence is determined by its final character. @ ICH Insert the indicated # of blank characters. A CUU Move cursor up the indicated # of rows. B CUD Move cursor down the indicated # of rows. C CUF Move cursor right the indicated # of columns. D CUB Move cursor left the indicated # of columns. E CNL Move cursor down the indicated # of rows, to column 1. F CPL Move cursor up the indicated # of rows, to column 1. G CHA Move cursor to indicated column in current row. H CUP Move cursor to the indicated row, column (origin at 1,1). J ED Erase display (default: from cursor to end of display). ESC [ 1 J: erase from start to cursor. ESC [ 2 J: erase whole display. ESC [ 3 J: erase whole display including scroll-back buffer (since Linux 3.0). K EL Erase line (default: from cursor to end of line). ESC [ 1 K: erase from start of line to cursor. ESC [ 2 K: erase whole line. L IL Insert the indicated # of blank lines. M DL Delete the indicated # of lines. P DCH Delete the indicated # of characters on current line. X ECH Erase the indicated # of characters on current line. a HPR Move cursor right the indicated # of columns. c DA Answer ESC [ ? 6 c: "I am a VT102". d VPA Move cursor to the indicated row, current column. e VPR Move cursor down the indicated # of rows. f HVP Move cursor to the indicated row, column. g TBC Without parameter: clear tab stop at current position. ESC [ 3 g: delete all tab stops. h SM Set Mode (see below). l RM Reset Mode (see below). m SGR Set attributes (see below). n DSR Status report (see below). q DECLL Set keyboard LEDs. ESC [ 0 q: clear all LEDs ESC [ 1 q: set Scroll Lock LED ESC [ 2 q: set Num Lock LED ESC [ 3 q: set Caps Lock LED r DECSTBM Set scrolling region; parameters are top and bottom row. s ? Save cursor location. u ? Restore cursor location. ` HPA Move cursor to indicated column in current row. **ECMA-48 Select Graphic Rendition** The ECMA-48 SGR sequence ESC [ _parameters_ m sets display attributes. Several attributes can be set in the same sequence, separated by semicolons. An empty parameter (between semicolons or string initiator or terminator) is interpreted as a zero. param result 0 reset all attributes to their defaults 1 set bold 2 set half-bright (simulated with color on a color display) 3 set italic (since Linux 2.6.22; simulated with color on a color display) 4 set underscore (simulated with color on a color display) (the colors used to simulate dim or underline are set using ESC ] ...) 5 set blink 7 set reverse video 10 reset selected mapping, display control flag, and toggle meta flag (ECMA-48 says "primary font"). 11 select null mapping, set display control flag, reset toggle meta flag (ECMA-48 says "first alternate font"). 12 select null mapping, set display control flag, set toggle meta flag (ECMA-48 says "second alternate font"). The toggle meta flag causes the high bit of a byte to be toggled before the mapping table translation is done. 21 set underline; before Linux 4.17, this value set normal intensity (as is done in many other terminals) 22 set normal intensity 23 italic off (since Linux 2.6.22) 24 underline off 25 blink off 27 reverse video off 30 set black foreground 31 set red foreground 32 set green foreground 33 set brown foreground 34 set blue foreground 35 set magenta foreground 36 set cyan foreground 37 set white foreground 38 256/24-bit foreground color follows, shoehorned into 16 basic colors (before Linux 3.16: set underscore on, set default foreground color) 39 set default foreground color (before Linux 3.16: set underscore off, set default foreground color) 40 set black background 41 set red background 42 set green background 43 set brown background 44 set blue background 45 set magenta background 46 set cyan background 47 set white background 48 256/24-bit background color follows, shoehorned into 8 basic colors 49 set default background color 90..97 set foreground to bright versions of 30..37 100..107 set background, same as 40..47 (bright not supported) Commands 38 and 48 require further arguments: ;5;x 256 color: values 0..15 are IBGR (black, red, green, ... white), 16..231 a 6x6x6 color cube, 232..255 a grayscale ramp ;2;r;g;b 24-bit color, r/g/b components are in the range 0..255 **ECMA-48 Mode Switches** ESC [ 3 h DECCRM (default off): Display control chars. ESC [ 4 h DECIM (default off): Set insert mode. ESC [ 20 h LF/NL (default off): Automatically follow echo of LF, VT, or FF with CR. **ECMA-48 Status Report Commands** ESC [ 5 n Device status report (DSR): Answer is ESC [ 0 n (Terminal OK). ESC [ 6 n Cursor position report (CPR): Answer is ESC [ _y_ ; _x_ R, where _x,y_ is the cursor location. **DEC Private Mode (DECSET/DECRST) sequences** These are not described in ECMA-48. We list the Set Mode sequences; the Reset Mode sequences are obtained by replacing the final 'h' by 'l'. ESC [ ? 1 h DECCKM (default off): When set, the cursor keys send an ESC O prefix, rather than ESC [. ESC [ ? 3 h DECCOLM (default off = 80 columns): 80/132 col mode switch. The driver sources note that this alone does not suffice; some user-mode utility such as resizecons(8) has to change the hardware registers on the console video card. ESC [ ? 5 h DECSCNM (default off): Set reverse-video mode. ESC [ ? 6 h DECOM (default off): When set, cursor addressing is relative to the upper left corner of the scrolling region. ESC [ ? 7 h DECAWM (default on): Set autowrap on. In this mode, a graphic character emitted after column 80 (or column 132 of DECCOLM is on) forces a wrap to the beginning of the following line first. ESC [ ? 8 h DECARM (default on): Set keyboard autorepeat on. ESC [ ? 9 h X10 Mouse Reporting (default off): Set reporting mode to 1 (or reset to 0)β€”see below. ESC [ ? 25 h DECTECM (default on): Make cursor visible. ESC [ ? 1000 h X11 Mouse Reporting (default off): Set reporting mode to 2 (or reset to 0)β€”see below. **Linux Console Private CSI Sequences** The following sequences are neither ECMA-48 nor native VT102. They are native to the Linux console driver. Colors are in SGR parameters: 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 = cyan, 7 = white; 8–15 = bright versions of 0–7. ESC [ 1 ; _n_ ] Set color _n_ as the underline color. ESC [ 2 ; _n_ ] Set color _n_ as the dim color. ESC [ 8 ] Make the current color pair the default attributes. ESC [ 9 ; _n_ ] Set screen blank timeout to _n_ minutes. ESC [ 10 ; _n_ ] Set bell frequency in Hz. ESC [ 11 ; _n_ ] Set bell duration in msec. ESC [ 12 ; _n_ ] Bring specified console to the front. ESC [ 13 ] Unblank the screen. ESC [ 14 ; _n_ ] Set the VESA powerdown interval in minutes. ESC [ 15 ] Bring the previous console to the front (since Linux 2.6.0). ESC [ 16 ; _n_ ] Set the cursor blink interval in milliseconds (since Linux 4.2). **Character sets** The kernel knows about 4 translations of bytes into console-screen symbols. The four tables are: a) Latin1 -> PC, b) VT100 graphics -> PC, c) PC -> PC, d) user-defined. There are two character sets, called G0 and G1, and one of them is the current character set. (Initially G0.) Typing **^N** causes G1 to become current, **^O** causes G0 to become current. These variables G0 and G1 point at a translation table, and can be changed by the user. Initially they point at tables a) and b), respectively. The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC ( K cause G0 to point at translation table a), b), c), and d), respectively. The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC ) K cause G1 to point at translation table a), b), c), and d), respectively. The sequence ESC c causes a terminal reset, which is what you want if the screen is all garbled. The oft-advised "echo ^V^O" will make only G0 current, but there is no guarantee that G0 points at table a). In some distributions there is a program reset(1) that just does "echo ^[c". If your terminfo entry for the console is correct (and has an entry rs1=\Ec), then "tput reset" will also work. The user-defined mapping table can be set using mapscrn(8). The result of the mapping is that if a symbol c is printed, the symbol s = map[c] is sent to the video memory. The bitmap that corresponds to s is found in the character ROM, and can be changed using setfont(8). **Mouse tracking** The mouse tracking facility is intended to return **xterm**(1)-compatible mouse status reports. Because the console driver has no way to know the device or type of the mouse, these reports are returned in the console input stream only when the virtual terminal driver receives a mouse update ioctl. These ioctls must be generated by a mouse-aware user-mode application such as the **gpm**(8) daemon. The mouse tracking escape sequences generated by **xterm**(1) encode numeric parameters in a single character as _value_ +040. For example, '!' is 1. The screen coordinate system is 1-based. The X10 compatibility mode sends an escape sequence on button press encoding the location and the mouse button pressed. It is enabled by sending ESC [ ? 9 h and disabled with ESC [ ? 9 l. On button press, **xterm**(1) sends ESC [ M _bxy_ (6 characters). Here _b_ is button-1, and _x_ and _y_ are the x and y coordinates of the mouse when the button was pressed. This is the same code the kernel also produces. Normal tracking mode (not implemented in Linux 2.0.24) sends an escape sequence on both button press and release. Modifier information is also sent. It is enabled by sending ESC [ ? 1000 h and disabled with ESC [ ? 1000 l. On button press or release, **xterm**(1) sends ESC [ M _bxy_. The low two bits of _b_ encode button information: 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release. The upper bits encode what modifiers were down when the button was pressed and are added together: 4=Shift, 8=Meta, 16=Control. Again _x_ and _y_ are the x and y coordinates of the mouse event. The upper left corner is (1,1). **Comparisons with other terminals** Many different terminal types are described, like the Linux console, as being "VT100-compatible". Here we discuss differences between the Linux console and the two most important others, the DEC VT102 and **xterm**(1). **Control-character handling** The VT102 also recognized the following control characters: NUL (0x00) was ignored; ENQ (0x05) triggered an answerback message; DC1 (0x11, **^Q** , XON) resumed transmission; DC3 (0x13, **^S** , XOFF) caused VT100 to ignore (and stop transmitting) all codes except XOFF and XON. VT100-like DC1/DC3 processing may be enabled by the terminal driver. The **xterm**(1) program (in VT100 mode) recognizes the control characters BEL, BS, HT, LF, VT, FF, CR, SO, SI, ESC. **Escape sequences** VT100 console sequences not implemented on the Linux console: ESC N SS2 Single shift 2. (Select G2 character set for the next character only.) ESC O SS3 Single shift 3. (Select G3 character set for the next character only.) ESC P DCS Device control string (ended by ESC \) ESC X SOS Start of string. ESC ^ PM Privacy message (ended by ESC \) ESC \ ST String terminator ESC * ... Designate G2 character set ESC + ... Designate G3 character set The program **xterm**(1) (in VT100 mode) recognizes ESC c, ESC # 8, ESC >, ESC =, ESC D, ESC E, ESC H, ESC M, ESC N, ESC O, ESC P ... ESC \, ESC Z (it answers ESC [ ? 1 ; 2 c, "I am a VT100 with advanced video option") and ESC ^ ... ESC \ with the same meanings as indicated above. It accepts ESC (, ESC ), ESC *, ESC + followed by 0, A, B for the DEC special character and line drawing set, UK, and US-ASCII, respectively. The user can configure **xterm**(1) to respond to VT220-specific control sequences, and it will identify itself as a VT52, VT100, and up depending on the way it is configured and initialized. It accepts ESC ] (OSC) for the setting of certain resources. In addition to the ECMA-48 string terminator (ST), **xterm**(1) accepts a BEL to terminate an OSC string. These are a few of the OSC control sequences recognized by **xterm**(1): ESC ] 0 ; _txt_ ST Set icon name and window title to _txt_. ESC ] 1 ; _txt_ ST Set icon name to _txt_. ESC ] 2 ; _txt_ ST Set window title to _txt_. ESC ] 4 ; _num_ ; _txt_ ST Set ANSI color _num_ to _txt_. ESC ] 10 ; _txt_ ST Set dynamic text color to _txt_. ESC ] 4 6 ; _name_ ST Change log file to _name_ (normally disabled by a compile-time option). ESC ] 5 0 ; _fn_ ST Set font to _fn_. It recognizes the following with slightly modified meaning (saving more state, behaving closer to VT100/VT220): ESC 7 DECSC Save cursor ESC 8 DECRC Restore cursor It also recognizes ESC F Cursor to lower left corner of screen (if enabled by **xterm**(1)'s **hpLowerleftBugCompat** resource). ESC l Memory lock (per HP terminals). Locks memory above the cursor. ESC m Memory unlock (per HP terminals). ESC n LS2 Invoke the G2 character set. ESC o LS3 Invoke the G3 character set. ESC | LS3R Invoke the G3 character set as GR. ESC } LS2R Invoke the G2 character set as GR. ESC ~ LS1R Invoke the G1 character set as GR. It also recognizes ESC % and provides a more complete UTF-8 implementation than Linux console. **CSI Sequences** Old versions of **xterm**(1), for example, from X11R5, interpret the blink SGR as a bold SGR. Later versions which implemented ANSI colors, for example, XFree86 3.1.2A in 1995, improved this by allowing the blink attribute to be displayed as a color. Modern versions of xterm implement blink SGR as blinking text and still allow colored text as an alternate rendering of SGRs. Stock X11R6 versions did not recognize the color-setting SGRs until the X11R6.8 release, which incorporated XFree86 xterm. All ECMA-48 CSI sequences recognized by Linux are also recognized by _xterm_ , however **xterm**(1) implements several ECMA-48 and DEC control sequences not recognized by Linux. The **xterm**(1) program recognizes all of the DEC Private Mode sequences listed above, but none of the Linux private-mode sequences. For discussion of **xterm**(1)'s own private-mode sequences, refer to the _Xterm Control Sequences_ document by Edward Moy, Stephen Gildea, and Thomas E. Dickey available with the X distribution. That document, though terse, is much longer than this manual page. For a chronological overview, ⟨http://invisible-island.net/xterm/xterm.log.html⟩ details changes to xterm. The _vttest_ program ⟨http://invisible-island.net/vttest/⟩ demonstrates many of these control sequences. The **xterm**(1) source distribution also contains sample scripts which exercise other features. ## NOTES ESC 8 (DECRC) is not able to restore the character set changed with ESC %. ## BUGS In Linux 2.0.23, CSI is broken, and NUL is not ignored inside escape sequences. Some older kernel versions (after Linux 2.0) interpret 8-bit control sequences. These "C1 controls" use codes between 128 and 159 to replace ESC [, ESC ] and similar two-byte control sequence initiators. There are fragments of that in modern kernels (either overlooked or broken by changes to support UTF-8), but the implementation is incomplete and should be regarded as unreliable. Linux "private mode" sequences do not follow the rules in ECMA-48 for private mode control sequences. In particular, those ending with ] do not use a standard terminating character. The OSC (set palette) sequence is a greater problem, since **xterm**(1) may interpret this as a control sequence which requires a string terminator (ST). Unlike the setterm(1) sequences which will be ignored (since they are invalid control sequences), the palette sequence will make **xterm**(1) appear to hang (though pressing the return-key will fix that). To accommodate applications which have been hardcoded to use Linux control sequences, set the **xterm**(1) resource **brokenLinuxOSC** to true. An older version of this document implied that Linux recognizes the ECMA-48 control sequence for invisible text. It is ignored. * * *
# wireshark-filter ## NAME wireshark-filter - Wireshark display filter syntax and reference ## SYNOPSIS **wireshark**[other options] [ **-Y** "display filter expression" | **--display-filter** "display filter expression" ] **tshark**[other options] [ **-Y** "display filter expression" | **--display-filter** "display filter expression" ] ## DESCRIPTION **Wireshark** and **TShark** share a powerful filter engine that helps remove the noise from a packet trace and lets you see only the packets that interest you. If a packet meets the requirements expressed in your filter, then it is displayed in the list of packets. Display filters let you compare the fields within a protocol against a specific value, compare fields against fields, and check the existence of specified fields or protocols. Filters are also used by other features such as statistics generation and packet list colorization (the latter is only available to **Wireshark**). This manual page describes their syntax. A comprehensive reference of filter fields can be found within Wireshark and in the display filter reference at https://www.wireshark.org/docs/dfref/. ## FILTER SYNTAX **Check whether a field or protocol exists** The simplest filter allows you to check for the existence of a protocol or field. If you want to see all packets which contain the IP protocol, the filter would be "ip" (without the quotation marks). To see all packets that contain a Token-Ring RIF field, use "tr.rif". Whenever a protocol or field appears as the argument of a function in a filter, an exists operator for that protocol or field implicitly appears. **Values and operators** Each field has a value, and that value can be used in operations with comparable values (which may be literals, other fields, or function results). The value of a field is not necessarily what appears in the **Wireshark** display or **TShark** output. For example, a protocol is semantically equivalent to the sequence of bytes that it spans, not its displayed text in the protocol tree. **Comparison operators** The comparison operators can be expressed either through English-like abbreviations or through C-like symbols: eq, == Equal ne, != Not Equal gt, > Greater Than lt, < Less Than ge, >= Greater than or Equal to le, <= Less than or Equal to The ordering depends on the value type in the usual way (e.g., lexicographic for strings and arithmetic for integers.) A field may appear more than once in a given frame. In that case equality can be strict (all fields must match the condition) or not (any field must match the condition). The inequality is the logical negation of equality. The following table contains all equality operators, their aliases and meaning: eq, any_eq, == Any field must be equal ne, all_ne, != All fields must be not equal all_eq, === All fields must be equal any_ne, !== Any fields must be not equal The operators "any" or "all" can be used with any comparison operator to make the test match any or all fields: all tcp.port > 1024 any ip.addr != 1.1.1.1 The "any" and "all" modifiers take precedence over comparison operators such as "===" and "any_eq". **Search and match operators** Additional operators exist expressed only in English, not C-like syntax: contains Does the protocol, field or slice contain a value matches, ~ Does the string match the given case-insensitive Perl-compatible regular expression The "contains" operator allows a filter to search for a sequence of characters, expressed as a string, or bytes, expressed as a byte array. The type of the left hand side of the "contains" operator must be comparable to that of the right hand side after any implicit or explicit conversions. For example, to search for a given HTTP URL in a capture, the following filter can be used: http contains "https://www.wireshark.org" The "contains" operator cannot be used on atomic fields, such as numbers or IP addresses. The "matches" or "~" operator allows a filter to apply to a specified Perl-compatible regular expression (PCRE2). The regular expression must be a double quoted string. The left hand side of the "matches" operator must be a string, which can be a non-stringlike field implicitly or explicitly converted to a string. Matches are case-insensitive by default. For example, to search for a given WAP WSP User-Agent, you can write: wsp.header.user_agent matches "cldc" This would match "cldc", "CLDC", "cLdC" or any other combination of upper and lower case letters. You can force case sensitivity using wsp.header.user_agent matches "(?-i)cldc" This is an example of PCRE2’s **(?** option**)** construct. **(?-i)** performs a case-sensitive pattern match but other options can be specified as well. More information can be found in the pcre2pattern(3)|https://www.pcre.org/current/doc/html/pcre2pattern.html man page. **Functions** The filter language has the following functions: upper(string-field) - converts a string field to uppercase lower(string-field) - converts a string field to lowercase len(field) - returns the byte length of a string or bytes field count(field) - returns the number of field occurrences in a frame string(field) - converts a non-string field to string vals(field) - converts a field value to its value string dec(field) - converts an unsigned integer to a decimal string hex(field) - converts an unsigned integer to a hexadecimal string float(field) - converts a field to single precision floating point double(field) - converts a field to double precision floating point max(f1,...,fn) - return the maximum value min(f1,...,fn) - return the minimum value abs(field) - return the absolute value of numeric fields upper() and lower() are useful for performing case-insensitive string comparisons. For example: upper(ncp.nds_stream_name) contains "MACRO" lower(mount.dump.hostname) == "angel" string() converts a field value to a string, suitable for use with operators like "matches" or "contains". Integer fields are converted to their decimal representation. It can be used with IP/Ethernet addresses (as well as others), but not with string or byte fields. For example: string(frame.number) matches "[13579]$" gives you all the odd packets. Note that the "matches" operator implicitly converts types of their value string representation; to match against the decimal representation of an integer field use string(). vals() converts an integer or boolean field value to a string using the field’s associated value string, if it has one. This produces strings similar to those seen in custom columns. The resultant string can also be used with other operators. E.g.: vals(pfcp.msg_type) contains "Request" would match all packets which have a PFCP request, even if that request is not matched with a response. dec() and hex() convert unsigned integer fields to decimal or hexadecimal representation. Currently dec() and string() give same result for an unsigned integer, but it is possible that in the future string() will use the native base of the field. max() and min() take any number of arguments and returns one value, respectively the largest/smallest. The arguments must all have the same type. There is also a set of functions to test IP addresses: ip_special_name(ip) - Returns the IP special-purpose block name as a string ip_special_mask(ip) - Returns the IP special-purpose block flags as a mask. The bits are: 4 3 2 1 0 --------- S D F G R S = Source, D = Destination, F = Forwardable, G = Globally-reachable, R = Reserved-by-protocol ip_linklocal(ip) - true if the IPv4 or IPv6 address is link-local ip_multicast(ip) - true if the IPv4 or IPv6 address is multicast ip_rfc1918(ipv4) - true if the IPv4 address is private-use (from the allocation in RFC 1918) ip_ula(ipv6) - true if the IPv6 address is unique-local (ULA) as in RFC 4193 **Macros** It is possible to define display filter macros. Macro are names that are replaced with the associated expression, possibly performing argument substitution. Macro expansions are purely textual replacements and performed recursively before compilation. They allow replacing long and often used expressions with easy to use names. Macros are defined using the GUI or directly in the "dmacros" configuration file. For example the definition "addplusone" {$1 + $2 + 1} creates a macro called addplusone that takes two arguments and expands to the given expression. Arguments in the replacement expression are given using the dollar sign. Macros are invoked like function but preceded with a dollar sign (sometimes also called a sigil): $addplusone(udp.src_port,udp.dst_port) results in the expression {udp.src_port + udp.dst_port + 1} after argument substitution. There is an older alternative notation to invoke macros: ${addplusone:udp.src_port;udp.dst_port} or ${addplusone;udp.src_port;udp.dst_port} Both forms are equivalent and can be used interchangibly as a matter of preference. **Protocol field types** Each protocol field is typed. The types are: ASN.1 object identifier, plain or relative AX.25 address Boolean Byte sequence Character string Character, 1 byte Date and time Ethernet or other MAC address EUI64 address Fibre Channel WWN Floating point, single or double precision Frame number Globally Unique Identifier IEEE-11073 floating point, 16 or 32 bits IPv4 address IPv6 address IPX network number Label OSI System-ID Protocol Signed integer, 1, 2, 3, 4, or 8 bytes Time offset Unsigned integer, 1, 2, 3, 4, or 8 bytes VINES address An integer may be expressed in decimal, octal, hexadecimal or binary notation, or as a C-style character constant. The following seven display filters are equivalent: frame.len > 10 frame.len > 012 frame.len > 0xa frame.len > 0b1010 frame.len > '\n' frame.len > '\x0a' frame.len > '\012' Boolean values are either true or false. In a display filter expression testing the value of a Boolean field, true is expressed as the word true (case-insensitive) or any non-zero number. False is expressed as false (case-insensitive) or the number zero. For example, a token-ring packet’s source route field is Boolean. To find any source-routed packets, a display filter would be any of the following: tr.sr == 1 tr.sr == true tr.sr == TRUE Non source-routed packets can be found with: tr.sr == 0 tr.sr == false tr.sr == FALSE Ethernet addresses and byte arrays are represented by hex digits. The hex digits may be separated by colons, periods, or hyphens: eth.dst eq ff:ff:ff:ff:ff:ff aim.data == 0.1.0.d fddi.src == aa-aa-aa-aa-aa-aa echo.data == 7a IPv4 addresses can be represented in either dotted decimal notation or by using the hostname: ip.src == 192.168.1.1 ip.dst eq www.mit.edu IPv4 addresses can be compared with the same logical relations as numbers: eq, ne, gt, ge, lt, and le. The IPv4 address is stored in host order, so you do not have to worry about the endianness of an IPv4 address when using it in a display filter. Classless Inter-Domain Routing (CIDR) notation can be used to test if an IPv4 address is in a certain subnet. For example, this display filter will find all packets in the 129.111 network: ip.addr == 129.111.0.0/16 Remember, the number after the slash represents the number of bits used to represent the network. CIDR notation can also be used with hostnames, as in this example of finding IP addresses on the same network as 'sneezy' (requires that 'sneezy' resolve to an IP address for filter to be valid): ip.addr eq sneezy/24 The CIDR notation can only be used on IP addresses or hostnames, not in variable names. So, a display filter like "ip.src/24 == ip.dst/24" is not valid (yet). Transaction and other IDs are often represented by unsigned 16 or 32 bit integers and formatted as a hexadecimal string with "0x" prefix: (dhcp.id == 0xfe089c15) || (ip.id == 0x0373) Strings are enclosed in double quotes: http.request.method == "POST" Inside double quotes, you may use a backslash to embed a double quote or an arbitrary byte represented in either octal or hexadecimal. browser.comment == "An embedded \" double-quote" Use of hexadecimal to look for "HEAD": http.request.method == "\x48EAD" Use of octal to look for "HEAD": http.request.method == "\110EAD" This means that you must escape backslashes with backslashes inside double quotes. smb.path contains "\\\\SERVER\\SHARE" looks for \\SERVER\SHARE in "smb.path". This may be more conveniently written as smb.path contains r"\\SERVER\SHARE" String literals prefixed with 'r' are called "raw strings". Such strings treat backslash as a literal character. Double quotes may still be escaped with backslash but note that backslashes are always preserved in the result. The following table lists all escape sequences supported with strings and character constants: \' single quote \" double quote \\ backslash \a audible bell \b backspace \f form feed \n line feed \r carriage return \t horizontal tab \v vertical tab \NNN arbitrary octal value \xNN arbitrary hexadecimal value \uNNNN Unicode codepoint U+NNNN \UNNNNNNNN Unicode codepoint U+NNNNNNNN Date and time values can be given in ISO 8601 format or using a legacy month-year-time format: "2020-07-04T12:34:56" "Sep 26, 2004 23:18:04.954975" The 'T' separator in ISO 8601 can be omitted. The timezone can be given as "Z" or an offset from UTC. When not using ISO 8601 the timezone can be given as the strings "UTC", "GMT" or "UT" for UTC or also given as an offset from UTC, plus some North American and Nautical/Military designations (see the specification for %z in strptime(3) <https://man.netbsd.org/strptime.3>). Note that arbitrary timezone names are not supported however. If the timezone is omitted then date and time values are interpreted as local time. **The slice operator** You can take a slice of a field if the field base type is a text string or a byte array (the base type of most network address fields is bytes). For example, you can filter on the vendor portion of an ethernet address (the first three bytes) like this: eth.src[0:3] == 00:00:83 Another example is: http.content_type[0:4] == "text" You can use the slice operator on a protocol name, too. The "frame" protocol can be useful, encompassing all the data captured by **Wireshark** or **TShark**. token[0:5] ne 0.0.0.1.1 llc[0] eq aa frame[100-199] contains "wireshark" The following syntax governs slices: [i:j] i = start_offset, j = length [i-j] i = start_offset, j = end_offset, inclusive. [i] i = start_offset, length = 1 [:j] start_offset = 0, length = j [i:] start_offset = i, end_offset = end_of_field Slice indexes are zero-based. Offsets can be negative, in which case they indicate the offset from the **end** of the field. The last byte of the field is at offset -1, the last but one byte is at offset -2, and so on. Here’s how to check the last four bytes of a frame: frame[-4:4] == 0.1.2.3 or frame[-4:] == 0.1.2.3 As mentioned above the slice operator can be used on string and byte fields and will respectively produce string or byte slices. String slices are indexed on UTF-8 codepoint boundaries (i.e: internationalized characters), so the following comparison is true: "touchΓ©"[5] == "Γ©" The example above generates an error because the compiler rejects constant expressions but is otherwise syntactically correct and exemplifies the behaviour of string slices. To obtain a byte slice of the same string the raw (@) operator can be used: @"touchΓ©"[5-6] == c3:a9 A slice can always be compared against either a string or a byte sequence. Slices can be combined. You can concatenate them using the comma operator: ftp[1,3-5,9:] == 01:03:04:05:09:0a:0b This concatenates offset 1, offsets 3-5, and offset 9 to the end of the ftp data. **The layer operator** A field can be restricted to a certain layer in the protocol stack using the layer operator (#), followed by a decimal number: ip.addr#2 == 192.168.30.40 matches only the inner (second) layer in the packet. Layers use simple stacking semantics and protocol layers are counted sequentially starting from 1. For example, in a packet that contains two IPv4 headers, the outer (first) source address can be matched with "ip.src#1" and the inner (second) source address can be matched with "ip.src#2". For more complicated ranges the same syntax used with slices is valid: tcp.port#[2-4] means layers number 2, 3 or 4 inclusive. The hash symbol is required to distinguish a layer range from a slice. **The at operator** By prefixing the field name with an at sign (@) the comparison is done against the raw packet data for the field. A character string must be decoded from a source encoding during dissection. If there are decoding errors the resulting string will usually contain replacement characters: browser.comment == "string is &#xFFFD;&#xFFFD;&#xFFFD;&#xFFFD;" The at operator allows testing the raw undecoded data: @browser.comment == 73:74:72:69:6e:67:20:69:73:20:aa:aa:aa:aa The syntactical rules for a bytes field type apply to the second example. **The membership operator** A field may be checked for matches against a set of values simply with the membership operator. For instance, you may find traffic on common HTTP/HTTPS ports with the following filter: tcp.port in {80,443,8080} as opposed to the more verbose: tcp.port == 80 or tcp.port == 443 or tcp.port == 8080 To find HTTP requests using the HEAD or GET methods: http.request.method in {"HEAD", "GET"} The set of values can also contain ranges: tcp.port in {443, 4430..4434} ip.addr in {10.0.0.5 .. 10.0.0.9, 192.168.1.1..192.168.1.9} frame.time_delta in {10 .. 10.5} **Implicit type conversions** When fields which are sequences of bytes, including protocols, are compared with (double quoted) literal strings and raw strings, the literals are converted to their byte representation using the UTF-8 encoding. (To be precise, the original byte sequence is used, not the canonical normalized forms, so the precomposed é (U+00E9) and decomposed Γ© (U+0065 U+0301) can match differently.) So, for instance, the following filters are equivalent: tcp.payload contains "GET" tcp.payload contains 47.45.54 As noted above, a slice can also be compared in either way: frame[60:2] gt 50.51 frame[60:2] gt "PQ" The inverse does not occur; stringlike fields are not implicitly converted to byte arrays. (Some operators allow stringlike fields to be compared with unquoted literals, which are then treated as strings; this is deprecated in general and specifically disallowed by the "matches" operator. Literal strings should be double quoted for clarity.) A hex integer that is 0xff or less (which means it fits inside one byte) can be implicitly converted to a byte string. This is not allowed for hex integers greater than one byte, because then one would need to specify the endianness of the multi-byte integer. Also, this is not allowed for decimal or octal numbers, since they would be confused with the hex numbers that make up byte string literals. Nevertheless, single-byte hex integers can be convenient: frame[4] == 0xff frame[1:4] contains 0x02 An integer or boolean field that has a value string can be compared to to one of the strings that corresponds with a value. As with stringlike fields and comparisons, it is possible to perform the comparison with an unquoted literal, though this is deprecated and will not work if the literal contains a space (as with "Modify Bearer Response" above). Double quotes are recommended. If there is a unique reverse mapping from the string literal into a numeric value, the string is converted into that number and the comparison function is applied using arithmetic rules. If the mapping is not unique, then equality and inequality can be tested, but not the ordered comparisons. This is in contrast with the string() and vals() functions, which convert the field value to a string and applies string (lexicographic) comparisons, as well as work with all operators that take strings. Therefore the following two filters give the same result: gtpv2.message_type <= 35 gtpv2.message_type <= "Modify Bearer Response" whereas vals(gtpv2.message_type) <= "Modify Bearer Response" matches all messages whose value string precedes "Modify Bearer Response" in lexicographical order, and string(gtpv2.message_type) <= "35" matches all messages such that the message type comes before "35" in lexicographical order, i.e. would also match "170" (the message type for "Release Access Bearers Request.") For the "contains" and "matches" operators, which operate on strings (or byte arrays in the case of "contains"), fields on the left hand side are implicitly converted to their value strings for comparison. (To compare a field with a byte array, use the raw/at (@) operator.) **Bitwise operators** It is also possible to define tests with bitwise operations. Currently the following bitwise operator is supported: bitand, bitwise_and, & Bitwise AND The bitwise AND operation allows masking bits and testing to see if one or more bits are set. Bitwise AND operates on integer protocol fields and slices. When testing for TCP SYN packets, you can write: tcp.flags & 0x02 That expression will match all packets that contain a "tcp.flags" field with the 0x02 bit, i.e. the SYN bit, set. To match locally administered unicast ethernet addresses you can use: eth.addr[0] & 0x0f == 2 When using slices, the bit mask must be specified as a byte string, and it must have the same number of bytes as the slice itself, as in: ip[42:2] & 40:ff **Arithmetic operators** Arithmetic expressions are supported with the usual operators: + Addition - Subtraction * Multiplication / Division % Modulo (integer remainder) Arithmetic operations can be performed on numeric types. Numeric types are integers, floating point numbers and date and time values. Date and time values can only be multiplied by integers or floating point numbers (i.e: scalars) and furthermore the scalar multiplier must appear on the right-hand side of the arithmetic operation. For example it is possible to filter for UDP destination ports greater or equal by one to the source port with the expression: udp.dstport >= udp.srcport + 1 It is possible to group arithmetic expressions using curly brackets (parenthesis will not work for this): tcp.dstport >= 4 * {tcp.srcport + 3} Do not confuse this usage of curly brackets with set membership. An unfortunate quirk in the filter syntax is that the subtraction operator must be preceded by a space character, so "A-B" must be written as "A -B" or "A - B". **Protocol field references** A variable using a sigil with the form $some.proto.field or ${some.proto.field} is called a field reference. A field reference is a field value read from the currently selected frame in the GUI. This is useful to build dynamic filters such as, frames since the last five minutes to the selected frame: frame.time_relative >= ${frame.time_relative} - 300 or more simply frame.time_relative >= $frame.time_relative - 300 Field references share a similar notation to macros but are distinct syntactical elements in the filter language. **Logical expressions** Tests can be combined using logical expressions. These too are expressible in C-like syntax or with English-like abbreviations. The following table lists the logical operators from highest to lowest precedence: not, ! Logical NOT (right-associative) and, && Logical AND (left-associative) xor, ^^ Logical XOR (left-associative) or, || Logical OR (left-associative) The evaluation is always performed left to right. Expressions can be grouped by parentheses as well. The expression "A and B or not C or D and not E or F" is read: (A and B) or (not C) or (D and (not E)) or F It’s usually better to be explicit about grouping using parenthesis. The following are all valid display filter expressions: tcp.port == 80 and ip.src == 192.168.2.1 not llc http and frame[100-199] contains "wireshark" (ipx.src.net == 0xbad && ipx.src.node == 0.0.0.0.0.1) || ip Remember that whenever a protocol or field name occurs in an expression, the "exists" operator is implicitly called. The "exists" operator has the highest priority. This means that the first filter expression must be read as "show me the packets for which tcp.port exists and equals 80, and ip.src exists and equals 192.168.2.1". The second filter expression means "show me the packets where not exists llc", or in other words "where llc does not exist" and hence will match all packets that do not contain the llc protocol. The third filter expression includes the constraint that offset 199 in the frame exists, in other words the length of the frame is at least 200. Because each comparison has an implicit exists test for field values care must be taken when using the display filter to remove noise from the packet trace. If, for example, you want to filter out all IP multicast packets to address 224.1.2.3, then using: ip.dst ne 224.1.2.3 may be too restrictive. This is the same as writing: ip.dst and ip.dst ne 224.1.2.3 The filter selects only frames that have the "ip.dst" field. Any other frames, including all non-IP packets, will not be displayed. To display the non-IP packets as well, you can use one of the following two expressions: not ip.dst or ip.dst ne 224.1.2.3 not ip.dst eq 224.1.2.3 The first filter uses "not ip.dst" to include all non-IP packets and then lets "ip.dst ne 224.1.2.3" filter out the unwanted IP packets. The second filter also negates the implicit existence test and so is a shorter way to write the first. ## FILTER FIELD REFERENCE The entire list of display filters is too large to list here. You can can find references and examples at the following locations: β€’ The online Display Filter Reference: https://www.wireshark.org/docs/dfref/ β€’ _View:Internals:Supported Protocols_ in Wireshark β€’ tshark -G fields on the command line β€’ The Wireshark wiki: https://wiki.wireshark.org/DisplayFilters ## NOTES The wireshark-filter(4) manpage is part of the **Wireshark** distribution. The latest version of **Wireshark** can be found at https://www.wireshark.org. Regular expressions in the "matches" operator are provided by the PCRE2 library. See https://www.pcre.org/ for more information. This manpage does not describe the capture filter syntax, which is different. See the manual page of pcap-filter(7) or, if that doesn’t exist, tcpdump(8), or, if that doesn’t exist, https://wiki.wireshark.org/CaptureFilters for a description of capture filters. Display Filters are also described in the Wireshark User’s Guide <https://www.wireshark.org/docs/wsug_html_chunked/ChWorkBuildDisplayFilterSection.html>. * * *
# tty ## NAME tty - controlling terminal ## DESCRIPTION The file _/dev/tty_ is a character file with major number 5 and minor number 0, usually with mode 0666 and ownership root:tty. It is a synonym for the controlling terminal of a process, if any. In addition to the ioctl(2) requests supported by the device that **tty** refers to, the ioctl(2) request **TIOCNOTTY** is supported. **TIOCNOTTY** Detach the calling process from its controlling terminal. If the process is the session leader, then **SIGHUP** and **SIGCONT** signals are sent to the foreground process group and all processes in the current session lose their controlling tty. This ioctl(2) call works only on file descriptors connected to _/dev/tty_. It is used by daemon processes when they are invoked by a user at a terminal. The process attempts to open _/dev/tty_. If the open succeeds, it detaches itself from the terminal by using **TIOCNOTTY** , while if the open fails, it is obviously not attached to a terminal and does not need to detach itself. ## FILES _/dev/tty_ * * *
# null ## NAME null, zero - data sink ## DESCRIPTION Data written to the _/dev/null_ and _/dev/zero_ special files is discarded. Reads from _/dev/null_ always return end of file (i.e., read(2) returns 0), whereas reads from _/dev/zero_ always return bytes containing zero ('\0' characters). These devices are typically created by: mknod -m 666 /dev/null c 1 3 mknod -m 666 /dev/zero c 1 5 chown root:root /dev/null /dev/zero ## FILES _/dev/null_ _/dev/zero_ ## NOTES If these devices are not writable and readable for all users, many programs will act strangely. Since Linux 2.6.31, reads from _/dev/zero_ are interruptible by signals. (This change was made to help with bad latencies for large reads from _/dev/zero_.) * * *
# random ## NAME random, urandom - kernel random number source devices ## SYNOPSIS #include <linux/random.h> **int ioctl(**_fd_**, RND** _request_**,**_param_**);** ## DESCRIPTION The character special files _/dev/random_ and _/dev/urandom_ (present since Linux 1.3.30) provide an interface to the kernel's random number generator. The file _/dev/random_ has major device number 1 and minor device number 8. The file _/dev/urandom_ has major device number 1 and minor device number 9. The random number generator gathers environmental noise from device drivers and other sources into an entropy pool. The generator also keeps an estimate of the number of bits of noise in the entropy pool. From this entropy pool, random numbers are created. Linux 3.17 and later provides the simpler and safer getrandom(2) interface which requires no special files; see the getrandom(2) manual page for details. When read, the _/dev/urandom_ device returns random bytes using a pseudorandom number generator seeded from the entropy pool. Reads from this device do not block (i.e., the CPU is not yielded), but can incur an appreciable delay when requesting large amounts of data. When read during early boot time, _/dev/urandom_ may return data prior to the entropy pool being initialized. If this is of concern in your application, use getrandom(2) or _/dev/random_ instead. The _/dev/random_ device is a legacy interface which dates back to a time where the cryptographic primitives used in the implementation of _/dev/urandom_ were not widely trusted. It will return random bytes only within the estimated number of bits of fresh noise in the entropy pool, blocking if necessary. _/dev/random_ is suitable for applications that need high quality randomness, and can afford indeterminate delays. When the entropy pool is empty, reads from _/dev/random_ will block until additional environmental noise is gathered. Since Linux 5.6, the **O_NONBLOCK** flag is ignored as _/dev/random_ will no longer block except during early boot process. In earlier versions, if open(2) is called for _/dev/random_ with the **O_NONBLOCK** flag, a subsequent read(2) will not block if the requested number of bytes is not available. Instead, the available bytes are returned. If no byte is available, read(2) will return -1 and _errno_ will be set to **EAGAIN**. The **O_NONBLOCK** flag has no effect when opening _/dev/urandom_. When calling read(2) for the device _/dev/urandom_ , reads of up to 256 bytes will return as many bytes as are requested and will not be interrupted by a signal handler. Reads with a buffer over this limit may return less than the requested number of bytes or fail with the error **EINTR** , if interrupted by a signal handler. Since Linux 3.16, a read(2) from _/dev/urandom_ will return at most 32 MB. A read(2) from _/dev/random_ will return at most 512 bytes (340 bytes before Linux 2.6.12). Writing to _/dev/random_ or _/dev/urandom_ will update the entropy pool with the data written, but this will not result in a higher entropy count. This means that it will impact the contents read from both files, but it will not make reads from _/dev/random_ faster. **Usage** The _/dev/random_ interface is considered a legacy interface, and _/dev/urandom_ is preferred and sufficient in all use cases, with the exception of applications which require randomness during early boot time; for these applications, getrandom(2) must be used instead, because it will block until the entropy pool is initialized. If a seed file is saved across reboots as recommended below, the output is cryptographically secure against attackers without local root access as soon as it is reloaded in the boot sequence, and perfectly adequate for network encryption session keys. (All major Linux distributions have saved the seed file across reboots since 2000 at least.) Since reads from _/dev/random_ may block, users will usually want to open it in nonblocking mode (or perform a read with timeout), and provide some sort of user notification if the desired entropy is not immediately available. **Configuration** If your system does not have _/dev/random_ and _/dev/urandom_ created already, they can be created with the following commands: mknod -m 666 /dev/random c 1 8 mknod -m 666 /dev/urandom c 1 9 chown root:root /dev/random /dev/urandom When a Linux system starts up without much operator interaction, the entropy pool may be in a fairly predictable state. This reduces the actual amount of noise in the entropy pool below the estimate. In order to counteract this effect, it helps to carry entropy pool information across shut-downs and start-ups. To do this, add the lines to an appropriate script which is run during the Linux system start-up sequence: echo "Initializing random number generator..." random_seed=/var/run/random-seed # Carry a random seed from start-up to start-up # Load and then save the whole entropy pool if [ -f $random_seed ]; then cat $random_seed >/dev/urandom else touch $random_seed fi chmod 600 $random_seed poolfile=/proc/sys/kernel/random/poolsize [ -r $poolfile ] && bits=$(cat $poolfile) || bits=4096 bytes=$(expr $bits / 8) dd if=/dev/urandom of=$random_seed count=1 bs=$bytes Also, add the following lines in an appropriate script which is run during the Linux system shutdown: # Carry a random seed from shut-down to start-up # Save the whole entropy pool echo "Saving random seed..." random_seed=/var/run/random-seed touch $random_seed chmod 600 $random_seed poolfile=/proc/sys/kernel/random/poolsize [ -r $poolfile ] && bits=$(cat $poolfile) || bits=4096 bytes=$(expr $bits / 8) dd if=/dev/urandom of=$random_seed count=1 bs=$bytes In the above examples, we assume Linux 2.6.0 or later, where _/proc/sys/kernel/random/poolsize_ returns the size of the entropy pool in bits (see below). **/proc interfaces** The files in the directory _/proc/sys/kernel/random_ (present since Linux 2.3.16) provide additional information about the _/dev/random_ device: _entropy_avail_ This read-only file gives the available entropy, in bits. This will be a number in the range 0 to 4096. _poolsize_ This file gives the size of the entropy pool. The semantics of this file vary across kernel versions: Linux 2.4: This file gives the size of the entropy pool in _bytes_. Normally, this file will have the value 512, but it is writable, and can be changed to any value for which an algorithm is available. The choices are 32, 64, 128, 256, 512, 1024, or 2048. Linux 2.6 and later: This file is read-only, and gives the size of the entropy pool in _bits_. It contains the value 4096. _read_wakeup_threshold_ This file contains the number of bits of entropy required for waking up processes that sleep waiting for entropy from _/dev/random_. The default is 64. _write_wakeup_threshold_ This file contains the number of bits of entropy below which we wake up processes that do a select(2) or poll(2) for write access to _/dev/random_. These values can be changed by writing to the files. _uuid_ _boot_id_ These read-only files contain random strings like 6fd5a44b-35f4-4ad4-a9b9-6b9be13e1fe9. The former is generated afresh for each read, the latter was generated once. **ioctl(2) interface** The following ioctl(2) requests are defined on file descriptors connected to either _/dev/random_ or _/dev/urandom_. All requests performed will interact with the input entropy pool impacting both _/dev/random_ and _/dev/urandom_. The **CAP_SYS_ADMIN** capability is required for all requests except **RNDGETENTCNT**. **RNDGETENTCNT** Retrieve the entropy count of the input pool, the contents will be the same as the _entropy_avail_ file under proc. The result will be stored in the int pointed to by the argument. **RNDADDTOENTCNT** Increment or decrement the entropy count of the input pool by the value pointed to by the argument. **RNDGETPOOL** Removed in Linux 2.6.9. **RNDADDENTROPY** Add some additional entropy to the input pool, incrementing the entropy count. This differs from writing to _/dev/random_ or _/dev/urandom_ , which only adds some data but does not increment the entropy count. The following structure is used: struct rand_pool_info { int entropy_count; int buf_size; __u32 buf[0]; }; Here _entropy_count_ is the value added to (or subtracted from) the entropy count, and _buf_ is the buffer of size _buf_size_ which gets added to the entropy pool. **RNDZAPENTCNT** **RNDCLEARPOOL** Zero the entropy count of all pools and add some system data (such as wall clock) to the pools. ## FILES _/dev/random_ _/dev/urandom_ ## NOTES For an overview and comparison of the various interfaces that can be used to obtain randomness, see random(7). ## BUGS During early boot time, reads from _/dev/urandom_ may return data prior to the entropy pool being initialized. * * *
# null ## NAME null, zero - data sink ## DESCRIPTION Data written to the _/dev/null_ and _/dev/zero_ special files is discarded. Reads from _/dev/null_ always return end of file (i.e., read(2) returns 0), whereas reads from _/dev/zero_ always return bytes containing zero ('\0' characters). These devices are typically created by: mknod -m 666 /dev/null c 1 3 mknod -m 666 /dev/zero c 1 5 chown root:root /dev/null /dev/zero ## FILES _/dev/null_ _/dev/zero_ ## NOTES If these devices are not writable and readable for all users, many programs will act strangely. Since Linux 2.6.31, reads from _/dev/zero_ are interruptible by signals. (This change was made to help with bad latencies for large reads from _/dev/zero_.) * * *
# vcs ## NAME vcs, vcsa - virtual console memory ## DESCRIPTION _/dev/vcs0_ is a character device with major number 7 and minor number 0, usually with mode 0644 and ownership root:tty. It refers to the memory of the currently displayed virtual console terminal. _/dev/vcs[1-63]_ are character devices for virtual console terminals, they have major number 7 and minor number 1 to 63, usually mode 0644 and ownership root:tty. _/dev/vcsa[0-63]_ are the same, but using _unsigned short_ s (in host byte order) that include attributes, and prefixed with four bytes giving the screen dimensions and cursor position: _lines_ , _columns_ , _x_ , _y_. (_x_ = _y_ = 0 at the top left corner of the screen.) When a 512-character font is loaded, the 9th bit position can be fetched by applying the ioctl(2) **VT_GETHIFONTMASK** operation (available since Linux 2.6.18) on _/dev/tty[1-63]_ ; the value is returned in the _unsigned short_ pointed to by the third ioctl(2) argument. These devices replace the screendump ioctl(2) operations of ioctl_console(2), so the system administrator can control access using filesystem permissions. The devices for the first eight virtual consoles may be created by: for x in 0 1 2 3 4 5 6 7 8; do mknod -m 644 /dev/vcs$x c 7 $x; mknod -m 644 /dev/vcsa$x c 7 $[$x+128]; done chown root:tty /dev/vcs* No ioctl(2) requests are supported. ## FILES _/dev/vcs[0-63]_ _/dev/vcsa[0-63]_ ## VERSIONS Introduced with Linux 1.1.92. ## EXAMPLES You may do a screendump on vt3 by switching to vt1 and typing cat /dev/vcs3 >foo Note that the output does not contain newline characters, so some processing may be required, like in fold -w 81 /dev/vcs3 | lpr or (horrors) setterm -dump 3 -file /proc/self/fd/1 The _/dev/vcsa0_ device is used for Braille support. This program displays the character and screen attributes under the cursor of the second virtual console, then changes the background color there: #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/vt.h> int main(void) { int fd; char *device = "/dev/vcsa2"; char *console = "/dev/tty2"; struct {unsigned char lines, cols, x, y;} scrn; unsigned short s; unsigned short mask; unsigned char attrib; int ch; fd = open(console, O_RDWR); if (fd < 0) { perror(console); exit(EXIT_FAILURE); } if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) { perror("VT_GETHIFONTMASK"); exit(EXIT_FAILURE); } (void) close(fd); fd = open(device, O_RDWR); if (fd < 0) { perror(device); exit(EXIT_FAILURE); } (void) read(fd, &scrn, 4); (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), SEEK_SET); (void) read(fd, &s, 2); ch = s & 0xff; if (s & mask) ch |= 0x100; attrib = ((s & ~mask) >> 8); printf("ch=%#03x attrib=%#02x\n", ch, attrib); s ^= 0x1000; (void) lseek(fd, -2, SEEK_CUR); (void) write(fd, &s, 2); exit(EXIT_SUCCESS); } * * *
# pts ## NAME ptmx, pts - pseudoterminal master and slave ## DESCRIPTION The file _/dev/ptmx_ (the pseudoterminal multiplexor device) is a character file with major number 5 and minor number 2, usually with mode 0666 and ownership root:root. It is used to create a pseudoterminal master and slave pair. When a process opens _/dev/ptmx_ , it gets a file descriptor for a pseudoterminal master and a pseudoterminal slave device is created in the _/dev/pts_ directory. Each file descriptor obtained by opening _/dev/ptmx_ is an independent pseudoterminal master with its own associated slave, whose path can be found by passing the file descriptor to ptsname(3). Before opening the pseudoterminal slave, you must pass the master's file descriptor to grantpt(3) and unlockpt(3). Once both the pseudoterminal master and slave are open, the slave provides processes with an interface that is identical to that of a real terminal. Data written to the slave is presented on the master file descriptor as input. Data written to the master is presented to the slave as input. In practice, pseudoterminals are used for implementing terminal emulators such as **xterm**(1), in which data read from the pseudoterminal master is interpreted by the application in the same way a real terminal would interpret the data, and for implementing remote-login programs such as sshd(8), in which data read from the pseudoterminal master is sent across the network to a client program that is connected to a terminal or terminal emulator. Pseudoterminals can also be used to send input to programs that normally refuse to read input from pipes (such as su(1), and passwd(1)). ## FILES _/dev/ptmx_ , _/dev/pts/*_ ## NOTES The Linux support for the above (known as UNIX 98 pseudoterminal naming) is done using the _devpts_ filesystem, which should be mounted on _/dev/pts_. * * *
# full ## NAME full - always full device ## CONFIGURATION If your system does not have _/dev/full_ created already, it can be created with the following commands: mknod -m 666 /dev/full c 1 7 chown root:root /dev/full ## DESCRIPTION The file _/dev/full_ has major device number 1 and minor device number 7. Writes to the _/dev/full_ device fail with an **ENOSPC** error. This can be used to test how a program handles disk-full errors. Reads from the _/dev/full_ device will return \0 characters. Seeks on _/dev/full_ will always succeed. ## FILES _/dev/full_ * * *
# pts ## NAME ptmx, pts - pseudoterminal master and slave ## DESCRIPTION The file _/dev/ptmx_ (the pseudoterminal multiplexor device) is a character file with major number 5 and minor number 2, usually with mode 0666 and ownership root:root. It is used to create a pseudoterminal master and slave pair. When a process opens _/dev/ptmx_ , it gets a file descriptor for a pseudoterminal master and a pseudoterminal slave device is created in the _/dev/pts_ directory. Each file descriptor obtained by opening _/dev/ptmx_ is an independent pseudoterminal master with its own associated slave, whose path can be found by passing the file descriptor to ptsname(3). Before opening the pseudoterminal slave, you must pass the master's file descriptor to grantpt(3) and unlockpt(3). Once both the pseudoterminal master and slave are open, the slave provides processes with an interface that is identical to that of a real terminal. Data written to the slave is presented on the master file descriptor as input. Data written to the master is presented to the slave as input. In practice, pseudoterminals are used for implementing terminal emulators such as **xterm**(1), in which data read from the pseudoterminal master is interpreted by the application in the same way a real terminal would interpret the data, and for implementing remote-login programs such as sshd(8), in which data read from the pseudoterminal master is sent across the network to a client program that is connected to a terminal or terminal emulator. Pseudoterminals can also be used to send input to programs that normally refuse to read input from pipes (such as su(1), and passwd(1)). ## FILES _/dev/ptmx_ , _/dev/pts/*_ ## NOTES The Linux support for the above (known as UNIX 98 pseudoterminal naming) is done using the _devpts_ filesystem, which should be mounted on _/dev/pts_. * * *
# lirc ## NAME lirc - lirc devices ## DESCRIPTION The _/dev/lirc*_ character devices provide a low-level bidirectional interface to infra-red (IR) remotes. Most of these devices can receive, and some can send. When receiving or sending data, the driver works in two different modes depending on the underlying hardware. Some hardware (typically TV-cards) decodes the IR signal internally and provides decoded button presses as scancode values. Drivers for this kind of hardware work in **LIRC_MODE_SCANCODE** mode. Such hardware usually does not support sending IR signals. Furthermore, such hardware can only decode a limited set of IR protocols, usually only the protocol of the specific remote which is bundled with, for example, a TV-card. Other hardware provides a stream of pulse/space durations. Such drivers work in **LIRC_MODE_MODE2** mode. Such hardware can be used with (almost) any kind of remote. This type of hardware can also be used in **LIRC_MODE_SCANCODE** mode, in which case the kernel IR decoders will decode the IR. These decoders can be written in extended BPF (see bpf(2)) and attached to the **lirc** device. Sometimes, this kind of hardware also supports sending IR data. The **LIRC_GET_FEATURES** ioctl (see below) allows probing for whether receiving and sending is supported, and in which modes, amongst other features. **Reading input with the LIRC_MODE_MODE2 mode** In the **LIRC_MODE_MODE2** mode, the data returned by read(2) provides 32-bit values representing a space or a pulse duration. The time of the duration (microseconds) is encoded in the lower 24 bits. Pulse (also known as flash) indicates a duration of infrared light being detected, and space (also known as gap) indicates a duration with no infrared. If the duration of space exceeds the inactivity timeout, a special timeout package is delivered, which marks the end of a message. The upper 8 bits indicate the type of package: **LIRC_MODE2_SPACE** Value reflects a space duration (microseconds). **LIRC_MODE2_PULSE** Value reflects a pulse duration (microseconds). **LIRC_MODE2_FREQUENCY** Value reflects a frequency (Hz); see the **LIRC_SET_MEASURE_CARRIER_MODE** ioctl. **LIRC_MODE2_TIMEOUT** Value reflects a space duration (microseconds). The package reflects a timeout; see the **LIRC_SET_REC_TIMEOUT_REPORTS** ioctl. **LIRC_MODE2_OVERFLOW** The IR receiver encountered an overflow, and as a result data is missing (since Linux 5.18). **Reading input with the LIRC_MODE_SCANCODE mode** In the **LIRC_MODE_SCANCODE** mode, the data returned by read(2) reflects decoded button presses, in the struct _lirc_scancode_. The scancode is stored in the _scancode_ field, and the IR protocol is stored in _rc_proto_. This field has one the values of the _enum rc_proto_. **Writing output with the LIRC_MODE_PULSE mode** The data written to the character device using write(2) is a pulse/space sequence of integer values. Pulses and spaces are only marked implicitly by their position. The data must start and end with a pulse, thus it must always include an odd number of samples. The write(2) function blocks until the data has been transmitted by the hardware. If more data is provided than the hardware can send, the write(2) call fails with the error **EINVAL**. **Writing output with the LIRC_MODE_SCANCODE mode** The data written to the character devices must be a single struct _lirc_scancode_. The _scancode_ and _rc_proto_ fields must be filled in, all other fields must be 0. The kernel IR encoders will convert the scancode to pulses and spaces. The protocol or scancode is invalid, or the **lirc** device cannot transmit. ## IOCTL COMMANDS #include <linux/lirc.h> /* But see BUGS */ int ioctl(int fd, int cmd, int *val); The following ioctl(2) operations are provided by the **lirc** character device to probe or change specific **lirc** hardware settings. **Always Supported Commands** _/dev/lirc_ * devices always support the following commands: **LIRC_GET_FEATURES**(_void_) Returns a bit mask of combined features bits; see FEATURES. If a device returns an error code for **LIRC_GET_FEATURES** , it is safe to assume it is not a **lirc** device. **Optional Commands** Some **lirc** devices support the commands listed below. Unless otherwise stated, these fail with the error **ENOTTY** if the operation isn't supported, or with the error **EINVAL** if the operation failed, or invalid arguments were provided. If a driver does not announce support of certain features, invoking the corresponding ioctls will fail with the error **ENOTTY**. **LIRC_GET_REC_MODE**(_void_) If the **lirc** device has no receiver, this operation fails with the error **ENOTTY**. Otherwise, it returns the receive mode, which will be one of: **LIRC_MODE_MODE2** The driver returns a sequence of pulse/space durations. **LIRC_MODE_SCANCODE** The driver returns struct _lirc_scancode_ values, each of which represents a decoded button press. **LIRC_SET_REC_MODE**(_int_) Set the receive mode. _val_ is either **LIRC_MODE_SCANCODE** or **LIRC_MODE_MODE2**. If the **lirc** device has no receiver, this operation fails with the error **ENOTTY.** **LIRC_GET_SEND_MODE**(_void_) Return the send mode. **LIRC_MODE_PULSE** or **LIRC_MODE_SCANCODE** is supported. If the **lirc** device cannot send, this operation fails with the error **ENOTTY.** **LIRC_SET_SEND_MODE**(_int_) Set the send mode. _val_ is either **LIRC_MODE_SCANCODE** or **LIRC_MODE_PULSE**. If the **lirc** device cannot send, this operation fails with the error **ENOTTY**. **LIRC_SET_SEND_CARRIER**(_int_) Set the modulation frequency. The argument is the frequency (Hz). **LIRC_SET_SEND_DUTY_CYCLE**(_int_) Set the carrier duty cycle. _val_ is a number in the range [0,100] which describes the pulse width as a percentage of the total cycle. Currently, no special meaning is defined for 0 or 100, but the values are reserved for future use. **LIRC_GET_MIN_TIMEOUT(**_void_**)** **LIRC_GET_MAX_TIMEOUT(**_void_**)** Some devices have internal timers that can be used to detect when there has been no IR activity for a long time. This can help **lircd**(8) in detecting that an IR signal is finished and can speed up the decoding process. These operations return integer values with the minimum/maximum timeout that can be set (microseconds). Some devices have a fixed timeout. For such drivers, **LIRC_GET_MIN_TIMEOUT** and **LIRC_GET_MAX_TIMEOUT** will fail with the error **ENOTTY**. **LIRC_SET_REC_TIMEOUT**(_int_) Set the integer value for IR inactivity timeout (microseconds). To be accepted, the value must be within the limits defined by **LIRC_GET_MIN_TIMEOUT** and **LIRC_GET_MAX_TIMEOUT**. A value of 0 (if supported by the hardware) disables all hardware timeouts and data should be reported as soon as possible. If the exact value cannot be set, then the next possible value _greater_ than the given value should be set. **LIRC_GET_REC_TIMEOUT**(_void_) Return the current inactivity timeout (microseconds). Available since Linux 4.18. **LIRC_SET_REC_TIMEOUT_REPORTS**(_int_) Enable (_val_ is 1) or disable (_val_ is 0) timeout packages in **LIRC_MODE_MODE2**. The behavior of this operation has varied across kernel versions: β€’ Since Linux 5.17: timeout packages are always enabled and this ioctl is a no-op. β€’ Since Linux 4.16: timeout packages are enabled by default. Each time the **lirc** device is opened, the **LIRC_SET_REC_TIMEOUT** operation can be used to disable (and, if desired, to later re-enable) the timeout on the file descriptor. β€’ In Linux 4.15 and earlier: timeout packages are disabled by default, and enabling them (via **LIRC_SET_REC_TIMEOUT**) on any file descriptor associated with the **lirc** device has the effect of enabling timeouts for all file descriptors referring to that device (until timeouts are disabled again). **LIRC_SET_REC_CARRIER**(_int_) Set the upper bound of the receive carrier frequency (Hz). See **LIRC_SET_REC_CARRIER_RANGE**. **LIRC_SET_REC_CARRIER_RANGE**(_int_) Sets the lower bound of the receive carrier frequency (Hz). For this to take affect, first set the lower bound using the **LIRC_SET_REC_CARRIER_RANGE** ioctl, and then the upper bound using the **LIRC_SET_REC_CARRIER** ioctl. **LIRC_SET_MEASURE_CARRIER_MODE**(_int_) Enable (_val_ is 1) or disable (_val_ is 0) the measure mode. If enabled, from the next key press on, the driver will send **LIRC_MODE2_FREQUENCY** packets. By default, this should be turned off. **LIRC_GET_REC_RESOLUTION**(_void_) Return the driver resolution (microseconds). **LIRC_SET_TRANSMITTER_MASK**(_int_) Enable the set of transmitters specified in _val_ , which contains a bit mask where each enabled transmitter is a 1. The first transmitter is encoded by the least significant bit, and so on. When an invalid bit mask is given, for example a bit is set even though the device does not have so many transmitters, this operation returns the number of available transmitters and does nothing otherwise. **LIRC_SET_WIDEBAND_RECEIVER**(_int_) Some devices are equipped with a special wide band receiver which is intended to be used to learn the output of an existing remote. This ioctl can be used to enable (_val_ equals 1) or disable (_val_ equals 0) this functionality. This might be useful for devices that otherwise have narrow band receivers that prevent them to be used with certain remotes. Wide band receivers may also be more precise. On the other hand, their disadvantage usually is reduced range of reception. Note: wide band receiver may be implicitly enabled if you enable carrier reports. In that case, it will be disabled as soon as you disable carrier reports. Trying to disable a wide band receiver while carrier reports are active will do nothing. ## FEATURES the **LIRC_GET_FEATURES** ioctl returns a bit mask describing features of the driver. The following bits may be returned in the mask: **LIRC_CAN_REC_MODE2** The driver is capable of receiving using **LIRC_MODE_MODE2**. **LIRC_CAN_REC_SCANCODE** The driver is capable of receiving using **LIRC_MODE_SCANCODE**. **LIRC_CAN_SET_SEND_CARRIER** The driver supports changing the modulation frequency using **LIRC_SET_SEND_CARRIER**. **LIRC_CAN_SET_SEND_DUTY_CYCLE** The driver supports changing the duty cycle using **LIRC_SET_SEND_DUTY_CYCLE**. **LIRC_CAN_SET_TRANSMITTER_MASK** The driver supports changing the active transmitter(s) using **LIRC_SET_TRANSMITTER_MASK**. **LIRC_CAN_SET_REC_CARRIER** The driver supports setting the receive carrier frequency using **LIRC_SET_REC_CARRIER**. Any **lirc** device since the drivers were merged in Linux 2.6.36 must have **LIRC_CAN_SET_REC_CARRIER_RANGE** set if **LIRC_CAN_SET_REC_CARRIER** feature is set. **LIRC_CAN_SET_REC_CARRIER_RANGE** The driver supports **LIRC_SET_REC_CARRIER_RANGE**. The lower bound of the carrier must first be set using the **LIRC_SET_REC_CARRIER_RANGE** ioctl, before using the **LIRC_SET_REC_CARRIER** ioctl to set the upper bound. **LIRC_CAN_GET_REC_RESOLUTION** The driver supports **LIRC_GET_REC_RESOLUTION**. **LIRC_CAN_SET_REC_TIMEOUT** The driver supports **LIRC_SET_REC_TIMEOUT**. **LIRC_CAN_MEASURE_CARRIER** The driver supports measuring of the modulation frequency using **LIRC_SET_MEASURE_CARRIER_MODE**. **LIRC_CAN_USE_WIDEBAND_RECEIVER** The driver supports learning mode using **LIRC_SET_WIDEBAND_RECEIVER**. **LIRC_CAN_SEND_PULSE** The driver supports sending using **LIRC_MODE_PULSE** or **LIRC_MODE_SCANCODE** ## BUGS Using these devices requires the kernel source header file _lirc.h_. This file is not available before Linux 4.6. Users of older kernels could use the file bundled in ⟨http://www.lirc.org⟩. * * *
# ioctl_console ## NAME ioctl_console - ioctls for console terminal and virtual consoles ## SYNOPSIS **#include <sys/ioctl.h>** **int ioctl(int** _fd_**, unsigned long** _op_**, ...);** ## DESCRIPTION The following Linux-specific ioctl(2) operations are supported for console terminals and virtual consoles. KDGETLED(2const) KDSETLED(2const) KDGKBLED(2const) KDSKBLED(2const) KDGKBTYPE(2const) KDADDIO(2const) KDDELIO(2const) KDENABIO(2const) KDDISABIO(2const) KDSETMODE(2const) KDGETMODE(2const) KDMKTONE(2const) KIOCSOUND(2const) GIO_CMAP(2const) PIO_CMAP(2const) GIO_FONT(2const) GIO_FONTX(2const) PIO_FONT(2const) PIO_FONTX(2const) PIO_FONTRESET(2const) GIO_SCRNMAP(2const) GIO_UNISCRNMAP(2const) PIO_SCRNMAP(2const) PIO_UNISCRNMAP(2const) GIO_UNIMAP(2const) PIO_UNIMAP(2const) PIO_UNIMAPCLR(2const) KDGKBMODE(2const) KDSKBMODE(2const) KDGKBMETA(2const) KDSKBMETA(2const) KDGKBENT(2const) KDSKBENT(2const) KDGKBSENT(2const) KDSKBSENT(2const) KDGKBDIACR(2const) KDGETKEYCODE(2const) KDSETKEYCODE(2const) KDSIGACCEPT(2const) See ioctl_kd(2). TIOCLINUX(2const) VT_OPENQRY(2const) VT_GETMODE(2const) VT_SETMODE(2const) VT_GETSTATE(2const) VT_RELDISP(2const) VT_ACTIVATE(2const) VT_WAITACTIVE(2const) VT_DISALLOCATE(2const) VT_RESIZE(2const) VT_RESIZEX(2const) See ioctl_vt(2). ## RETURN VALUE On success, 0 is returned (except where indicated). On failure, -1 is returned, and _errno_ is set to indicate the error. ## STANDARDS Linux. ## CAVEATS Do not regard this man page as documentation of the Linux console ioctls. This is provided for the curious only, as an alternative to reading the source. Ioctl's are undocumented Linux internals, liable to be changed without warning. (And indeed, this page more or less describes the situation as of kernel version 1.1.94; there are many minor and not-so-minor differences with earlier versions.) Very often, ioctls are introduced for communication between the kernel and one particular well-known program (fdisk, hdparm, setserial, tunelp, loadkeys, selection, setfont, etc.), and their behavior will be changed when required by this particular program. * * *
# mem ## NAME mem, kmem, port - system memory, kernel memory and system ports ## DESCRIPTION _/dev/mem_ is a character device file that is an image of the main memory of the computer. It may be used, for example, to examine (and even patch) the system. Byte addresses in _/dev/mem_ are interpreted as physical memory addresses. References to nonexistent locations cause errors to be returned. Examining and patching is likely to lead to unexpected results when read-only or write-only bits are present. Since Linux 2.6.26, and depending on the architecture, the **CONFIG_STRICT_DEVMEM** kernel configuration option limits the areas which can be accessed through this file. For example: on x86, RAM access is not allowed but accessing memory-mapped PCI regions is. It is typically created by: mknod -m 660 /dev/mem c 1 1 chown root:kmem /dev/mem The file _/dev/kmem_ is the same as _/dev/mem_ , except that the kernel virtual memory rather than physical memory is accessed. Since Linux 2.6.26, this file is available only if the **CONFIG_DEVKMEM** kernel configuration option is enabled. It is typically created by: mknod -m 640 /dev/kmem c 1 2 chown root:kmem /dev/kmem _/dev/port_ is similar to _/dev/mem_ , but the I/O ports are accessed. It is typically created by: mknod -m 660 /dev/port c 1 4 chown root:kmem /dev/port ## FILES _/dev/mem_ _/dev/kmem_ _/dev/port_ * * *
# smartpqi ## NAME smartpqi - Microchip Smart Storage SCSI driver ## SYNOPSIS **modprobe smartpqi**[**disable_device_id_wildcards=**{**0** |**1**}] [**disable_heartbeat=**{**0** |**1**}] [**disable_ctrl_shutdown=**{**0** |**1**}] [**lockup_action=**{**none** |**reboot** |**panic**}] [**expose_ld_first=**{**0** |**1**}] [**hide_vsep=**{**0** |**1**}] [**disable_managed_interrupts=**{**0** |**1**}] [**ctrl_ready_timeout=**{**0** |[**30** ,**1800**]}] ## DESCRIPTION **smartpqi** is a SCSI driver for Microchip Smart Storage controllers. **Supported _ioctl_() operations** For compatibility with applications written for the cciss(4) and hpsa(4) drivers, many, but not all of the ioctl(2) operations supported by the **hpsa** driver are also supported by the **smartpqi** driver. The data structures used by these operations are described in the Linux kernel source file _include/linux/cciss_ioctl.h_. **CCISS_DEREGDISK** **CCISS_REGNEWDISK** **CCISS_REGNEWD** These operations all do exactly the same thing, which is to cause the driver to re-scan for new devices. This does exactly the same thing as writing to the **smartpqi** -specific host _rescan_ attribute. **CCISS_GETPCIINFO** This operation returns the PCI domain, bus, device, and function and "board ID" (PCI subsystem ID). **CCISS_GETDRIVVER** This operation returns the driver version in four bytes, encoded as: (major_version << 28) | (minor_version << 24) | (release << 16) | revision **CCISS_PASSTHRU** Allows BMIC and CISS commands to be passed through to the controller. **Boot options** **disable_device_id_wildcards=**{**0** |**1**} Disables support for device ID wildcards. The default value is 0 (wildcards are enabled). **disable_heartbeat=**{**0** |**1**} Disables support for the controller's heartbeat check. This parameter is used for debugging purposes. The default value is 0 (the controller's heartbeat check is enabled). **disable_ctrl_shutdown=**{**0** |**1**} Disables support for shutting down the controller in the event of a controller lockup. The default value is 0 (controller will be shut down). **lockup_action=**{**none** |**reboot** |**panic**} Specifies the action the driver takes when a controller lockup is detected. The default action is **none**. parameter action ───────────────────────────────────────────── **none** take controller offline only **reboot** reboot the system **panic** panic the system **expose_ld_first=**{**0** |**1**} This option exposes logical devices to the OS before physical devices. The default value is 0 (physical devices exposed first). **hide_vsep=**{**0** |**1**} This option disables exposure of the virtual SEP to the OS. The default value is 0 (virtual SEP is exposed). **disable_managed_interrupts=**{**0** |**1**} Disables driver utilization of Linux kernel managed interrupts for controllers. The managed interrupts feature automatically distributes interrupts to all available CPUs and assigns SMP affinity. The default value is 0 (managed interrupts enabled). **ctrl_ready_timeout=**{**0** |[**30** ,**1800**]} This option specifies the timeout in seconds for the driver to wait for the controller to be ready. The valid range is 0 or [**30** , **1800**]. The default value is 0, which causes the driver to use a timeout of 180 seconds. ## FILES **Device nodes** Disk drives are accessed via the SCSI disk driver (_sd_), tape drives via the SCSI tape driver (_st_), and the RAID controller via the SCSI generic driver (_sg_), with device nodes named _/dev/sd_ *, _/dev/st_ *, and _/dev/sg_ *, respectively. [1mSmartPQI-specific host attribute files in _/sys_ _/sys/class/scsi_host/host_ *_/rescan_ The host _rescan_ attribute is a write-only attribute. Writing to this attribute will cause the driver to scan for new, changed, or removed devices (e.g., hot-plugged tape drives, or newly configured or deleted logical volumes) and notify the SCSI mid-layer of any changes detected. Usually this action is triggered automatically by configuration changes, so the user should not normally have to write to this file. Doing so may be useful when hot-plugging devices such as tape drives or entire storage boxes containing pre-configured logical volumes. _/sys/class/scsi_host/host_ *_/lockup_action_ The host _lockup_action_ attribute is a read/write attribute. This attribute will cause the driver to perform a specific action in the unlikely event that a controller lockup has been detected. See **OPTIONS** above for an explanation of the _lockup_action_ values. _/sys/class/scsi_host/host_ *_/driver_version_ The _driver_version_ attribute is read-only. This attribute contains the smartpqi driver version. For example: $ **cat /sys/class/scsi_host/host1/driver_version** 1.1.2-126 _/sys/class/scsi_host/host_ *_/firmware_version_ The _firmware_version_ attribute is read-only. This attribute contains the controller firmware version. For example: $ **cat /sys/class/scsi_host/host1/firmware_version** 1.29-112 _/sys/class/scsi_host/host_ *_/model_ The _model_ attribute is read-only. This attribute contains the product identification string of the controller. For example: $ **cat /sys/class/scsi_host/host1/model** 1100-16i _/sys/class/scsi_host/host_ *_/serial_number_ The _serial_number_ attribute is read-only. This attribute contains the unique identification number of the controller. For example: $ **cat /sys/class/scsi_host/host1/serial_number** 6A316373777 _/sys/class/scsi_host/host_ *_/vendor_ The _vendor_ attribute is read-only. This attribute contains the vendor identification string of the controller. For example: $ **cat /sys/class/scsi_host/host1/vendor** Adaptec _/sys/class/scsi_host/host_ *_/enable_stream_detection_ The _enable_stream_detection_ attribute is read-write. This attribute enables/disables stream detection in the driver. Enabling stream detection can improve sequential write performance for ioaccel-enabled volumes. See the **ssd_smart_path_enabled** disk attribute section for details on ioaccel-enabled volumes. The default value is 1 (stream detection enabled). Enable example: $ **echo 1 > /sys/class/scsi_host/host1/enable_stream_detection** _/sys/class/scsi_host/host_ *_/enable_r5_writes_ The _enable_r5_writes_ attribute is read-write. This attribute enables/disables RAID 5 write operations for ioaccel-enabled volumes. Enabling can improve sequential write performance. See the **ssd_smart_path_enabled** disk attribute section for details on ioaccel-enabled volumes. The default value is 1 (RAID 5 writes enabled). Enable example: $ **echo 1 > /sys/class/scsi_host/host1/enable_r5_writes** _/sys/class/scsi_host/host_ *_/enable_r6_writes_ The _enable_r6_writes_ attribute is read-write. This attribute enables/disables RAID 6 write operations for ioaccel-enabled volumes. Enabling can improve sequential write performance. See the **ssd_smart_path_enabled** disk attribute section for details on ioaccel-enabled volumes. The default value is 1 (RAID 6 writes enabled). Enable example: $ **echo 1 > /sys/class/scsi_host/host1/enable_r6_writes** [1mSmartPQI-specific disk attribute files in _/sys_ In the file specifications below, _c_ stands for the number of the appropriate SCSI controller, _b_ is the bus number, _t_ the target number, and _l_ is the logical unit number (LUN). _/sys/class/scsi_disk/_ c _:_ b _:_ t _:_ l _/device/raid_level_ The _raid_level_ attribute is read-only. This attribute contains the RAID level of the logical volume. For example: $ **cat /sys/class/scsi_disk/4:0:0:0/device/raid_level** RAID 0 _/sys/class/scsi_disk/_ c _:_ b _:_ t _:_ l _/device/sas_address_ The _sas_address_ attribute is read-only. This attribute contains the SAS address of the device. For example: $ **cat /sys/class/scsi_disk/1:0:3:0/device/sas_address** 0x5001173d028543a2 _/sys/class/scsi_disk/_ c _:_ b _:_ t _:_ l _/device/ssd_smart_path_enabled_ The _ssd_smart_path_enabled_ attribute is read-only. This attribute is for ioaccel-enabled volumes. (Ioaccel is an alternative driver submission path that allows the driver to send I/O requests directly to backend SCSI devices, bypassing the controller firmware. This results in an increase in performance. This method is used for HBA disks and for logical volumes comprised of SSDs.) Contains 1 if ioaccel is enabled for the volume and 0 otherwise. For example: $ **cat /sys/class/scsi_disk/1:0:3:0/device/ssd_smart_path_enabled** 0 _/sys/class/scsi_disk/_ c _:_ b _:_ t _:_ l _/device/lunid_ The _lunid_ attribute is read-only. This attribute contains the SCSI LUN ID for the device. For example: $ **cat /sys/class/scsi_disk/13:1:0:3/device/lunid** 0x0300004000000000 _/sys/class/scsi_disk/_ c _:_ b _:_ t _:_ l _/device/unique_id_ The _unique_id_ attribute is read-only. This attribute contains a 16-byte ID that uniquely identifies the device within the controller. For example: $ **cat /sys/class/scsi_disk/13:1:0:3/device/unique_id** 600508B1001C6D4723A8E98D704FDB94 _/sys/class/scsi_disk/_ c _:_ b _:_ t _:_ l _/device/path_info_ The _path_info_ attribute is read-only. This attribute contains the _c_ :_b_ :_t_ :_l_ of the device along with the device type and whether the device is Active or Inactive. If the device is an HBA device, _path_info_ will also display the PORT, BOX, and BAY the device is plugged into. For example: $ **cat /sys/class/scsi_disk/13:1:0:3/device/path_info** [13:1:0:3] Direct-Access Active $ **cat /sys/class/scsi_disk/12:0:9:0/device/path_info** [12:0:9:0] Direct-Access PORT: C1 BOX: 1 BAY: 14 Inactive [12:0:9:0] Direct-Access PORT: C0 BOX: 1 BAY: 14 Active _/sys/class/scsi_disk/_ c _:_ b _:_ t _:_ l _/device/raid_bypass_cnt_ The _raid_bypass_cnt_ attribute is read-only. This attribute contains the number of I/O requests that have gone through the ioaccel path for ioaccel-enabled volumes. See the **ssd_smart_path_enabled** disk attribute section for details on ioaccel-enabled volumes. For example: $ **cat /sys/class/scsi_disk/13:1:0:3/device/raid_bypass_cnt** 0x300 _/sys/class/scsi_disk/_ c _:_ b _:_ t _:_ l _/device/sas_ncq_prio_enable_ The _sas_ncq_prio_enable_ attribute is read/write. This attribute enables SATA NCQ priority support. This attribute works only when device has NCQ support and controller firmware can handle IO with NCQ priority attribute. For example: $ **echo 1 > /sys/class/scsi_disk/13:1:0:3/device/sas_ncq_prio_enable** ## VERSIONS The **smartpqi** driver was added in Linux 4.9. ## NOTES **Configuration** To configure a Microchip Smart Storage controller, refer to the User Guide for the controller, which can be found by searching for the specific controller at ⟨https://www.microchip.com/design-centers/storage⟩. * * *
# sd ## NAME sd - driver for SCSI disk drives ## SYNOPSIS **#include <linux/hdreg.h> **/* for HDIO_GETGEO */ **#include <linux/fs.h> **/* for BLKGETSIZE and BLKRRPART */ ## CONFIGURATION The block device name has the following form: **sd** _lp,_ where _l_ is a letter denoting the physical drive, and _p_ is a number denoting the partition on that physical drive. Often, the partition number, _p_ , will be left off when the device corresponds to the whole drive. SCSI disks have a major device number of 8, and a minor device number of the form (16 * _drive_number_) + _partition_number_ , where _drive_number_ is the number of the physical drive in order of detection, and _partition_number_ is as follows: β€’ partition 0 is the whole drive β€’ partitions 1–4 are the DOS "primary" partitions β€’ partitions 5–8 are the DOS "extended" (or "logical") partitions For example, _/dev/sda_ will have major 8, minor 0, and will refer to all of the first SCSI drive in the system; and _/dev/sdb3_ will have major 8, minor 19, and will refer to the third DOS "primary" partition on the second SCSI drive in the system. At this time, only block devices are provided. Raw devices have not yet been implemented. ## DESCRIPTION The following _ioctl_ s are provided: **HDIO_GETGEO** Returns the BIOS disk parameters in the following structure: struct hd_geometry { unsigned char heads; unsigned char sectors; unsigned short cylinders; unsigned long start; }; A pointer to this structure is passed as the ioctl(2) parameter. The information returned in the parameter is the disk geometry of the drive _as understood by DOS!_ This geometry is _not_ the physical geometry of the drive. It is used when constructing the drive's partition table, however, and is needed for convenient operation of **fdisk**(1), **efdisk**(1), and **lilo**(1). If the geometry information is not available, zero will be returned for all of the parameters. **BLKGETSIZE** Returns the device size in sectors. The ioctl(2) parameter should be a pointer to a _long_. **BLKRRPART** Forces a reread of the SCSI disk partition tables. No parameter is needed. The SCSI ioctl(2) operations are also supported. If the ioctl(2) parameter is required, and it is NULL, then ioctl(2) fails with the error **EINVAL**. ## FILES _/dev/sd[a-h]_ the whole device _/dev/sd[a-h][0-8]_ individual block partitions * * *
# random ## NAME random, urandom - kernel random number source devices ## SYNOPSIS #include <linux/random.h> **int ioctl(**_fd_**, RND** _request_**,**_param_**);** ## DESCRIPTION The character special files _/dev/random_ and _/dev/urandom_ (present since Linux 1.3.30) provide an interface to the kernel's random number generator. The file _/dev/random_ has major device number 1 and minor device number 8. The file _/dev/urandom_ has major device number 1 and minor device number 9. The random number generator gathers environmental noise from device drivers and other sources into an entropy pool. The generator also keeps an estimate of the number of bits of noise in the entropy pool. From this entropy pool, random numbers are created. Linux 3.17 and later provides the simpler and safer getrandom(2) interface which requires no special files; see the getrandom(2) manual page for details. When read, the _/dev/urandom_ device returns random bytes using a pseudorandom number generator seeded from the entropy pool. Reads from this device do not block (i.e., the CPU is not yielded), but can incur an appreciable delay when requesting large amounts of data. When read during early boot time, _/dev/urandom_ may return data prior to the entropy pool being initialized. If this is of concern in your application, use getrandom(2) or _/dev/random_ instead. The _/dev/random_ device is a legacy interface which dates back to a time where the cryptographic primitives used in the implementation of _/dev/urandom_ were not widely trusted. It will return random bytes only within the estimated number of bits of fresh noise in the entropy pool, blocking if necessary. _/dev/random_ is suitable for applications that need high quality randomness, and can afford indeterminate delays. When the entropy pool is empty, reads from _/dev/random_ will block until additional environmental noise is gathered. Since Linux 5.6, the **O_NONBLOCK** flag is ignored as _/dev/random_ will no longer block except during early boot process. In earlier versions, if open(2) is called for _/dev/random_ with the **O_NONBLOCK** flag, a subsequent read(2) will not block if the requested number of bytes is not available. Instead, the available bytes are returned. If no byte is available, read(2) will return -1 and _errno_ will be set to **EAGAIN**. The **O_NONBLOCK** flag has no effect when opening _/dev/urandom_. When calling read(2) for the device _/dev/urandom_ , reads of up to 256 bytes will return as many bytes as are requested and will not be interrupted by a signal handler. Reads with a buffer over this limit may return less than the requested number of bytes or fail with the error **EINTR** , if interrupted by a signal handler. Since Linux 3.16, a read(2) from _/dev/urandom_ will return at most 32 MB. A read(2) from _/dev/random_ will return at most 512 bytes (340 bytes before Linux 2.6.12). Writing to _/dev/random_ or _/dev/urandom_ will update the entropy pool with the data written, but this will not result in a higher entropy count. This means that it will impact the contents read from both files, but it will not make reads from _/dev/random_ faster. **Usage** The _/dev/random_ interface is considered a legacy interface, and _/dev/urandom_ is preferred and sufficient in all use cases, with the exception of applications which require randomness during early boot time; for these applications, getrandom(2) must be used instead, because it will block until the entropy pool is initialized. If a seed file is saved across reboots as recommended below, the output is cryptographically secure against attackers without local root access as soon as it is reloaded in the boot sequence, and perfectly adequate for network encryption session keys. (All major Linux distributions have saved the seed file across reboots since 2000 at least.) Since reads from _/dev/random_ may block, users will usually want to open it in nonblocking mode (or perform a read with timeout), and provide some sort of user notification if the desired entropy is not immediately available. **Configuration** If your system does not have _/dev/random_ and _/dev/urandom_ created already, they can be created with the following commands: mknod -m 666 /dev/random c 1 8 mknod -m 666 /dev/urandom c 1 9 chown root:root /dev/random /dev/urandom When a Linux system starts up without much operator interaction, the entropy pool may be in a fairly predictable state. This reduces the actual amount of noise in the entropy pool below the estimate. In order to counteract this effect, it helps to carry entropy pool information across shut-downs and start-ups. To do this, add the lines to an appropriate script which is run during the Linux system start-up sequence: echo "Initializing random number generator..." random_seed=/var/run/random-seed # Carry a random seed from start-up to start-up # Load and then save the whole entropy pool if [ -f $random_seed ]; then cat $random_seed >/dev/urandom else touch $random_seed fi chmod 600 $random_seed poolfile=/proc/sys/kernel/random/poolsize [ -r $poolfile ] && bits=$(cat $poolfile) || bits=4096 bytes=$(expr $bits / 8) dd if=/dev/urandom of=$random_seed count=1 bs=$bytes Also, add the following lines in an appropriate script which is run during the Linux system shutdown: # Carry a random seed from shut-down to start-up # Save the whole entropy pool echo "Saving random seed..." random_seed=/var/run/random-seed touch $random_seed chmod 600 $random_seed poolfile=/proc/sys/kernel/random/poolsize [ -r $poolfile ] && bits=$(cat $poolfile) || bits=4096 bytes=$(expr $bits / 8) dd if=/dev/urandom of=$random_seed count=1 bs=$bytes In the above examples, we assume Linux 2.6.0 or later, where _/proc/sys/kernel/random/poolsize_ returns the size of the entropy pool in bits (see below). **/proc interfaces** The files in the directory _/proc/sys/kernel/random_ (present since Linux 2.3.16) provide additional information about the _/dev/random_ device: _entropy_avail_ This read-only file gives the available entropy, in bits. This will be a number in the range 0 to 4096. _poolsize_ This file gives the size of the entropy pool. The semantics of this file vary across kernel versions: Linux 2.4: This file gives the size of the entropy pool in _bytes_. Normally, this file will have the value 512, but it is writable, and can be changed to any value for which an algorithm is available. The choices are 32, 64, 128, 256, 512, 1024, or 2048. Linux 2.6 and later: This file is read-only, and gives the size of the entropy pool in _bits_. It contains the value 4096. _read_wakeup_threshold_ This file contains the number of bits of entropy required for waking up processes that sleep waiting for entropy from _/dev/random_. The default is 64. _write_wakeup_threshold_ This file contains the number of bits of entropy below which we wake up processes that do a select(2) or poll(2) for write access to _/dev/random_. These values can be changed by writing to the files. _uuid_ _boot_id_ These read-only files contain random strings like 6fd5a44b-35f4-4ad4-a9b9-6b9be13e1fe9. The former is generated afresh for each read, the latter was generated once. **ioctl(2) interface** The following ioctl(2) requests are defined on file descriptors connected to either _/dev/random_ or _/dev/urandom_. All requests performed will interact with the input entropy pool impacting both _/dev/random_ and _/dev/urandom_. The **CAP_SYS_ADMIN** capability is required for all requests except **RNDGETENTCNT**. **RNDGETENTCNT** Retrieve the entropy count of the input pool, the contents will be the same as the _entropy_avail_ file under proc. The result will be stored in the int pointed to by the argument. **RNDADDTOENTCNT** Increment or decrement the entropy count of the input pool by the value pointed to by the argument. **RNDGETPOOL** Removed in Linux 2.6.9. **RNDADDENTROPY** Add some additional entropy to the input pool, incrementing the entropy count. This differs from writing to _/dev/random_ or _/dev/urandom_ , which only adds some data but does not increment the entropy count. The following structure is used: struct rand_pool_info { int entropy_count; int buf_size; __u32 buf[0]; }; Here _entropy_count_ is the value added to (or subtracted from) the entropy count, and _buf_ is the buffer of size _buf_size_ which gets added to the entropy pool. **RNDZAPENTCNT** **RNDCLEARPOOL** Zero the entropy count of all pools and add some system data (such as wall clock) to the pools. ## FILES _/dev/random_ _/dev/urandom_ ## NOTES For an overview and comparison of the various interfaces that can be used to obtain randomness, see random(7). ## BUGS During early boot time, reads from _/dev/urandom_ may return data prior to the entropy pool being initialized. * * *
# initrd ## NAME initrd - boot loader initialized RAM disk ## CONFIGURATION _/dev/initrd_ is a read-only block device assigned major number 1 and minor number 250. Typically _/dev/initrd_ is owned by root:disk with mode 0400 (read access by root only). If the Linux system does not have _/dev/initrd_ already created, it can be created with the following commands: mknod -m 400 /dev/initrd b 1 250 chown root:disk /dev/initrd Also, support for both "RAM disk" and "Initial RAM disk" (e.g., **CONFIG_BLK_DEV_RAM=y** and **CONFIG_BLK_DEV_INITRD=y**) must be compiled directly into the Linux kernel to use _/dev/initrd_. When using _/dev/initrd_ , the RAM disk driver cannot be loaded as a module. ## DESCRIPTION The special file _/dev/initrd_ is a read-only block device. This device is a RAM disk that is initialized (e.g., loaded) by the boot loader before the kernel is started. The kernel then can use _/dev/initrd_ 's contents for a two-phase system boot-up. In the first boot-up phase, the kernel starts up and mounts an initial root filesystem from the contents of _/dev/initrd_ (e.g., RAM disk initialized by the boot loader). In the second phase, additional drivers or other modules are loaded from the initial root device's contents. After loading the additional modules, a new root filesystem (i.e., the normal root filesystem) is mounted from a different device. **Boot-up operation** When booting up with **initrd** , the system boots as follows: (1) The boot loader loads the kernel program and _/dev/initrd_ 's contents into memory. (2) On kernel startup, the kernel uncompresses and copies the contents of the device _/dev/initrd_ onto device _/dev/ram0_ and then frees the memory used by _/dev/initrd_. (3) The kernel then read-write mounts the device _/dev/ram0_ as the initial root filesystem. (4) If the indicated normal root filesystem is also the initial root filesystem (e.g., _/dev/ram0_) then the kernel skips to the last step for the usual boot sequence. (5) If the executable file _/linuxrc_ is present in the initial root filesystem, _/linuxrc_ is executed with UID 0. (The file _/linuxrc_ must have executable permission. The file _/linuxrc_ can be any valid executable, including a shell script.) (6) If _/linuxrc_ is not executed or when _/linuxrc_ terminates, the normal root filesystem is mounted. (If _/linuxrc_ exits with any filesystems mounted on the initial root filesystem, then the behavior of the kernel is **UNSPECIFIED**. See the NOTES section for the current kernel behavior.) (7) If the normal root filesystem has a directory _/initrd_ , the device _/dev/ram0_ is moved from _/_ to _/initrd_. Otherwise, if the directory _/initrd_ does not exist, the device _/dev/ram0_ is unmounted. (When moved from _/_ to _/initrd_ , _/dev/ram0_ is not unmounted and therefore processes can remain running from _/dev/ram0_. If directory _/initrd_ does not exist on the normal root filesystem and any processes remain running from _/dev/ram0_ when _/linuxrc_ exits, the behavior of the kernel is **UNSPECIFIED**. See the NOTES section for the current kernel behavior.) (8) The usual boot sequence (e.g., invocation of _/sbin/init_) is performed on the normal root filesystem. **Options** The following boot loader options, when used with **initrd** , affect the kernel's boot-up operation: **initrd=**_filename_ Specifies the file to load as the contents of _/dev/initrd_. For **LOADLIN** this is a command-line option. For **LILO** you have to use this command in the **LILO** configuration file _/etc/lilo.config_. The filename specified with this option will typically be a gzipped filesystem image. **noinitrd** This boot option disables the two-phase boot-up operation. The kernel performs the usual boot sequence as if _/dev/initrd_ was not initialized. With this option, any contents of _/dev/initrd_ loaded into memory by the boot loader contents are preserved. This option permits the contents of _/dev/initrd_ to be any data and need not be limited to a filesystem image. However, device _/dev/initrd_ is read-only and can be read only one time after system startup. **root=**_device-name_ Specifies the device to be used as the normal root filesystem. For **LOADLIN** this is a command-line option. For **LILO** this is a boot time option or can be used as an option line in the **LILO** configuration file _/etc/lilo.config_. The device specified by this option must be a mountable device having a suitable root filesystem. **Changing the normal root filesystem** By default, the kernel's settings (e.g., set in the kernel file with **rdev**(8) or compiled into the kernel file), or the boot loader option setting is used for the normal root filesystems. For an NFS-mounted normal root filesystem, one has to use the **nfs_root_name** and **nfs_root_addrs** boot options to give the NFS settings. For more information on NFS-mounted root see the kernel documentation file _Documentation/filesystems/nfs/nfsroot.txt_ (or _Documentation/filesystems/nfsroot.txt_ before Linux 2.6.33). For more information on setting the root filesystem see also the **LILO** and **LOADLIN** documentation. It is also possible for the _/linuxrc_ executable to change the normal root device. For _/linuxrc_ to change the normal root device, _/proc_ must be mounted. After mounting _/proc_ , _/linuxrc_ changes the normal root device by writing into the proc files _/proc/sys/kernel/real-root-dev_ , _/proc/sys/kernel/nfs-root-name_ , and _/proc/sys/kernel/nfs-root-addrs_. For a physical root device, the root device is changed by having _/linuxrc_ write the new root filesystem device number into _/proc/sys/kernel/real-root-dev_. For an NFS root filesystem, the root device is changed by having _/linuxrc_ write the NFS setting into files _/proc/sys/kernel/nfs-root-name_ and _/proc/sys/kernel/nfs-root-addrs_ and then writing 0xff (e.g., the pseudo-NFS-device number) into file _/proc/sys/kernel/real-root-dev_. For example, the following shell command line would change the normal root device to _/dev/hdb1_ : echo 0x365 >/proc/sys/kernel/real-root-dev For an NFS example, the following shell command lines would change the normal root device to the NFS directory _/var/nfsroot_ on a local networked NFS server with IP number 193.8.232.7 for a system with IP number 193.8.232.2 and named "idefix": echo /var/nfsroot >/proc/sys/kernel/nfs-root-name echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \ >/proc/sys/kernel/nfs-root-addrs echo 255 >/proc/sys/kernel/real-root-dev **Note** : The use of _/proc/sys/kernel/real-root-dev_ to change the root filesystem is obsolete. See the Linux kernel source file _Documentation/admin-guide/initrd.rst_ (or _Documentation/initrd.txt_ before Linux 4.10) as well as pivot_root(2) and pivot_root(8) for information on the modern method of changing the root filesystem. **Usage** The main motivation for implementing **initrd** was to allow for modular kernel configuration at system installation. A possible system installation scenario is as follows: (1) The loader program boots from floppy or other media with a minimal kernel (e.g., support for _/dev/ram_ , _/dev/initrd_ , and the ext2 filesystem) and loads _/dev/initrd_ with a gzipped version of the initial filesystem. (2) The executable _/linuxrc_ determines what is needed to (1) mount the normal root filesystem (i.e., device type, device drivers, filesystem) and (2) the distribution media (e.g., CD-ROM, network, tape, ...). This can be done by asking the user, by auto-probing, or by using a hybrid approach. (3) The executable _/linuxrc_ loads the necessary modules from the initial root filesystem. (4) The executable _/linuxrc_ creates and populates the root filesystem. (At this stage the normal root filesystem does not have to be a completed system yet.) (5) The executable _/linuxrc_ sets _/proc/sys/kernel/real-root-dev_ , unmounts _/proc_ , the normal root filesystem and any other filesystems it has mounted, and then terminates. (6) The kernel then mounts the normal root filesystem. (7) Now that the filesystem is accessible and intact, the boot loader can be installed. (8) The boot loader is configured to load into _/dev/initrd_ a filesystem with the set of modules that was used to bring up the system. (e.g., device _/dev/ram0_ can be modified, then unmounted, and finally, the image is written from _/dev/ram0_ to a file.) (9) The system is now bootable and additional installation tasks can be performed. The key role of _/dev/initrd_ in the above is to reuse the configuration data during normal system operation without requiring initial kernel selection, a large generic kernel or, recompiling the kernel. A second scenario is for installations where Linux runs on systems with different hardware configurations in a single administrative network. In such cases, it may be desirable to use only a small set of kernels (ideally only one) and to keep the system-specific part of configuration information as small as possible. In this case, create a common file with all needed modules. Then, only the _/linuxrc_ file or a file executed by _/linuxrc_ would be different. A third scenario is more convenient recovery disks. Because information like the location of the root filesystem partition is not needed at boot time, the system loaded from _/dev/initrd_ can use a dialog and/or auto-detection followed by a possible sanity check. Last but not least, Linux distributions on CD-ROM may use **initrd** for easy installation from the CD-ROM. The distribution can use **LOADLIN** to directly load _/dev/initrd_ from CD-ROM without the need of any floppies. The distribution could also use a **LILO** boot floppy and then bootstrap a bigger RAM disk via _/dev/initrd_ from the CD-ROM. ## FILES _/dev/initrd_ _/dev/ram0_ _/linuxrc_ _/initrd_ ## NOTES β€’ With the current kernel, any filesystems that remain mounted when _/dev/ram0_ is moved from _/_ to _/initrd_ continue to be accessible. However, the _/proc/mounts_ entries are not updated. β€’ With the current kernel, if directory _/initrd_ does not exist, then _/dev/ram0_ will **not** be fully unmounted if _/dev/ram0_ is used by any process or has any filesystem mounted on it. If _/dev/ram0_ is **not** fully unmounted, then _/dev/ram0_ will remain in memory. β€’ Users of _/dev/initrd_ should not depend on the behavior given in the above notes. The behavior may change in future versions of the Linux kernel. * * *
# md ## NAME md - Multiple Device driver aka Linux Software RAID ## SYNOPSIS **/dev/md** _n_ **/dev/md/**_n_ **/dev/md/** name ## DESCRIPTION The **md** driver provides virtual devices that are created from one or more independent underlying devices. This array of devices often contains redundancy and the devices are often disk drives, hence the acronym RAID which stands for a Redundant Array of Independent Disks. **md** supports RAID levels 1 (mirroring), 4 (striped array with parity device), 5 (striped array with distributed parity information), 6 (striped array with distributed dual redundancy information), and 10 (striped and mirrored). If some number of underlying devices fails while using one of these levels, the array will continue to function; this number is one for RAID levels 4 and 5, two for RAID level 6, and all but one (N-1) for RAID level 1, and dependent on configuration for level 10. **md** also supports a number of pseudo RAID (non-redundant) configurations including RAID0 (striped array), LINEAR (catenated array), MULTIPATH (a set of different interfaces to the same device), and FAULTY (a layer over a single device into which errors can be injected). **MD METADATA** Each device in an array may have some _metadata_ stored in the device. This metadata is sometimes called a **superblock**. The metadata records information about the structure and state of the array. This allows the array to be reliably re-assembled after a shutdown. **md** provides support for two different formats of metadata, and other formats can be added. The common format β€” known as version 0.90 β€” has a superblock that is 4K long and is written into a 64K aligned block that starts at least 64K and less than 128K from the end of the device (i.e. to get the address of the superblock round the size of the device down to a multiple of 64K and then subtract 64K). The available size of each device is the amount of space before the super block, so between 64K and 128K is lost when a device in incorporated into an MD array. This superblock stores multi-byte fields in a processor-dependent manner, so arrays cannot easily be moved between computers with different processors. The new format β€” known as version 1 β€” has a superblock that is normally 1K long, but can be longer. It is normally stored between 8K and 12K from the end of the device, on a 4K boundary, though variations can be stored at the start of the device (version 1.1) or 4K from the start of the device (version 1.2). This metadata format stores multibyte data in a processor- independent format and supports up to hundreds of component devices (version 0.90 only supports 28). The metadata contains, among other things: LEVEL The manner in which the devices are arranged into the array (LINEAR, RAID0, RAID1, RAID4, RAID5, RAID10, MULTIPATH). UUID a 128 bit Universally Unique Identifier that identifies the array that contains this device. When a version 0.90 array is being reshaped (e.g. adding extra devices to a RAID5), the version number is temporarily set to 0.91. This ensures that if the reshape process is stopped in the middle (e.g. by a system crash) and the machine boots into an older kernel that does not support reshaping, then the array will not be assembled (which would cause data corruption) but will be left untouched until a kernel that can complete the reshape processes is used. **ARRAYS WITHOUT METADATA** While it is usually best to create arrays with superblocks so that they can be assembled reliably, there are some circumstances when an array without superblocks is preferred. These include: LEGACY ARRAYS Early versions of the **md** driver only supported LINEAR and RAID0 configurations and did not use a superblock (which is less critical with these configurations). While such arrays should be rebuilt with superblocks if possible, **md** continues to support them. FAULTY Being a largely transparent layer over a different device, the FAULTY personality doesn't gain anything from having a superblock. MULTIPATH It is often possible to detect devices which are different paths to the same storage directly rather than having a distinctive superblock written to the device and searched for on all paths. In this case, a MULTIPATH array with no superblock makes sense. RAID1 In some configurations it might be desired to create a RAID1 configuration that does not use a superblock, and to maintain the state of the array elsewhere. While not encouraged for general use, it does have special-purpose uses and is supported. **ARRAYS WITH EXTERNAL METADATA** _md_ driver supports arrays with externally managed metadata. That is, the metadata is not managed by the kernel but rather by a user-space program which is external to the kernel. This allows support for a variety of metadata formats without cluttering the kernel with lots of details. _md_ is able to communicate with the user-space program through various sysfs attributes so that it can make appropriate changes to the metadata - for example to mark a device as faulty. When necessary, _md_ will wait for the program to acknowledge the event by writing to a sysfs attribute. The manual page for mdmon(8) contains more detail about this interaction. **CONTAINERS** Many metadata formats use a single block of metadata to describe a number of different arrays which all use the same set of devices. In this case it is helpful for the kernel to know about the full set of devices as a whole. This set is known to md as a _container_. A container is an _md_ array with externally managed metadata and with device offset and size so that it just covers the metadata part of the devices. The remainder of each device is available to be incorporated into various arrays. **LINEAR** A LINEAR array simply catenates the available space on each drive to form one large virtual drive. One advantage of this arrangement over the more common RAID0 arrangement is that the array may be reconfigured at a later time with an extra drive, so the array is made bigger without disturbing the data that is on the array. This can even be done on a live array. If a chunksize is given with a LINEAR array, the usable space on each device is rounded down to a multiple of this chunksize. **RAID0** A RAID0 array (which has zero redundancy) is also known as a striped array. A RAID0 array is configured at creation with a **Chunk Size** which must be at least 4 kibibytes. The RAID0 driver assigns the first chunk of the array to the first device, the second chunk to the second device, and so on until all drives have been assigned one chunk. This collection of chunks forms a **stripe**. Further chunks are gathered into stripes in the same way, and are assigned to the remaining space in the drives. If devices in the array are not all the same size, then once the smallest device has been exhausted, the RAID0 driver starts collecting chunks into smaller stripes that only span the drives which still have remaining space. A bug was introduced in linux 3.14 which changed the layout of blocks in a RAID0 beyond the region that is striped over all devices. This bug does not affect an array with all devices the same size, but can affect other RAID0 arrays. Linux 5.4 (and some stable kernels to which the change was backported) will not normally assemble such an array as it cannot know which layout to use. There is a module parameter "raid0.default_layout" which can be set to "1" to force the kernel to use the pre-3.14 layout or to "2" to force it to use the 3.14-and-later layout. when creating a new RAID0 array, _mdadm_ will record the chosen layout in the metadata in a way that allows newer kernels to assemble the array without needing a module parameter. To assemble an old array on a new kernel without using the module parameter, use either the **--update=layout-original** option or the **--update=layout-alternate** option. Once you have updated the layout you will not be able to mount the array on an older kernel. If you need to revert to an older kernel, the layout information can be erased with the **--update=layout-unspecificed** option. If you use this option to **--assemble** while running a newer kernel, the array will NOT assemble, but the metadata will be update so that it can be assembled on an older kernel. Note that setting the layout to "unspecified" removes protections against this bug, and you must be sure that the kernel you use matches the layout of the array. **RAID1** A RAID1 array is also known as a mirrored set (though mirrors tend to provide reflected images, which RAID1 does not) or a plex. Once initialised, each device in a RAID1 array contains exactly the same data. Changes are written to all devices in parallel. Data is read from any one device. The driver attempts to distribute read requests across all devices to maximise performance. All devices in a RAID1 array should be the same size. If they are not, then only the amount of space available on the smallest device is used (any extra space on other devices is wasted). Note that the read balancing done by the driver does not make the RAID1 performance profile be the same as for RAID0; a single stream of sequential input will not be accelerated (e.g. a single dd), but multiple sequential streams or a random workload will use more than one spindle. In theory, having an N-disk RAID1 will allow N sequential threads to read from all disks. Individual devices in a RAID1 can be marked as "write-mostly". These drives are excluded from the normal read balancing and will only be read from when there is no other option. This can be useful for devices connected over a slow link. **RAID4** A RAID4 array is like a RAID0 array with an extra device for storing parity. This device is the last of the active devices in the array. Unlike RAID0, RAID4 also requires that all stripes span all drives, so extra space on devices that are larger than the smallest is wasted. When any block in a RAID4 array is modified, the parity block for that stripe (i.e. the block in the parity device at the same device offset as the stripe) is also modified so that the parity block always contains the "parity" for the whole stripe. I.e. its content is equivalent to the result of performing an exclusive-or operation between all the data blocks in the stripe. This allows the array to continue to function if one device fails. The data that was on that device can be calculated as needed from the parity block and the other data blocks. **RAID5** RAID5 is very similar to RAID4. The difference is that the parity blocks for each stripe, instead of being on a single device, are distributed across all devices. This allows more parallelism when writing, as two different block updates will quite possibly affect parity blocks on different devices so there is less contention. This also allows more parallelism when reading, as read requests are distributed over all the devices in the array instead of all but one. **RAID6** RAID6 is similar to RAID5, but can handle the loss of any _two_ devices without data loss. Accordingly, it requires N+2 drives to store N drives worth of data. The performance for RAID6 is slightly lower but comparable to RAID5 in normal mode and single disk failure mode. It is very slow in dual disk failure mode, however. **RAID10** RAID10 provides a combination of RAID1 and RAID0, and is sometimes known as RAID1+0. Every datablock is duplicated some number of times, and the resulting collection of datablocks are distributed over multiple drives. When configuring a RAID10 array, it is necessary to specify the number of replicas of each data block that are required (this will usually be 2) and whether their layout should be "near", "far" or "offset". **About the RAID10 Layout Examples:** The examples below visualise the chunk distribution on the underlying devices for the respective layout. For simplicity it is assumed that the size of the chunks equals the size of the blocks of the underlying devices as well as those of the RAID10 device exported by the kernel (for example **/dev/md/** name). Therefore the chunks / chunk numbers map directly to the blocks /block addresses of the exported RAID10 device. Decimal numbers (0, 1, 2, ...) are the chunks of the RAID10 and due to the above assumption also the blocks and block addresses of the exported RAID10 device. Repeated numbers mean copies of a chunk / block (obviously on different underlying devices). Hexadecimal numbers (0x00, 0x01, 0x02, ...) are the block addresses of the underlying devices. **"near" Layout** When "near" replicas are chosen, the multiple copies of a given chunk are laid out consecutively ("as close to each other as possible") across the stripes of the array. With an even number of devices, they will likely (unless some misalignment is present) lay at the very same offset on the different devices. This is as the "classic" RAID1+0; that is two groups of mirrored devices (in the example below the groups Device #1 / #2 and Device #3 / #4 are each a RAID1) both in turn forming a striped RAID0. **Example with 2 copies per chunk and an even number (4) of** **devices:** β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Device #1 β”‚ Device #2 β”‚ Device #3 β”‚ Device #4 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 0x00 β”‚ 0 β”‚ 0 β”‚ 1 β”‚ 1 β”‚ β”‚ 0x01 β”‚ 2 β”‚ 2 β”‚ 3 β”‚ 3 β”‚ β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ β”‚ 0x80 β”‚ 254 β”‚ 254 β”‚ 255 β”‚ 255 β”‚ β””β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ \---------v---------/ \---------v---------/ RAID1 RAID1 \---------------------v---------------------/ RAID0 **Example with 2 copies per chunk and an odd number (5) of** **devices:** β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Dev #1 β”‚ Dev #2 β”‚ Dev #3 β”‚ Dev #4 β”‚ Dev #5 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 0x00 β”‚ 0 β”‚ 0 β”‚ 1 β”‚ 1 β”‚ 2 β”‚ β”‚ 0x01 β”‚ 2 β”‚ 3 β”‚ 3 β”‚ 4 β”‚ 4 β”‚ β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ β”‚ 0x80 β”‚ 317 β”‚ 318 β”‚ 318 β”‚ 319 β”‚ 319 β”‚ β””β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ **"far" Layout** When "far" replicas are chosen, the multiple copies of a given chunk are laid out quite distant ("as far as reasonably possible") from each other. First a complete sequence of all data blocks (that is all the data one sees on the exported RAID10 block device) is striped over the devices. Then another (though "shifted") complete sequence of all data blocks; and so on (in the case of more than 2 copies per chunk). The "shift" needed to prevent placing copies of the same chunks on the same devices is actually a cyclic permutation with offset 1 of each of the stripes within a complete sequence of chunks. The offset 1 is relative to the previous complete sequence of chunks, so in case of more than 2 copies per chunk one gets the following offsets: 1. complete sequence of chunks: offset = 0 2. complete sequence of chunks: offset = 1 3. complete sequence of chunks: offset = 2 : n. complete sequence of chunks: offset = n-1 **Example with 2 copies per chunk and an even number (4) of** **devices:** β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Device #1 β”‚ Device #2 β”‚ Device #3 β”‚ Device #4 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 0x00 β”‚ 0 β”‚ 1 β”‚ 2 β”‚ 3 β”‚ \ β”‚ 0x01 β”‚ 4 β”‚ 5 β”‚ 6 β”‚ 7 β”‚ > [#] β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ : β”‚ 0x40 β”‚ 252 β”‚ 253 β”‚ 254 β”‚ 255 β”‚ / β”‚ 0x41 β”‚ 3 β”‚ 0 β”‚ 1 β”‚ 2 β”‚ \ β”‚ 0x42 β”‚ 7 β”‚ 4 β”‚ 5 β”‚ 6 β”‚ > [#]~ β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ : β”‚ 0x80 β”‚ 255 β”‚ 252 β”‚ 253 β”‚ 254 β”‚ / β””β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ **Example with 2 copies per chunk and an odd number (5) of** **devices:** β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Dev #1 β”‚ Dev #2 β”‚ Dev #3 β”‚ Dev #4 β”‚ Dev #5 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 0x00 β”‚ 0 β”‚ 1 β”‚ 2 β”‚ 3 β”‚ 4 β”‚ \ β”‚ 0x01 β”‚ 5 β”‚ 6 β”‚ 7 β”‚ 8 β”‚ 9 β”‚ > [#] β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ : β”‚ 0x40 β”‚ 315 β”‚ 316 β”‚ 317 β”‚ 318 β”‚ 319 β”‚ / β”‚ 0x41 β”‚ 4 β”‚ 0 β”‚ 1 β”‚ 2 β”‚ 3 β”‚ \ β”‚ 0x42 β”‚ 9 β”‚ 5 β”‚ 6 β”‚ 7 β”‚ 8 β”‚ > [#]~ β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ : β”‚ 0x80 β”‚ 319 β”‚ 315 β”‚ 316 β”‚ 317 β”‚ 318 β”‚ / β””β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ With [#] being the complete sequence of chunks and [#]~ the cyclic permutation with offset 1 thereof (in the case of more than 2 copies per chunk there would be ([#]~)~, (([#]~)~)~, ...). The advantage of this layout is that MD can easily spread sequential reads over the devices, making them similar to RAID0 in terms of speed. The cost is more seeking for writes, making them substantially slower. **"offset" Layout** When "offset" replicas are chosen, all the copies of a given chunk are striped consecutively ("offset by the stripe length after each other") over the devices. Explained in detail, <number of devices> consecutive chunks are striped over the devices, immediately followed by a "shifted" copy of these chunks (and by further such "shifted" copies in the case of more than 2 copies per chunk). This pattern repeats for all further consecutive chunks of the exported RAID10 device (in other words: all further data blocks). The "shift" needed to prevent placing copies of the same chunks on the same devices is actually a cyclic permutation with offset 1 of each of the striped copies of <number of devices> consecutive chunks. The offset 1 is relative to the previous striped copy of <number of devices> consecutive chunks, so in case of more than 2 copies per chunk one gets the following offsets: 1. <number of devices> consecutive chunks: offset = 0 2. <number of devices> consecutive chunks: offset = 1 3. <number of devices> consecutive chunks: offset = 2 : n. <number of devices> consecutive chunks: offset = n-1 **Example with 2 copies per chunk and an even number (4) of** **devices:** β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Device #1 β”‚ Device #2 β”‚ Device #3 β”‚ Device #4 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 0x00 β”‚ 0 β”‚ 1 β”‚ 2 β”‚ 3 β”‚ ) AA β”‚ 0x01 β”‚ 3 β”‚ 0 β”‚ 1 β”‚ 2 β”‚ ) AA~ β”‚ 0x02 β”‚ 4 β”‚ 5 β”‚ 6 β”‚ 7 β”‚ ) AB β”‚ 0x03 β”‚ 7 β”‚ 4 β”‚ 5 β”‚ 6 β”‚ ) AB~ β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ) ... β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ) ... β”‚ 0x79 β”‚ 251 β”‚ 252 β”‚ 253 β”‚ 254 β”‚ ) EX β”‚ 0x80 β”‚ 254 β”‚ 251 β”‚ 252 β”‚ 253 β”‚ ) EX~ β””β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ **Example with 2 copies per chunk and an odd number (5) of** **devices:** β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Dev #1 β”‚ Dev #2 β”‚ Dev #3 β”‚ Dev #4 β”‚ Dev #5 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 0x00 β”‚ 0 β”‚ 1 β”‚ 2 β”‚ 3 β”‚ 4 β”‚ ) AA β”‚ 0x01 β”‚ 4 β”‚ 0 β”‚ 1 β”‚ 2 β”‚ 3 β”‚ ) AA~ β”‚ 0x02 β”‚ 5 β”‚ 6 β”‚ 7 β”‚ 8 β”‚ 9 β”‚ ) AB β”‚ 0x03 β”‚ 9 β”‚ 5 β”‚ 6 β”‚ 7 β”‚ 8 β”‚ ) AB~ β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ) ... β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ : β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚ ) ... β”‚ 0x79 β”‚ 314 β”‚ 315 β”‚ 316 β”‚ 317 β”‚ 318 β”‚ ) EX β”‚ 0x80 β”‚ 318 β”‚ 314 β”‚ 315 β”‚ 316 β”‚ 317 β”‚ ) EX~ β””β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ With AA, AB, ..., AZ, BA, ... being the sets of <number of devices> consecutive chunks and AA~, AB~, ..., AZ~, BA~, ... the cyclic permutations with offset 1 thereof (in the case of more than 2 copies per chunk there would be (AA~)~, ... as well as ((AA~)~)~, ... and so on). This should give similar read characteristics to "far" if a suitably large chunk size is used, but without as much seeking for writes. It should be noted that the number of devices in a RAID10 array need not be a multiple of the number of replica of each data block; however, there must be at least as many devices as replicas. If, for example, an array is created with 5 devices and 2 replicas, then space equivalent to 2.5 of the devices will be available, and every block will be stored on two different devices. Finally, it is possible to have an array with both "near" and "far" copies. If an array is configured with 2 near copies and 2 far copies, then there will be a total of 4 copies of each block, each on a different drive. This is an artifact of the implementation and is unlikely to be of real value. **MULTIPATH** MULTIPATH is not really a RAID at all as there is only one real device in a MULTIPATH md array. However there are multiple access points (paths) to this device, and one of these paths might fail, so there are some similarities. A MULTIPATH array is composed of a number of logically different devices, often fibre channel interfaces, that all refer the the same real device. If one of these interfaces fails (e.g. due to cable problems), the MULTIPATH driver will attempt to redirect requests to another interface. The MULTIPATH drive is not receiving any ongoing development and should be considered a legacy driver. The device-mapper based multipath drivers should be preferred for new installations. **FAULTY** The FAULTY md module is provided for testing purposes. A FAULTY array has exactly one component device and is normally assembled without a superblock, so the md array created provides direct access to all of the data in the component device. The FAULTY module may be requested to simulate faults to allow testing of other md levels or of filesystems. Faults can be chosen to trigger on read requests or write requests, and can be transient (a subsequent read/write at the address will probably succeed) or persistent (subsequent read/write of the same address will fail). Further, read faults can be "fixable" meaning that they persist until a write request at the same address. Fault types can be requested with a period. In this case, the fault will recur repeatedly after the given number of requests of the relevant type. For example if persistent read faults have a period of 100, then every 100th read request would generate a fault, and the faulty sector would be recorded so that subsequent reads on that sector would also fail. There is a limit to the number of faulty sectors that are remembered. Faults generated after this limit is exhausted are treated as transient. The list of faulty sectors can be flushed, and the active list of failure modes can be cleared. **UNCLEAN SHUTDOWN** When changes are made to a RAID1, RAID4, RAID5, RAID6, or RAID10 array there is a possibility of inconsistency for short periods of time as each update requires at least two block to be written to different devices, and these writes probably won't happen at exactly the same time. Thus if a system with one of these arrays is shutdown in the middle of a write operation (e.g. due to power failure), the array may not be consistent. To handle this situation, the md driver marks an array as "dirty" before writing any data to it, and marks it as "clean" when the array is being disabled, e.g. at shutdown. If the md driver finds an array to be dirty at startup, it proceeds to correct any possibly inconsistency. For RAID1, this involves copying the contents of the first drive onto all other drives. For RAID4, RAID5 and RAID6 this involves recalculating the parity for each stripe and making sure that the parity block has the correct data. For RAID10 it involves copying one of the replicas of each block onto all the others. This process, known as "resynchronising" or "resync" is performed in the background. The array can still be used, though possibly with reduced performance. If a RAID4, RAID5 or RAID6 array is degraded (missing at least one drive, two for RAID6) when it is restarted after an unclean shutdown, it cannot recalculate parity, and so it is possible that data might be undetectably corrupted. The md driver will fail to start an array in this condition without manual intervention, though this behaviour can be overridden by a kernel parameter. **RECOVERY** If the md driver detects a write error on a device in a RAID1, RAID4, RAID5, RAID6, or RAID10 array, it immediately disables that device (marking it as faulty) and continues operation on the remaining devices. If there are spare drives, the driver will start recreating on one of the spare drives the data which was on that failed drive, either by copying a working drive in a RAID1 configuration, or by doing calculations with the parity block on RAID4, RAID5 or RAID6, or by finding and copying originals for RAID10. A read-error will cause md to attempt a recovery by overwriting the bad block. i.e. it will find the correct data from elsewhere, write it over the block that failed, and then try to read it back again. If either the write or the re-read fail, md will treat the error the same way that a write error is treated, and will fail the whole device. While this recovery process is happening, the md driver will monitor accesses to the array and will slow down the rate of recovery if other activity is happening, so that normal access to the array will not be unduly affected. When no other activity is happening, the recovery process proceeds at full speed. The actual speed targets for the two different situations can be controlled by the **speed_limit_min** and **speed_limit_max** control files mentioned below. **SCRUBBING AND MISMATCHES** As storage devices can develop bad blocks at any time it is valuable to regularly read all blocks on all devices in an array so as to catch such bad blocks early. This process is called _scrubbing_. md arrays can be scrubbed by writing either _check_ or _repair_ to the file _md/sync_action_ in the _sysfs_ directory for the device. Requesting a scrub will cause _md_ to read every block on every device in the array, and check that the data is consistent. For RAID1 and RAID10, this means checking that the copies are identical. For RAID4, RAID5, RAID6 this means checking that the parity block is (or blocks are) correct. If a read error is detected during this process, the normal read- error handling causes correct data to be found from other devices and to be written back to the faulty device. In many case this will effectively _fix_ the bad block. If all blocks read successfully but are found to not be consistent, then this is regarded as a _mismatch_. If _check_ was used, then no action is taken to handle the mismatch, it is simply recorded. If _repair_ was used, then a mismatch will be repaired in the same way that _resync_ repairs arrays. For RAID5/RAID6 new parity blocks are written. For RAID1/RAID10, all but one block are overwritten with the content of that one block. A count of mismatches is recorded in the _sysfs_ file _md/mismatch_cnt_. This is set to zero when a scrub starts and is incremented whenever a sector is found that is a mismatch. _md_ normally works in units much larger than a single sector and when it finds a mismatch, it does not determine exactly how many actual sectors were affected but simply adds the number of sectors in the IO unit that was used. So a value of 128 could simply mean that a single 64KB check found an error (128 x 512bytes = 64KB). If an array is created by _mdadm_ with _--assume-clean_ then a subsequent check could be expected to find some mismatches. On a truly clean RAID5 or RAID6 array, any mismatches should indicate a hardware problem at some level - software issues should never cause such a mismatch. However on RAID1 and RAID10 it is possible for software issues to cause a mismatch to be reported. This does not necessarily mean that the data on the array is corrupted. It could simply be that the system does not care what is stored on that part of the array - it is unused space. The most likely cause for an unexpected mismatch on RAID1 or RAID10 occurs if a swap partition or swap file is stored on the array. When the swap subsystem wants to write a page of memory out, it flags the page as 'clean' in the memory manager and requests the swap device to write it out. It is quite possible that the memory will be changed while the write-out is happening. In that case the 'clean' flag will be found to be clear when the write completes and so the swap subsystem will simply forget that the swapout had been attempted, and will possibly choose a different page to write out. If the swap device was on RAID1 (or RAID10), then the data is sent from memory to a device twice (or more depending on the number of devices in the array). Thus it is possible that the memory gets changed between the times it is sent, so different data can be written to the different devices in the array. This will be detected by _check_ as a mismatch. However it does not reflect any corruption as the block where this mismatch occurs is being treated by the swap system as being empty, and the data will never be read from that block. It is conceivable for a similar situation to occur on non-swap files, though it is less likely. Thus the _mismatch_cnt_ value can not be interpreted very reliably on RAID1 or RAID10, especially when the device is used for swap. **BITMAP WRITE-INTENT LOGGING** _md_ supports a bitmap based write-intent log. If configured, the bitmap is used to record which blocks of the array may be out of sync. Before any write request is honoured, md will make sure that the corresponding bit in the log is set. After a period of time with no writes to an area of the array, the corresponding bit will be cleared. This bitmap is used for two optimisations. Firstly, after an unclean shutdown, the resync process will consult the bitmap and only resync those blocks that correspond to bits in the bitmap that are set. This can dramatically reduce resync time. Secondly, when a drive fails and is removed from the array, md stops clearing bits in the intent log. If that same drive is re- added to the array, md will notice and will only recover the sections of the drive that are covered by bits in the intent log that are set. This can allow a device to be temporarily removed and reinserted without causing an enormous recovery cost. The intent log can be stored in a file on a separate device, or it can be stored near the superblocks of an array which has superblocks. It is possible to add an intent log to an active array, or remove an intent log if one is present. All raid levels with redundancy are supported. **BAD BLOCK LIST** Each device in an _md_ array can store a list of known-bad-blocks. This list is 4K in size and usually positioned at the end of the space between the superblock and the data. When a block cannot be read and cannot be repaired by writing data recovered from other devices, the address of the block is stored in the bad block list. Similarly if an attempt to write a block fails, the address will be recorded as a bad block. If attempting to record the bad block fails, the whole device will be marked faulty. Attempting to read from a known bad block will cause a read error. Attempting to write to a known bad block will be ignored if any write errors have been reported by the device. If there have been no write errors then the data will be written to the known bad block and if that succeeds, the address will be removed from the list. This allows an array to fail more gracefully - a few blocks on different devices can be faulty without taking the whole array out of action. The list is particularly useful when recovering to a spare. If a few blocks cannot be read from the other devices, the bulk of the recovery can complete and those few bad blocks will be recorded in the bad block list. **RAID WRITE HOLE** Due to non-atomicity nature of RAID write operations, interruption of write operations (system crash, etc.) to RAID456 array can lead to inconsistent parity and data loss (so called RAID-5 write hole). To plug the write hole md supports two mechanisms described below. DIRTY STRIPE JOURNAL From Linux 4.4, md supports write ahead journal for RAID456. When the array is created, an additional journal device can be added to the array through write-journal option. The RAID write journal works similar to file system journals. Before writing to the data disks, md persists data AND parity of the stripe to the journal device. After crashes, md searches the journal device for incomplete write operations, and replay them to the data disks. When the journal device fails, the RAID array is forced to run in read-only mode. PARTIAL PARITY LOG From Linux 4.12 md supports Partial Parity Log (PPL) for RAID5 arrays only. Partial parity for a write operation is the XOR of stripe data chunks not modified by the write. PPL is stored in the metadata region of RAID member drives, no additional journal drive is needed. After crashes, if one of the not modified data disks of the stripe is missing, this updated parity can be used to recover its data. See Documentation/driver-api/md/raid5-ppl.rst for implementation details. **WRITE-BEHIND** This allows certain devices in the array to be flagged as _write-_ _mostly_. MD will only read from such devices if there is no other option. If a write-intent bitmap is also provided, write requests to write-mostly devices will be treated as write-behind requests and md will not wait for writes to those requests to complete before reporting the write as complete to the filesystem. This allows for a RAID1 with WRITE-BEHIND to be used to mirror data over a slow link to a remote computer (providing the link isn't too slow). The extra latency of the remote link will not slow down normal operations, but the remote system will still have a reasonably up-to-date copy of all data. **FAILFAST** From Linux 4.10, _md_ supports FAILFAST for RAID1 and RAID10 arrays. This is a flag that can be set on individual drives, though it is usually set on all drives, or no drives. When _md_ sends an I/O request to a drive that is marked as FAILFAST, and when the array could survive the loss of that drive without losing data, _md_ will request that the underlying device does not perform any retries. This means that a failure will be reported to _md_ promptly, and it can mark the device as faulty and continue using the other device(s). _md_ cannot control the timeout that the underlying devices use to determine failure. Any changes desired to that timeout must be set explictly on the underlying device, separately from using _mdadm_. If a FAILFAST request does fail, and if it is still safe to mark the device as faulty without data loss, that will be done and the array will continue functioning on a reduced number of devices. If it is not possible to safely mark the device as faulty, _md_ will retry the request without disabling retries in the underlying device. In any case, _md_ will not attempt to repair read errors on a device marked as FAILFAST by writing out the correct. It will just mark the device as faulty. FAILFAST is appropriate for storage arrays that have a low probability of true failure, but will sometimes introduce unacceptable delays to I/O requests while performing internal maintenance. The value of setting FAILFAST involves a trade-off. The gain is that the chance of unacceptable delays is substantially reduced. The cost is that the unlikely event of data-loss on one device is slightly more likely to result in data- loss for the array. When a device in an array using FAILFAST is marked as faulty, it will usually become usable again in a short while. _mdadm_ makes no attempt to detect that possibility. Some separate mechanism, tuned to the specific details of the expected failure modes, needs to be created to monitor devices to see when they return to full functionality, and to then re-add them to the array. In order of this "re-add" functionality to be effective, an array using FAILFAST should always have a write-intent bitmap. **RESTRIPING** _Restriping_ , also known as _Reshaping_ , is the processes of re- arranging the data stored in each stripe into a new layout. This might involve changing the number of devices in the array (so the stripes are wider), changing the chunk size (so stripes are deeper or shallower), or changing the arrangement of data and parity (possibly changing the RAID level, e.g. 1 to 5 or 5 to 6). _md_ can reshape a RAID4, RAID5, or RAID6 array to have a different number of devices (more or fewer) and to have a different layout or chunk size. It can also convert between these different RAID levels. It can also convert between RAID0 and RAID10, and between RAID0 and RAID4 or RAID5. Other possibilities may follow in future kernels. During any stripe process there is a 'critical section' during which live data is being overwritten on disk. For the operation of increasing the number of drives in a RAID5, this critical section covers the first few stripes (the number being the product of the old and new number of devices). After this critical section is passed, data is only written to areas of the array which no longer hold live data β€” the live data has already been located away. For a reshape which reduces the number of devices, the 'critical section' is at the end of the reshape process. md is not able to ensure data preservation if there is a crash (e.g. power failure) during the critical section. If md is asked to start an array which failed during a critical section of restriping, it will fail to start the array. To deal with this possibility, a user-space program must β€’ Disable writes to that section of the array (using the **sysfs** interface), β€’ take a copy of the data somewhere (i.e. make a backup), β€’ allow the process to continue and invalidate the backup and restore write access once the critical section is passed, and β€’ provide for restoring the critical data before restarting the array after a system crash. **mdadm** do this for growing a RAID5 array. For operations that do not change the size of the array, like simply increasing chunk size, or converting RAID5 to RAID6 with one extra device, the entire process is the critical section. In this case, the restripe will need to progress in stages, as a section is suspended, backed up, restriped, and released. **SYSFS INTERFACE** Each block device appears as a directory in _sysfs_ (which is usually mounted at **/sys**). For MD devices, this directory will contain a subdirectory called **md** which contains various files for providing access to information about the array. This interface is documented more fully in the file **Documentation/admin-guide/md.rst** which is distributed with the kernel sources. That file should be consulted for full documentation. The following are just a selection of attribute files that are available. **md/sync_speed_min** This value, if set, overrides the system-wide setting in **/proc/sys/dev/raid/speed_limit_min** for this array only. Writing the value **system** to this file will cause the system-wide setting to have effect. **md/sync_speed_max** This is the partner of **md/sync_speed_min** and overrides **/proc/sys/dev/raid/speed_limit_max** described below. **md/sync_action** This can be used to monitor and control the resync/recovery process of MD. In particular, writing "check" here will cause the array to read all data block and check that they are consistent (e.g. parity is correct, or all mirror replicas are the same). Any discrepancies found are **NOT** corrected. A count of problems found will be stored in **md/mismatch_count**. Alternately, "repair" can be written which will cause the same check to be performed, but any errors will be corrected. Finally, "idle" can be written to stop the check/repair process. **md/stripe_cache_size** This is only available on RAID5 and RAID6. It records the size (in pages per device) of the stripe cache which is used for synchronising all write operations to the array and all read operations if the array is degraded. The default is 256. Valid values are 17 to 32768. Increasing this number can increase performance in some situations, at some cost in system memory. Note, setting this value too high can result in an "out of memory" condition for the system. memory_consumed = system_page_size * nr_disks * stripe_cache_size **md/preread_bypass_threshold** This is only available on RAID5 and RAID6. This variable sets the number of times MD will service a full-stripe- write before servicing a stripe that requires some "prereading". For fairness this defaults to 1. Valid values are 0 to stripe_cache_size. Setting this to 0 maximizes sequential-write throughput at the cost of fairness to threads doing small or random writes. **md/bitmap/backlog** The value stored in the file only has any effect on RAID1 when write-mostly devices are active, and write requests to those devices are proceed in the background. This variable sets a limit on the number of concurrent background writes, the valid values are 0 to 16383, 0 means that write-behind is not allowed, while any other number means it can happen. If there are more write requests than the number, new writes will by synchronous. **md/bitmap/can_clear** This is for externally managed bitmaps, where the kernel writes the bitmap itself, but metadata describing the bitmap is managed by mdmon or similar. When the array is degraded, bits mustn't be cleared. When the array becomes optimal again, bit can be cleared, but first the metadata needs to record the current event count. So md sets this to 'false' and notifies mdmon, then mdmon updates the metadata and writes 'true'. There is no code in mdmon to actually do this, so maybe it doesn't even work. **md/bitmap/chunksize** The bitmap chunksize can only be changed when no bitmap is active, and the value should be power of 2 and at least 512. **md/bitmap/location** This indicates where the write-intent bitmap for the array is stored. It can be "none" or "file" or a signed offset from the array metadata - measured in sectors. You cannot set a file by writing here - that can only be done with the SET_BITMAP_FILE ioctl. Write 'none' to 'bitmap/location' will clear bitmap, and the previous location value must be write to it to restore bitmap. **md/bitmap/max_backlog_used** This keeps track of the maximum number of concurrent write- behind requests for an md array, writing any value to this file will clear it. **md/bitmap/metadata** This can be 'internal' or 'clustered' or 'external'. 'internal' is set by default, which means the metadata for bitmap is stored in the first 256 bytes of the bitmap space. 'clustered' means separate bitmap metadata are used for each cluster node. 'external' means that bitmap metadata is managed externally to the kernel. **md/bitmap/space** This shows the space (in sectors) which is available at md/bitmap/location, and allows the kernel to know when it is safe to resize the bitmap to match a resized array. It should big enough to contain the total bytes in the bitmap. For 1.0 metadata, assume we can use up to the superblock if before, else to 4K beyond superblock. For other metadata versions, assume no change is possible. **md/bitmap/time_base** This shows the time (in seconds) between disk flushes, and is used to looking for bits in the bitmap to be cleared. The default value is 5 seconds, and it should be an unsigned long value. **KERNEL PARAMETERS** The md driver recognised several different kernel parameters. **raid=noautodetect** This will disable the normal detection of md arrays that happens at boot time. If a drive is partitioned with MS- DOS style partitions, then if any of the 4 main partitions has a partition type of 0xFD, then that partition will normally be inspected to see if it is part of an MD array, and if any full arrays are found, they are started. This kernel parameter disables this behaviour. **md_mod.start_ro=1** **/sys/module/md_mod/parameters/start_ro** This tells md to start all arrays in read-only mode. This is a soft read-only that will automatically switch to read- write on the first write request. However until that write request, nothing is written to any device by md, and in particular, no resync or recovery operation is started. **md_mod.start_dirty_degraded=1** **/sys/module/md_mod/parameters/start_dirty_degraded** As mentioned above, md will not normally start a RAID4, RAID5, or RAID6 that is both dirty and degraded as this situation can imply hidden data loss. This can be awkward if the root filesystem is affected. Using this module parameter allows such arrays to be started at boot time. It should be understood that there is a real (though small) risk of data corruption in this situation. **md=**_n_**,**_dev_**,**_dev_**,...** **md=d** _n_**,**_dev_**,**_dev_**,...** This tells the md driver to assemble **/dev/md n** from the listed devices. It is only necessary to start the device holding the root filesystem this way. Other arrays are best started once the system is booted. **md=**_n_**,**_l_**,**_c_**,**_i_**,**_dev..._ This tells the md driver to assemble a legacy RAID0 or LINEAR array without a superblock. _n_ gives the md device number, _l_ gives the level, 0 for RAID0 or -1 for LINEAR, _c_ gives the chunk size as a base-2 logarithm offset by twelve, so 0 means 4K, 1 means 8K. _i_ is ignored (legacy support). ## FILES **/proc/mdstat** Contains information about the status of currently running array. **/proc/sys/dev/raid/speed_limit_min** A readable and writable file that reflects the current "goal" rebuild speed for times when non-rebuild activity is current on an array. The speed is in Kibibytes per second, and is a per-device rate, not a per-array rate (which means that an array with more disks will shuffle more data for a given speed). The default is 1000. **/proc/sys/dev/raid/speed_limit_max** A readable and writable file that reflects the current "goal" rebuild speed for times when no non-rebuild activity is current on an array. The default is 200,000. * * *
# wavelan ## NAME wavelan - AT&T GIS WaveLAN ISA device driver ## SYNOPSIS **insmod wavelan_cs.o [io=**_B,B.._**] [ irq=**_I,I.._**] [name=**_N,N.._**]** ## DESCRIPTION _This driver is obsolete:_ it was removed in Linux 2.6.35. **wavelan** is the low-level device driver for the NCR / AT&T / Lucent **WaveLAN ISA** and Digital (DEC) **RoamAbout DS** wireless ethernet adapter. This driver is available as a module or might be compiled in the kernel. This driver supports multiple cards in both forms (up to 4) and allocates the next available ethernet device (eth0..eth#) for each card found, unless a device name is explicitly specified (see below). This device name will be reported in the kernel log file with the MAC address, NWID, and frequency used by the card. **Parameters** This section applies to the module form (parameters passed on the insmod(8) command line). If the driver is included in the kernel, use the _ether=IRQ,IO,NAME_ syntax on the kernel command line. **io** Specify the list of base addresses where to search for wavelan cards (setting by dip switch on the card). If you don't specify any io address, the driver will scan 0x390 and 0x3E0 addresses, which might conflict with other hardware... **irq** Set the list of IRQs that each wavelan card should use (the value is saved in permanent storage for future use). **name** Set the list of names to be used for each wavelan card device (name used by ifconfig(8)). **Wireless extensions** Use **iwconfig**(8) to manipulate wireless extensions. **NWID (or domain)** Set the network ID [_0_ to _FFFF_] or disable it [_off_]. As the NWID is stored in the card Permanent Storage Area, it will be reused at any further invocation of the driver. **Frequency & channels** For the 2.4 GHz 2.00 Hardware, you are able to set the frequency by specifying one of the 10 defined channels (_2.412, 2.422, 2.425,_ _2.4305, 2.432, 2.442, 2.452, 2.460, 2.462_ or _2.484_) or directly as a numeric value. The frequency is changed immediately and permanently. Frequency availability depends on the regulations... **Statistics spy** Set a list of MAC addresses in the driver (up to 8) and get the last quality of link for each of those (see **iwspy**(8)). **/proc/net/wireless** _status_ is the status reported by the modem. _Link quality_ reports the quality of the modulation on the air (direct sequence spread spectrum) [max = 16]. _Level_ and _Noise_ refer to the signal level and noise level [max = 64]. The _crypt discarded packet_ and _misc_ _discarded packet_ counters are not implemented. **Private ioctl** You may use **iwpriv**(8) to manipulate private ioctls. **Quality and level threshold** Enables you to define the quality and level threshold used by the modem (packet below that level are discarded). **Histogram** This functionality makes it possible to set a number of signal level intervals and to count the number of packets received in each of those defined intervals. This distribution might be used to calculate the mean value and standard deviation of the signal level. **Specific notes** This driver fails to detect some **non-NCR/AT &T/Lucent **Wavelan cards. If this happens for you, you must look in the source code on how to add your card to the detection routine. Some of the mentioned features are optional. You may enable or disable them by changing flags in the driver header and recompile. * * *
# hpsa ## NAME hpsa - HP Smart Array SCSI driver ## SYNOPSIS modprobe hpsa [ hpsa_allow_any=1 ] ## DESCRIPTION **hpsa** is a SCSI driver for HP Smart Array RAID controllers. **Options** _hpsa_allow_any=1_ : This option allows the driver to attempt to operate on any HP Smart Array hardware RAID controller, even if it is not explicitly known to the driver. This allows newer hardware to work with older drivers. Typically this is used to allow installation of operating systems from media that predates the RAID controller, though it may also be used to enable **hpsa** to drive older controllers that would normally be handled by the cciss(4) driver. These older boards have not been tested and are not supported with **hpsa** , and cciss(4) should still be used for these. **Supported hardware** The **hpsa** driver supports the following Smart Array boards: Smart Array P700M Smart Array P212 Smart Array P410 Smart Array P410i Smart Array P411 Smart Array P812 Smart Array P712m Smart Array P711m StorageWorks P1210m Since Linux 4.14, the following Smart Array boards are also supported: Smart Array 5300 Smart Array 5312 Smart Array 532 Smart Array 5i Smart Array 6400 Smart Array 6400 EM Smart Array 641 Smart Array 642 Smart Array 6i Smart Array E200 Smart Array E200i Smart Array E200i Smart Array E200i Smart Array E200i Smart Array E500 Smart Array P400 Smart Array P400i Smart Array P600 Smart Array P700m Smart Array P800 **Configuration details** To configure HP Smart Array controllers, use the HP Array Configuration Utility (either **hpacuxe**(8) or **hpacucli**(8)) or the Offline ROM-based Configuration Utility (ORCA) run from the Smart Array's option ROM at boot time. ## FILES **Device nodes** Logical drives are accessed via the SCSI disk driver (sd(4)), tape drives via the SCSI tape driver (st(4)), and the RAID controller via the SCSI generic driver (**sg**(4)), with device nodes named _/dev/sd*_ , _/dev/st*_ , and _/dev/sg*_ , respectively. **HPSA-specific host attribute files in /sys** _/sys/class/scsi_host/host*/rescan_ This is a write-only attribute. Writing to this attribute will cause the driver to scan for new, changed, or removed devices (e.g., hot-plugged tape drives, or newly configured or deleted logical drives, etc.) and notify the SCSI midlayer of any changes detected. Normally a rescan is triggered automatically by HP's Array Configuration Utility (either the GUI or the command-line variety); thus, for logical drive changes, the user should not normally have to use this attribute. This attribute may be useful when hot plugging devices like tape drives, or entire storage boxes containing preconfigured logical drives. _/sys/class/scsi_host/host*/firmware_revision_ This attribute contains the firmware version of the Smart Array. For example: # **cd /sys/class/scsi_host/host4** ; # **cat firmware_revision** ; 7.14 **HPSA-specific disk attribute files in /sys** _/sys/class/scsi_disk/c:b:t:l/device/unique_id_ This attribute contains a 32 hex-digit unique ID for each logical drive. For example: # **cd /sys/class/scsi_disk/4:0:0:0/device** ; # **cat unique_id** ; 600508B1001044395355323037570F77 _/sys/class/scsi_disk/c:b:t:l/device/raid_level_ This attribute contains the RAID level of each logical drive. For example: # **cd /sys/class/scsi_disk/4:0:0:0/device** ; # **cat raid_level** ; RAID 0 _/sys/class/scsi_disk/c:b:t:l/device/lunid_ This attribute contains the 16 hex-digit (8 byte) LUN ID by which a logical drive or physical device can be addressed. _c_ :_b_ :_t_ :_l_ are the controller, bus, target, and lun of the device. For example: # **cd /sys/class/scsi_disk/4:0:0:0/device** ; # **cat lunid** ; 0x0000004000000000 **Supported ioctl() operations** For compatibility with applications written for the cciss(4) driver, many, but not all of the ioctls supported by the cciss(4) driver are also supported by the **hpsa** driver. The data structures used by these ioctls are described in the Linux kernel source file _include/linux/cciss_ioctl.h_. **CCISS_DEREGDISK** **CCISS_REGNEWDISK** **CCISS_REGNEWD** These three ioctls all do exactly the same thing, which is to cause the driver to rescan for new devices. This does exactly the same thing as writing to the hpsa-specific host "rescan" attribute. **CCISS_GETPCIINFO** Returns PCI domain, bus, device, and function and "board ID" (PCI subsystem ID). **CCISS_GETDRIVVER** Returns driver version in three bytes encoded as: (major_version << 16) | (minor_version << 8) | (subminor_version) **CCISS_PASSTHRU** **CCISS_BIG_PASSTHRU** Allows "BMIC" and "CISS" commands to be passed through to the Smart Array. These are used extensively by the HP Array Configuration Utility, SNMP storage agents, and so on. See _cciss_vol_status_ at ⟨http://cciss.sf.net⟩ for some examples. * * *
# rtc ## NAME rtc - real-time clock ## SYNOPSIS #include <linux/rtc.h> **int ioctl(**_fd_**, RTC_**_request_**,**_param_**);** ## DESCRIPTION This is the interface to drivers for real-time clocks (RTCs). Most computers have one or more hardware clocks which record the current "wall clock" time. These are called "Real Time Clocks" (RTCs). One of these usually has battery backup power so that it tracks the time even while the computer is turned off. RTCs often provide alarms and other interrupts. All i386 PCs, and ACPI-based systems, have an RTC that is compatible with the Motorola MC146818 chip on the original PC/AT. Today such an RTC is usually integrated into the mainboard's chipset (south bridge), and uses a replaceable coin-sized backup battery. Non-PC systems, such as embedded systems built around system-on- chip processors, use other implementations. They usually won't offer the same functionality as the RTC from a PC/AT. **RTC vs system clock** RTCs should not be confused with the system clock, which is a software clock maintained by the kernel and used to implement gettimeofday(2) and time(2), as well as setting timestamps on files, and so on. The system clock reports seconds and microseconds since a start point, defined to be the POSIX Epoch: 1970-01-01 00:00:00 +0000 (UTC). (One common implementation counts timer interrupts, once per "jiffy", at a frequency of 100, 250, or 1000 Hz.) That is, it is supposed to report wall clock time, which RTCs also do. A key difference between an RTC and the system clock is that RTCs run even when the system is in a low power state (including "off"), and the system clock can't. Until it is initialized, the system clock can only report time since system boot ... not since the POSIX Epoch. So at boot time, and after resuming from a system low power state, the system clock will often be set to the current wall clock time using an RTC. Systems without an RTC need to set the system clock using another clock, maybe across the network or by entering that data manually. **RTC functionality** RTCs can be read and written with hwclock(8), or directly with the ioctl(2) requests listed below. Besides tracking the date and time, many RTCs can also generate interrupts β€’ on every clock update (i.e., once per second); β€’ at periodic intervals with a frequency that can be set to any power-of-2 multiple in the range 2 Hz to 8192 Hz; β€’ on reaching a previously specified alarm time. Each of those interrupt sources can be enabled or disabled separately. On many systems, the alarm interrupt can be configured as a system wakeup event, which can resume the system from a low power state such as Suspend-to-RAM (STR, called S3 in ACPI systems), Hibernation (called S4 in ACPI systems), or even "off" (called S5 in ACPI systems). On some systems, the battery backed RTC can't issue interrupts, but another one can. The _/dev/rtc_ (or _/dev/rtc0_ , _/dev/rtc1_ , etc.) device can be opened only once (until it is closed) and it is read-only. On read(2) and select(2) the calling process is blocked until the next interrupt from that RTC is received. Following the interrupt, the process can read a long integer, of which the least significant byte contains a bit mask encoding the types of interrupt that occurred, while the remaining 3 bytes contain the number of interrupts since the last read(2). **ioctl(2) interface** The following ioctl(2) requests are defined on file descriptors connected to RTC devices: **RTC_RD_TIME** Returns this RTC's time in the following structure: struct rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; /* unused */ int tm_yday; /* unused */ int tm_isdst; /* unused */ }; The fields in this structure have the same meaning and ranges as for the _tm_ structure described in gmtime(3). A pointer to this structure should be passed as the third ioctl(2) argument. **RTC_SET_TIME** Sets this RTC's time to the time specified by the _rtc_time_ structure pointed to by the third ioctl(2) argument. To set the RTC's time the process must be privileged (i.e., have the **CAP_SYS_TIME** capability). **RTC_ALM_READ** **RTC_ALM_SET** Read and set the alarm time, for RTCs that support alarms. The alarm interrupt must be separately enabled or disabled using the **RTC_AIE_ON** , **RTC_AIE_OFF** requests. The third ioctl(2) argument is a pointer to an _rtc_time_ structure. Only the _tm_sec_ , _tm_min_ , and _tm_hour_ fields of this structure are used. **RTC_IRQP_READ** **RTC_IRQP_SET** Read and set the frequency for periodic interrupts, for RTCs that support periodic interrupts. The periodic interrupt must be separately enabled or disabled using the **RTC_PIE_ON** , **RTC_PIE_OFF** requests. The third ioctl(2) argument is an _unsigned long *_ or an _unsigned long_ , respectively. The value is the frequency in interrupts per second. The set of allowable frequencies is the multiples of two in the range 2 to 8192. Only a privileged process (i.e., one having the **CAP_SYS_RESOURCE** capability) can set frequencies above the value specified in _/proc/sys/dev/rtc/max-user-freq_. (This file contains the value 64 by default.) **RTC_AIE_ON** **RTC_AIE_OFF** Enable or disable the alarm interrupt, for RTCs that support alarms. The third ioctl(2) argument is ignored. **RTC_UIE_ON** **RTC_UIE_OFF** Enable or disable the interrupt on every clock update, for RTCs that support this once-per-second interrupt. The third ioctl(2) argument is ignored. **RTC_PIE_ON** **RTC_PIE_OFF** Enable or disable the periodic interrupt, for RTCs that support these periodic interrupts. The third ioctl(2) argument is ignored. Only a privileged process (i.e., one having the **CAP_SYS_RESOURCE** capability) can enable the periodic interrupt if the frequency is currently set above the value specified in _/proc/sys/dev/rtc/max-user-freq_. **RTC_EPOCH_READ** **RTC_EPOCH_SET** Many RTCs encode the year in an 8-bit register which is either interpreted as an 8-bit binary number or as a BCD number. In both cases, the number is interpreted relative to this RTC's Epoch. The RTC's Epoch is initialized to 1900 on most systems but on Alpha and MIPS it might also be initialized to 1952, 1980, or 2000, depending on the value of an RTC register for the year. With some RTCs, these operations can be used to read or to set the RTC's Epoch, respectively. The third ioctl(2) argument is an _unsigned_ _long *_ or an _unsigned long_ , respectively, and the value returned (or assigned) is the Epoch. To set the RTC's Epoch the process must be privileged (i.e., have the **CAP_SYS_TIME** capability). **RTC_WKALM_RD** **RTC_WKALM_SET** Some RTCs support a more powerful alarm interface, using these ioctls to read or write the RTC's alarm time (respectively) with this structure: struct rtc_wkalrm { unsigned char enabled; unsigned char pending; struct rtc_time time; }; The _enabled_ flag is used to enable or disable the alarm interrupt, or to read its current status; when using these calls, **RTC_AIE_ON** and **RTC_AIE_OFF** are not used. The _pending_ flag is used by **RTC_WKALM_RD** to report a pending interrupt (so it's mostly useless on Linux, except when talking to the RTC managed by EFI firmware). The _time_ field is as used with **RTC_ALM_READ** and **RTC_ALM_SET** except that the _tm_mday_ , _tm_mon_ , and _tm_year_ fields are also valid. A pointer to this structure should be passed as the third ioctl(2) argument. ## FILES _/dev/rtc_ _/dev/rtc0_ _/dev/rtc1_ ... RTC special character device files. _/proc/driver/rtc_ status of the (first) RTC. ## NOTES When the kernel's system time is synchronized with an external reference using adjtimex(2) it will update a designated RTC periodically every 11 minutes. To do so, the kernel has to briefly turn off periodic interrupts; this might affect programs using that RTC. An RTC's Epoch has nothing to do with the POSIX Epoch which is used only for the system clock. If the year according to the RTC's Epoch and the year register is less than 1970 it is assumed to be 100 years later, that is, between 2000 and 2069. Some RTCs support "wildcard" values in alarm fields, to support scenarios like periodic alarms at fifteen minutes after every hour, or on the first day of each month. Such usage is nonportable; portable user-space code expects only a single alarm interrupt, and will either disable or reinitialize the alarm after receiving it. Some RTCs support periodic interrupts with periods that are multiples of a second rather than fractions of a second; multiple alarms; programmable output clock signals; nonvolatile memory; and other hardware capabilities that are not currently exposed by this API. * * *
# dsp56k ## NAME dsp56k - DSP56001 interface device ## SYNOPSIS **#include <asm/dsp56k.h>** **ssize_t read(int** _fd_**, void ***_data_**, size_t** _length_**);** **ssize_t write(int** _fd_**, void ***_data_**, size_t** _length_**);** **int ioctl(int** _fd_**, DSP56K_UPLOAD, struct dsp56k_upload ***_program_**);** **int ioctl(int** _fd_**, DSP56K_SET_TX_WSIZE, int** _wsize_**);** **int ioctl(int** _fd_**, DSP56K_SET_RX_WSIZE, int** _wsize_**);** **int ioctl(int** _fd_**, DSP56K_HOST_FLAGS, struct dsp56k_host_flags ***_flags_**);** **int ioctl(int** _fd_**, DSP56K_HOST_CMD, int** _cmd_**);** ## CONFIGURATION The _dsp56k_ device is a character device with major number 55 and minor number 0. ## DESCRIPTION The Motorola DSP56001 is a fully programmable 24-bit digital signal processor found in Atari Falcon030-compatible computers. The _dsp56k_ special file is used to control the DSP56001, and to send and receive data using the bidirectional handshaked host port. To send a data stream to the signal processor, use write(2) to the device, and read(2) to receive processed data. The data can be sent or received in 8, 16, 24, or 32-bit quantities on the host side, but will always be seen as 24-bit quantities in the DSP56001. The following ioctl(2) calls are used to control the _dsp56k_ device: **DSP56K_UPLOAD** resets the DSP56001 and uploads a program. The third ioctl(2) argument must be a pointer to a _struct dsp56k_upload_ with members _.bin_ pointing to a DSP56001 binary program, and _.len_ set to the length of the program, counted in 24-bit words. **DSP56K_SET_TX_WSIZE** sets the transmit word size. Allowed values are in the range 1 to 4, and is the number of bytes that will be sent at a time to the DSP56001. These data quantities will either be padded with bytes containing zero, or truncated to fit the native 24-bit data format of the DSP56001. **DSP56K_SET_RX_WSIZE** sets the receive word size. Allowed values are in the range 1 to 4, and is the number of bytes that will be received at a time from the DSP56001. These data quantities will either truncated, or padded with a null byte ('\0'), to fit the native 24-bit data format of the DSP56001. **DSP56K_HOST_FLAGS** read and write the host flags. The host flags are four general-purpose bits that can be read by both the hosting computer and the DSP56001. Bits 0 and 1 can be written by the host, and bits 2 and 3 can be written by the DSP56001. To access the host flags, the third ioctl(2) argument must be a pointer to a _struct dsp56k_host_flags_. If bit 0 or 1 is set in the _.dir_ member, the corresponding bit in _.out_ will be written to the host flags. The state of all host flags will be returned in the lower four bits of the _.status_ member. **DSP56K_HOST_CMD** sends a host command. Allowed values are in the range 0 to 31, and is a user-defined command handled by the program running in the DSP56001. ## FILES _/dev/dsp56k_ * * *
# msr ## NAME msr - x86 CPU MSR access device ## DESCRIPTION _/dev/cpu/CPUNUM/msr_ provides an interface to read and write the model-specific registers (MSRs) of an x86 CPU. _CPUNUM_ is the number of the CPU to access as listed in _/proc/cpuinfo_. The register access is done by opening the file and seeking to the MSR number as offset in the file, and then reading or writing in chunks of 8 bytes. An I/O transfer of more than 8 bytes means multiple reads or writes of the same register. This file is protected so that it can be read and written only by the user _root_ , or members of the group _root_. ## NOTES The _msr_ driver is not auto-loaded. On modular kernels you might need to use the following command to load it explicitly before use: $ modprobe msr * * *
# fd ## NAME fd - floppy disk device ## CONFIGURATION Floppy drives are block devices with major number 2. Typically they are owned by root:floppy (i.e., user root, group floppy) and have either mode 0660 (access checking via group membership) or mode 0666 (everybody has access). The minor numbers encode the device type, drive number, and controller number. For each device type (that is, combination of density and track count) there is a base minor number. To this base number, add the drive's number on its controller and 128 if the drive is on the secondary controller. In the following device tables, _n_ represents the drive number. **Warning: if you use formats with more tracks than supported by** **your drive, you may cause it mechanical damage.** Trying once if more tracks than the usual 40/80 are supported should not damage it, but no warranty is given for that. If you are not sure, don't create device entries for those formats, so as to prevent their usage. Drive-independent device files which automatically detect the media format and capacity: Name Base minor # ─────────────── **fd** _n_ 0 5.25 inch double-density device files: Name Capacity Cyl. Sect. Heads Base KiB minor # ─────────────────────────────────────────────────────── **fd** _n_**d360** 360 40 9 2 4 5.25 inch high-density device files: Name Capacity Cyl. Sect. Heads Base KiB minor # ─────────────────────────────────────────────────────── **fd** _n_**h360** 360 40 9 2 20 **fd** _n_**h410** 410 41 10 2 48 **fd** _n_**h420** 420 42 10 2 64 **fd** _n_**h720** 720 80 9 2 24 **fd** _n_**h880** 880 80 11 2 80 **fd** _n_**h1200** 1200 80 15 2 8 **fd** _n_**h1440** 1440 80 18 2 40 **fd** _n_**h1476** 1476 82 18 2 56 **fd** _n_**h1494** 1494 83 18 2 72 **fd** _n_**h1600** 1600 80 20 2 92 3.5 inch double-density device files: Name Capacity Cyl. Sect. Heads Base KiB minor # ─────────────────────────────────────────────────────── **fd** _n_**u360** 360 80 9 1 12 **fd** _n_**u720** 720 80 9 2 16 **fd** _n_**u800** 800 80 10 2 120 **fd** _n_**u1040** 1040 80 13 2 84 **fd** _n_**u1120** 1120 80 14 2 88 3.5 inch high-density device files: Name Capacity Cyl. Sect. Heads Base KiB minor # ─────────────────────────────────────────────────────── **fd** _n_**u360** 360 40 9 2 12 **fd** _n_**u720** 720 80 9 2 16 **fd** _n_**u820** 820 82 10 2 52 **fd** _n_**u830** 830 83 10 2 68 **fd** _n_**u1440** 1440 80 18 2 28 **fd** _n_**u1600** 1600 80 20 2 124 **fd** _n_**u1680** 1680 80 21 2 44 **fd** _n_**u1722** 1722 82 21 2 60 **fd** _n_**u1743** 1743 83 21 2 76 **fd** _n_**u1760** 1760 80 22 2 96 **fd** _n_**u1840** 1840 80 23 2 116 **fd** _n_**u1920** 1920 80 24 2 100 3.5 inch extra-density device files: Name Capacity Cyl. Sect. Heads Base KiB minor # ─────────────────────────────────────────────────────── **fd** _n_**u2880** 2880 80 36 2 32 **fd** _n_**CompaQ** 2880 80 36 2 36 **fd** _n_**u3200** 3200 80 40 2 104 **fd** _n_**u3520** 3520 80 44 2 108 **fd** _n_**u3840** 3840 80 48 2 112 ## DESCRIPTION **fd** special files access the floppy disk drives in raw mode. The following ioctl(2) calls are supported by **fd** devices: **FDCLRPRM** clears the media information of a drive (geometry of disk in drive). **FDSETPRM** sets the media information of a drive. The media information will be lost when the media is changed. **FDDEFPRM** sets the media information of a drive (geometry of disk in drive). The media information will not be lost when the media is changed. This will disable autodetection. In order to reenable autodetection, you have to issue an **FDCLRPRM**. **FDGETDRVTYP** returns the type of a drive (name parameter). For formats which work in several drive types, **FDGETDRVTYP** returns a name which is appropriate for the oldest drive type which supports this format. **FDFLUSH** invalidates the buffer cache for the given drive. **FDSETMAXERRS** sets the error thresholds for reporting errors, aborting the operation, recalibrating, resetting, and reading sector by sector. **FDSETMAXERRS** gets the current error thresholds. **FDGETDRVTYP** gets the internal name of the drive. **FDWERRORCLR** clears the write error statistics. **FDWERRORGET** reads the write error statistics. These include the total number of write errors, the location and disk of the first write error, and the location and disk of the last write error. Disks are identified by a generation number which is incremented at (almost) each disk change. **FDTWADDLE** Switch the drive motor off for a few microseconds. This might be needed in order to access a disk whose sectors are too close together. **FDSETDRVPRM** sets various drive parameters. **FDGETDRVPRM** reads these parameters back. **FDGETDRVSTAT** gets the cached drive state (disk changed, write protected et al.) **FDPOLLDRVSTAT** polls the drive and return its state. **FDGETFDCSTAT** gets the floppy controller state. **FDRESET** resets the floppy controller under certain conditions. **FDRAWCMD** sends a raw command to the floppy controller. For more precise information, consult also the _< linux/fd.h>_ and _< linux/fdreg.h>_ include files, as well as the **floppycontrol**(1) manual page. ## FILES _/dev/fd*_ ## NOTES The various formats permit reading and writing many types of disks. However, if a floppy is formatted with an inter-sector gap that is too small, performance may drop, to the point of needing a few seconds to access an entire track. To prevent this, use interleaved formats. It is not possible to read floppies which are formatted using GCR (group code recording), which is used by Apple II and Macintosh computers (800k disks). Reading floppies which are hard sectored (one hole per sector, with the index hole being a little skewed) is not supported. This used to be common with older 8-inch floppies. * * *
# hd ## NAME hd - MFM/IDE hard disk devices ## DESCRIPTION The **hd*** devices are block devices to access MFM/IDE hard disk drives in raw mode. The master drive on the primary IDE controller (major device number 3) is **hda** ; the slave drive is **hdb**. The master drive of the second controller (major device number 22) is **hdc** and the slave is **hdd**. General IDE block device names have the form **hd** _X_ , or **hd** _XP_ , where _X_ is a letter denoting the physical drive, and _P_ is a number denoting the partition on that physical drive. The first form, **hd** _X_ , is used to address the whole drive. Partition numbers are assigned in the order the partitions are discovered, and only nonempty, nonextended partitions get a number. However, partition numbers 1–4 are given to the four partitions described in the MBR (the "primary" partitions), regardless of whether they are unused or extended. Thus, the first logical partition will be **hd** _X_**5**. Both DOS-type partitioning and BSD-disklabel partitioning are supported. You can have at most 63 partitions on an IDE disk. For example, _/dev/hda_ refers to all of the first IDE drive in the system; and _/dev/hdb3_ refers to the third DOS "primary" partition on the second one. They are typically created by: mknod -m 660 /dev/hda b 3 0 mknod -m 660 /dev/hda1 b 3 1 mknod -m 660 /dev/hda2 b 3 2 ... mknod -m 660 /dev/hda8 b 3 8 mknod -m 660 /dev/hdb b 3 64 mknod -m 660 /dev/hdb1 b 3 65 mknod -m 660 /dev/hdb2 b 3 66 ... mknod -m 660 /dev/hdb8 b 3 72 chown root:disk /dev/hd* ## FILES _/dev/hd*_ * * *
# ttyS ## NAME ttyS - serial terminal lines ## DESCRIPTION **ttyS[0-3]** are character devices for the serial terminal lines. They are typically created by: mknod -m 660 /dev/ttyS0 c 4 64 # base address 0x3f8 mknod -m 660 /dev/ttyS1 c 4 65 # base address 0x2f8 mknod -m 660 /dev/ttyS2 c 4 66 # base address 0x3e8 mknod -m 660 /dev/ttyS3 c 4 67 # base address 0x2e8 chown root:tty /dev/ttyS[0-3] ## FILES _/dev/ttyS[0-3]_ * * *
# magic ## NAME **magic** β€” file command's magic pattern file ## DESCRIPTION This manual page documents the format of magic files as used by the _file_(1) command, version 5.46. The _file_(1) command identifies the type of a file using, among other tests, a test for whether the file contains certain β€œmagic patterns”. The database of these β€œmagic patterns” is usually located in a binary file in _/usr/local/share/misc/magic.mgc_ or a directory of source text magic pattern fragment files in _/usr/local/share/misc/magic_. The database specifies what patterns are to be tested for, what message or MIME type to print if a particular pattern is found, and additional information to extract from the file. The format of the source fragment files that are used to build this database is as follows: Each line of a fragment file specifies a test to be performed. A test compares the data starting at a particular offset in the file with a byte value, a string or a numeric value. If the test succeeds, a message is printed. The line consists of the following fields: offset A number specifying the offset (in bytes) into the file of the data which is to be tested. This offset can be a negative number if it is: **β€’** The first direct offset of the magic entry (at continuation level 0), in which case it is interpreted an offset from end end of the file going backwards. This works only when a file descriptor to the file is available and it is a regular file. **β€’** A continuation offset relative to the end of the last up-level field (&). If the offset starts with the symbol β€œ+”, then all offsets are interpreted as from the beginning of the file (the default). type The type of the data to be tested. The possible values are: byte A one-byte value. short A two-byte value in this machine's native byte order. long A four-byte value in this machine's native byte order. quad An eight-byte value in this machine's native byte order. float A 32-bit single precision IEEE floating point number in this machine's native byte order. double A 64-bit double precision IEEE floating point number in this machine's native byte order. string A string of bytes. The string type specification can be optionally followed by a /<width> option and optionally followed by a set of flags [bCcftTtWw]*. Slash characters can be used to separate options for readability. The width limits the number of characters to be copied. Zero means all characters. The following flags are supported: b Force binary file test. C Use upper case insensitive matching: upper case characters in the magic match both lower and upper case characters in the target, whereas lower case characters in the magic only match upper case characters in the target. (not valid for regex) c Use lower case insensitive matching: lower case characters in the magic match both lower and upper case characters in the target, whereas upper case characters in the magic only match upper case characters in the target. (not valid for regex) To do a complete case insensitive match, specify both β€œc” and β€œC”. f Require that the matched string is a full word, not a partial word match. s Don't include the match length in the offset computation. (only valid for search and regex) T Trim the string, i.e. leading and trailing whitespace t Force text file test. W Compact whitespace in the target, which must contain at least one whitespace character. (not valid for regex) If the magic has n consecutive blanks, the target needs at least n consecutive blanks to match. w Treat every blank in the magic as an optional blank. is deleted before the string is printed. (not valid for regex) pstring A Pascal-style string where the first byte/short/int is interpreted as the unsigned length. The length defaults to byte and can be specified as a modifier. The following modifiers are supported: B A byte length (default). H A 2 byte big endian length. h A 2 byte little endian length. L A 4 byte big endian length. l A 4 byte little endian length. J The length includes itself in its count. The string is not NUL terminated. β€œJ” is used rather than the more valuable β€œI” because this type of length is a feature of the JPEG format. date A four-byte value interpreted as a UNIX date. qdate An eight-byte value interpreted as a UNIX date. ldate A four-byte value interpreted as a UNIX-style date, but interpreted as local time rather than UTC. qldate An eight-byte value interpreted as a UNIX- style date, but interpreted as local time rather than UTC. qwdate An eight-byte value interpreted as a Windows- style date. msdosdate A two-byte value interpreted as FAT/DOS-style date. msdostime A two-byte value interpreted as FAT/DOS-style time. beid3 A 32-bit ID3 length in big-endian byte order. beshort A two-byte value in big-endian byte order. belong A four-byte value in big-endian byte order. bequad An eight-byte value in big-endian byte order. befloat A 32-bit single precision IEEE floating point number in big-endian byte order. bedouble A 64-bit double precision IEEE floating point number in big-endian byte order. bedate A four-byte value in big-endian byte order, interpreted as a Unix date. beqdate An eight-byte value in big-endian byte order, interpreted as a Unix date. beldate A four-byte value in big-endian byte order, interpreted as a UNIX-style date, but interpreted as local time rather than UTC. beqldate An eight-byte value in big-endian byte order, interpreted as a UNIX-style date, but interpreted as local time rather than UTC. beqwdate An eight-byte value in big-endian byte order, interpreted as a Windows-style date. bemsdosdate A two-byte value in big-endian byte order, interpreted as FAT/DOS-style date. bemsdostime A two-byte value in big-endian byte order, interpreted as FAT/DOS-style time. bestring16 A two-byte unicode (UCS16) string in big- endian byte order. leid3 A 32-bit ID3 length in little-endian byte order. leshort A two-byte value in little-endian byte order. lelong A four-byte value in little-endian byte order. lequad An eight-byte value in little-endian byte order. lefloat A 32-bit single precision IEEE floating point number in little-endian byte order. ledouble A 64-bit double precision IEEE floating point number in little-endian byte order. ledate A four-byte value in little-endian byte order, interpreted as a UNIX date. leqdate An eight-byte value in little-endian byte order, interpreted as a UNIX date. leldate A four-byte value in little-endian byte order, interpreted as a UNIX-style date, but interpreted as local time rather than UTC. leqldate An eight-byte value in little-endian byte order, interpreted as a UNIX-style date, but interpreted as local time rather than UTC. leqwdate An eight-byte value in little-endian byte order, interpreted as a Windows-style date. lemsdosdate A two-byte value in little-endian byte order, interpreted as FAT/DOS-style date. lemsdostime A two-byte value in little-endian byte order, interpreted as FAT/DOS-style time. lestring16 A two-byte unicode (UCS16) string in little- endian byte order. melong A four-byte value in middle-endian (PDP-11) byte order. medate A four-byte value in middle-endian (PDP-11) byte order, interpreted as a UNIX date. meldate A four-byte value in middle-endian (PDP-11) byte order, interpreted as a UNIX-style date, but interpreted as local time rather than UTC. indirect Starting at the given offset, consult the magic database again. The offset of the indirect magic is by default absolute in the file, but one can specify /r to indicate that the offset is relative from the beginning of the entry. name Define a β€œnamed” magic instance that can be called from another use magic entry, like a subroutine call. Named instance direct magic offsets are relative to the offset of the previous matched entry, but indirect offsets are relative to the beginning of the file as usual. Named magic entries return true if there was a match in the evaluation of the entry, or if there was a previous existing match. use Recursively call the named magic starting from the current offset. If the name of the referenced begins with a ^ then the endianness of the magic is switched; if the magic mentioned leshort for example, it is treated as beshort and vice versa. This is useful to avoid duplicating the rules for different endianness. regex A regular expression match in extended POSIX regular expression syntax (like egrep). Regular expressions can take exponential time to process, and their performance is hard to predict, so their use is discouraged. When used in production environments, their performance should be carefully checked. The size of the string to search should also be limited by specifying /<length>, to avoid performance issues scanning long files. The type specification can also be optionally followed by /[c][s][l]. The β€œc” flag makes the match case insensitive, while the β€œs” flag update the offset to the start offset of the match, rather than the end. The β€œl” modifier, changes the limit of length to mean number of lines instead of a byte count. Lines are delimited by the platforms native line delimiter. When a line count is specified, an implicit byte count also computed assuming each line is 80 characters long. If neither a byte or line count is specified, the search is limited automatically to 8KiB. ^ and $ match the beginning and end of individual lines, respectively, not beginning and end of file. search A literal string search starting at the given offset. The same modifier flags can be used as for string patterns. The search expression must contain the range in the form /number, that is the number of positions at which the match will be attempted, starting from the start offset. This is suitable for searching larger binary expressions with variable offsets, using \ escapes for special characters. The order of modifier and number is not relevant. default This is intended to be used with the test _x_ (which is always true) and it has no type. It matches when no other test at that continuation level has matched before. Clearing that matched tests for a continuation level, can be done using the clear test. clear This test is always true and clears the match flag for that continuation level. It is intended to be used with the default test. der Parse the file as a DER Certificate file. The test field is used as a der type that needs to be matched. The DER types are: eoc, bool, int, bit_str, octet_str, null, obj_id, obj_desc, ext, real, enum, embed, utf8_str, rel_oid, time, res2, seq, set, num_str, prt_str, t61_str, vid_str, ia5_str, utc_time, gen_time, gr_str, vis_str, gen_str, univ_str, char_str, bmp_str, date, tod, datetime, duration, oid-iri, rel-oid-iri. These types can be followed by an optional numeric size, which indicates the field width in bytes. guid A Globally Unique Identifier, parsed and printed as XXXXXXXX-XXXX-XXXX-XXXX- XXXXXXXXXXXX. It's format is a string. offset This is a quad value indicating the current offset of the file. It can be used to determine the size of the file or the magic buffer. For example the magic entries: -0 offset x this file is %lld bytes -0 offset <=100 must be more than 100 \ bytes and is only %lld octal A string representing an octal number. For compatibility with the Single Unix Standard, the type specifiers dC and d1 are equivalent to byte, the type specifiers uC and u1 are equivalent to ubyte, the type specifiers dS and d2 are equivalent to short, the type specifiers uS and u2 are equivalent to ushort, the type specifiers dI, dL, and d4 are equivalent to long, the type specifiers uI, uL, and u4 are equivalent to ulong, the type specifier d8 is equivalent to quad, the type specifier u8 is equivalent to uquad, and the type specifier s is equivalent to string. In addition, the type specifier dQ is equivalent to quad and the type specifier uQ is equivalent to uquad. Each top-level magic pattern (see below for an explanation of levels) is classified as text or binary according to the types used. Types β€œregex” and β€œsearch” are classified as text tests, unless non-printable characters are used in the pattern. All other tests are classified as binary. A top-level pattern is considered to be a test text when all its patterns are text patterns; otherwise, it is considered to be a binary pattern. When matching a file, binary patterns are tried first; if no match is found, and the file looks like text, then its encoding is determined and the text patterns are tried. The numeric types may optionally be followed by an operand and a numeric value, to specify that the value is to be modified according to the operand and the numeric value before any comparisons are done. The following operands are supported: &, |, ↑, +, -, *, /, %. Prepending a u to the type indicates that ordered comparisons should be unsigned. test The value to be compared with the value from the file. If the type is numeric, this value is specified in C form; if it is a string, it is specified as a C string with the usual escapes permitted (e.g. \n for new-line). Numeric values may be preceded by a character indicating the operation to be performed. It may be =, to specify that the value from the file must equal the specified value, <, to specify that the value from the file must be less than the specified value, >, to specify that the value from the file must be greater than the specified value, &, to specify that the value from the file must have set all of the bits that are set in the specified value, ^, to specify that the value from the file must have clear any of the bits that are set in the specified value, or ~, the value specified after is negated before tested. x, to specify that any value will match. If the character is omitted, it is assumed to be =. Operators &, ^, and ~ don't work with floats and doubles. The operator ! specifies that the line matches if the test does _not_ succeed. Numeric values are specified in C form; e.g. 13 is decimal, 013 is octal, and 0x13 is hexadecimal. Numeric operations are not performed on date types, instead the numeric value is interpreted as an offset. For string values, the string from the file must match the specified string. The operators =, < and > (but not &) can be applied to strings. The length used for matching is that of the string argument in the magic file. This means that a line can match any non-empty string (usually used to then print the string), with _> \0_ (because all non-empty strings are greater than the empty string). Dates are treated as numerical values in the respective internal representation. The special test _x_ always evaluates to true. message The message to be printed if the comparison succeeds. If the string contains a _printf_(3) format specification, the value from the file (with any specified masking performed) is printed using the message as the format string. If the string begins with β€œ\b”, the message printed is the remainder of the string with no whitespace added before it: multiple matches are normally separated by a single space. An APPLE 4+4 character APPLE creator and type can be specified as: !:apple CREATYPE A slash-separated list of commonly found filename extensions can be specified as: !:ext ext[/ext...] i.e. the literal string β€œ!:ext” followed by a slash-separated list of commonly found extensions; for example for JPEG images: !:ext jpeg/jpg/jpe/jfif A MIME type is given on a separate line, which must be the next non-blank or comment line after the magic line that identifies the file type, and has the following format: !:mime MIMETYPE i.e. the literal string β€œ!:mime” followed by the MIME type. An optional strength can be supplied on a separate line which refers to the current magic description using the following format: !:strength OP VALUE The operand OP can be: +, -, *, or / and VALUE is a constant between 0 and 255. This constant is applied using the specified operand to the currently computed default magic strength. Some file formats contain additional information which is to be printed along with the file type or need additional tests to determine the true file type. These additional tests are introduced by one or more _>_ characters preceding the offset. The number of _>_ on the line indicates the level of the test; a line with no _>_ at the beginning is considered to be at level 0. Tests are arranged in a tree-like hierarchy: if the test on a line at level _n_ succeeds, all following tests at level _n+1_ are performed, and the messages printed if the tests succeed, until a line with level _n_ (or less) appears. For more complex files, one can use empty messages to get just the "if/then" effect, in the following way: 0 string MZ >0x18 uleshort <0x40 MS-DOS executable >0x18 uleshort >0x3f extended PC executable (e.g., MS Windows) Offsets do not need to be constant, but can also be read from the file being examined. If the first character following the last _>_ is a _(_ then the string after the parenthesis is interpreted as an indirect offset. That means that the number after the parenthesis is used as an offset in the file. The value at that offset is read, and is used again as an offset in the file. Indirect offsets are of the form: (_x [[.,][bBcCeEfFgGhHiIlmosSqQ]][+-][ y_ _])_. The value of _x_ is used as an offset in the file. A byte, id3 length, short or long is read at that offset depending on the _[bBcCeEfFgGhHiIlLmsSqQ]_ type specifier. The value is treated as signed if β€œ,” is specified or unsigned if β€œ.” is specified. The capitalized types interpret the number as a big endian value, whereas the small letter versions interpret the number as a little endian value; the _m_ type interprets the number as a middle endian (PDP-11) value. To that number the value of _y_ is added and the result is used as an offset in the file. The default type if one is not specified is long. The following types are recognized: **Type Sy Mnemonic Sy Endian Sy Size** bcBC Byte/Char N/A 1 efg Double Little 8 EFG Double Big 8 hs Half/Short Little 2 HS Half/Short Big 2 i ID3 Little 4 I ID3 Big 4 l Long Little 4 L Long Big 4 m Middle Middle 4 o Octal Textual Variable q Quad Little 8 Q Quad Big 8 That way variable length structures can be examined: # MS Windows executables are also valid MS-DOS executables 0 string MZ >0x18 uleshort <0x40 MZ executable (MS-DOS) # skip the whole block below if it is not an extended executable >0x18 uleshort >0x3f >>(0x3c.l) string PE\0\0 PE executable (MS-Windows) >>(0x3c.l) string LX\0\0 LX executable (OS/2) This strategy of examining has a drawback: you must make sure that you eventually print something, or users may get empty output (such as when there is neither PE\0\0 nor LE\0\0 in the above example). If this indirect offset cannot be used directly, simple calculations are possible: appending _[+-*/% &|^]number_ inside parentheses allows one to modify the value read from the file before it is used as an offset: # MS Windows executables are also valid MS-DOS executables 0 string MZ # sometimes, the value at 0x18 is less that 0x40 but there's still an # extended executable, simply appended to the file >0x18 uleshort <0x40 >>(4.s*512) leshort 0x014c COFF executable (MS-DOS, DJGPP) >>(4.s*512) leshort !0x014c MZ executable (MS-DOS) Sometimes you do not know the exact offset as this depends on the length or position (when indirection was used before) of preceding fields. You can specify an offset relative to the end of the last up-level field using β€˜&’ as a prefix to the offset: 0 string MZ >0x18 uleshort >0x3f >>(0x3c.l) string PE\0\0 PE executable (MS-Windows) # immediately following the PE signature is the CPU type >>>&0 leshort 0x14c for Intel 80386 >>>&0 leshort 0x8664 for x86-64 >>>&0 leshort 0x184 for DEC Alpha Indirect and relative offsets can be combined: 0 string MZ >0x18 uleshort <0x40 >>(4.s*512) leshort !0x014c MZ executable (MS-DOS) # if it's not COFF, go back 512 bytes and add the offset taken # from byte 2/3, which is yet another way of finding the start # of the extended executable >>>&(2.s-514) string LE LE executable (MS Windows VxD driver) Or the other way around: 0 string MZ >0x18 uleshort >0x3f >>(0x3c.l) string LE\0\0 LE executable (MS-Windows) # at offset 0x80 (-4, since relative offsets start at the end # of the up-level match) inside the LE header, we find the absolute # offset to the code area, where we look for a specific signature >>>(&0x7c.l+0x26) string UPX \b, UPX compressed Or even both! 0 string MZ >0x18 uleshort >0x3f >>(0x3c.l) string LE\0\0 LE executable (MS-Windows) # at offset 0x58 inside the LE header, we find the relative offset # to a data area where we look for a specific signature >>>&(&0x54.l-3) string UNACE \b, ACE self-extracting archive If you have to deal with offset/length pairs in your file, even the second value in a parenthesized expression can be taken from the file itself, using another set of parentheses. Note that this additional indirect offset is always relative to the start of the main indirect offset. 0 string MZ >0x18 uleshort >0x3f >>(0x3c.l) string PE\0\0 PE executable (MS-Windows) # search for the PE section called ".idata"... >>>&0xf4 search/0x140 .idata # ...and go to the end of it, calculated from start+length; # these are located 14 and 10 bytes after the section name >>>>(&0xe.l+(-4)) string PK\3\4 \b, ZIP self-extracting archive If you have a list of known values at a particular continuation level, and you want to provide a switch-like default case: # clear that continuation level match >18 clear x >18 lelong 1 one >18 lelong 2 two >18 default x # print default match >>18 lelong x unmatched 0x%x ## BUGS The formats long, belong, lelong, melong, short, beshort, and leshort do not depend on the length of the C data types short and long on the platform, even though the Single Unix Specification implies that they do. However, as OS X Mountain Lion has passed the Single Unix Specification validation suite, and supplies a version of _file_(1) in which they do not depend on the sizes of the C data types and that is built for a 64-bit environment in which long is 8 bytes rather than 4 bytes, presumably the validation suite does not test whether, for example long refers to an item with the same size as the C data type long. There should probably be type names int8, uint8, int16, uint16, int32, uint32, int64, and uint64, and specified-byte-order variants of them, to make it clearer that those types have specified widths. * * *
# ioctl_tty ## NAME ioctl_tty - ioctls for terminals and serial lines ## LIBRARY Standard C library (_libc_ , _-lc_) ## SYNOPSIS **#include <asm/termbits.h> **/* Definition of constants */ **#include <sys/ioctl.h>** **int ioctl(int** _fd_**, int** _op_**, ...);** ## DESCRIPTION The ioctl(2) call for terminals and serial ports accepts many possible operation arguments. Most require a third argument, of varying type, here called _argp_ or _arg_. Use of **ioctl**() makes for nonportable programs. Use the POSIX interface described in termios(3) whenever possible. **Get and set terminal attributes** TCGETS(2const) TCSETS(2const) TCSETSW(2const) TCSETSF(2const) TCGETS(2const) TCSETS(2const) TCSETSW(2const) TCSETSF(2const) TCGETS(2const) TCSETS(2const) TCSETSW(2const) TCSETSF(2const) **Locking the termios structure** TIOCGLCKTRMIOS(2const) TIOCSLCKTRMIOS(2const) **Get and set window size** TIOCGWINSZ(2const) TIOCSWINSZ(2const) **Sending a break** TCSBRK(2const) TCSBRKP(2const) TIOCSBRK(2const) TIOCCBRK(2const) **Software flow control** TCXONC(2const) **Buffer count and flushing** FIONREAD(2const) TIOCINQ(2const) TIOCOUTQ(2const) TCFLSH(2const) TIOCSERGETLSR(2const) **Faking input** TIOCSTI(2const) **Redirecting console output** TIOCCONS(2const) **Controlling terminal** TIOCSCTTY(2const) TIOCNOTTY(2const) **Process group and session ID** TIOCGPGRP(2const) TIOCSPGRP(2const) TIOCGSID(2const) **Exclusive mode** TIOCEXCL(2const) TIOCGEXCL(2const) TIOCNXCL(2const) **Line discipline** TIOCGETD(2const) TIOCSETD(2const) **Pseudoterminal ioctls** TIOCPKT(2const) TIOCGPKT(2const) TIOCSPTLCK(2const) TIOCGPTLCK(2const) TIOCGPTPEER(2const) **Modem control** TIOCMGET(2const) TIOCMSET(2const) TIOCMBIC(2const) TIOCMBIS(2const) TIOCMIWAIT(2const) TIOCGICOUNT(2const) **Marking a line as local** TIOCGSOFTCAR(2const) TIOCSSOFTCAR(2const) **Linux-specific** For the TIOCLINUX(2const) ioctl, see ioctl_console(2). **Kernel debugging** TIOCTTYGSTRUCT(2const) ## RETURN VALUE On success, 0 is returned. On error, -1 is returned, and _errno_ is set to indicate the error. * * *
# loop ## NAME loop, loop-control - loop devices ## SYNOPSIS #include <linux/loop.h> ## DESCRIPTION The loop device is a block device that maps its data blocks not to a physical device such as a hard disk or optical disk drive, but to the blocks of a regular file in a filesystem or to another block device. This can be useful for example to provide a block device for a filesystem image stored in a file, so that it can be mounted with the mount(8) command. You could do $ **dd if=/dev/zero of=file.img bs=1MiB count=10** ; $ **sudo losetup /dev/loop4 file.img** ; $ **sudo mkfs -t ext4 /dev/loop4** ; $ **sudo mkdir /myloopdev** ; $ **sudo mount /dev/loop4 /myloopdev** ; See losetup(8) for another example. A transfer function can be specified for each loop device for encryption and decryption purposes. The following ioctl(2) operations are provided by the loop block device: **LOOP_SET_FD** Associate the loop device with the open file whose file descriptor is passed as the (third) ioctl(2) argument. **LOOP_CLR_FD** Disassociate the loop device from any file descriptor. **LOOP_SET_STATUS** Set the status of the loop device using the (third) ioctl(2) argument. This argument is a pointer to a _loop_info_ structure, defined in _< linux/loop.h>_ as: struct loop_info { int lo_number; /* ioctl r/o */ dev_t lo_device; /* ioctl r/o */ unsigned long lo_inode; /* ioctl r/o */ dev_t lo_rdevice; /* ioctl r/o */ int lo_offset; int lo_encrypt_type; int lo_encrypt_key_size; /* ioctl w/o */ int lo_flags; /* ioctl r/w (r/o before Linux 2.6.25) */ char lo_name[LO_NAME_SIZE]; unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ unsigned long lo_init[2]; char reserved[4]; }; The encryption type (_lo_encrypt_type_) should be one of **LO_CRYPT_NONE** , **LO_CRYPT_XOR** , **LO_CRYPT_DES** , **LO_CRYPT_FISH2** , **LO_CRYPT_BLOW** , **LO_CRYPT_CAST128** , **LO_CRYPT_IDEA** , **LO_CRYPT_DUMMY** , **LO_CRYPT_SKIPJACK** , or (since Linux 2.6.0) **LO_CRYPT_CRYPTOAPI**. The _lo_flags_ field is a bit mask that can include zero or more of the following: **LO_FLAGS_READ_ONLY** The loopback device is read-only. **LO_FLAGS_AUTOCLEAR**(since Linux 2.6.25) The loopback device will autodestruct on last close. **LO_FLAGS_PARTSCAN**(since Linux 3.2) Allow automatic partition scanning. **LO_FLAGS_DIRECT_IO**(since Linux 4.10) Use direct I/O mode to access the backing file. The only _lo_flags_ that can be modified by **LOOP_SET_STATUS** are **LO_FLAGS_AUTOCLEAR** and **LO_FLAGS_PARTSCAN**. **LOOP_GET_STATUS** Get the status of the loop device. The (third) ioctl(2) argument must be a pointer to a _struct loop_info_. **LOOP_CHANGE_FD**(since Linux 2.6.5) Switch the backing store of the loop device to the new file identified file descriptor specified in the (third) ioctl(2) argument, which is an integer. This operation is possible only if the loop device is read-only and the new backing store is the same size and type as the old backing store. **LOOP_SET_CAPACITY**(since Linux 2.6.30) Resize a live loop device. One can change the size of the underlying backing store and then use this operation so that the loop driver learns about the new size. This operation takes no argument. **LOOP_SET_DIRECT_IO**(since Linux 4.10) Set DIRECT I/O mode on the loop device, so that it can be used to open backing file. The (third) ioctl(2) argument is an unsigned long value. A nonzero represents direct I/O mode. **LOOP_SET_BLOCK_SIZE**(since Linux 4.14) Set the block size of the loop device. The (third) ioctl(2) argument is an unsigned long value. This value must be a power of two in the range [512,pagesize]; otherwise, an **EINVAL** error results. **LOOP_CONFIGURE**(since Linux 5.8) Setup and configure all loop device parameters in a single step using the (third) ioctl(2) argument. This argument is a pointer to a _loop_config_ structure, defined in _< linux/loop.h>_ as: struct loop_config { __u32 fd; __u32 block_size; struct loop_info64 info; __u64 __reserved[8]; }; In addition to doing what **LOOP_SET_STATUS** can do, **LOOP_CONFIGURE** can also be used to do the following: β€’ set the correct block size immediately by setting _loop_config.block_size_ ; β€’ explicitly request direct I/O mode by setting **LO_FLAGS_DIRECT_IO** in _loop_config.info.lo_flags_ ; and β€’ explicitly request read-only mode by setting **LO_FLAGS_READ_ONLY** in _loop_config.info.lo_flags_. Since Linux 2.6, there are two new ioctl(2) operations: **LOOP_SET_STATUS64** **LOOP_GET_STATUS64** These are similar to **LOOP_SET_STATUS** and **LOOP_GET_STATUS** described above but use the _loop_info64_ structure, which has some additional fields and a larger range for some other fields: struct loop_info64 { uint64_t lo_device; /* ioctl r/o */ uint64_t lo_inode; /* ioctl r/o */ uint64_t lo_rdevice; /* ioctl r/o */ uint64_t lo_offset; uint64_t lo_sizelimit; /* bytes, 0 == max available */ uint32_t lo_number; /* ioctl r/o */ uint32_t lo_encrypt_type; uint32_t lo_encrypt_key_size; /* ioctl w/o */ uint32_t lo_flags; i /* ioctl r/w (r/o before Linux 2.6.25) */ uint8_t lo_file_name[LO_NAME_SIZE]; uint8_t lo_crypt_name[LO_NAME_SIZE]; uint8_t lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ uint64_t lo_init[2]; }; **/dev/loop-control** Since Linux 3.1, the kernel provides the _/dev/loop-control_ device, which permits an application to dynamically find a free device, and to add and remove loop devices from the system. To perform these operations, one first opens _/dev/loop-control_ and then employs one of the following ioctl(2) operations: **LOOP_CTL_GET_FREE** Allocate or find a free loop device for use. On success, the device number is returned as the result of the call. This operation takes no argument. **LOOP_CTL_ADD** Add the new loop device whose device number is specified as a long integer in the third ioctl(2) argument. On success, the device index is returned as the result of the call. If the device is already allocated, the call fails with the error **EEXIST**. **LOOP_CTL_REMOVE** Remove the loop device whose device number is specified as a long integer in the third ioctl(2) argument. On success, the device number is returned as the result of the call. If the device is in use, the call fails with the error **EBUSY**. ## FILES _/dev/loop*_ The loop block special device files. ## EXAMPLES The program below uses the _/dev/loop-control_ device to find a free loop device, opens the loop device, opens a file to be used as the underlying storage for the device, and then associates the loop device with the backing store. The following shell session demonstrates the use of the program: $ **dd if=/dev/zero of=file.img bs=1MiB count=10** ; 10+0 records in 10+0 records out 10485760 bytes (10 MB) copied, 0.00609385 s, 1.7 GB/s $ **sudo ./mnt_loop file.img** ; loopname = /dev/loop5 **Program source** #include <fcntl.h> #include <linux/loop.h> #include <sys/ioctl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \ } while (0) int main(int argc, char *argv[]) { int loopctlfd, loopfd, backingfile; long devnr; char loopname[4096]; if (argc != 2) { fprintf(stderr, "Usage: %s backing-file\n", argv[0]); exit(EXIT_FAILURE); } loopctlfd = open("/dev/loop-control", O_RDWR); if (loopctlfd == -1) errExit("open: /dev/loop-control"); devnr = ioctl(loopctlfd, LOOP_CTL_GET_FREE); if (devnr == -1) errExit("ioctl-LOOP_CTL_GET_FREE"); sprintf(loopname, "/dev/loop%ld", devnr); printf("loopname = %s\n", loopname); loopfd = open(loopname, O_RDWR); if (loopfd == -1) errExit("open: loopname"); backingfile = open(argv[1], O_RDWR); if (backingfile == -1) errExit("open: backing-file"); if (ioctl(loopfd, LOOP_SET_FD, backingfile) == -1) errExit("ioctl-LOOP_SET_FD"); exit(EXIT_SUCCESS); } * * *
# vcs ## NAME vcs, vcsa - virtual console memory ## DESCRIPTION _/dev/vcs0_ is a character device with major number 7 and minor number 0, usually with mode 0644 and ownership root:tty. It refers to the memory of the currently displayed virtual console terminal. _/dev/vcs[1-63]_ are character devices for virtual console terminals, they have major number 7 and minor number 1 to 63, usually mode 0644 and ownership root:tty. _/dev/vcsa[0-63]_ are the same, but using _unsigned short_ s (in host byte order) that include attributes, and prefixed with four bytes giving the screen dimensions and cursor position: _lines_ , _columns_ , _x_ , _y_. (_x_ = _y_ = 0 at the top left corner of the screen.) When a 512-character font is loaded, the 9th bit position can be fetched by applying the ioctl(2) **VT_GETHIFONTMASK** operation (available since Linux 2.6.18) on _/dev/tty[1-63]_ ; the value is returned in the _unsigned short_ pointed to by the third ioctl(2) argument. These devices replace the screendump ioctl(2) operations of ioctl_console(2), so the system administrator can control access using filesystem permissions. The devices for the first eight virtual consoles may be created by: for x in 0 1 2 3 4 5 6 7 8; do mknod -m 644 /dev/vcs$x c 7 $x; mknod -m 644 /dev/vcsa$x c 7 $[$x+128]; done chown root:tty /dev/vcs* No ioctl(2) requests are supported. ## FILES _/dev/vcs[0-63]_ _/dev/vcsa[0-63]_ ## VERSIONS Introduced with Linux 1.1.92. ## EXAMPLES You may do a screendump on vt3 by switching to vt1 and typing cat /dev/vcs3 >foo Note that the output does not contain newline characters, so some processing may be required, like in fold -w 81 /dev/vcs3 | lpr or (horrors) setterm -dump 3 -file /proc/self/fd/1 The _/dev/vcsa0_ device is used for Braille support. This program displays the character and screen attributes under the cursor of the second virtual console, then changes the background color there: #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/vt.h> int main(void) { int fd; char *device = "/dev/vcsa2"; char *console = "/dev/tty2"; struct {unsigned char lines, cols, x, y;} scrn; unsigned short s; unsigned short mask; unsigned char attrib; int ch; fd = open(console, O_RDWR); if (fd < 0) { perror(console); exit(EXIT_FAILURE); } if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) { perror("VT_GETHIFONTMASK"); exit(EXIT_FAILURE); } (void) close(fd); fd = open(device, O_RDWR); if (fd < 0) { perror(device); exit(EXIT_FAILURE); } (void) read(fd, &scrn, 4); (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), SEEK_SET); (void) read(fd, &s, 2); ch = s & 0xff; if (s & mask) ch |= 0x100; attrib = ((s & ~mask) >> 8); printf("ch=%#03x attrib=%#02x\n", ch, attrib); s ^= 0x1000; (void) lseek(fd, -2, SEEK_CUR); (void) write(fd, &s, 2); exit(EXIT_SUCCESS); } * * *
# sk98lin ## NAME sk98lin - Marvell/SysKonnect Gigabit Ethernet driver v6.21 ## SYNOPSIS **insmod sk98lin.o**[**Speed_A=**_i,j,..._] [**Speed_B=**_i,j,..._] [**AutoNeg_A=**_i,j,..._] [**AutoNeg_B=**_i,j,..._] [**DupCap_A=**_i,j,..._] [**DupCap_B=**_i,j,..._] [**FlowCtrl_A=**_i,j,..._] [**FlowCtrl_B=**_i,j,..._] [**Role_A=**_i,j,..._] [**Role_B=**_i,j,..._] [**ConType=**_i,j,..._] [**Moderation=**_i,j,..._] [**IntsPerSec=**_i,j,..._] [**PrefPort=**_i,j,..._] [**RlmtMode=**_i,j,..._] ## DESCRIPTION **Note** : This obsolete driver was removed in Linux 2.6.26. **sk98lin** is the Gigabit Ethernet driver for Marvell and SysKonnect network adapter cards. It supports SysKonnect SK-98xx/SK-95xx compliant Gigabit Ethernet Adapter and any Yukon compliant chipset. When loading the driver using insmod, parameters for the network adapter cards might be stated as a sequence of comma separated commands. If for instance two network adapters are installed and AutoNegotiation on Port A of the first adapter should be ON, but on the Port A of the second adapter switched OFF, one must enter: insmod sk98lin.o AutoNeg_A=On,Off After **sk98lin** is bound to one or more adapter cards and the _/proc_ filesystem is mounted on your system, a dedicated statistics file will be created in the folder _/proc/net/sk98lin_ for all ports of the installed network adapter cards. Those files are named _eth[x]_ , where _x_ is the number of the interface that has been assigned to a dedicated port by the system. If loading is finished, any desired IP address can be assigned to the respective _eth[x]_ interface using the ifconfig(8) command. This causes the adapter to connect to the Ethernet and to display a status message on the console saying "ethx: network connection up using port y" followed by the configured or detected connection parameters. The **sk98lin** also supports large frames (also called jumbo frames). Using jumbo frames can improve throughput tremendously when transferring large amounts of data. To enable large frames, the MTU (maximum transfer unit) size for an interface is to be set to a high value. The default MTU size is 1500 and can be changed up to 9000 (bytes). Setting the MTU size can be done when assigning the IP address to the interface or later by using the ifconfig(8) command with the mtu parameter. If for instance eth0 needs an IP address and a large frame MTU size, the following two commands might be used: ifconfig eth0 10.1.1.1 ifconfig eth0 mtu 9000 Those two commands might even be combined into one: ifconfig eth0 10.1.1.1 mtu 9000 Note that large frames can be used only if permitted by your network infrastructure. This means, that any switch being used in your Ethernet must also support large frames. Quite some switches support large frames, but need to be configured to do so. Most of the times, their default setting is to support only standard frames with an MTU size of 1500 (bytes). In addition to the switches inside the network, all network adapters that are to be used must also be enabled regarding jumbo frames. If an adapter is not set to receive large frames, it will simply drop them. Switching back to the standard Ethernet frame size can be done by using the ifconfig(8) command again: ifconfig eth0 mtu 1500 The Marvell/SysKonnect Gigabit Ethernet driver for Linux is able to support VLAN and Link Aggregation according to IEEE standards 802.1, 802.1q, and 802.3ad. Those features are available only after installation of open source modules which can be found on the Internet: _VLAN_ : ⟨http://www.candelatech.com/~greear/vlan.html⟩ _Link Aggregation_ : ⟨http://www.st.rim.or.jp/~yumo⟩ Note that Marvell/SysKonnect does not offer any support for these open source modules and does not take the responsibility for any kind of failures or problems arising when using these modules. **Parameters** **Speed_A=**_i,j,..._ This parameter is used to set the speed capabilities of port A of an adapter card. It is valid only for Yukon copper adapters. Possible values are: _10_ , _100_ , _1000_ , or _Auto_ ; _Auto_ is the default. Usually, the speed is negotiated between the two ports during link establishment. If this fails, a port can be forced to a specific setting with this parameter. **Speed_B=**_i,j,..._ This parameter is used to set the speed capabilities of port B of an adapter card. It is valid only for Yukon copper adapters. Possible values are: _10_ , _100_ , _1000_ , or _Auto_ ; _Auto_ is the default. Usually, the speed is negotiated between the two ports during link establishment. If this fails, a port can be forced to a specific setting with this parameter. **AutoNeg_A=**_i,j,..._ Enables or disables the use of autonegotiation of port A of an adapter card. Possible values are: _On_ , _Off_ , or _Sense_ ; _On_ is the default. The _Sense_ mode automatically detects whether the link partner supports auto-negotiation or not. **AutoNeg_B=**_i,j,..._ Enables or disables the use of autonegotiation of port B of an adapter card. Possible values are: _On_ , _Off_ , or _Sense_ ; _On_ is the default. The _Sense_ mode automatically detects whether the link partner supports auto-negotiation or not. **DupCap_A=**_i,j,..._ This parameter indicates the duplex mode to be used for port A of an adapter card. Possible values are: _Half_ , _Full_ , or _Both_ ; _Both_ is the default. This parameter is relevant only if AutoNeg_A of port A is not set to _Sense_. If AutoNeg_A is set to _On_ , all three values of DupCap_A ( _Half_ , _Full_ , or _Both_) might be stated. If AutoNeg_A is set to _Off_ , only DupCap_A values _Full_ and _Half_ are allowed. This DupCap_A parameter is useful if your link partner does not support all possible duplex combinations. **DupCap_B=**_i,j,..._ This parameter indicates the duplex mode to be used for port B of an adapter card. Possible values are: _Half_ , _Full_ , or _Both_ ; _Both_ is the default. This parameter is relevant only if AutoNeg_B of port B is not set to _Sense_. If AutoNeg_B is set to _On_ , all three values of DupCap_B ( _Half_ , _Full_ , or _Both_) might be stated. If AutoNeg_B is set to _Off_ , only DupCap_B values _Full_ and _Half_ are allowed. This DupCap_B parameter is useful if your link partner does not support all possible duplex combinations. **FlowCtrl_A=**_i,j,..._ This parameter can be used to set the flow control capabilities the port reports during auto-negotiation. Possible values are: _Sym_ , _SymOrRem_ , _LocSend_ , or _None_ ; _SymOrRem_ is the default. The different modes have the following meaning: _Sym_ = Symmetric Both link partners are allowed to send PAUSE frames. _SymOrRem_ = SymmetricOrRemote Both or only remote partner are allowed to send PAUSE frames. _LocSend_ = LocalSend Only local link partner is allowed to send PAUSE frames. _None_ = None No link partner is allowed to send PAUSE frames. Note that this parameter is ignored if AutoNeg_A is set to _Off_. **FlowCtrl_B=**_i,j,..._ This parameter can be used to set the flow control capabilities the port reports during auto-negotiation. Possible values are: _Sym_ , _SymOrRem_ , _LocSend_ , or _None_ ; _SymOrRem_ is the default. The different modes have the following meaning: _Sym_ = Symmetric Both link partners are allowed to send PAUSE frames. _SymOrRem_ = SymmetricOrRemote Both or only remote partner are allowed to send PAUSE frames. _LocSend_ = LocalSend Only local link partner is allowed to send PAUSE frames. _None_ = None No link partner is allowed to send PAUSE frames. Note that this parameter is ignored if AutoNeg_B is set to _Off_. **Role_A=**_i,j,..._ This parameter is valid only for 1000Base-T adapter cards. For two 1000Base-T ports to communicate, one must take the role of the master (providing timing information), while the other must be the slave. Possible values are: _Auto_ , _Master_ , or _Slave_ ; _Auto_ is the default. Usually, the role of a port is negotiated between two ports during link establishment, but if that fails the port A of an adapter card can be forced to a specific setting with this parameter. **Role_B=**_i,j,..._ This parameter is valid only for 1000Base-T adapter cards. For two 1000Base-T ports to communicate, one must take the role of the master (providing timing information), while the other must be the slave. Possible values are: _Auto_ , _Master_ , or _Slave_ ; _Auto_ is the default. Usually, the role of a port is negotiated between two ports during link establishment, but if that fails the port B of an adapter card can be forced to a specific setting with this parameter. **ConType=**_i,j,..._ This parameter is a combination of all five per-port parameters within one single parameter. This simplifies the configuration of both ports of an adapter card. The different values of this variable reflect the most meaningful combinations of port parameters. Possible values and their corresponding combination of per-port parameters: **ConType DupCap AutoNeg FlowCtrl Role Speed** _Auto_ Both On SymOrRem Auto Auto _100FD_ Full Off None Auto 100 _100HD_ Half Off None Auto 100 _10FD_ Full Off None Auto 10 _10HD_ Half Off None Auto 10 Stating any other port parameter together with this _ConType_ parameter will result in a merged configuration of those settings. This is due to the fact, that the per-port parameters (e.g., _Speed_A_) have a higher priority than the combined variable _ConType_. **Moderation=**_i,j,..._ Interrupt moderation is employed to limit the maximum number of interrupts the driver has to serve. That is, one or more interrupts (which indicate any transmit or receive packet to be processed) are queued until the driver processes them. When queued interrupts are to be served, is determined by the _IntsPerSec_ parameter, which is explained later below. Possible moderation modes are: _None_ , _Static_ , or _Dynamic_ ; _None_ is the default. The different modes have the following meaning: _None_ No interrupt moderation is applied on the adapter card. Therefore, each transmit or receive interrupt is served immediately as soon as it appears on the interrupt line of the adapter card. _Static_ Interrupt moderation is applied on the adapter card. All transmit and receive interrupts are queued until a complete moderation interval ends. If such a moderation interval ends, all queued interrupts are processed in one big bunch without any delay. The term _Static_ reflects the fact, that interrupt moderation is always enabled, regardless how much network load is currently passing via a particular interface. In addition, the duration of the moderation interval has a fixed length that never changes while the driver is operational. _Dynamic_ Interrupt moderation might be applied on the adapter card, depending on the load of the system. If the driver detects that the system load is too high, the driver tries to shield the system against too much network load by enabling interrupt moderation. Ifβ€”at a later timeβ€”the CPU utilization decreases again (or if the network load is negligible), the interrupt moderation will automatically be disabled. Interrupt moderation should be used when the driver has to handle one or more interfaces with a high network load, whichβ€”as a consequenceβ€”leads also to a high CPU utilization. When moderation is applied in such high network load situations, CPU load might be reduced by 20–30% on slow computers. Note that the drawback of using interrupt moderation is an increase of the round-trip-time (RTT), due to the queuing and serving of interrupts at dedicated moderation times. **IntsPerSec=**_i,j,..._ This parameter determines the length of any interrupt moderation interval. Assuming that static interrupt moderation is to be used, an _IntsPerSec_ parameter value of 2000 will lead to an interrupt moderation interval of 500 microseconds. Possible values for this parameter are in the range of 30...40000 (interrupts per second). The default value is 2000. This parameter is used only if either static or dynamic interrupt moderation is enabled on a network adapter card. This parameter is ignored if no moderation is applied. Note that the duration of the moderation interval is to be chosen with care. At first glance, selecting a very long duration (e.g., only 100 interrupts per second) seems to be meaningful, but the increase of packet-processing delay is tremendous. On the other hand, selecting a very short moderation time might compensate the use of any moderation being applied. **PrefPort=**_i,j,..._ This parameter is used to force the preferred port to A or B (on dual-port network adapters). The preferred port is the one that is used if both ports A and B are detected as fully functional. Possible values are: _A_ or _B_ ; _A_ is the default. **RlmtMode=**_i,j,..._ RLMT monitors the status of the port. If the link of the active port fails, RLMT switches immediately to the standby link. The virtual link is maintained as long as at least one "physical" link is up. This parameters states how RLMT should monitor both ports. Possible values are: _CheckLinkState_ , _CheckLocalPort_ , _CheckSeg_ , or _DualNet_ ; _CheckLinkState_ is the default. The different modes have the following meaning: _CheckLinkState_ Check link state only: RLMT uses the link state reported by the adapter hardware for each individual port to determine whether a port can be used for all network traffic or not. _CheckLocalPort_ In this mode, RLMT monitors the network path between the two ports of an adapter by regularly exchanging packets between them. This mode requires a network configuration in which the two ports are able to "see" each other (i.e., there must not be any router between the ports). _CheckSeg_ Check local port and segmentation: This mode supports the same functions as the CheckLocalPort mode and additionally checks network segmentation between the ports. Therefore, this mode is to be used only if Gigabit Ethernet switches are installed on the network that have been configured to use the Spanning Tree protocol. _DualNet_ In this mode, ports A and B are used as separate devices. If you have a dual port adapter, port A will be configured as _eth[x]_ and port B as _eth[x+1]_. Both ports can be used independently with distinct IP addresses. The preferred port setting is not used. RLMT is turned off. Note that RLMT modes _CheckLocalPort_ and _CheckLinkState_ are designed to operate in configurations where a network path between the ports on one adapter exists. Moreover, they are not designed to work where adapters are connected back- to-back. ## FILES _/proc/net/sk98lin/eth[x]_ The statistics file of a particular interface of an adapter card. It contains generic information about the adapter card plus a detailed summary of all transmit and receive counters. _/usr/src/linux/Documentation/networking/sk98lin.txt_ This is the _README_ file of the _sk98lin_ driver. It contains a detailed installation HOWTO and describes all parameters of the driver. It denotes also common problems and provides the solution to them. ## BUGS Report any bugs to [email protected] * * *
# mem ## NAME mem, kmem, port - system memory, kernel memory and system ports ## DESCRIPTION _/dev/mem_ is a character device file that is an image of the main memory of the computer. It may be used, for example, to examine (and even patch) the system. Byte addresses in _/dev/mem_ are interpreted as physical memory addresses. References to nonexistent locations cause errors to be returned. Examining and patching is likely to lead to unexpected results when read-only or write-only bits are present. Since Linux 2.6.26, and depending on the architecture, the **CONFIG_STRICT_DEVMEM** kernel configuration option limits the areas which can be accessed through this file. For example: on x86, RAM access is not allowed but accessing memory-mapped PCI regions is. It is typically created by: mknod -m 660 /dev/mem c 1 1 chown root:kmem /dev/mem The file _/dev/kmem_ is the same as _/dev/mem_ , except that the kernel virtual memory rather than physical memory is accessed. Since Linux 2.6.26, this file is available only if the **CONFIG_DEVKMEM** kernel configuration option is enabled. It is typically created by: mknod -m 640 /dev/kmem c 1 2 chown root:kmem /dev/kmem _/dev/port_ is similar to _/dev/mem_ , but the I/O ports are accessed. It is typically created by: mknod -m 660 /dev/port c 1 4 chown root:kmem /dev/port ## FILES _/dev/mem_ _/dev/kmem_ _/dev/port_ * * *
# pam_xauth ## NAME pam_xauth - PAM module to forward xauth keys between users ## SYNOPSIS **pam_xauth.so**[debug] [xauthpath=_/path/to/xauth_] [systemuser=_UID_] [targetuser=_UID_] ## DESCRIPTION The pam_xauth PAM module is designed to forward xauth keys (sometimes referred to as "cookies") between users. Without pam_xauth, when xauth is enabled and a user uses the su(1) command to assume another user's privileges, that user is no longer able to access the original user's X display because the new user does not have the key needed to access the display. pam_xauth solves the problem by forwarding the key from the user running su (the source user) to the user whose identity the source user is assuming (the target user) when the session is created, and destroying the key when the session is torn down. This means, for example, that when you run su(1) from an xterm session, you will be able to run X programs without explicitly dealing with the **xauth**(1) xauth command or ~/.Xauthority files. pam_xauth will only forward keys if xauth can list a key connected to the $DISPLAY environment variable. Primitive access control is provided by ~/.xauth/export in the invoking user's home directory and ~/.xauth/import in the target user's home directory. If a user has a ~/.xauth/import file, the user will only receive cookies from users listed in the file. If there is no ~/.xauth/import file, the user will accept cookies from any other user. If a user has a .xauth/export file, the user will only forward cookies to users listed in the file. If there is no ~/.xauth/export file, and the invoking user is not **root** , the user will forward cookies to any other user. If there is no ~/.xauth/export file, and the invoking user is **root** , the user will _not_ forward cookies to other users. Both the import and export files support wildcards (such as _*_). Both the import and export files can be empty, signifying that no users are allowed. ## OPTIONS **debug** Print debug information. **xauthpath=**_/path/to/xauth_ Specify the path the xauth program (it is expected in /usr/X11R6/bin/xauth, /usr/bin/xauth, or /usr/bin/X11/xauth by default). **systemuser=**_UID_ Specify the highest UID which will be assumed to belong to a "system" user. pam_xauth will refuse to forward credentials to users with UID less than or equal to this number, except for root and the "targetuser", if specified. **targetuser=**_UID_ Specify a single target UID which is exempt from the systemuser check. ## MODULE TYPES PROVIDED Only the **session** type is provided. ## RETURN VALUES PAM_BUF_ERR Memory buffer error. PAM_PERM_DENIED Permission denied by import/export file. PAM_SESSION_ERR Cannot determine user name, UID or access users home directory. PAM_SUCCESS Success. PAM_USER_UNKNOWN User not known. ## EXAMPLES Add the following line to /etc/pam.d/su to forward xauth keys between users when calling su: session optional pam_xauth.so ## IMPLEMENTATION DETAILS pam_xauth will work _only_ if it is used from a setuid application in which the **getuid**() call returns the id of the user running the application, and for which PAM can supply the name of the account that the user is attempting to assume. The typical application of this type is su(1). The application must call both **pam_open_session**() and **pam_close_session**() with the ruid set to the uid of the calling user and the euid set to root, and must have provided as the PAM_USER item the name of the target user. pam_xauth calls **xauth**(1) as the source user to extract the key for $DISPLAY, then calls xauth as the target user to merge the key into the a temporary database and later remove the database. pam_xauth cannot be told to not remove the keys when the session is closed. ## FILES ~/.xauth/import XXX ~/.xauth/export XXX * * *
# cryptsetup-open ## NAME cryptsetup-open, cryptsetup-create, cryptsetup-plainOpen, cryptsetup-luksOpen, cryptsetup-loopaesOpen, cryptsetup- tcryptOpen, cryptsetup-bitlkOpen, cryptsetup-fvault2Open - open an encrypted device and create a mapping with a specified name ## SYNOPSIS **cryptsetup** _open_ **--type <device_type> [<options>] <device> <name>** ## DESCRIPTION Opens (creates a mapping with) <name> backed by device <device>. Device type can be _plain_ , _luks_ (default), _luks1_ , _luks2_ , _loopaes_ or _tcrypt_. For backward compatibility, there are **open** command aliases: **create**(argument-order <name> <device>): open --type plain **plainOpen** : open --type plain **luksOpen** : open --type luks **loopaesOpen** : open --type loopaes **tcryptOpen** : open --type tcrypt **bitlkOpen** : open --type bitlk **< options> **are type-specific and are described below for individual device types. For **create** , the order of the <name> and <device> options is inverted for historical reasons; all other aliases use the standard **< device> <name> **order. **PLAIN** **open --type plain <device> <name> **--cipher <spec> --key-size <bits> --hash <alg> plainOpen <device> <name> (old syntax) create <name> <device> (OBSOLETE syntax) Opens (creates a mapping with) <name> backed by device <device>. You should always specify options --cipher, --key-size and (if no keyfile or keyring is used) then also --hash to avoid incompatibility, as default values can differ in older cryptsetup versions. The plain format also allows retrieving a volume key from a kernel keyring specified by --volume-key-keyring. The key in the kernel keyring must be configured before issuing cryptsetup commands, as cryptsetup does not upload any keys to the keyring in plain mode. For subsequent commands (like resize), the user must ensure that the key in the keyring is unchanged. Otherwise, reloading the key can cause data corruption after an unexpected key change. **< options> **can be [--hash, --cipher, --sector-size, --key-file, --keyfile-size, --keyfile-offset, --key-size, --offset, --skip, --device-size, --size, --readonly, --shared, --allow-discards, --refresh, --timeout, --verify-passphrase, --iv-large-sectors, --volume-key-keyring]. **EXAMPLES:** To map the encrypted device /dev/sda10 to the decrypted device /dev/mapper/e1, you can use: **cryptsetup open --type plain --cipher aes-cbc-essiv:sha256** **--key-size 256 --hash sha256 /dev/sda10 e1** The decrypted device can then be used as a normal block device to mount a filesystem. To map a device with a volume key in the preconfigured trusted or encrypted keyring, you need to specify the keyring with the key and remove the hash specification, for example, to use **%trusted:mykey** : **cryptsetup open --type plain /dev/sda10 e1** **--volume-key-keyring=%trusted:mykey --cipher aes-xts-plain64** **--key-size 256** Note that the key size must match the preconfigured key in the keyring. **LUKS** **open <device> <name>** open --type <luks1|luks2> <device> <name> (explicit version request) luksOpen <device> <name> (old syntax) Opens the LUKS device <device> and sets up a mapping <name> after successful verification of the supplied passphrase. First, the passphrase is searched in LUKS2 tokens unprotected by PIN. If such a token does not exist (or fails to unlock keyslot) and the passphrase is not supplied via --key-file, the command prompts for passphrase interactively. If there is a valid LUKS2 token but it requires a PIN to unlock the assigned keyslot, it is not used unless one of the following options is added: --token-only, --token-type where type matches the desired PIN-protected token or --token-id with id matching the PIN-protected token. **< options> **can be [--key-file, --keyfile-offset, --keyfile-size, --readonly, --test-passphrase, --allow-discards, --header, --key-slot, --volume-key-file, --token-id, --token-only, --token-type, --disable-external-tokens, --disable-keyring, --disable-locks, --type, --refresh, --serialize-memory-hard-pbkdf, --unbound, --tries, --timeout, --verify-passphrase, --persistent, --volume-key-keyring, --link-vk-to-keyring, --external-tokens-path]. **loopAES** **open --type loopaes <device> <name> --key-file <keyfile>** loopaesOpen <device> <name> --key-file <keyfile> (old syntax) Opens the loop-AES <device> and sets up a mapping <name>. If the key file is encrypted with GnuPG, then you have to use --key-file=- and decrypt it before use, e.g., like this: **gpg** **--decrypt <keyfile> | cryptsetup loopaesOpen --key-file=- <device>** **< name>**. The loop-AES extension cannot use the direct input of the key file on the real terminal because the keys are separated by end-of-line, and only part of the multi-key file would be read. If you need it in script, just use the pipe redirection: **echo** **$keyfile | cryptsetup loopaesOpen --key-file=- <device> <name>**. Use --keyfile-size to specify the proper key length if needed. Use --offset to specify device offset. Note that the units need to be specified in terms of 512-byte sectors. Use --skip to specify the IV offset. If the original device used an offset but did not use it in IV sector calculations, you must explicitly use --skip 0 in addition to the offset parameter. Use --hash to override the default hash function for passphrase hashing (otherwise it is detected according to key size). **< options> **can be [--cipher, --key-file, --keyfile-size, --keyfile-offset, --key-size, --offset, --skip, --hash, --readonly, --allow-discards, --refresh]. **TrueCrypt and VeraCrypt** **open --type tcrypt <device> <name>** tcryptOpen <device> <name> (old syntax) Opens the TCRYPT (TrueCrypt and VeraCrypt compatible) <device> and sets up a mapping <name>. The --key-file option allows a combination of file content with the passphrase The --key-file option can be repeated. Note that using keyfiles differs from LUKS keyfile logic. If --cipher or --hash options are used, only cipher chains or PBKDF2 variants with the specified hash algorithms are checked. This could speed up unlocking the device (but also reveals some information about the container). If you use --header in combination with hidden or system options, the header file must contain specific headers in the same positions as the original encrypted container. Option --allow-discards cannot be combined with option --tcrypt-hidden. For normal mapping, it can cause the destruction of hidden volume (hidden volume appears as unused space for outer volume, so this space can be discarded). **< options> **can be [--key-file, --tcrypt-hidden, --tcrypt-system, --tcrypt-backup, --readonly, --test-passphrase, --allow-discards, --veracrypt (ignored), --disable-veracrypt, --veracrypt-pim, --veracrypt-query-pim, --header, --cipher, --hash, --tries, --timeout, --verify-passphrase]. **BitLocker** **open --type bitlk <device> <name>** bitlkOpen <device> <name> (old syntax) Opens the BITLK (a BitLocker compatible) <device> and sets up a mapping <name>. Note that --test-passphrase doesn’t work with --volume-key-file because we cannot check whether the provided volume key is correct for this device. When using --volume-key-file, the device will be opened even if the provided key is incorrect. **< options> **can be [--key-file, --keyfile-offset, --keyfile-size, --key-size, --readonly, --test-passphrase, --allow-discards --volume-key-file, --tries, --timeout, --verify-passphrase]. **FileVault2** **open --type fvault2 <device> <name>** fvault2Open <device> <name> (old syntax) Opens the FVAULT2 (a FileVault2 compatible) <device> and sets up a mapping <name>. **< options> **can be [--key-file, --keyfile-offset, --keyfile-size, --key-size, --readonly, --test-passphrase, --allow-discards --volume-key-file, --tries, --timeout, --verify-passphrase]. ## OPTIONS **--allow-discards** Allow the use of discard (TRIM) requests for the device. This is also not supported for LUKS2 devices with data integrity protection. **WARNING:** This command can have a negative security impact because it can make filesystem-level operations visible on the physical device. For example, information leaking filesystem type, used space, etc., may be extractable from the physical device if the discarded blocks can be located later. If in doubt, do not use it. A kernel version of 3.1 or later is needed. For earlier kernels, this option is ignored. **--batch-mode** , **-q** Suppresses all confirmation questions. Use with care! If the --verify-passphrase option is not specified, this option also switches off the passphrase verification. **--cipher** , **-c** _< cipher-spec>_ Set the cipher specification string for the _plain_ device type. For the _tcrypt_ device type, it restricts checked cipher chains when looking for the header. _cryptsetup --help_ shows the compiled-in defaults. If a hash is part of the cipher specification, then it is used as part of the IV generation. For example, ESSIV needs a hash function, while "plain64" does not and hence none is specified. For XTS mode, you can optionally set a key size of 512 bits with the -s option. Key size for XTS mode is twice that for other modes for the same security level. **--debug** or **--debug-json** Run in debug mode with full diagnostic logs. Debug output lines are always prefixed by **#**. If --debug-json is used, additional LUKS2 JSON data structures are printed. **--device-size** _size[units]_ Instead of the real device size, use the specified value. Usable only with _plain_ device type. If no unit suffix is specified, the size is in bytes. Unit suffix can be S for 512 byte sectors, K/M/G/T (or KiB, MiB, GiB, TiB) for units with 1024 base or KB/MB/GB/TB for 1000 base (SI scale). **--disable-external-tokens** Disable loading of plugins for external LUKS2 tokens. **--disable-keyring** Do not load the volume key in the kernel keyring; store it directly in the dm-crypt target instead. This option is supported only for the LUKS2 type. **--disable-locks** Disable lock protection for metadata on disk. This option is valid only for LUKS2 and is ignored for other formats. **WARNING:** Do not use this option unless you run cryptsetup in a restricted environment where locking is impossible to perform (where /run directory cannot be used). **--disable-veracrypt** This option can be used to disable VeraCrypt compatible mode (only TrueCrypt devices are recognized). See the _TCRYPT_ section in cryptsetup(8) for more info. **--external-tokens-path** _< absolute path>_ Override the system directory path where cryptsetup searches for external token handlers (or token plugins). It must be an absolute path (starting with '/' character). **--hash** , **-h** _< hash-spec>_ Specifies the passphrase hash. Applies to _plain_ and _loopaes_ device types only. For the _tcrypt_ device type, it restricts the checked PBKDF2 variants when looking for the header. **--header** _< device or file storing the LUKS header>_ Specify a detached (separated) metadata device or file where the header is stored. **WARNING:** There is no check whether the ciphertext device specified actually belongs to the header given. In fact, you can specify an arbitrary device as the ciphertext device with the --header option. Use with care. **--help** , **-?** Show help text and default parameters. **--iv-large-sectors** Count Initialization Vector (IV) in larger sector size (if set) instead of 512-byte sectors. This option can be used only with the _plain_ device type. This option does not have any performance or security impact; use it only for accessing incompatible existing disk images from other systems that require this option. **--key-description** _text_ Set the key description in the keyring that will be used for passphrase retrieval. **--key-file** , **-d** _file_ Read the passphrase from the file. If the name given is "-", then the passphrase will be read from stdin. In this case, reading will not stop at newline characters. With _plain_ device type, the passphrase obtained via --key-file option is passed directly in dm-crypt. Unlike the interactive mode (stdin), where the digest of the passphrase is passed in dm-crypt instead. See section _NOTES ON PASSPHRASE PROCESSING_ in cryptsetup(8) for more information. **--keyfile-offset** _value_ Skip _value_ bytes at the beginning of the key file. **--keyfile-size** , **-l** _value_ Read a maximum of _value_ bytes from the key file. The default is to read the whole file up to the compiled-in maximum that can be queried with --help. Supplying more data than the compiled-in maximum aborts the operation. This option is useful to cut trailing newlines, for example. If --keyfile-offset is also given, the size count starts after the offset. **--key-size** , **-s** _bits_ Sets key size in _bits_. The argument has to be a multiple of 8. The possible key sizes are limited by the cipher and mode used. See /proc/crypto for more information. Note that the key size in /proc/crypto is stated in bytes. This option can be used for _plain_ and _luks_ devices. For LUKS2 devices in reencryption, you may use the parameter twice to specify both old and new volume key sizes. Each --key-size option corresponds to the respective --volume-key-file parameter (also allowed to be used up to two times). **--key-slot** , **-S** _< 0-N>_ This option selects a specific keyslot to compare the passphrase against. If the given passphrase would only matches a different keyslot, the operation fails. The maximum number of keyslots depends on the LUKS version. LUKS1 can have up to 8 keyslots. LUKS2 can have up to 32 keyslots based on keyslot area size and key size, but a valid keyslot ID can always be between 0 and 31 for LUKS2. **--link-vk-to-keyring** _< keyring description>::<key description>_ Link the volume key in a keyring with the specified key name. The volume key is linked only if the requested action is successfully finished (with --test-passphrase, the verified volume key is linked in a keyring without taking further action). The _< keyring description>_ string has to contain the existing kernel keyring description. The keyring name may be optionally prefixed with "%:" or "%keyring:" type descriptions. Or, the keyring may also be specified directly by numeric key id. Also, special keyring notations starting with "@" may be used to select existing predefined kernel keyrings. The string "::" is a delimiter used to separate the keyring description and key description. _< key description>_ part describes key type and key name of volume key linked in the keyring described in _< keyring_ _description >_. The type may be specified by adding a "%<type_name>:" prefix in front of the key name. If the type is missing, the default _user_ type is applied. If the key of the same name and type already exists (already linked in the keyring), it will get replaced in the process. See also the **KEY IDENTIFIERS** section of keyctl(1). **--offset** , **-o** _< number of 512 byte sectors>_ Start offset in the backend device in 512-byte sectors. This option is only relevant with plain or loopaes device types. **--perf-high_priority** Set dm-crypt workqueues and the writer thread to high priority. This improves throughput and latency of dm-crypt while degrading the general responsiveness of the system. This option is available only for low-level dm-crypt performance tuning, use only if you need a change to the default dm-crypt behaviour. Needs kernel 6.10 or later. **--perf-no_read_workqueue** , **--perf-no_write_workqueue** Bypass dm-crypt internal workqueue and process read or write requests synchronously. These options are available only for low-level dm-crypt performance tuning, use only if you need a change to the default dm-crypt behaviour. Needs kernel 5.9 or later. **--perf-same_cpu_crypt** Perform encryption using the same CPU on which that IO was submitted. The default is to use an unbound workqueue so that encryption work is automatically balanced between available CPUs. This option is available only for low-level dm-crypt performance tuning, use only if you need a change to the default dm-crypt behaviour. **--perf-submit_from_crypt_cpus** Disable offloading writes to a separate thread after encryption. There are some situations where offloading write bios from the encryption threads to a single thread degrades performance significantly. The default is to offload write bios to the same thread. This option is available only for low-level dm-crypt performance tuning, use only if you need a change to the default dm-crypt behaviour. **--persistent** If used with LUKS2 devices and activation commands like _open_ or _refresh_ , the specified activation flags are persistently written into metadata and used next time automatically, even for normal activation. (No need to use cryptab or other system configuration files.) If you need to remove a persistent flag, use --persistent without the flag you want to remove (e.g., to disable the persistently stored discard flag, use --persistent without --allow-discards). Only --allow-discards, --perf-same_cpu_crypt, --perf-submit_from_crypt_cpus, --perf-no_read_workqueue, --perf-no_write_workqueue and --integrity-no-journal can be stored persistently. **--readonly** , **-r** Set up a read-only mapping. **--refresh** Refreshes an active device with a new set of parameters. See cryptsetup-refresh(8) for more details. **--sector-size** _bytes_ Set encryption sector size for use with _plain_ device type. It must be a power of two and in the 512 - 4096 bytes range. The default encryption sector size is 512 bytes. Increasing sector size from 512 to 4096 bytes can provide better performance on most modern storage devices and with some hardware encryption accelerators. Note that using a sector size larger than the underlying storage device’s physical sector size may result in data corruption during unexpected power failures. A power failure during write operations may result in only partial completion of the encryption sector write, leaving encrypted data in an inconsistent state that cannot be properly decrypted. **--serialize-memory-hard-pbkdf** Use a global lock to serialize unlocking of keyslots using memory-hard PBKDF. This is a workaround for a specific situation when multiple devices are activated in parallel, and the system, instead of reporting out of memory, starts unconditionally stop processes using the out-of-memory killer. **DO NOT USE** this switch until you are implementing the boot environment with parallel devices activation! **--shared** Creates an additional mapping for one common ciphertext device. Arbitrary mappings are supported. This option is only relevant for the _plain_ device type. Use --offset, --size and --skip to specify the mapped area. **--size** , **-b** _< number of 512 byte sectors>_ Set the size of the device in sectors of 512 bytes. Usable only with _plain_ device type. **--skip** , **-p** _< number of 512 byte sectors>_ Start offset used in IV calculation in 512-byte sectors (how many sectors of the encrypted data to skip at the beginning). This option is only relevant with plain or loopaes device types. Hence, if --offset _n_ , and --skip _s_ , sector _n_ (the first sector of the encrypted device) will get a sector number of _s_ for the IV calculation. **--tcrypt-backup** , **--tcrypt-hidden** , **--tcrypt-system** Specify which TrueCrypt on-disk header will be used to open the device. See the _TCRYPT_ section in cryptsetup(8) for more info. Using a system-encrypted device with the --tcrypt-system option requires specific settings to work as expected. TrueCrypt/VeraCrypt supports full system encryption (only a partition table is not encrypted) or system partition encryption (only a system partition is encrypted). The metadata header then contains the offset and size of the encrypted area. Cryptsetup needs to know the specific partition offset to calculate encryption parameters. To properly map a partition, you must specify a real partition device so cryptsetup can calculate this offset. While you can use a full device as a parameter (/dev/sdb), always prefer to specify the partition you want to map (/dev/sdb1), as only the system partition mode can be detected this way. For mapping images (stored in a file), you can use the additional --header option with the real partition device. If the --header is used (and it is different from the data image), cryptsetup expects that the data image contains a snapshot of the data partition only. If --header is not used (or points to the same image), cryptsetup expects that the image contains a full disk (including the partition table). This can map a full encrypted area that is not directly mountable as a filesystem. Please prefer creating a loop device with partitions (**losetup -P** , see losetup(8) man page) and use a real partition (/dev/loopXp1) as the device parameter. **--test-passphrase** Do not activate the device, just verify the passphrase. The device mapping name is not mandatory if this option is used. **--timeout** , **-t** _seconds_ The number of seconds to wait before a timeout on passphrase input via terminal. It is relevant every time a passphrase is asked. It has no effect if used in conjunction with --key-file. This option is useful when the system should not stall if the user does not input a passphrase, e.g., during boot. The default is a value of 0 seconds, which means to wait forever. **--token-id** Specify what token to use and allow the token PIN prompt to take precedence over the interactive keyslot passphrase prompt. If omitted, all available tokens (not protected by PIN) will be checked before proceeding further with the passphrase prompt. **--token-only** Do not proceed further with the action if the token-based keyslot unlock failed. Without the option, the action asks for a passphrase to proceed further. It allows LUKS2 tokens protected by PIN to take precedence over the interactive keyslot passphrase prompt. **--token-type** _type_ Restrict tokens eligible for operation to a specific token _type_. Mostly useful when no --token-id is specified. It allows LUKS2 _type_ tokens protected by PIN to take precedence over the interactive keyslot passphrase prompt. **--tries** , **-T** How often the input of the passphrase shall be retried. The default is 3 tries. **--type** _type_ Specifies required device type, for more info, read the _BASIC_ _ACTIONS_ section in cryptsetup(8). **--unbound** Allowed only together with --test-passphrase parameter, it allows one to test the passphrase for an unbound LUKS2 keyslot. Otherwise, an unbound keyslot passphrase can be tested only when a specific keyslot is selected via --key-slot parameter. **--usage** Show short option help. **--veracrypt** This option is ignored as VeraCrypt compatible mode is supported by default. **--veracrypt-pim** , **--veracrypt-query-pim** Use a custom Personal Iteration Multiplier (PIM) for the VeraCrypt device. See the _TCRYPT_ section in cryptsetup(8) for more info. **--verify-passphrase** , **-y** When interactively asking for a passphrase, ask for it twice and complain if both inputs do not match. Advised when creating a _plain_ type mapping for the first time. Ignored on input from file or stdin. **--version** , **-V** Show the program version. **--volume-key-file** _file_ , --master-key-file file (OBSOLETE alias) Use a volume key stored in a file. This allows one to open _luks_ and _bitlk_ device types without giving a passphrase. For devices in reencryption, the option may be used twice to specify both old and new volume keys. When using the option twice, make sure you pair each --volume-key-file option with the respective --key-size parameter as well. **--volume-key-keyring** _< key description>_ Use a volume key stored in a keyring. This allows one to open _luks_ and _plain_ device types without giving a passphrase. For LUKS, the key and associated type have to be readable from userspace so that the volume key digest may be verified before activation. For devices in reencryption, the option may be used twice to specify both old and new volume keys. For PLAIN type, the user must ensure that the key in the keyring is unchanged since activation. Otherwise, reloading the key can cause data corruption after an unexpected key change. The _< key description>_ uses keyctl-compatible syntax. This can either be a numeric key ID or a string name in the format _% <key type>:<key name>_. See also the **KEY IDENTIFIERS** section of keyctl(1). When no _% <key type>:_ prefix is specified, we assume the key type is _user_ (default type). ## CRYPTSETUP Part of cryptsetup project <https://gitlab.com/cryptsetup/cryptsetup/>. This page is part of the _Cryptsetup_ ((open-source disk encryption)) project. Information about the project can be found at ⟨https://gitlab.com/cryptsetup/cryptsetup⟩. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository ⟨https://gitlab.com/cryptsetup/cryptsetup.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-01.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is _not_ part of the original manual page), send a mail to [email protected] cryptsetup 2.8.1-git 2025-08-09 _CRYPTSETUP-OPEN_(8) * * *
# systemd-portabled.service ## NAME systemd-portabled.service, systemd-portabled - Portable service manager ## SYNOPSIS systemd-portabled.service /usr/lib/systemd/systemd-portabled ## DESCRIPTION **systemd-portabled** is a system service that may be used to attach, detach and inspect portable service images. Most of **systemd-portabled** 's functionality is accessible through the portablectl(1) command. See the **Portable Services******[1] page for details about the concepts this service implements. Seeorg.freedesktop.portable1(5) and org.freedesktop.LogControl1(5) for a description of the D-Bus API. ## NOTES 1. Portable Services https://systemd.io/PORTABLE_SERVICES * * *
# ip-nexthop ## NAME ip-nexthop - nexthop object management ## SYNOPSIS **ip**[ _ip-OPTIONS_ ] **nexthop**{ _COMMAND_ | **help**} **ip nexthop**{ **show** | **flush**} _SELECTOR_ **ip nexthop**{ **add** | **replace**} id _ID NH_ **ip nexthop**{ **get** | **del**} id _ID_ **ip nexthop bucket list** _BUCKET_SELECTOR_ **ip nexthop bucket get** id _ID_ index _INDEX_ _SELECTOR_ := [ **id** _ID_ ] [ **dev** _DEV_ ] [ **vrf** _NAME_ ] [ **master** _DEV_ ] [ **groups**] [ **fdb**] _BUCKET_SELECTOR_ := _SELECTOR_ | [ **nhid** _ID_ ] _NH_ := { **blackhole** | [ **via** _ADDRESS_ ] [ **dev** _DEV_ ] [ **onlink**] [ **encap** _ENCAP_ ] [ **fdb**] | **group** _GROUP_ [ **hw_stats**{ **on** | **off**} ] [ **fdb**] [ **type** _TYPE_ [ _TYPE_ARGS_ ] ] } _ENCAP_ := [ _ENCAP_MPLS_ ] _ENCAP_MPLS_ := **mpls**[ _LABEL_ ] [ **ttl** _TTL_ ] _GROUP_ := **id**[,**weight**[/...] _TYPE_ := { **mpath** | **resilient**} _TYPE_ARGS_ := [ _RESILIENT_ARGS_ ] _RESILIENT_ARGS_ := [ **buckets** _BUCKETS_ ] [ **idle_timer** _IDLE_ ] [ **unbalanced_timer** _UNBALANCED_ ] ## DESCRIPTION **ip nexthop** is used to manipulate entries in the kernel's nexthop tables. ip nexthop add id ID add new nexthop entry ip nexthop replace id ID change the configuration of a nexthop or add new one **via** _[ FAMILY ] ADDRESS_ the address of the nexthop router, in the address family FAMILY. Address family must match address family of nexthop instance. **dev** _NAME_ is the output device. **onlink** pretend that the nexthop is directly attached to this link, even if it does not match any interface prefix. **encap** _ENCAPTYPE ENCAPHDR_ attach tunnel encapsulation attributes to this route. _ENCAPTYPE_ is a string specifying the supported encapsulation type. Namely: **mpls** - encapsulation type MPLS _ENCAPHDR_ is a set of encapsulation attributes specific to the _ENCAPTYPE._ **mpls** _MPLSLABEL_ - mpls label stack with labels separated by _/_ **ttl** _TTL_ - TTL to use for MPLS header or 0 to inherit from IP header **group** _GROUP [_ **type** _TYPE [ TYPE_ARGS ] ]_ create a nexthop group. Group specification is id with an optional weight (id,weight) and a '/' as a separator between entries. _TYPE_ is a string specifying the nexthop group type. Namely: **mpath** - Multipath nexthop group backed by the hash-threshold algorithm. The default when the type is unspecified. **resilient** - Resilient nexthop group. Group is resilient to addition and deletion of nexthops. _TYPE_ARGS_ is a set of attributes specific to the _TYPE._ **resilient** **buckets** _BUCKETS_ - Number of nexthop buckets. Cannot be changed for an existing group **idle_timer** _IDLE_ - Time in seconds in which a nexthop bucket does not see traffic and is therefore considered idle. Default is 120 seconds **unbalanced_timer** _UNBALANCED_ - Time in seconds in which a nexthop group is unbalanced and is therefore considered unbalanced. The kernel will try to rebalance unbalanced groups, which might result in some flows being reset. A value of 0 means that no rebalancing will take place. Default is 0 seconds **blackhole** create a blackhole nexthop **fdb** nexthop and nexthop groups for use with layer-2 fdb entries. A fdb nexthop group can only have fdb nexthops. Example: Used to represent a vxlan remote vtep ip. layer-2 vxlan fdb entry pointing to an ecmp nexthop group containing multiple remote vtep ips. ip nexthop delete id ID delete nexthop with given id. ip nexthop show show the contents of the nexthop table or the nexthops selected by some criteria. **dev** _DEV_ show the nexthops using the given device. **vrf** _NAME_ show the nexthops using devices associated with the vrf name **master** _DEV_ show the nexthops using devices enslaved to given master device **groups** show only nexthop groups **fdb** show only fdb nexthops and nexthop groups ip nexthop flush flushes nexthops selected by some criteria. Criteria options are the same as show. ip nexthop get id ID get a single nexthop by id ip nexthop bucket show show the contents of the nexthop bucket table or the nexthop buckets selected by some criteria. **id** _ID_ show the nexthop buckets that belong to a nexthop group with a given id **nhid** _ID_ show the nexthop buckets that hold a nexthop with a given id **dev** _DEV_ show the nexthop buckets using the given device **vrf** _NAME_ show the nexthop buckets using devices associated with the vrf name **master** _DEV_ show the nexthop buckets using devices enslaved to given master device ip nexthop bucket get id ID index INDEX get a single nexthop bucket by nexthop group id and bucket index ## EXAMPLES ip nexthop ls Show all nexthop entries in the kernel. ip nexthop add id 1 via 192.168.1.1 dev eth0 Adds an IPv4 nexthop with id 1 using the gateway 192.168.1.1 out device eth0. ip nexthop add id 2 encap mpls 200/300 via 10.1.1.1 dev eth0 Adds an IPv4 nexthop with mpls encapsulation attributes attached to it. ip nexthop add id 3 group 1/2 Adds a nexthop with id 3. The nexthop is a group using nexthops with ids 1 and 2 at equal weight. ip nexthop add id 4 group 1,5/2,11 Adds a nexthop with id 4. The nexthop is a group using nexthops with ids 1 and 2 with nexthop 1 at weight 5 and nexthop 2 at weight 11. ip nexthop add id 5 via 192.168.1.2 fdb Adds a fdb nexthop with id 5. ip nexthop add id 7 group 5/6 fdb Adds a fdb nexthop group with id 7. A fdb nexthop group can only have fdb nexthops. ip nexthop add id 10 group 1/2 type resilient buckets 32 Add a resilient nexthop group with id 10 and 32 nexthop buckets. * * *
# accton ## NAME accton - turns process accounting on or off ## SYNOPSIS **accton**[_OPTION_] on**|** off**|** filename **accton**[ **-V** | **--version**] [ **-h** | **--help**] ## DESCRIPTION **accton** _filename_ turns on process accounting. ## OPTIONS **-V, --version** Print the version number of **ac** to standard output and quit. **-h, --help** Prints the usage string and default locations of system files to standard output and exits. **on** Turns on process accounting using the default accounting file name. **off** Turns off process accounting. ## FILES _acct_ The system wide process accounting file. See acct(5) (or **pacct**(5)) for further details. * * *
# ibprintswitch ## NAME ibprintswitch.pl - print either the switch specified or a list of switches from the ibnetdiscover output ## SYNOPSIS **ibprintswitch.pl**[-R -l -C <ca_name> -P <ca_port>] [<switch_guid|switch_name>] ## DESCRIPTION Faster than greping/viewing with an editor the output of ibnetdiscover, ibprintswitch.pl will parse out and print either the switch information for the switch specified or a list of all the switches found in the subnet. In addition, it will crudely parse on the node description information and if found report all the information for an entire chasis if the description information is consistent. Finally, ibprintswitch.pl will also reuse the cached ibnetdiscover output from some of the other diag tools which makes it a bit faster than running ibnetdiscover from scratch. ## OPTIONS **-l** List the switches (simply a wrapper for ibswitches). **-R** Recalculate the ibnetdiscover information, ie do not use the cached information. This option is slower but should be used if the diag tools have not been used for some time or if there are other reasons to believe that the fabric has changed. **-C <ca_name> **use the specified ca_name for the search. **-P <ca_port> **use the specified ca_port for the search. * * *
# ibdatacounts ## NAME ibdatacounts - get IB port data counters ## SYNOPSIS **ibdatacounts**[-h] [-b] [-v] [-G] [-N | -nocolor] [-C ca_name] [-P ca_port] [-t(imeout) timeout_ms] <lid|guid> [<port>] ## DESCRIPTION Obtain PMA data counters from specified port (or node). Port address is lid unless -G option is used to specify a GUID address. ## OPTIONS -G use GUID address argument. In most cases, it is the Port GUID. Example: "0x08f1040023" -v increase the verbosity level -b brief mode -N | -nocolor use mono rather than color mode -C <ca_name> use the specified ca_name. -P <ca_port> use the specified ca_port. -t <timeout_ms> override the default timeout for the solicited mads. ## EXAMPLE ibdatacounts 2 # show data counters for lid 2 ibdatacounts 2 4 # show data counters for lid 2 port 4 * * *
# btreplay ## NAME btreplay - recreate IO loads recorded by blktrace ## SYNOPSIS **btreplay [**_options_ ] <_dev_...> ## DESCRIPTION The _btrecord_ and _btreplay_ tools provide the ability to record and replay IOs captured by the _blktrace_ utility. Attempts are made to maintain ordering, CPU mappings and time-separation of IOs. The _blktrace_ utility provides the ability to collect detailed traces from the kernel for each IO processed by the block IO layer. The traces provide a complete timeline for each IO processed, including detailed information concerning when an IO was first received by the block IO layer β€” indicating the device, CPU number, time stamp, IO direction, sector number and IO size (number of sectors). Using this information, one is able to **replay** the IO again on the same machine or another set up entirely. The basic operating work-flow to replay IOs would be something like: - Run _blktrace_ to collect traces. Here you specify the device or devices that you wish to trace and later replay IOs upon. Note: the only traces you are interested in are **QUEUE** requests β€” thus, to save system resources (including storage for traces), one could specify the _-a queue_ command line option to _blktrace_. - While _blktrace_ is running, you run the workload that you are interested in. - When the work load has completed, you stop the _blktrace_ utility (thus saving all traces over the complete workload). - You extract the pertinent IO information from the traces saved by _blktrace_ using the _btrecord_ utility. This will parse each trace file created by _blktrace_ , and crafty IO descriptions to be used in the next phase of the workload processing. - Once _btrecord_ has successfully created a series of data files to be processed, you can run the _btreplay_ utility which attempts to generate the same IOs seen during the sample workload phase. ## OPTIONS -c <_num_ > --cpus=<_num_ > Set number of CPUs to use. -d <_dir_ > --input-directory=<_dir_ > Set input directory. This option requires a single parameter providing the directory name for where input files are to be found. The default directory is the current directory (_._). -F --find-records Find record files automatically This option instructs _btreplay_ to go find all the record files in the directory specified (either via the _-d_ option, or in the default directory (_._). -h --help Show help and exit. -i <_basename_ > --input-base=<_basename_ > Set base name for input files. Each input file has 3 fields: 1. Device identifier (taken directly from the device name of the _blktrace_ output file). 2. _btrecord_ base name β€” by default ``replay''. 3. The CPU number (again, taken directly from the _blktrace_ output file name). This option requires a single parameter that will override the default name (replay), and replace it with the specified value. -I <_num_ > --iterations=<_num_ > Set number of iterations to run. This option requires a single parameter which specifies the number of times to run through the input files. The default value is 1 -M <_filename_ > --map-devs=<_filename_ > Specify device mappings. This option requires a single parameter which specifies the name of a file contain device mappings. The file must be very simply managed, with just two pieces of data per line: - The device name on the recorded system (with the '_/dev/_ ' removed). Example: _/dev/sda_ would just be _sda_. - The device name on the replay system to use (again, without the '_/dev/_ ' path prepended). An example file for when one would map devices _/dev/sda_ and _/dev/sdb_ on the recorded system to _dev/sdg_ and _sdh_ on the replay system would be: sda sdg sdb sdh The only entries in the file that are allowed are these two element lines β€” we do not (yet?) support the notion of blank lines, or comment lines, or the like. The utility allows for multiple _-M_ options to be supplied on the command line. -N --no-stalls Disable pre-bunch stalls. When specified on the command line, all pre-bunch stall indicators will be ignored. IOs will be replayed without inter-bunch delays. -x <_factor_ > --acc-factor=<_factor_ > Specify acceleration factor. Default value is 1 (no acceleration). -v --verbose Enable verbose output. When specified on the command line, this option instructs _btreplay_ to store information concerning each **stall** and IO operation performed by _btreplay_. The name of each file so created will be the input file name used with an extension of _.rep_ appended onto it. Thus, an input file of the name _sdab.replay.3_ would generate a verbose output file with the name _sdab.replay.3.rep_ in the directory specified for input files. In addition, _btreplay_ will also output to _stderr_ the names of the input files being processed. -V --version Show version number and exit. -W --write-enable Enable writing during replay. As a precautionary measure, by default _btreplay_ will not process **write** requests. In order to enable _btreplay_ to actually **write** to devices one must explicitly specify the _-W_ option. * * *
# warnquota ## NAME warnquota - send mail to users over quota ## SYNOPSIS **warnquota**[ **-ugsid**] [ **-F** _quotaformat_ ] [ **-q** _quotatab_ ] [ **-c** _configfile_ ] [ **-a** _adminsfile_ ] [ _filesystem_... ] ## DESCRIPTION **warnquota** checks the disk quota for specified local filesystems (or for each local filesystem if none specified) and mails a warning message to those users who have reached their softlimit. It is typically run via cron(8). **-F, --format=**_quotaformat_ Perform setting for specified format (ie. don't perform format autodetection). Possible format names are: **vfsold** Original quota format with 16-bit UIDs / GIDs, **vfsv0** Quota format with 32-bit UIDs / GIDs, 64-bit space usage, 32-bit inode usage and limits, **vfsv1** Quota format with 64-bit quota limits and usage, **xfs** Quota on XFS filesystem. **-q, --quota-tab=**_quotatab_ Use _quotatab_ instead of _/etc/quotatab_ as file with device description strings (see quotatab(5) for syntax). **-c, --config=**_configfile_ Use _configfile_ instead of _/etc/warnquota.conf_ as configuration file (see warnquota.conf(5) for syntax). **-a, --admins-file=**_adminsfile_ Use _adminsfile_ instead of _/etc/quotagrpadmins_ as a file with administrators of the groups (see quotagrpadmins(5) for syntax). **-u, --user** check whether users are not exceeding quotas (default). **-g, --group** check whether groups are not exceeding quotas. If group is exceeding quota a mail is sent to the user specified in /etc/quotagrpadmins. **-s, --human-readable[=**_units_] Try to report used space, number of used inodes and limits in more appropriate units than the default ones. Units can be also specified explicitely by an optional argument in format [ **kgt**],[ **kgt**] where the first character specifies space units and the second character specifies inode units. **-i, --no-autofs** ignore mountpoints mounted by automounter. **-d, --no-details** do not attach quota report in email. ## FILES **aquota.user** quota file at the filesystem root (version 2 quota, non-XFS filesystems) **quota.user** quota file at the filesystem root (version 1 quota, non-XFS filesystems) **/etc/warnquota.conf** configuration file **/etc/quotatab** device description **/etc/quotagrpadmins** administrators of the groups **/etc/mtab** default filesystems **/etc/passwd** default set of users * * *
# systemd-timedated.service ## NAME systemd-timedated.service, systemd-timedated - Time and date bus mechanism ## SYNOPSIS systemd-timedated.service /usr/lib/systemd/systemd-timedated ## DESCRIPTION systemd-timedated.service is a system service that may be used as a mechanism to change the system clock and timezone, as well as to enable/disable network time synchronization. systemd-timedated is automatically activated on request and terminates itself when it is unused. The tool timedatectl(1) is a command line client to this service. systemd-timedated currently offers access to the following four settings: β€’ The system time β€’ The system timezone β€’ A boolean controlling whether the system RTC is in local or UTC timezone β€’ Whether the time synchronization service is enabled/started or disabled/stopped, see next section. See org.freedesktop.timedate1(5) and org.freedesktop.LogControl1(5) for information about the D-Bus API. ## LIST OF NETWORK TIME SYNCHRONIZATION SERVICES **systemd-timedated** will look for files with a ".list" extension in ntp-units.d/ directories. Each file is parsed as a list of unit names, one per line. Empty lines and lines with comments ("#") are ignored. Files are read from /usr/lib/systemd/ntp-units.d/ and the corresponding directories under /etc/, /run/, /usr/local/lib/. Files in /etc/ override files with the same name in /run/, /usr/local/lib/, and /usr/lib/. Files in /run/ override files with the same name under /usr/. Packages should install their configuration files in /usr/lib/ (distribution packages) or /usr/local/lib/ (local installs). **Example 1. ntp-units.d/ entry for systemd-timesyncd** # /usr/lib/systemd/ntp-units.d/80-systemd-timesync.list systemd-timesyncd.service If the environment variable _$SYSTEMD_TIMEDATED_NTP_SERVICES_ is set, **systemd-timedated** will parse the contents of that variable as a colon-separated list of unit names. When set, this variable overrides the file-based list described above. **Example 2. An override that specifies that chronyd should be used** **if available** SYSTEMD_TIMEDATED_NTP_SERVICES=chronyd.service:systemd-timesyncd.service * * *
# rpmkeys ## NAME rpmkeys - RPM Keyring ## SYNOPSIS **rpmkeys**{**--list|--import|--erase|--delete|--checksig**} ## DESCRIPTION The general forms of rpm(8) digital signature commands are **rpmkeys**{**-l|--list**} [_FINGERPRINT ..._] **rpmkeys**{**-x|--export**} [_FINGERPRINT ..._] **rpmkeys**{**-i|--import**} _PUBKEY ..._ **rpmkeys**{**-e|--erase|-d|--delete**} _FINGERPRINT ..._ **rpmkeys**{**-K|--checksig**} _PACKAGE_FILE ..._ The **--checksig** option checks all the digests and signatures contained in _PACKAGE_FILE_ to ensure the integrity and origin of the package. Note that signatures are now verified whenever a package is read, and **--checksig** is useful to verify all of the digests and signatures associated with a package. Digital signatures cannot be verified without a public key. An ASCII armored public key can be added to the **rpm** persistent keyring using **--import**. The following commands are available for manipulating the persistent rpm keyring: **rpmkeys**{**-l|--list**} [_FINGERPRINT ..._] List currently imported public key(s) (aka certificates) by their fingerprint and user ID. If no fingerprints are specified, list all keys. The fingerprint is the handle used for all operations on the keys. **rpmkeys**{**-x|--export**} [_FINGERPRINT ..._] Output the key(s) using an ASCII-armor encoding. Exporting allows for inspecting the data with specialized tools, such as Sequoia or GnuPG. For example: **rpmkeys –export 771b18d3d7baa28734333c424344591e1964c5fc | sq** **inspect** **rpmkeys**{**-e|--erase|-d|--delete**} _FINGERPRINT ..._ Erase the key(s) designated by _FINGERPRINT_. For example: **rpmkeys --erase 771b18d3d7baa28734333c424344591e1964c5fc** * * *
# tc-matchall ## NAME matchall - traffic control filter that matches every packet ## SYNOPSIS **tc filter**... **matchall**[ **skip_sw** | **skip_hw**] [ **action** _ACTION_SPEC_ ] [ **classid** _CLASSID_ ] ## DESCRIPTION The **matchall** filter allows one to classify every packet that flows on the port and run a action on it. ## OPTIONS **action** _ACTION_SPEC_ Apply an action from the generic actions framework on matching packets. **classid** _CLASSID_ Push matching packets into the class identified by _CLASSID_. **skip_sw** Do not process filter by software. If hardware has no offload support for this filter, or TC offload is not enabled for the interface, operation will fail. **skip_hw** Do not process filter by hardware. ## EXAMPLES To create ingress mirroring from port eth1 to port eth2: tc qdisc add dev eth1 handle ffff: clsact tc filter add dev eth1 ingress \ matchall skip_sw \ action mirred egress mirror \ dev eth2 The first command creates a clsact qdisc with handle **ffff:** on device **eth1** where the second command attaches a matchall filters on it that mirrors the packets to device eth2 for ingress. To create egress mirroring from port eth1 to port eth2: tc qdisc add dev eth1 handle ffff: clsact tc filter add dev eth1 egress \ matchall skip_sw \ action mirred egress mirror \ dev eth2 The first command creates a clsact qdisc with handle **ffff:** on device **eth1** where the second command attaches a matchall filters on it that mirrors the packets to device eth2 for egress. To sample one of every 100 packets flowing into interface eth0 to psample group 12: tc qdisc add dev eth0 handle ffff: ingress tc filter add dev eth0 parent ffff: matchall \ action sample rate 100 group 12 * * *
# pvs ## NAME pvs β€” Display information about physical volumes ## SYNOPSIS **pvs** [ _option_args_ ] [ _position_args_ ] ## DESCRIPTION pvs produces formatted output about PVs. ## USAGE **pvs** [ **-a** |**--all**] [ **-o** |**--options** _String_ ] [ **-S** |**--select** _String_ ] [ **-O** |**--sort** _String_ ] [ **--segments**] [ **--aligned**] [ **--binary**] [ **--configreport log** |**vg** |**lv** |**pv** |**pvseg** |**seg**] [ **--foreign**] [ **--ignorelockingfailure**] [ **--logonly**] [ **--nameprefixes**] [ **--noheadings**] [ **--nosuffix**] [ **--readonly**] [ **--reportformat basic** |**json**] [ **--rows**] [ **--separator** _String_ ] [ **--shared**] [ **--unbuffered**] [ **--units**[_Number_]**r** |**R** |**h** |**H** |**b** |**B** |**s** |**S** |**k** |**K** |**m** |**M** |**g** |**G** |**t** |**T** |**p** |**P** |**e** |**E**] [ **--unquoted**] [ COMMON_OPTIONS ] [ _PV_ |_Tag_ ... ] Common options for lvm: [ **-d** |**--debug**] [ **-h** |**--help**] [ **-q** |**--quiet**] [ **-t** |**--test**] [ **-v** |**--verbose**] [ **-y** |**--yes**] [ **--commandprofile** _String_ ] [ **--config** _String_ ] [ **--devices** _PV_ ] [ **--devicesfile** _String_ ] [ **--driverloaded y** |**n**] [ **--journal** _String_ ] [ **--lockopt** _String_ ] [ **--longhelp**] [ **--nohints**] [ **--nolocking**] [ **--profile** _String_ ] [ **--version**] ## OPTIONS **--aligned** Use with --separator to align the output columns **-a** |**--all** Show information about devices that have not been initial‐ ized by LVM, i.e. they are not PVs. **--binary** Use binary values "0" or "1" instead of descriptive literal values for columns that have exactly two valid values to report (not counting the "unknown" value which denotes that the value could not be determined). **--commandprofile** _String_ The command profile to use for command configuration. See lvm.conf(5) for more information about profiles. **--config** _String_ Config settings for the command. These override lvm.conf(5) settings. The String arg uses the same format as lvm.conf(5), or may use section/field syntax. See lvm.conf(5) for more information about config. **--configreport log** |**vg** |**lv** |**pv** |**pvseg** |**seg** See lvmreport(7). **-d** |**--debug**... Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if configured). **--devices** _PV_ Devices that the command can use. This option can be re‐ peated or accepts a comma separated list of devices. This overrides the devices file. **--devicesfile** _String_ A file listing devices that LVM should use. The file must exist in _/etc/lvm/devices/_ and is managed with the lvmdevices(8) command. This overrides the lvm.conf(5) **de‐** **vices/devicesfile** and **devices/use_devicesfile** settings. **--driverloaded y** |**n** If set to no, the command will not attempt to use device- mapper. For testing and debugging. **--foreign** Report/display foreign VGs that would otherwise be skipped. See lvmsystemid(7) for more information about foreign VGs. **-h** |**--help** Display help text. **--ignorelockingfailure** Allows a command to continue with read-only metadata opera‐ tions after locking failures. **--journal** _String_ Record information in the systemd journal. This informa‐ tion is in addition to information enabled by the lvm.conf log/journal setting. command: record information about the command. output: record the default command output. de‐ bug: record full command debugging. **--lockopt** _String_ Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information. **--logonly** Suppress command report and display only log report. **--longhelp** Display long help text. **--nameprefixes** Add an "LVM2_" prefix plus the field name to the output. Useful with --noheadings to produce a list of field=value pairs that can be used to set environment variables (for example, in udev rules). **--noheadings** Suppress the headings line that is normally the first line of output. Useful if grepping the output. **--nohints** Do not use the hints file to locate devices for PVs. A com‐ mand may read more devices to find PVs when hints are not used. The command will still perform standard hint file in‐ validation where appropriate. **--nolocking** Disable locking. **--nosuffix** Suppress the suffix on output sizes. Use with --units (ex‐ cept h and H) if processing the output. **-o** |**--options** _String_ Comma-separated, ordered list of fields to display in columns. String arg syntax is: [**+** |**-** |**#**]_Field1_[**,**_Field2_ ...] The prefix **+** will append the specified fields to the de‐ fault fields, **-** will remove the specified fields from the default fields, and **#** will compact specified fields (remov‐ ing them when empty for all rows.) Use **-o help** to view the list of all available fields. Use separate lists of fields to add, remove or compact by repeating the -o option: -o+field1,field2 -o-field3,field4 -o#field5. These lists are evaluated from left to right. Use field name **lv_all** to view all LV fields, **vg_all** all VG fields, **pv_all** all PV fields, **pvseg_all** all PV segment fields, **seg_all** all LV segment fields, and **pvseg_all** all PV segment columns. See the lvm.conf(5) report section for more config options. See lvmreport(7) for more information about reporting. **--profile** _String_ An alias for --commandprofile or --metadataprofile, depend‐ ing on the command. **-q** |**--quiet**... Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'. **--readonly** Run the command in a special read-only mode which will read on-disk metadata without needing to take any locks. This can be used to peek inside metadata used by a virtual ma‐ chine image while the virtual machine is running. No at‐ tempt will be made to communicate with the device-mapper kernel driver, so this option is unable to report whether or not LVs are actually in use. **--reportformat basic** |**json** Overrides current output format for reports which is de‐ fined globally by the report/output_format setting in lvm.conf(5). **basic** is the original format with columns and rows. If there is more than one report per command, each report is prefixed with the report name for identification. **json** produces report output in JSON format. See lvmreport(7) for more information. **--rows** Output columns as rows. **--segments** Produces one line of output for each contiguous allocation of space on each PV, showing the start (pvseg_start) and length (pvseg_size) in units of physical extents. **-S** |**--select** _String_ Select objects for processing and reporting based on speci‐ fied criteria. The criteria syntax is described by **--se‐** **lect help** and lvmreport(7). For reporting commands, one row is displayed for each object matching the criteria. See **--options help** for selectable object fields. Rows can be displayed with an additional "selected" field (-o se‐ lected) showing 1 if the row matches the selection and 0 otherwise. For non-reporting commands which process LVM entities, the selection is used to choose items to process. **--separator** _String_ String to use to separate each column. Useful if grepping the output. **--shared** Report/display shared VGs that would otherwise be skipped when lvmlockd is not being used on the host. See lvmlockd(8) for more information about shared VGs. **-O** |**--sort** _String_ Comma-separated ordered list of columns to sort by. Re‐ places the default selection. Precede any column with **-** for a reverse sort on that column. **-t** |**--test** Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but never‐ theless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't. **--unbuffered** Produce output immediately without sorting or aligning the columns properly. **--units**[_Number_]**r** |**R** |**h** |**H** |**b** |**B** |**s** |**S** |**k** |**K** |**m** |**M** |**g** |**G** |**t** |**T** |**p** |**P** |**e** |**E** All sizes are output in these units: human-(r)eadable with '<' rounding indicator, (h)uman-readable, (b)ytes, (s)ec‐ tors, (k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes. Capitalise to use multiples of 1000 (S.I.) instead of 1024. Custom units can be speci‐ fied, e.g. --units 3M. **--unquoted** When used with --nameprefixes, output values in the field=value pairs are not quoted. **-v** |**--verbose**... Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr. **--version** Display version information. **-y** |**--yes** Do not prompt for confirmation interactively but always as‐ sume the answer yes. Use with extreme caution. (For auto‐ matic no, see -qq.) ## VARIABLES _PV_ Physical Volume name, a device path under /dev. For com‐ mands managing physical extents, a PV positional arg gener‐ ally accepts a suffix indicating a range (or multiple ranges) of physical extents (PEs). When the first PE is omitted, it defaults to the start of the device, and when the last PE is omitted it defaults to end. Start and end range (inclusive): _PV_[**:**_PE_**-**_PE_]... Start and length range (counting from 0): _PV_[**:**_PE_**+**_PE_]... _Tag_ Tag name. See lvm(8) for information about tag names and using tags in place of a VG, LV or PV. _String_ See the option description for information about the string content. _Size_[UNIT] Size is an input number that accepts an optional unit. In‐ put units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT represents other possible input units: **b** |**B** is bytes, **s** |**S** is sectors of 512 bytes, **k** |**K** is KiB, **m** |**M** is MiB, **g** |**G** is GiB, **t** |**T** is TiB, **p** |**P** is PiB, **e** |**E** is EiB. (This should not be confused with the output control --units, where capital letters mean multiple of 1000.) ## ENVIRONMENT VARIABLES See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter. ## NOTES The pv_attr bits are: 1 (**d**)uplicate, (**a**)llocatable, (**u**)sed 2 e(**x**)ported 3 (**m**)issing * * *
# [email protected] ## NAME [email protected], systemd-fsck-root.service, systemd-fsck- usr.service, systemd-fsck - File system checker logic ## SYNOPSIS [email protected] systemd-fsck-root.service systemd-fsck-usr.service /usr/lib/systemd/systemd-fsck ## DESCRIPTION [email protected], systemd-fsck-root.service, and systemd-fsck-usr.service are services responsible for file system checks. They are instantiated for each device that is configured for file system checking. systemd-fsck-root.service and systemd-fsck-usr.service are responsible for file system checks on the root and /usr file system, respectively, but only if the root filesystem was not checked in the initrd. [email protected] is used for all other file systems and for the root file system in the initrd. These services are started at boot if **passno** in /etc/fstab for the file system is set to a value greater than zero, but only if it is also configured to be mounted at boot (i.e. without "noauto" option). The file system check for root is performed before the other file systems. Other file systems may be checked in parallel, except when they are on the same rotating disk. systemd-fsck does not know any details about specific filesystems, and simply executes file system checkers specific to each filesystem type (fsck._type_). These checkers will decide if the filesystem should actually be checked based on the time since last check, number of mounts, unclean unmount, etc. systemd-fsck-root.service and systemd-fsck-usr.service will activate reboot.target if fsck(8) returns the "System should reboot" condition, or emergency.target if **fsck** returns the "Filesystem errors left uncorrected" condition. [email protected] will fail if fsck(8) returns either the "System should reboot" or the "Filesystem errors left uncorrected" condition. For filesystems listed in /etc/fstab without "nofail" or "noauto" options, local-fs.target will then activate emergency.target. ## KERNEL COMMAND LINE **systemd-fsck** understands these kernel command line parameters: _fsck.mode=_ One of "auto", "force", "skip". Controls the mode of operation. The default is "auto", and ensures that file system checks are done when the file system checker deems them necessary. "force" unconditionally results in full file system checks. "skip" skips any file system checks. Added in version 186. _fsck.repair=_ One of "preen", "yes", "no". Controls the mode of operation. The default is "preen", and will automatically repair problems that can be safely fixed. "yes" will answer yes to all questions by fsck and "no" will answer no to all questions. Added in version 213. ## CREDENTIALS **systemd-fsck** supports the service credentials logic as implemented by _ImportCredential=_ /_LoadCredential=_ /_SetCredential=_ (see systemd.exec(5) for details). The following credentials are used when passed in: _fsck.mode_ , _fsck.repair_ The contents of the credentials are parsed as same as the kernel command line options with the same name. See above for more details. Added in version 258. Note that by default the [email protected], systemd-fsck-root.service, and systemd-fsck-usr.service unit files are set up to inherit both _fsck.mode_ and _fsck.repair_ credentials from the service manager. * * *
# ip-mroute ## NAME ip-mroute - multicast routing cache management ## SYNOPSIS **ip mroute show**[ [ **to**] _PREFIX_ ] [ **from** _PREFIX_ ] [ **iif** _DEVICE_ ] [ **table** _TABLE_ID_ ] ## DESCRIPTION **mroute** objects are multicast routing cache entries created by a user-level mrouting daemon (f.e. **pimd** or **mrouted**). Due to the limitations of the current interface to the multicast routing engine, it is impossible to change **mroute** objects administratively, so we can only display them. This limitation will be removed in the future. **ip mroute show - list mroute cache entries** **to** _PREFIX_ **(default)** the prefix selecting the destination multicast addresses to list. **iif** _NAME_ the interface on which multicast packets are received. **from** _PREFIX_ the prefix selecting the IP source addresses of the multicast route. **table** _TABLE_ID_ the table id selecting the multicast table. It can be **local** , **main** , **default** , **all** or a number. * * *
# rmmod ## NAME rmmod - Simple program to remove a module from the Linux Kernel ## SYNOPSIS **rmmod**[_OPTIONS_] [_list of modulenames_] ## DESCRIPTION **rmmod** is a trivial program to remove a module or a list of modules from the kernel (when module unloading support is provided). Most users will want to use modprobe(8) with the **-r** option instead since it removes unused dependent modules as well. When a list of modules is provided, the program will process them one at a time. If a module is not found, **rmmod** will immediately exit with an error code. Should the module removal fail, the program will log an error AND continue with the next module. This behaviour is NOT controlled by the **--force** option. ## OPTIONS **-f** , **--force** This option can be extremely dangerous: it has no effect unless CONFIG_MODULE_FORCE_UNLOAD was set when the kernel was compiled. With this option, you can remove modules which are being used, or which are not designed to be removed, or have been marked as unsafe (see lsmod(8)). **-s** , **--syslog** Send errors to syslog instead of standard error. **-v** , **--verbose** Print messages about what the program is doing. Usually **rmmod** prints messages only if something goes wrong. **-V** , **--version** Show version of program and exit. **-h** , **--help** Print the help message and exit. ## BUGS Please direct any bug reports to kmod's issue tracker at https://github.com/kmod-project/kmod/issues/ alongside with version used, steps to reproduce the problem and the expected outcome. * * *
# systemd-update-done.service ## NAME systemd-update-done.service, systemd-update-done - Mark /etc/ and /var/ as fully updated ## SYNOPSIS systemd-update-done.service /usr/lib/systemd/systemd-update-done ## DESCRIPTION systemd-update-done.service is a service that is invoked as part of the first boot after the vendor operating system resources in /usr/ have been updated. This is useful to implement offline updates of /usr/ which might require updates to /etc/ or /var/ on the following boot. systemd-update-done.service updates the file modification time (mtime) stored in and "on" the files /etc/.updated and /var/.updated to the modification time of the /usr/ directory, unless the stamp files are already newer. (The timestamp is stored as the mtime field on the file, but also _in_ the file to support filesystems that do not store full timestamp precision.) Services that shall run after offline upgrades of /usr/ should order themselves before systemd-update-done.service, and use the _ConditionNeedsUpdate=_ (see systemd.unit(5)) condition to make sure to run when /etc/ or /var/ are older than /usr/ according to the modification times of the files described above. This requires that updates to /usr/ are always followed by an update of the modification time of /usr/, for example by invoking touch(1) on it. Note that if the _systemd.condition_needs_update=_ kernel command line option is used it overrides the _ConditionNeedsUpdate=_ unit condition checks. In that case systemd-update-done.service will not reset the condition state until a follow-up reboot where the kernel switch is not specified anymore. ## OPTIONS The following options are understood: **--root=**_root_ Takes a directory path as an argument. The program will operate on paths below the specified root directory. Added in version 258. **-h** , **--help** Print a short help text and exit. * * *
# pam_cifscreds ## NAME pam_cifscreds - PAM module to manage NTLM credentials in kernel keyring ## SYNOPSIS Edit the PAM configuration files for the systems that you want to automatically register NTLM credentials for, e.g. _/etc/pam.d/login_ , and modify as follows: ... auth substack system-auth +++ auth optional pam_cifscreds.so auth include postlogin ... ... session include system-auth +++ session optional pam_cifscreds.so domain=DOMAIN session include postlogin ... Change DOMAIN to the name of you Windows domain, or use host= as described below. ## DESCRIPTION The **pam_cifscreds** PAM module is a tool for automatically adding credentials (username and password) for the purpose of establishing sessions in multiuser mounts. When a cifs filesystem is mounted with the "multiuser" option, and does not use krb5 authentication, it needs to be able to get the credentials for each user from somewhere. The **pam_cifscreds** module can be used to provide these credentials to the kernel automatically at login. In the session section of the PAM configuration file, the module can either an NT domain name or a list of hostname or addresses. ## OPTIONS **pam_cifscreds** supports a couple options which can be set in the PAM configuration files. You must have one (and only one) of **domain=** or **host=**. **debug** Turns on some extra debug logging. **domain= <NT domain name>** Credentials will be added for the specified NT domain name. **host= <hostname or IP address>[,...]** Credentials will be added for the specified hostnames or IP addresses. ## NOTES The pam_cifscreds PAM module requires a kernel built with support for the **login** key type. That key type was added in v3.3 in mainline Linux kernels. Since **pam_cifscreds** adds keys to the session keyring, it is highly recommended that one use **pam_keyinit** to ensure that a session keyring is established at login time. * * *
# systemd-sysext ## NAME systemd-sysext, systemd-sysext.service, systemd-sysext- initrd.service, systemd-confext, systemd-confext.service, systemd- confext-initrd.service - Activates System Extension Images ## SYNOPSIS **systemd-sysext**[OPTIONS...] COMMAND systemd-sysext.service **systemd-confext**[OPTIONS...] COMMAND systemd-confext.service ## DESCRIPTION **systemd-sysext** activates/deactivates system extension images. System extension images may – dynamically at runtime β€” extend the /usr/ and /opt/ directory hierarchies with additional files. This is particularly useful on immutable system images where a /usr/ and/or /opt/ hierarchy residing on a read-only file system shall be extended temporarily at runtime without making any persistent modifications. System extension images should contain files and directories similar in fashion to regular operating system tree. When one or more system extension images are activated, their /usr/ and /opt/ hierarchies are combined via "overlayfs" with the same hierarchies of the host OS, and the host /usr/ and /opt/ overmounted with it ("merging"). When they are deactivated, the mount point is disassembled β€” again revealing the unmodified original host version of the hierarchy ("unmerging"). Merging thus makes the extension's resources suddenly appear below the /usr/ and /opt/ hierarchies as if they were included in the base OS image itself. Unmerging makes them disappear again, leaving in place only the files that were shipped with the base OS image itself. Files and directories contained in the extension images outside of the /usr/ and /opt/ hierarchies are _not_ merged, and hence have no effect when included in a system extension image. In particular, files in the /etc/ and /var/ included in a system extension image will _not_ appear in the respective hierarchies after activation. System extension images are strictly read-only by default. On mutable host file systems, /usr/ and /opt/ hierarchies become read-only while extensions are merged, unless mutability is enabled. Mutability may be enabled via the **--mutable=** option; see "Mutability" below for more information. System extensions are supposed to be purely additive, i.e. they are supposed to include only files that do not exist in the underlying basic OS image. However, the underlying mechanism (overlayfs) also allows overlaying or removing files, but it is recommended not to make use of this. System extension images may be provided in the following formats: 1. Plain directories or btrfs subvolumes containing the OS tree 2. Disk images with a GPT disk label, following the **Discoverable** **Partitions Specification******[1] 3. Disk images lacking a partition table, with a naked Linux file system (e.g. erofs, squashfs or ext4) These image formats are the same ones thatsystemd-nspawn(1) supports via its **--directory=** /**--image=** switches and those that the service manager supports via **RootDirectory=** /**RootImage=**. Similar to them they may optionally carry Verity authentication information. System extensions are searched for in the directories /etc/extensions/, /run/extensions/ and /var/lib/extensions/. The first two listed directories are not suitable for carrying large binary images, however are still useful for carrying symlinks to them. The primary place for installing system extensions is /var/lib/extensions/. Any directories found in these search directories are considered directory based extension images; any files with the .raw suffix are considered disk image based extension images. When invoked in the initrd, the additional directory /.extra/sysext/ is included in the directories that are searched for extension images. Note however, that by default a tighter image policy applies to images found there, though, see below. This directory is populated by systemd-stub(7) with extension images found in the system's EFI System Partition. During boot OS extension images are activated automatically, if the systemd-sysext.service is enabled. Note that this service runs only after the underlying file systems where system extensions may be located have been mounted. This means they are not suitable for shipping resources that are processed by subsystems running in earliest boot. Specifically, OS extension images are not suitable for shipping system services or systemd-sysusers(8) definitions. See the **Portable Services******[2] page for a simple mechanism for shipping system services in disk images, in a similar fashion to OS extensions. Note the different isolation on these two mechanisms: while system extension directly extend the underlying OS image with additional files that appear in a way very similar to as if they were shipped in the OS image itself and thus imply no security isolation, portable services imply service level sandboxing in one way or another. The systemd-sysext.service service is guaranteed to finish start-up before basic.target is reached; i.e. at the time regular services initialize (those which do not use _DefaultDependencies=no_), the files and directories system extensions provide are available in /usr/ and /opt/ and may be accessed. Note that there is no concept of enabling/disabling installed system extension images: all installed extension images are automatically activated at boot. However, you can place an empty directory named like the extension (no .raw) in /etc/extensions/ to "mask" an extension with the same name in a system folder with lower precedence. A simple mechanism for version compatibility is enforced: a system extension image must carry a /usr/lib/extension-release.d/extension-release._NAME_ file, which must match its image name, that is compared with the host os-release file: the contained _ID=_ fields have to match unless "_any" is set for the extension. If the extension _ID=_ is not "_any", the _SYSEXT_LEVEL=_ field (if defined) has to match. If the latter is not defined, the _VERSION_ID=_ field has to match instead. If the extension defines the _ARCHITECTURE=_ field and the value is not "_any" it has to match the kernel's architecture reported by uname(2) but the used architecture identifiers are the same as for _ConditionArchitecture=_ described in systemd.unit(5). _EXTENSION_RELOAD_MANAGER=_ can be set to 1 if the extension requires a service manager reload after application of the extension. Note that for the reasons mentioned earlier, **Portable** **Services******[2] remain the recommended way to ship system services. System extensions should not ship a /usr/lib/os-release file (as that would be merged into the host /usr/ tree, overriding the host OS version data, which is not desirable). The extension-release file follows the same format and semantics, and carries the same content, as the os-release file of the OS, but it describes the resources carried in the extension image. The**systemd-confext** concept follows the same principle as the systemd-sysext(8) functionality but instead of working on /usr and /opt, **confext** will extend only /etc. Files and directories contained in the confext images outside of the /etc/ hierarchy are _not_ merged, and hence have no effect when included in the image. Formats for these images are of the same as sysext images. The merged hierarchy will be mounted with "nosuid" and (if not disabled via **--noexec=false**) "noexec". Just like sysexts, confexts are strictly read-only by default. Merging confexts on mutable host file systems will result in /etc/ becoming read-only. As with sysexts, mutability can be enabled via the **--mutable=** option. Refer to "Mutability" below for more information. Confexts are looked for in the directories /run/confexts/, /var/lib/confexts/, /usr/lib/confexts/ and /usr/local/lib/confexts/. The first listed directory is not suitable for carrying large binary images, however is still useful for carrying symlinks to them. The primary place for installing configuration extensions is /var/lib/confexts/. Any directories found in these search directories are considered directory based confext images; any files with the .raw suffix are considered disk image based confext images. Again, just like sysext images, the confext images will contain a /etc/extension-release.d/extension-release._NAME_ file, which must match the image name (with the usual escape hatch of the _user.extension-release.strict_ xattr(7)), and again with content being one or more of _ID=_ , _VERSION_ID=_ , and _CONFEXT_LEVEL_. Confext images will then be checked and matched against the base OS layer. ## USES The primary use case for system images are immutable environments where debugging and development tools shall optionally be made available, but not included in the immutable base OS image itself (e.g. strace(1) and gdb(1) shall be an optionally installable addition in order to make debugging/development easier). System extension images should not be misunderstood as a generic software packaging framework, as no dependency scheme is available: system extensions should carry all files they need themselves, except for those already shipped in the underlying host system image. Typically, system extension images are built at the same time as the base OS image β€” within the same build system. Another use case for the system extension concept is temporarily overriding OS supplied resources with newer ones, for example to install a locally compiled development version of some low-level component over the immutable OS image without doing a full OS rebuild or modifying the nominally immutable image. (e.g. "install" a locally built package with **DESTDIR=/var/lib/extensions/mytest make install && systemd-sysext** **refresh** , making it available in /usr/ as if it was installed in the OS image itself.) This case works regardless of whether the underlying host /usr/ is managed as immutable disk image or is a traditional package manager controlled (i.e. writable) tree. With **systemd-confext** one can perform runtime reconfiguration of OS services. Sometimes, there is a need to swap certain configuration parameter values or restart only a specific service without deployment of new code or a complete OS deployment. In other words, we want to be able to tie the most frequently configured options to runtime updateable flags that can be changed without a system reboot. This will help reduce servicing times when there is a need for changing the OS configuration. It also provides a reliable tool for managing configuration because all old configuration files disappear when the **systemd-confext** image is removed. ## MUTABILITY By default, merging system extensions on mutable host file systems will render /usr/ and /opt/ hierarchies read-only. Merging configuration extensions will have the same effect on /etc/. Mutable mode allows writes to these locations when extensions are merged. The following modes are supported: 1. **disabled** : Force immutable mode even if write routing directories exist below /var/lib/extensions.mutable/. This is the default. 2. **auto** : Automatic mode. Mutability is disabled by default and only enabled if a corresponding write routing directory exists below /var/lib/extensions.mutable/. 3. **enabled** : Force mutable mode and automatically create write routing directories below /var/lib/extensions.mutable/ when required. 4. **import** : Force immutable mode like **disabled** above, but merge the contents of directories below /var/lib/extensions.mutable/ into the host file system. 5. **ephemeral** : Force mutable mode like **enabled** above, but instead of using write routing directory below /var/lib/extensions.mutable/, **systemd-sysext** will use empty ephemeral directories. This means that the modifications made in the merged hierarchies will be gone when the hierarchies are unmerged. 6. **ephemeral-import** : Force mutable mode like **ephemeral** above, but instead of ignoring the contents of write routing directories under /var/lib/extensions.mutable/, merge them into the host file system, like **import** does. See "Options" below on specifying modes using the **--mutable=** command line option. With exception of the ephemeral mode, the mutable mode routes writes to subdirectories in /var/lib/extensions.mutable/. Writes to /usr/ are directed to /var/lib/extensions.mutable/usr/ writes to /opt/ are directed to /var/lib/extensions.mutable/opt/, and writes to /etc/ land in /var/lib/extensions.mutable/etc/. If usr/, opt/, or etc/ in /var/lib/extensions.mutable/ are symlinks, then writes are directed to the symlinks' targets. Consequently, to retain mutability of a host file system, create symlinks /var/lib/extensions.mutable/etc/ β†’ /etc/ /var/lib/extensions.mutable/usr/ β†’ /usr/ /var/lib/extensions.mutable/opt/ β†’ /opt/ to route writes back to the original base directory hierarchy. Alternatively, a temporary file system may be mounted to /var/lib/extensions.mutable/, or symlinks in /var/lib/extensions.mutable/ may point to sub-directories on a temporary file system (e.g. below /tmp/) to only allow ephemeral changes. Note that this is not the same as ephemeral mode, because the temporary file system will still exist after unmerging. Added in version 256. ## COMMANDS The following commands are understood by both the sysext and confext concepts: **status** When invoked without any command verb, or when **status** is specified the current merge status is shown, separately (for both /usr/ and /opt/ of sysext and for /etc/ of confext). Added in version 248. **merge** Merges all currently installed system extension images into /usr/ and /opt/, by overmounting these hierarchies with an "overlayfs" file system combining the underlying hierarchies with those included in the extension images. This command will fail if the hierarchies are already merged. For confext, the merge happens into the /etc/ directory instead. Added in version 248. **unmerge** Unmerges all currently installed system extension images from /usr/ and /opt/ for sysext and /etc/, for confext, by unmounting the "overlayfs" file systems created by **merge** prior. Added in version 248. **refresh** A combination of **unmerge** and **merge** : if already mounted the existing "overlayfs" instance is unmounted temporarily, and then replaced by a new version. This command is useful after installing/removing system extension images, in order to update the "overlayfs" file system accordingly. If no system extensions are installed when this command is executed, the equivalent of **unmerge** is executed, without establishing any new "overlayfs" instance. Note that currently there's a brief moment where neither the old nor the new "overlayfs" file system is mounted. This implies that all resources supplied by a system extension will briefly disappear β€” even if it exists continuously during the refresh operation. Added in version 248. **list** A brief list of installed extension images is shown. Added in version 248. **-h** , **--help** Print a short help text and exit. **--version** Print a short version string and exit. ## OPTIONS **--root=** Operate relative to the specified root directory, i.e. establish the "overlayfs" mount not on the top-level host /usr/ and /opt/ hierarchies for sysext or /etc/ for confext, but below some specified root directory. Added in version 248. **--force** When merging system extensions into /usr/ and /opt/ for sysext and /etc/ for confext, ignore version incompatibilities, i.e. force merging regardless of whether the version information included in the images matches the host or not. Added in version 248. **--image-policy=**_policy_ Takes an image policy string as argument, as per systemd.image-policy(7). The policy is enforced when operating on system extension disk images. If not specified, defaults to "root=verity+signed+encrypted+unprotected+absent:usr=verity+signed+encrypted+unprotected+absent" for system extensions, i.e. only the root and /usr/ file systems in the image are used. For configuration extensions defaults to "root=verity+signed+encrypted+unprotected+absent". When run in the initrd and operating on a system extension image stored in the /.extra/sysext/ directory a slightly stricter policy is used by default: "root=signed+absent:usr=signed+absent", see above for details. Added in version 254. **--mutable=**_BOOL_**|**_auto_**|**_import_**|**_ephemeral_**|**_ephemeral-import_ Set mutable mode. **no** force immutable mode even with write routing directories present. This is the default. Added in version 256. **auto** enable mutable mode individually for /usr/, /opt/, and /etc/ if write routing sub-directories or symlinks are present in /var/lib/extensions.mutable/; disable otherwise. See "Mutability" above for more information on write routing. Added in version 256. **yes** force mutable mode. Write routing directories will be created in /var/lib/extensions.mutable/ if not present. Added in version 256. **import** immutable mode, but with contents of write routing directories in /var/lib/extensions.mutable/ also merged into the host file system. Added in version 256. **ephemeral** force mutable mode, but with contents of write routing directories in /var/lib/extensions.mutable/ being ignored, and modifications of the host file system being discarded after unmerge. Added in version 256. **ephemeral-import** force mutable mode, with contents of write routing directories in /var/lib/extensions.mutable/ being merged into the host file system, but with the modifications made to the host file system being discarded after unmerge. Added in version 256. Added in version 256. **--noexec=**_BOOL_ When merging configuration extensions into /etc/ the "MS_NOEXEC" mount flag is used by default. This option can be used to disable it. Added in version 254. **--no-reload** When used with **merge** , **unmerge** or **refresh** , do not reload daemon after executing the changes even if an extension that is applied requires a reload via the _EXTENSION_RELOAD_MANAGER=_ set to 1. Added in version 255. **--no-pager** Do not pipe output into a pager. **--no-legend** Do not print the legend, i.e. column headers and the footer with hints. **--json=**_MODE_ Shows output formatted as JSON. Expects one of "short" (for the shortest possible output without any redundant whitespace or line breaks), "pretty" (for a pretty version of the same, with indentation and line breaks) or "off" (to turn off JSON output, the default). ## EXIT STATUS On success, 0 is returned. ## NOTES 1. Discoverable Partitions Specification https://uapi-group.org/specifications/specs/discoverable_partitions_specification 2. Portable Services https://systemd.io/PORTABLE_SERVICES * * *
# systemd-suspend.service ## NAME systemd-suspend.service, systemd-hibernate.service, systemd- hybrid-sleep.service, systemd-suspend-then-hibernate.service, systemd-sleep - System sleep state logic ## SYNOPSIS systemd-suspend.service systemd-hibernate.service systemd-hybrid-sleep.service systemd-suspend-then-hibernate.service /usr/lib/systemd/system-sleep ## DESCRIPTION systemd-suspend.service is a system service that is pulled in by suspend.target and is responsible for the actual system suspend. Similarly, systemd-hibernate.service is pulled in by hibernate.target to execute the actual hibernation. Finally, systemd-hybrid-sleep.service is pulled in by hybrid-sleep.target to execute hybrid hibernation with system suspend and pulled in by suspend-then-hibernate.target to execute system suspend with a timeout that will activate hibernate later. Immediately before entering system suspend and/or hibernation systemd-suspend.service (and the other mentioned units, respectively) will run all executables in /usr/lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be "pre", the second either "suspend", "hibernate", "hybrid-sleep", or "suspend-then-hibernate" depending on the chosen action. An environment variable called "SYSTEMD_SLEEP_ACTION" will be set and contain the sleep action that is processing. This is primarily helpful for "suspend-then-hibernate" where the value of the variable will be "suspend", "hibernate", or "suspend-after-failed-hibernate" in cases where hibernation has failed. Immediately after leaving system suspend and/or hibernation the same executables are run, but the first argument is now "post". All executables in this directory are executed in parallel, and execution of the action is not continued until all executables have finished. Note that user.slice will be frozen while the executables are running, so they should not attempt to communicate with any user services expecting a reply. Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks. If applications want to react to system suspend/hibernation and resume, they should rather use the **Inhibitor Locks******[1]. Note that systemd-suspend.service, systemd-hibernate.service, systemd-hybrid-sleep.service, and systemd-suspend-then-hibernate.service should never be executed directly. Instead, trigger system sleep with a command such as**systemctl suspend** or **systemctl hibernate**. Internally, this service will echo a string like "mem" into /sys/power/state, to trigger the actual system suspend. What exactly is written where can be configured in the [Sleep] section of /etc/systemd/sleep.conf or a sleep.conf.d file. See systemd-sleep.conf(5). Note that by default these services freeze user.slice while they run. This prevents the execution of any process in any of the user sessions while the system is entering into and resuming from sleep. Thus, this prevents the hooks in /usr/lib/systemd/system-sleep/, or any other process for that matter, from communicating with any user session process during sleep. ## OPTIONS **systemd-sleep** understands the following commands: **-h** , **--help** Print a short help text and exit. **--version** Print a short version string and exit. **suspend** , **hibernate** , **suspend-then-hibernate** , **hybrid-sleep** Suspend, hibernate, suspend then hibernate, or put the system to hybrid sleep. Added in version 203. ## NOTES 1. Inhibitor Locks https://systemd.io/INHIBITOR_LOCKS * * *
# sln ## NAME sln - create symbolic links ## SYNOPSIS **sln** _source dest_ **sln** _filelist_ ## DESCRIPTION The **sln** program creates symbolic links. Unlike the ln(1) program, it is statically linked. This means that if for some reason the dynamic linker is not working, **sln** can be used to make symbolic links to dynamic libraries. The command line has two forms. In the first form, it creates _dest_ as a new symbolic link to _source_. In the second form, _filelist_ is a list of space-separated pathname pairs, and the effect is as if **sln** was executed once for each line of the file, with the two pathnames as the arguments. The **sln** program supports no command-line options. * * *
# lspci ## NAME lspci - list all PCI devices ## SYNOPSIS **lspci**[**options**] ## DESCRIPTION **lspci** is a utility for displaying information about PCI buses in the system and devices connected to them. By default, it shows a brief list of devices. Use the options described below to request either a more verbose output or output intended for parsing by other programs. If you are going to report bugs in PCI device drivers or in _lspci_ itself, please include output of "lspci -vvx" or even better "lspci -vvxxx" (however, see below for possible caveats). Some parts of the output, especially in the highly verbose modes, are probably intelligible only to experienced PCI hackers. For exact definitions of the fields, please consult either the PCI specifications or the **header.h** and **/usr/include/linux/pci.h** include files. Access to some parts of the PCI configuration space is restricted to root on many operating systems, so the features of _lspci_ available to normal users are limited. However, _lspci_ tries its best to display as much as available and mark all other information with _< access denied>_ text. ## OPTIONS **Basic display modes** **-m** Dump PCI device data in a backward-compatible machine readable form. See below for details. **-mm** Dump PCI device data in a machine readable form for easy parsing by scripts. See below for details. **-t** Show a tree-like diagram containing all buses, bridges, devices and connections between them. **Display options** **-v** Be verbose and display detailed information about all devices. **-vv** Be very verbose and display more details. This level includes everything deemed useful. **-vvv** Be even more verbose and display everything we are able to parse, even if it doesn't look interesting at all (e.g., undefined memory regions). **-k** Show kernel drivers handling each device and also kernel modules capable of handling it. Turned on by default when **-v** is given in the normal mode of output. (Currently works only on Linux with kernel 2.6 or newer.) **-x** Show hexadecimal dump of the standard part of the configuration space (the first 64 bytes or 128 bytes for CardBus bridges). **-xxx** Show hexadecimal dump of the whole PCI configuration space. It is available only to root as several PCI devices **crash** when you try to read some parts of the config space (this behavior probably doesn't violate the PCI standard, but it's at least very stupid). However, such devices are rare, so you needn't worry much. **-xxxx** Show hexadecimal dump of the extended (4096-byte) PCI configuration space available on PCI-X 2.0 and PCI Express buses. **-b** Bus-centric view. Show all IRQ numbers and addresses as seen by the cards on the PCI bus instead of as seen by the kernel. **-D** Always show PCI domain numbers. By default, lspci suppresses them on machines which have only domain 0. **-P** Identify PCI devices by path through each bridge, instead of by bus number. **-PP** Identify PCI devices by path through each bridge, showing the bus number as well as the device number. **Options to control resolving ID's to names** **-n** Show PCI vendor and device codes as numbers instead of looking them up in the PCI ID list. **-nn** Show PCI vendor and device codes as both numbers and names. **-q** Use DNS to query the central PCI ID database if a device is not found in the local **pci.ids** file. If the DNS query succeeds, the result is cached in **$XDG_CACHE_HOME/pci-ids** and it is recognized in subsequent runs even if **-q** is not given any more. Please use this switch inside automated scripts only with caution to avoid overloading the database servers. **-qq** Same as **-q** , but the local cache is reset. **-Q** Query the central database even for entries which are recognized locally. Use this if you suspect that the displayed entry is wrong. **Options for selection of devices** **-s [[[[ <domain>]:]<bus>]:][<device>][.[<func>]]** Show only devices in the specified domain (in case your machine has several host bridges, they can either share a common bus number space or each of them can address a PCI domain of its own; domains are numbered from 0 to ffff), bus (0 to ff), device (0 to 1f) and function (0 to 7). Each component of the device address can be omitted or set to "*", both meaning "any value". All numbers are hexadecimal. E.g., "0:" means all devices on bus 0, "0" means all functions of device 0 on any bus, "0.3" selects third function of device 0 on all buses and ".4" shows only the fourth function of each device. **-d [ <vendor>]:[<device>][:<class>[:<prog-if>]]** Show only devices with specified vendor, device, class ID, and programming interface. The ID's are given in hexadecimal and may be omitted or given as "*", both meaning "any value". The class ID can contain "x" characters which stand for "any digit". **Other options** **-i <file>** Use **< file> **as the PCI ID list instead of /usr/local/share/pci.ids. **-p <file>** Use **< file> **as the map of PCI ID's handled by kernel modules. By default, lspci uses /lib/modules/_kernel_version_ /modules.pcimap. Applies only to Linux systems with recent enough module tools. **-M** Invoke bus mapping mode which performs a thorough scan of all PCI devices, including those behind misconfigured bridges, etc. This option gives meaningful results only with a direct hardware access mode, which usually requires root privileges. By default, the bus mapper scans domain. You can use the **-s** option to select a different domain. **--version** Shows _lspci_ version. This option should be used stand- alone. **PCI access options** The PCI utilities use the PCI library to talk to PCI devices (see pcilib(7) for details). You can use the following options to influence its behavior: **-A <method>** The library supports a variety of methods to access the PCI hardware. By default, it uses the first access method available, but you can use this option to override this decision. See **-A help** for a list of available methods and their descriptions. **-O <param>=<value>** The behavior of the library is controlled by several named parameters. This option allows one to set the value of any of the parameters. Use **-O help** for a list of known parameters and their default values. **-H1** Use direct hardware access via Intel configuration mechanism 1. (This is a shorthand for **-A intel-conf1**.) **-H2** Use direct hardware access via Intel configuration mechanism 2. (This is a shorthand for **-A intel-conf2**.) **-F <file>** Instead of accessing real hardware, read the list of devices and values of their configuration registers from the given file produced by an earlier run of lspci -x. This is very useful for analysis of user-supplied bug reports, because you can display the hardware configuration in any way you want without disturbing the user with requests for more dumps. **-G** Increase debug level of the library. ## MACHINE READABLE OUTPUT If you intend to process the output of lspci automatically, please use one of the machine-readable output formats (**-m** , **-vm** , **-vmm**) described in this section. All other formats are likely to change between versions of lspci. All numbers are always printed in hexadecimal. If you want to process numeric ID's instead of names, please add the **-n** switch. **Simple format (-m)** In the simple format, each device is described on a single line, which is formatted as parameters suitable for passing to a shell script, i.e., values separated by whitespaces, quoted and escaped if necessary. Some of the arguments are positional: slot, class, vendor name, device name, subsystem vendor name and subsystem name (the last two are empty if the device has no subsystem); the remaining arguments are option-like: **-r** _rev_ Revision number. **-p** _progif_ Programming interface. The relative order of positional arguments and options is undefined. New options can be added in future versions, but they will always have a single argument not separated from the option by any spaces, so they can be easily ignored if not recognized. **Verbose format (-vmm)** The verbose output is a sequence of records separated by blank lines. Each record describes a single device by a sequence of lines, each line containing a single `_tag_ : _value_ ' pair. The _tag_ and the _value_ are separated by a single tab character. Neither the records nor the lines within a record are in any particular order. Tags are case-sensitive. The following tags are defined: **Slot** The name of the slot where the device resides ([_domain_ :]_bus_ :_device_._function_). This tag is always the first in a record. **Class** Name of the class. **Vendor** Name of the vendor. **Device** Name of the device. **SVendor** Name of the subsystem vendor (optional). **SDevice** Name of the subsystem (optional). **PhySlot** The physical slot where the device resides (optional, Linux only). **Rev** Revision number (optional). **ProgIf** Programming interface (optional). **Driver** Kernel driver currently handling the device (optional, Linux only). **Module** Kernel module reporting that it is capable of handling the device (optional, Linux only). Multiple lines with this tag can occur. **NUMANode** NUMA node this device is connected to (optional, Linux only). **IOMMUGroup** IOMMU group that this device is part of (optional, Linux only). New tags can be added in future versions, so you should silently ignore any tags you don't recognize. **Backward-compatible verbose format (-vm)** In this mode, lspci tries to be perfectly compatible with its old versions. It's almost the same as the regular verbose format, but the **Device** tag is used for both the slot and the device name, so it occurs twice in a single record. Please avoid using this format in any new code. ## FILES **/usr/local/share/pci.ids** A list of all known PCI ID's (vendors, devices, classes and subclasses). Maintained at https://pci-ids.ucw.cz/, use the **update-pciids** utility to download the most recent version. **/usr/local/share/pci.ids.gz** If lspci is compiled with support for compression, this file is tried before pci.ids. **$XDG_CACHE_HOME/pci-ids** All ID's found in the DNS query mode are cached in this file. ## BUGS Sometimes, lspci is not able to decode the configuration registers completely. This usually happens when not enough documentation was available to the authors. In such cases, it at least prints the **<?> **mark to signal that there is potentially something more to say. If you know the details, patches will be of course welcome. Access to the extended configuration space is currently supported only by the **linux_sysfs** back-end. * * *
# sm-notify ## NAME sm-notify - send reboot notifications to NFS peers ## SYNOPSIS **/usr/sbin/sm-notify [-dfn] [-m** _minutes_**] [-v** _name_**] [-p** _notify-port_**]** **[-P** _path_**]** ## DESCRIPTION File locks are not part of persistent file system state. Lock state is thus lost when a host reboots. Network file systems must also detect when lock state is lost because a remote host has rebooted. After an NFS client reboots, an NFS server must release all file locks held by applications that were running on that client. After a server reboots, a client must remind the server of file locks held by applications running on that client. For NFS version 2 and version 3, the _Network Status Monitor_ protocol (or NSM for short) is used to notify NFS peers of reboots. On Linux, two separate user-space components constitute the NSM service: **sm-notify** A helper program that notifies NFS peers after the local system reboots **rpc.statd** A daemon that listens for reboot notifications from other hosts, and manages the list of hosts to be notified when the local system reboots The local NFS lock manager alerts its local **rpc.statd** of each remote peer that should be monitored. When the local system reboots, the **sm-notify** command notifies the NSM service on monitored peers of the reboot. When a remote reboots, that peer notifies the local **rpc.statd** , which in turn passes the reboot notification back to the local NFS lock manager. ## NSM OPERATION IN DETAIL The first file locking interaction between an NFS client and server causes the NFS lock managers on both peers to contact their local NSM service to store information about the opposite peer. On Linux, the local lock manager contacts **rpc.statd**. **rpc.statd** records information about each monitored NFS peer on persistent storage. This information describes how to contact a remote peer in case the local system reboots, how to recognize which monitored peer is reporting a reboot, and how to notify the local lock manager when a monitored peer indicates it has rebooted. An NFS client sends a hostname, known as the client's _caller_name_ , in each file lock request. An NFS server can use this hostname to send asynchronous GRANT calls to a client, or to notify the client it has rebooted. The Linux NFS server can provide the client's _caller_name_ or the client's network address to **rpc.statd**. For the purposes of the NSM protocol, this name or address is known as the monitored peer's _mon_name_. In addition, the local lock manager tells **rpc.statd** what it thinks its own hostname is. For the purposes of the NSM protocol, this hostname is known as _my_name_. There is no equivalent interaction between an NFS server and a client to inform the client of the server's _caller_name_. Therefore NFS clients do not actually know what _mon_name_ an NFS server might use in an SM_NOTIFY request. The Linux NFS client records the server's hostname used on the mount command to identify rebooting NFS servers. **Reboot notification** When the local system reboots, the **sm-notify** command reads the list of monitored peers from persistent storage and sends an SM_NOTIFY request to the NSM service on each listed remote peer. It uses the _mon_name_ string as the destination. To identify which host has rebooted, the **sm-notify** command normally sends _my_name_ string recorded when that remote was monitored. The remote **rpc.statd** matches incoming SM_NOTIFY requests using this string, or the caller's network address, to one or more peers on its own monitor list. If **rpc.statd** does not find a peer on its monitor list that matches an incoming SM_NOTIFY request, the notification is not forwarded to the local lock manager. In addition, each peer has its own _NSM_ _state number_ , a 32-bit integer that is bumped after each reboot by the **sm-notify** command. **rpc.statd** uses this number to distinguish between actual reboots and replayed notifications. Part of NFS lock recovery is rediscovering which peers need to be monitored again. The **sm-notify** command clears the monitor list on persistent storage after each reboot. ## OPTIONS **-d** Keeps **sm-notify** attached to its controlling terminal and running in the foreground so that notification progress may be monitored directly. **-f** Send notifications even if **sm-notify** has already run since the last system reboot. **-m** _retry-time_ Specifies the length of time, in minutes, to continue retrying notifications to unresponsive hosts. If this option is not specified, **sm-notify** attempts to send notifications for 15 minutes. Specifying a value of 0 causes **sm-notify** to continue sending notifications to unresponsive peers until it is manually killed. Notifications are retried if sending fails, the remote does not respond, the remote's NSM service is not registered, or if there is a DNS failure which prevents the remote's _mon_name_ from being resolved to an address. Hosts are not removed from the notification list until a valid reply has been received. However, the SM_NOTIFY procedure has a void result. There is no way for **sm-notify** to tell if the remote recognized the sender and has started appropriate lock recovery. **-n** Prevents **sm-notify** from updating the local system's NSM state number. **-p** _port_ Specifies the source port number **sm-notify** should use when sending reboot notifications. If this option is not specified, a randomly chosen ephemeral port is used. This option can be used to traverse a firewall between client and server. **-P, --state-directory-path** _pathname_ Specifies the pathname of the parent directory where NSM state information resides. If this option is not specified, **sm-notify** uses _/var/lib/nfs_ by default. After starting, **sm-notify** attempts to set its effective UID and GID to the owner and group of the subdirectory **sm** of this directory. After changing the effective ids, **sm-** **notify** only needs to access files in **sm** and **sm.bak** within the state-directory-path. **-v** _ipaddr_ **|**_hostname_ Specifies the network address from which to send reboot notifications, and the _mon_name_ argument to use when sending SM_NOTIFY requests. If this option is not specified, **sm-notify** uses a wildcard address as the transport bind address, and uses the _my_name_ recorded when the remote was monitored as the _mon_name_ argument when sending SM_NOTIFY requests. The _ipaddr_ form can be expressed as either an IPv4 or an IPv6 presentation address. If the _ipaddr_ form is used, the **sm-notify** command converts this address to a hostname for use as the _mon_name_ argument when sending SM_NOTIFY requests. This option can be useful in multi-homed configurations where the remote requires notification from a specific network address. ## CONFIGURATION FILE Many of the options that can be set on the command line can also be controlled through values set in the **[sm-notify]** or, in one case, the **[statd]** section of the _/etc/nfs.conf_ configuration file. Values recognized in the **[sm-notify]** section include: **retry-time** , **outgoing-port** , and **outgoing-addr**. These have the same effect as the command line options **m** , **p** , and **v** respectively. An additional value recognized in the **[sm-notify]** section is **lift-** **grace**. By default, **sm-notify** will lift lockd's grace period early if it has no hosts to notify. Some high availability configurations will run one **sm-notify** per floating IP address. In these configurations, lifting the grace period early may prevent clients from reclaiming locks. Setting **lift-grace** to **n** will prevent **sm-notify** from ending the grace period early. **lift-grace** has no corresponding command line option. The value recognized in the **[statd]** section is **state-directory-** **path**. ## SECURITY The **sm-notify** command must be started as root to acquire privileges needed to access the state information database. It drops root privileges as soon as it starts up to reduce the risk of a privilege escalation attack. During normal operation, the effective user ID it chooses is the owner of the state directory. This allows it to continue to access files in that directory after it has dropped its root privileges. To control which user ID **rpc.statd** chooses, simply use chown(1) to set the owner of the state directory. ## ADDITIONAL NOTES Lock recovery after a reboot is critical to maintaining data integrity and preventing unnecessary application hangs. To help **rpc.statd** match SM_NOTIFY requests to NLM requests, a number of best practices should be observed, including: The UTS nodename of your systems should match the DNS names that NFS peers use to contact them The UTS nodenames of your systems should always be fully qualified domain names The forward and reverse DNS mapping of the UTS nodenames should be consistent The hostname the client uses to mount the server should match the server's _mon_name_ in SM_NOTIFY requests it sends Unmounting an NFS file system does not necessarily stop either the NFS client or server from monitoring each other. Both may continue monitoring each other for a time in case subsequent NFS traffic between the two results in fresh mounts and additional file locking. On Linux, if the **lockd** kernel module is unloaded during normal operation, all remote NFS peers are unmonitored. This can happen on an NFS client, for example, if an automounter removes all NFS mount points due to inactivity. **IPv6 and TI-RPC support** TI-RPC is a pre-requisite for supporting NFS on IPv6. If TI-RPC support is built into the **sm-notify** command ,it will choose an appropriate IPv4 or IPv6 transport based on the network address returned by DNS for each remote peer. It should be fully compatible with remote systems that do not support TI-RPC or IPv6. Currently, the **sm-notify** command supports sending notification only via datagram transport protocols. ## FILES _/var/lib/nfs/sm_ directory containing monitor list _/var/lib/nfs/sm.bak_ directory containing notify list _/var/lib/nfs/state_ NSM state number for this host _/proc/sys/fs/nfs/nsm_local_state_ kernel's copy of the NSM state number * * *
# tc-codel ## NAME CoDel - Controlled-Delay Active Queue Management algorithm ## SYNOPSIS **tc qdisc ... codel**[ **limit** PACKETS ] [ **target** TIME ] [ **interval** TIME ] [ **ecn** | **noecn**] [ **ce_threshold** TIME ] ## DESCRIPTION CoDel (pronounced "coddle") is an adaptive "no-knobs" active queue management algorithm (AQM) scheme that was developed to address the shortcomings of RED and its variants. It was developed with the following goals in mind: * It should be parameterless. * It should keep delays low while permitting bursts of traffic. * It should control delay. * It should adapt dynamically to changing link rates with no impact on utilization. * It should be simple and efficient and should scale from simple to complex routers. ## ALGORITHM CoDel comes with three major innovations. Instead of using queue size or queue average, it uses the local minimum queue as a measure of the standing/persistent queue. Second, it uses a single state-tracking variable of the minimum delay to see where it is relative to the standing queue delay. Third, instead of measuring queue size in bytes or packets, it is measured in packet-sojourn time in the queue. CoDel measures the minimum local queue delay (i.e. standing queue delay) and compares it to the value of the given acceptable queue delay **target.** As long as the minimum queue delay is less than **target** or the buffer contains fewer than MTU worth of bytes, packets are not dropped. Codel enters a dropping mode when the minimum queue delay has exceeded **target** for a time greater than **interval.** In this mode, packets are dropped at different drop times which is set by a control law. The control law ensures that the packet drops cause a linear change in the throughput. Once the minimum delay goes below **target,** packets are no longer dropped. Additional details can be found in the paper cited below. ## PARAMETERS **limit** is the hard limit on the real queue size. When this limit is reached, incoming packets are dropped. If the value is lowered, packets are dropped so that the new limit is met. Default is 1000 packets. **target** is the acceptable minimum standing/persistent queue delay. This minimum delay is identified by tracking the local minimum queue delay that packets experience. Default and recommended value is 5ms. **interval** is used to ensure that the measured minimum delay does not become too stale. The minimum delay must be experienced in the last epoch of length **interval.** It should be set on the order of the worst- case RTT through the bottleneck to give endpoints sufficient time to react. Default value is 100ms. **ecn | noecn** can be used to mark packets instead of dropping them. If **ecn** has been enabled, **noecn** can be used to turn it off and vice-a-versa. By default, **ecn** is turned off. **ce_threshold** sets a threshold above which all packets are marked with ECN Congestion Experienced. This is useful for DCTCP-style congestion control algorithms that require marking at very shallow queueing thresholds. ## EXAMPLES # tc qdisc add dev eth0 root codel # tc -s qdisc show qdisc codel 801b: dev eth0 root refcnt 2 limit 1000p target 5.0ms interval 100.0ms Sent 245801662 bytes 275853 pkt (dropped 0, overlimits 0 requeues 24) backlog 0b 0p requeues 24 count 0 lastcount 0 ldelay 2us drop_next 0us maxpacket 7306 ecn_mark 0 drop_overlimit 0 # tc qdisc add dev eth0 root codel limit 100 target 4ms interval 30ms ecn # tc -s qdisc show qdisc codel 801c: dev eth0 root refcnt 2 limit 100p target 4.0ms interval 30.0ms ecn Sent 237573074 bytes 268561 pkt (dropped 0, overlimits 0 requeues 5) backlog 0b 0p requeues 5 count 0 lastcount 0 ldelay 76us drop_next 0us maxpacket 2962 ecn_mark 0 drop_overlimit 0 ## SOURCES Kathleen Nichols and Van Jacobson, "Controlling Queue Delay", ACM Queue, http://queue.acm.org/detail.cfm?id=2209336 * * *
# systemd-importd.service ## NAME systemd-importd.service, systemd-importd - VM and container image import and export service ## SYNOPSIS systemd-importd.service /usr/lib/systemd/systemd-importd ## DESCRIPTION **systemd-importd** is a system service that allows importing, exporting and downloading of disk images. It provides the implementation for importctl(1)'s **pull-raw** , **pull-tar** , **import-raw** , **import-tar** , **import-fs** , **export-raw** , and **export-tar** commands. See org.freedesktop.import1(5) and org.freedesktop.LogControl1(5) for a description of the D-Bus API. * * *
# arptables-nft-save ## NAME arptables-save β€” dump arptables rules to stdout (nft-based) ## SYNOPSIS **arptables-save**[**-M** _modprobe_] [**-c**] **arptables-save**[**-V**] ## DESCRIPTION **arptables-save** is used to dump the contents of an ARP Table in easily parseable format to STDOUT. Use I/O-redirection provided by your shell to write to a file. **-M** , **--modprobe** _modprobe_program_ Specify the path to the modprobe program. By default, arptables-save will inspect /proc/sys/kernel/modprobe to determine the executable's path. **-c** , **--counters** Include the current values of all packet and byte counters in the output. **-V** , **--version** Print version information and exit. * * *
# stap-exporter ## NAME stap-exporter - systemtap-prometheus interoperation mechanism ## SYNOPSIS **stap-exporter**[ _OPTIONS_ ] ## DESCRIPTION _stap-exporter_ runs a set of systemtap scripts and relays their procfs outputs to remote HTTP clients on demand. This makes systemtap scripts directly usable as individual prometheus exporters. This is assisted by a set of macros provided in the **prometheus.stpm** tapset file. ## OPTIONS The _stap-exporter_ program supports the following options. **-p --port PORT** Listen to the specified TCP port for HTTP requests. Port 9900 is used by default. **-k --keepalive KEEPALIVE** Scripts that run longer than KEEPALIVE seconds beyond the last request are shut down. There is no timeout by default, so once started, scripts are kept running. **-s --scripts SCRIPTS** Search the directory SCRIPTS for ***.stp** files to be exposed. The default is given in the **stappaths.7** man page. **-h --help** Print help message. ## OPERATION Upon startup, _stap-exporter_ searches the directory specified by the **-s** directory for files named ***.stp**. The name of each file becomes available as a URL component for subsequent GET HTTP requests. For example, when an HTTP client asks for **/foo.stp** , and the **foo.stp** script (executable / shell-script) was known, then it is spawned with additional _stap_ options to set a module name. This predictable module name makes it possible for stap-exporter to transcribe a procfs file from that running script to HTTP clients. After a configurable period of disuse (**-k** or **--keepalive** option), a systemtap script is terminated. It will be restarted again if a client requests. All files whose name includes the substring **autostart** are started immediately (and restarted if they stop), rather than on-demand. These are excluded from keepalive considerations. Scripts that may be too slow to start or wish to report long-term statistics are candidates for this treatment. ## EXAMPLE Suppose that **example.stp** contains the following script. It counts read syscalls on a per-thread & per-cpu basis. global arr% probe syscall.read { arr[tid(), cpu()]++ } probe prometheus { @prometheus_dump_array2(arr, "count", "tid", "cpu") } The _prometheus_dump_array_ macros are used to produce metrics from an array. Systemtap provides a _prometheus_dump_arrayN_ macro for all N from 1 to 8. The first argument of the macros represents an array with N-element keys. The second argument represents the name of the metric. The remaining N arguments represent the names of the metric's labels. One may launch stap-exporter as root, or equivalent _stapdev_ privi‐ leges, then after a brief delay, use any web client to fetch data: # stap-exporter -p 9999 -k 60 -c . & $ curl http://localhost:9999/example.stp Refresh page to access metrics. [...] $ curl http://localhost:9999/example.stp count{tid="12614",cpu="0"} 9 count{tid="12170",cpu="3"} 107 count{tid="1802",cpu="0"} 33687 count{tid="12617",cpu="1"} 99 [...] The same URL may be added to a Prometheus server's scrape_config section, or a Performance Co-Pilot pmdaprometheus config.d direc‐ tory, to collect this data into a monitoring system. ## SAFETY AND SECURITY The stap-exporter server does not enforce any particular security mechanisms. Therefore, deployment in an untrusted environment needs to consider: script selection Since systemtap scripts are run under the privileges of the stap-exporter process (probably _root_), the system adminis‐ trator must select only safe & robust scripts. Check the scripts installed by default before activating the service. Scripts cannot take input from the web clients. TCP/IP firewalling Since stap-exporter exposes the selected TCP/HTTP port to all interfaces on the host, it may be necessary to add a firewall. It is unlikely to be appropriate to expose such a service to an untrusted network. HTTP filtering Since stap-exporter exposes the configured systemtap scripts to all HTTP clients without authentication, it may be necessary to protect it from abuse even on mostly trust‐ ed networks. An HTTP proxy may be used to impose URL- or client- or usage- or authentication-dependent filters. HTTPS Since stap-exporter speaks only plain HTTP, an HTTP proxy may be used to support HTTPS secure protocols. ## BUGS Use the Bugzilla link of the project web page or our mailing list. **http://sourceware.org/systemtap/ **, **< [email protected]>**. error::reporting(7stap), **https://sourceware.org/systemtap/wiki/HowToReportBugs ** * * *
# tc-skbedit ## NAME skbedit - SKB editing action ## SYNOPSIS **tc**... **action skbedit**[ **queue_mapping** _QUEUE_MAPPING_ ] [ **priority** _PRIORITY_ ] [ **mark** _MARK_[**/**_MASK] ] [_ **ptype** _PTYPE_ ] [ **inheritdsfield**] ## DESCRIPTION The **skbedit** action allows one to change a packet's associated meta data. It complements the **pedit** action, which in turn allows one to change parts of the packet data itself. The most unique feature of **skbedit** is its ability to decide over which queue of an interface with multiple transmit queues the packet is to be sent out. The number of available transmit queues is reflected by sysfs entries within _/sys/class/net/ <interface>/queues_ with name _tx-N_ (where _N_ is the actual queue number). ## OPTIONS **queue_mapping** _QUEUE_MAPPING_ Override the packet's transmit queue. Useful when applied to packets transmitted over MQ-capable network interfaces. _QUEUE_MAPPING_ is an unsigned 16bit value in decimal format. **priority** _PRIORITY_ Override the packet classification decision. _PRIORITY_ is either **root** , **none** or a hexadecimal major class ID optionally followed by a colon (**:**) and a hexadecimal minor class ID. **mark** _MARK_[**/**_MASK]_ Change the packet's firewall mark value. _MARK_ is an unsigned 32bit value in automatically detected format (i.e., prefix with '**0x** ' for hexadecimal interpretation, etc.). _MASK_ defines the 32-bit mask selecting bits of mark value. Default is 0xffffffff. **ptype** _PTYPE_ Override the packet's type. Useful for setting packet type to host when needing to allow ingressing packets with the wrong MAC address but correct IP address. _PTYPE_ is one of: host, otherhost, broadcast, multicast **inheritdsfield** Override the packet classification decision, and any value specified with **priority** , using the information stored in the Differentiated Services Field of the IPv6/IPv4 header (RFC2474). * * *
# route ## NAME route - show / manipulate the IP routing table ## SYNOPSIS **route**[**-CFvnNee**] [**-A** family |**-4** |**-6**] **route**[**-v**] [**-A** family |**-4** |**-6**] **add**[**-net** |**-host**] _target_ [**netmask** _Nm_] [**gw** _Gw_] [**metric** _N_] [**mss** _M_] [**window** _W_] [**irtt** _I_] [**reject**] [**mod**] [**dyn**] [**reinstate**] [[**dev**] _If_] **route**[**-v**] [**-A** _family_ |**-4** |**-6**] **del**[**-net** |**-host**] _target_ [**gw** _Gw_] [**netmask** _Nm_] [**metric** _M_] [[**dev**] _If_] **route**[**-V**] [**--version**] [**-h**] [**--help**] ## DESCRIPTION **Route** manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program. When the **add** or **del** options are used, **route** modifies the routing tables. Without these options, **route** displays the current contents of the routing tables. ## OPTIONS **-A** _family_ use the specified address family (eg `inet'). Use **route** **--help** for a full list. You can use **-6** as an alias for **--inet6** and **-4** as an alias for **-A inet** **-F** operate on the kernel's FIB (Forwarding Information Base) routing table. This is the default. **-C** operate on the kernel's routing cache. **-v** select verbose operation. **-n** show numerical addresses instead of trying to determine symbolic host names. This is useful if you are trying to determine why the route to your nameserver has vanished. **-e** use netstat(8)-format for displaying the routing table. **-ee** will generate a very long line with all parameters from the routing table. **del** delete a route. **add** add a new route. _target_ the destination network or host. You can provide an addresses or symbolic network or host name. Optionally you can use **/**_prefixlen_ notation instead of using the **netmask** option. **-net** the _target_ is a network. **-host** the _target_ is a host. **netmask** _NM_ when adding a network route, the netmask to be used. **gw** _GW_ route packets via a gateway. **NOTE:** The specified gateway must be reachable first. This usually means that you have to set up a static route to the gateway beforehand. If you specify the address of one of your local interfaces, it will be used to decide about the interface to which the packets should be routed to. This is a BSDism compatibility hack. **metric** _M_ set the metric field in the routing table (used by routing daemons) to _M_. If this option is not specified the metric for inet6 (IPv6) address family defaults to '1', for inet (IPv4) it defaults to '0'. You should always specify an explicit metric value to not rely on those defaults - they also differ from iproute2. **mss** _M_ sets MTU (Maximum Transmission Unit) of the route to _M_ bytes. Note that the current implementation of the route command does not allow the option to set the Maximum Segment Size (MSS). **window** _W_ set the TCP window size for connections over this route to _W_ bytes. This is typically only used on AX.25 networks and with drivers unable to handle back to back frames. **irtt** _I_ set the initial round trip time (irtt) for TCP connections over this route to _I_ milliseconds (1-12000). This is typically only used on AX.25 networks. If omitted the RFC 1122 default of 300ms is used. **reject** install a blocking route, which will force a route lookup to fail. This is for example used to mask out networks before using the default route. This is NOT for firewalling. **mod, dyn, reinstate** install a dynamic or modified route. These flags are for diagnostic purposes, and are generally only set by routing daemons. **dev** _If_ force the route to be associated with the specified device, as the kernel will otherwise try to determine the device on its own (by checking already existing routes and device specifications, and where the route is added to). In most normal networks you won't need this. If **dev** _If_ is the last option on the command line, the word **dev** may be omitted, as it's the default. Otherwise the order of the route modifiers (**metric netmask gw dev**) doesn't matter. ## EXAMPLES **route add -net 127.0.0.0 netmask 255.0.0.0 metric 1024 dev lo** adds the normal loopback entry, using netmask 255.0.0.0 and associated with the "lo" device (assuming this device was previously set up correctly with ifconfig(8)). **route add -net 192.56.76.0 netmask 255.255.255.0 metric 1024 dev** **eth0** adds a route to the local network 192.56.76.x via "eth0". The word "dev" can be omitted here. **route del default** deletes the current default route, which is labeled "default" or 0.0.0.0 in the destination field of the current routing table. **route del -net 192.56.76.0 netmask 255.255.255.0** deletes the route. Since the Linux routing kernel uses classless addressing, you pretty much always have to specify the netmask that is same as as seen in 'route -n' listing. **route add default gw mango** adds a default route (which will be used if no other route matches). All packets using this route will be gatewayed through the address of a node named "mango". The device which will actually be used for that route depends on how we can reach "mango" - "mango" must be on directly reachable route. **route add mango sl0** Adds the route to the host named "mango" via the SLIP interface (assuming that "mango" is the SLIP host). **route add -net 192.57.66.0 netmask 255.255.255.0 gw mango** This command adds the net "192.57.66.x" to be gatewayed through the former route to the SLIP interface. **route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0** This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via "eth0". This is the correct normal configuration line with a multicasting kernel. **route add -net 10.0.0.0 netmask 255.0.0.0 metric 1024 reject** This installs a rejecting route for the private network "10.x.x.x." **route -6 add 2001:0002::/48 metric 1 dev eth0** This adds a IPv6 route with the specified metric to be directly reachable via eth0. ## OUTPUT The output of the kernel routing table is organized in the following columns **Destination** The destination network or destination host. **Gateway** The gateway address or '*' if none set. **Genmask** The netmask for the destination net; '255.255.255.255' for a host destination and '0.0.0.0' for the **default** route. **Flags** Possible flags include **U**(route is **up**) **H**(target is a **host**) **G**(use **gateway**) **R**(**reinstate** route for dynamic routing) **D**(**dynamically** installed by daemon or redirect) **M**(**modified** from routing daemon or redirect) **A**(installed by **addrconf**) **C**(**cache** entry) **!**(**reject** route) **Metric** The 'distance' to the target (usually counted in hops). **Ref** Number of references to this route. (Not used in the Linux kernel.) **Use** Count of lookups for the route. Depending on the use of -F and -C this will be either route cache misses (-F) or hits (-C). **Iface** Interface to which packets for this route will be sent. **MSS** Default maximum segment size for TCP connections over this route. **Window** Default window size for TCP connections over this route. **irtt** Initial RTT (Round Trip Time). The kernel uses this to guess about the best TCP protocol parameters without waiting on (possibly slow) answers. **HH (cached only)** The number of ARP entries and cached routes that refer to the hardware header cache for the cached route. This will be -1 if a hardware address is not needed for the interface of the cached route (e.g. lo). **Arp (cached only)** Whether or not the hardware address for the cached route is up to date. ## FILES _/proc/net/ipv6_route_ _/proc/net/route_ _/proc/net/rt_cache_ * * *
# systemd-repart ## NAME systemd-repart, systemd-repart.service - Automatically grow and add partitions, and generate disk images (DDIs) ## SYNOPSIS **systemd-repart**[OPTIONS...] [_[BLOCKDEVICE]_...] systemd-repart.service ## DESCRIPTION **systemd-repart** creates partition tables, and adds or grows partitions, based on the configuration files described in repart.d(5). **systemd-repart** is used when _building_ OS images, and also when _deploying_ images to automatically adjust them, during boot, to the system they are running on. This way the image can be minimal in size and may be augmented automatically at boot, taking possession of the disk space available. If invoked with no arguments, **systemd-repart** operates on the block device backing the root file system partition of the running OS, thus adding and growing partitions of the booted OS itself. When called in the initrd, it operates on the block device backing /sysroot/ instead, i.e. on the block device the system will soon transition into. If _--image=_ is used, it will operate on the specified device or image file. The systemd-repart.service service is generally run at boot in the initrd, in order to augment the partition table of the OS before its partitions are mounted. **systemd-repart** operations are mostly incremental: it grows existing partitions or adds new ones, but does not shrink, delete, or move existing partitions. The service is intended to be run on every boot, but when it detects that the partition table already matches the installed repart.d/*.conf configuration files, it executes no operation. The following use cases are among those covered: β€’ The root partition may be grown to cover the whole available disk space. β€’ A /home/, swap, or /srv/ partition can be added. β€’ A second (or third, ...) root partition may be added, to cover A/B style setups where a second version of the root file system is alternatingly used for implementing update schemes. The deployed image would carry only a single partition ("A") but on first boot a second partition ("B") for this purpose is automatically created. The algorithm executed by **systemd-repart** is roughly as follows: 1. The repart.d/*.conf configuration files are loaded and parsed, and ordered by filename (without the directory prefix). For each configuration file, drop-in files are loaded from directories with same name as the configuration file with the suffix ".d" added. 2. The partition table on the block device is loaded and parsed, if present. 3. The existing partitions in the partition table are matched with the repart.d/*.conf files by GPT partition type UUID. The first existing partition of a specific type is assigned the first configuration file declaring the same type. The second existing partition of a specific type is then assigned the second configuration file declaring the same type, and so on. After this iterative assigning is complete, any existing partitions that have no matching configuration file are considered "foreign" and left as they are. And any configuration files for which no partition was matched are treated as requests to create a partition. 4. Partitions that shall be created are now allocated on the disk, taking the size constraints and weights declared in the configuration files into account. Free space is used within the limits set by size and padding requests. In addition, existing partitions that should be grown are grown. New partitions are always appended to the end of the partition table, taking the first partition table slot whose index is greater than the indexes of all existing partitions. Partitions are never reordered and thus partition numbers remain stable. When partitions are created, they are placed in the smallest area of free space that is large enough to satisfy the size and padding limits. This means that partitions might have different order on disk than in the partition table. Note that this allocation happens in memory only, the partition table on disk is not updated yet. 5. All existing partitions for which configuration files exist and which currently have no GPT partition label set will be assigned a label, either explicitly configured in the configuration or β€” if that's missing β€” derived automatically from the partition type. The same is done for all partitions that are newly created. These assignments are done in memory only, too, the disk is not updated yet. 6. Similarly, all existing partitions for which configuration files exist and which currently have an all-zero identifying UUID will be assigned a new UUID. This UUID is cryptographically hashed from a common seed value together with the partition type UUID (and a counter in case multiple partitions of the same type are defined), see below. The same is done for all partitions that are created anew. These assignments are done in memory only, too, the disk is not updated yet. 7. Similarly, if the disk's volume UUID is all zeroes it is also initialized, also cryptographically hashed from the same common seed value. This is done in memory only too. 8. The disk space assigned to new partitions (i.e. what was previously free space) is now erased. Specifically, all file system signatures are removed, and if the device supports it, the **BLKDISCARD** I/O control command is issued to inform the hardware that the space is now empty. In addition any "padding" between partitions and at the end of the device is similarly erased. 9. The new partition table is finally written to disk. The kernel is asked to reread the partition table. As an exception to the normal incremental operation, when called in a special "factory reset" mode, **systemd-repart** may be used to erase existing partitions to reset an installation back to vendor defaults. This mode of operation is used when either the **--factory-reset=yes** switch is passed on the tool's command line, or the **systemd.factory_reset=yes** option is specified on the kernel command line, or the _FactoryResetRequest_ EFI variable (vendor UUID **8cf2644b-4b0b-428f-9387-6d876050dc67**) is set to "yes". It alters the algorithm above slightly: between the 3rd and the 4th step above any partition marked explicitly via the _FactoryReset=_ boolean is deleted, and the algorithm restarted, thus immediately re-creating these partitions anew empty. Note that **systemd-repart** by default only changes partition tables, it does not create or resize any file systems within these partitions, unless the _Format=_ configuration option is specified. Also note that there are also separate mechanisms available for this purpose, for example systemd-growfs(8) and **systemd-makefs**. The UUIDs identifying the new partitions created (or assigned to existing partitions that have no UUID yet), as well as the disk as a whole are hashed cryptographically from a common seed value. This seed value is usually the machine-id(5) of the system, so that the machine ID reproducibly determines the UUIDs assigned to all partitions. If the machine ID cannot be read (or the user passes **--seed=random** , see below) the seed is generated randomly instead, so that the partition UUIDs are also effectively random. The seed value may also be set explicitly, formatted as UUID via the **--seed=** option. By hashing these UUIDs from a common seed images prepared with this tool become reproducible and the result of the algorithm above deterministic. The positional argument should specify the block device or a regular file to operate on. If **--empty=create** is specified, the specified path is created as regular file, which is useful for generating disk images from scratch. ## OPTIONS The following options are understood: **--dry-run=** Takes a boolean. If this switch is not specified, **--dry-run=yes** is the implied default. Controls whether systemd-repart executes the requested re-partition operations or whether it should only show what it would do. Unless **--dry-run=no** is specified systemd-repart will not actually touch the device's partition table. Added in version 245. **--empty=** Takes one of "refuse", "allow", "require", "force" or "create". Controls how to operate on block devices that are entirely empty, i.e. carry no partition table/disk label yet. If this switch is not specified, the implied default is "refuse". If "refuse" **systemd-repart** requires that the block device it shall operate on already carries a partition table and refuses operation if none is found. If "allow" the command will extend an existing partition table or create a new one if none exists. If "require" the command will create a new partition table if none exists so far, and refuse operation if one already exists. If "force" it will create a fresh partition table unconditionally, erasing the disk fully in effect. If "force" no existing partitions will be taken into account or survive the operation. Hence: use with care, this is a great way to lose all your data. If "create" a new loopback file is create under the path passed via the device node parameter, of the size indicated with **--size=** , see below. Added in version 245. **--discard=** Takes a boolean. If this switch is not specified ,**--discard=yes** is the implied default. Controls whether to issue the **BLKDISCARD** I/O control command on the space taken up by any added partitions or on the space in between them. Usually, it is a good idea to issue this request since it tells the underlying hardware that the covered blocks shall be considered empty, improving performance. If operating on a regular file instead of a block device node, a sparse file is generated. Added in version 245. **--size=** Takes a size in bytes, using the usual K, M, G, T suffixes, or the special value "auto". If used the specified device node path must refer to a regular file, which is then grown to the specified size if smaller, before any change is made to the partition table. If specified as "auto" the minimal size for the disk image is automatically determined (i.e. the minimal sizes of all partitions are summed up, taking space for additional metadata into account). This switch is not supported if the specified node is a block device. This switch has no effect if the file is already as large as the specified size or larger. The specified size is implicitly rounded up to multiples of 4096. When used with **--empty=create** this specifies the initial size of the loopback file to create. The **--size=auto** option takes the sizes of pre-existing partitions into account. However, it does not accommodate for partition tables that are not tightly packed: the configured partitions might still not fit into the backing device if empty space exists between pre-existing partitions (or before the first partition) that cannot be fully filled by partitions to grow or create. Also note that the automatic size determination does not take files or directories specified with **CopyFiles=** into account: operation might fail if the specified files or directories require more disk space then the configured per-partition minimal size limit. Added in version 246. **--factory-reset=** Takes boolean. If this switch is not specified, **--factory-reset=no** is the implied default. Controls whether to operate in "factory reset" mode, see above. If set to true this will remove all existing partitions marked with _FactoryReset=_ set to yes early while executing the re-partitioning algorithm. Use with care, this is a great way to lose all your data. Note that partition files need to explicitly turn _FactoryReset=_ on, as the option defaults to off. If no partitions are marked for factory reset this switch has no effect. Note that there are two other methods to request factory reset operation: via the kernel command line and via an EFI variable, see above. Added in version 245. **--can-factory-reset** If this switch is specified the disk is not re-partitioned. Instead it is determined if any existing partitions are marked with _FactoryReset=_. If there are the tool will exit with exit status zero, otherwise non-zero. This switch may be used to quickly determine whether the running system supports a factory reset mechanism built on **systemd-repart**. Added in version 245. **--root=** Takes a path to a directory to use as root file system when searching for repart.d/*.conf files, for the machine ID file to use as seed and for the _CopyFiles=_ and _CopyBlocks=_ source files and directories. By default when invoked on the regular system this defaults to the host's root file system /. If invoked from the initrd this defaults to /sysroot/, so that the tool operates on the configuration and machine ID stored in the root file system later transitioned into itself. See **--copy-source=** for a more restricted option that only affects _CopyFiles=_. Added in version 245. **--image=** Takes a path to a disk image file or device to mount and use in a similar fashion to **--root=** , see above. Added in version 249. **--image-policy=**_policy_ Takes an image policy string as argument, as per systemd.image-policy(7). The policy is enforced when operating on the disk image specified via **--image=** , see above. If not specified, defaults to the "*" policy, i.e. all recognized file systems in the image are used. **--seed=** Takes a UUID as argument or the special value **random**. If a UUID is specified the UUIDs to assign to partitions and the partition table itself are derived via cryptographic hashing from it. If not specified, it is attempted to read the machine ID from the host (or more precisely, the root directory configured via **--root=**) and use it as seed instead, falling back to a randomized seed otherwise. Use **--seed=random** to force a randomized seed. Explicitly specifying the seed may be used to generated strictly reproducible partition tables. Added in version 245. **--pretty=** Takes a boolean argument. If this switch is not specified, it defaults to on when called from an interactive terminal and off otherwise. Controls whether to show a user friendly table and graphic illustrating the changes applied. Added in version 245. **--definitions=** Takes a file system path. If specified the *.conf files are read from the specified directory instead of searching in /usr/lib/repart.d/*.conf, /etc/repart.d/*.conf, /run/repart.d/*.conf. This parameter can be specified multiple times. Added in version 245. **--key-file=** Takes a file system path. Configures the encryption key to use when setting up LUKS2 volumes configured with the _Encrypt=key-file_ setting in partition files. Should refer to a regular file containing the key, or an **AF_UNIX** stream socket in the file system. In the latter case, a connection is made to it and the key read from it. If this switch is not specified, the empty key (i.e. zero length key) is used. This behaviour is useful for setting up encrypted partitions during early first boot that receive their user-supplied password only in a later setup step. Added in version 247. **--private-key=** Takes a file system path or an engine or provider specific designation. Configures the signing key to use when creating verity signature partitions with the _Verity=signature_ setting in partition files. Added in version 252. **--private-key-source=** Takes one of "file", "engine" or "provider". In the latter two cases, it is followed by the name of a provider or engine, separated by colon, that will be passed to OpenSSL's "engine" or "provider" logic. Configures how to load the private key to use when creating verity signature partitions with the _Verity=signature_ setting in partition files. Added in version 256. **--certificate=** Takes a file system path or a provider specific designation. Configures the PEM encoded X.509 certificate to use when creating verity signature partitions with the _Verity=signature_ setting in partition files. Added in version 252. **--certificate-source=** Takes one of "file", or "provider". In the latter case, it is followed by the name of a provider, separated by colon, that will be passed to OpenSSL's "provider" logic. Configures how to load the X.509 certificate to use when creating verity signature partitions with the _Verity=signature_ setting in partition files. Added in version 257. **--join-signature=** Specifies a colon-separated tuple with a hex-encoded top-level Verity hash of a _Verity=hash_ partition as first element, and a PKCS7 signature of the roothash as a path to a DER-encoded signature file, or as an ASCII base64 string encoding of a DER-encoded signature prefixed by "base64:". To be used on a pre-existing image that was created with a parameter such as **--defer-partitions=root-verity-sig** , in order to allow implementing offline signing of the verity signature partition. This is an alternative to online signing using parameters such as **--private-key=** , for build systems where the private key for production signing is not available in the same context where content is created. Added in version 258. **--tpm2-device=** , **--tpm2-pcrs=** Configures the TPM2 device and list of PCRs to use for LUKS2 volumes configured with the _Encrypt=tpm2_ option. These options take the same parameters as the identically named options to systemd-cryptenroll(1) and have the same effect on partitions where TPM2 enrollment is requested. Added in version 248. **--tpm2-device-key=**_PATH_ , **--tpm2-seal-key-handle=**_HANDLE_ Configures a TPM2 SRK key to bind encryption to. See systemd-cryptenroll(1) for details on this option. Added in version 255. **--tpm2-public-key=**_PATH_ , **--tpm2-public-key-pcrs=**_PCR[+PCR...]_ Configures a TPM2 signed PCR policy to bind encryption to. See systemd-cryptenroll(1) for details on these two options. Added in version 252. **--tpm2-pcrlock=**_PATH_ Configures a TPM2 pcrlock policy to bind encryption to. See systemd-cryptenroll(1) for details on this option. Added in version 255. **--split=**_BOOL_ Enables generation of split artifacts from partitions configured with _SplitName=_. If enabled, for each partition with _SplitName=_ set, a separate output file containing just the contents of that partition is generated. The output filename consists of the loopback filename suffixed with the name configured with _SplitName=_. If the loopback filename ends with ".raw", the suffix is inserted before the ".raw" extension instead. Note that **--split** is independent from **--dry-run**. Even if **--dry-run** is enabled, split artifacts will still be generated from an existing image if **--split** is enabled. Added in version 252. **--include-partitions=**_PARTITIONS_ , **--exclude-partitions=**_PARTITIONS_ These options specify which partition types **systemd-repart** should operate on. If **--include-partitions=** is used, all partitions that are not specified are excluded. If **--exclude-partitions=** is used, all partitions that are specified are excluded. Both options take a comma separated list of GPT partition type UUIDs or identifiers (see _Type=_ in repart.d(5)). Added in version 253. **--defer-partitions=**_PARTITIONS_ This option specifies for which partition types **systemd-repart** should defer. All partitions that are deferred using this option are still taken into account when calculating the sizes and offsets of other partitions, but are not actually written to the disk image. The net effect of this option is that if you run **systemd-repart** again without this option, the missing partitions will be added as if they had not been deferred the first time **systemd-repart** was executed. Added in version 253. **--sector-size=**_BYTES_ This option allows configuring the sector size of the image produced by **systemd-repart**. It takes a value that is a power of "2" between "512" and "4096". This option is useful when building images for disks that use a different sector size as the disk on which the image is produced. Added in version 253. **--architecture=**_ARCH_ This option allows overriding the architecture used for architecture specific partition types. For example, if set to "arm64" a partition type of "root-x86-64" referenced in repart.d/ drop-ins will be patched dynamically to refer to "root-arm64" instead. Takes one of "alpha", "arc", "arm", "arm64", "ia64", "loongarch64", "mips-le", "mips64-le", "parisc", "ppc", "ppc64", "ppc64-le", "riscv32", "riscv64", "s390", "s390x", "tilegx", "x86" or "x86-64". Added in version 254. **--offline=**_BOOL_ Instructs **systemd-repart** to build the image offline. Takes a boolean or "auto". Defaults to "auto". If enabled, the image is built without using loop devices. This is useful to build images unprivileged or when loop devices are not available. If disabled, the image is always built using loop devices. If "auto", **systemd-repart** will build the image online if possible and fall back to building the image offline if loop devices are not available or cannot be accessed due to missing permissions. Added in version 254. **--copy-from=**_PATH_ Instructs **systemd-repart** to synthesize partition definitions from the partition table in the given image or device. This option can be specified multiple times to synthesize definitions from each of the given images or devices. The generated definitions will copy the partitions into the destination partition table. The copied partitions will have the same size, metadata and contents but might have a different partition number and might be located at a different offset in the destination partition table. These definitions can be combined with partition definitions read from regular partition definition files. The synthesized definitions take precedence over the definitions read from partition definition files. Added in version 255. **--copy-source=**_PATH_ , **-s** _PATH_ Specifies a source directory all _CopyFiles=_ source paths shall be considered relative to. This is similar to **--root=** , but exclusively applies to the _CopyFiles=_ setting. If **--root=** and **--copy-source=** are used in combination the former applies as usual, except for _CopyFiles=_ where the latter takes precedence. Added in version 255. **--make-ddi=**_TYPE_ Takes one of "sysext", "confext" or "portable". Generates a Discoverable Disk Image (DDI) for a system extension (sysext, see systemd-sysext(8) for details), configuration extension (confext) or **Portable Services******[1]. The generated image will consist of a signed Verity "erofs" file system as root partition. In this mode of operation the partition definitions in /usr/lib/repart.d/*.conf and related directories are not read, and**--definitions=** is not supported, as appropriate definitions for the selected DDI class will be chosen automatically. Must be used in conjunction with **--copy-source=** to specify the file hierarchy to populate the DDI with. The specified directory should contain an etc/ subdirectory if "confext" is selected. If "sysext" is selected it should contain either a usr/ or opt/ directory, or both. If "portable" is used a full OS file hierarchy can be provided. This option implies **--empty=create** , **--size=auto** and **--seed=random**(the latter two can be overridden). The private key and certificate for signing the DDI must be specified via the **--private-key=** and **--certificate=** switches. Added in version 255. **-S** , **-C** , **-P** Shortcuts for **--make-ddi=sysext** , **--make-ddi=confext** , **--make-ddi=portable** , respectively. Added in version 255. **--append-fstab=** Takes one of "no", "auto" or "replace". Controls how the generated fstab(5) file by **--generate-fstab=** will behave in case that there is a previously existing file. If "no" **systemd-repart** will complain and abort in case that there is a file. This is the default behaviour. If "replace" the file will be silently replaced with the new generated one. If "auto" **systemd-repart** will search in the pre-existing file the section that belong to the automatically generated content and will replace it with the newer generated content, and keep the user provided section if there is one. The generated section is identified looking for the automatic content surrounded by "# Start section ↓ of automatically generated fstab by systemd-repart" and "# End section ↑ of automatically generated fstab by systemd-repart". The content that is before and after those comments are considered user provided, and kept in the new file. Added in version 258. **--generate-fstab=**_PATH_ Specifies a path where to write fstab(5) entries for the mountpoints configured with **MountPoint=** in the root directory specified with **--copy-source=** or **--root=** or in the host's root directory if neither is specified. Disabled by default. Added in version 256. **--generate-crypttab=**_PATH_ Specifies a path where to write crypttab entries for the encrypted volumes configured with **EncryptedVolume=** in the root directory specified with **--copy-source=** or **--root=** or in the host's root directory if neither is specified. Disabled by default. Added in version 256. **--list-devices** Show a list of candidate block devices this command may operate on. Specifically, this enumerates block devices currently present that support partition tables, and shows their device node paths along with any of their symlinks. Added in version 257. **-h** , **--help** Print a short help text and exit. **--version** Print a short version string and exit. **--no-pager** Do not pipe output into a pager. **--no-legend** Do not print the legend, i.e. column headers and the footer with hints. **--json=**_MODE_ Shows output formatted as JSON. Expects one of "short" (for the shortest possible output without any redundant whitespace or line breaks), "pretty" (for a pretty version of the same, with indentation and line breaks) or "off" (to turn off JSON output, the default). ## EXIT STATUS On success, 0 is returned, and a non-zero failure code otherwise. ## EXAMPLE **Example 1. Generate a configuration extension image** The following creates a configuration extension DDI (confext) for an /etc/motd update: mkdir -p tree/etc/extension-release.d echo "Hello World" >tree/etc/motd cat >tree/etc/extension-release.d/extension-release.my-motd <<EOF ID=fedora VERSION_ID=38 IMAGE_ID=my-motd IMAGE_VERSION=7 EOF systemd-repart -C \ --private-key=verity-private-key.pem \ --certificate=verity-certificate.pem \ -s tree/ \ /var/lib/confexts/my-motd.confext.raw systemd-confext refresh The DDI generated that way may be applied to the system with **systemd-confext**(1). **Example 2. Generate a system extension image and sign it via** **PKCS11** The following creates a system extension DDI (sysext) for an /usr/foo update and signs it with a hardware token via PKCS11: mkdir -p tree/usr/lib/extension-release.d echo "Hello World" >tree/usr/foo cat >tree/usr/lib/extension-release.d/extension-release.my-foo <<EOF ID=fedora VERSION_ID=38 IMAGE_ID=my-foo IMAGE_VERSION=7 EOF systemd-repart --make-ddi=sysext \ --private-key-source=engine:pkcs11 \ --private-key="pkcs11:model=PKCS%2315%20emulated;manufacturer=piv_II;serial=0123456789abcdef;token=Some%20Cert" \ --certificate=verity-certificate.pem \ -s tree/ \ /var/lib/extensions/my-foo.sysext.raw systemd-sysext refresh The DDI generated that way may be applied to the system with systemd-sysext(8). **Example 3. Generate a dm-verity signature offline and append it to** **a pre-built image** The following creates an image with dm-verity metadata, signs it separately to simulate an offline signing system, and then appends the signature to the image: mkdir -p repart.d/ /tmp/tree/usr/lib/ cat >/tmp/tree/usr/lib/os-release <<EOF ID=debian VERSION_ID=13 EOF cat >repart.d/10-root.conf <<EOF [Partition] Type=root Format=erofs SizeMinBytes=100M SizeMaxBytes=100M Verity=data VerityMatchKey=root EOF cat >repart.d/11-root-verity.conf <<EOF [Partition] Type=root-verity Label=%o_%w_verity Verity=hash VerityMatchKey=root SizeMinBytes=400M SizeMaxBytes=400M EOF cat >repart.d/12-root-verity-sig.conf <<EOF [Partition] Type=root-verity-sig Label=%o_%w_verity_sig Verity=signature VerityMatchKey=root EOF systemd-repart --definitions repart.d \ --defer-partitions=root-verity-sig \ --copy-source=/tmp/tree/ \ --empty=create --size=600M \ --json=short \ /tmp/img.raw | | jq --raw-output0 .[-1].roothash > /tmp/img.roothash openssl smime -sign -in /tmp/img.roothash \ -inkey verity-private-key.pem \ -signer verity-certificate.pem \ -noattr -binary -outform der \ -out /tmp/img.roothash.p7s systemd-repart --definitions repart.d \ --dry-run=no --root=/tmp/tree/ \ --join-signature="$(cat /tmp/img.roothash):/tmp/img.roothash.p7s" \ --certificate=verity-certificate.pem \ /tmp/img.raw ## NOTES 1. Portable Services https://systemd.io/PORTABLE_SERVICES * * *
# pam_systemd ## NAME pam_systemd - Register user sessions in the systemd login manager ## SYNOPSIS pam_systemd.so ## DESCRIPTION **pam_systemd** registers user sessions with the systemd login manager systemd-logind.service(8), and hence the systemd control group hierarchy. The module also applies various resource management and runtime parameters to the new session, as configured in the **JSON User** **Records******[1] of the user, when one is defined. On login, this module β€” in conjunction with systemd-logind.service β€” ensures the following: 1. If it does not exist yet, the user runtime directory /run/user/$UID is either created or mounted as new "tmpfs" file system with quota applied, and its ownership changed to the user that is logging in. 2. The _$XDG_SESSION_ID_ environment variable is initialized. If auditing is available and **pam_loginuid.so** was run before this module (which is highly recommended), the variable is initialized from the auditing session id (/proc/self/sessionid). Otherwise, an independent session counter is used. 3. A new systemd scope unit is created for the session. If this is the first concurrent session of the user, an implicit per-user slice unit below user.slice is automatically created and the scope placed into it. An instance of the system service [email protected], which runs the systemd user manager instance, is started. 4. The "$TZ", "$EMAIL" and "$LANG" environment variables are configured for the user, based on the respective data from the user's JSON record (if it is defined). Moreover, any environment variables explicitly configured in the user record are imported, and the umask, nice level, and resource limits initialized. On logout, this module ensures the following: 1. If enabled in logind.conf(5) (_KillUserProcesses=_), all processes of the session are terminated. If the last concurrent session of a user ends, the user's systemd instance will be terminated too, and so will the user's slice unit. 2. If the last concurrent session of a user ends, the user runtime directory /run/user/$UID and all its contents are removed, too. If the system was not booted up with systemd as init system, this module does nothing and immediately returns **PAM_SUCCESS**. ## OPTIONS The following options are understood: _class=_ Takes a string argument which sets the session class. The _XDG_SESSION_CLASS_ environment variable (see below) takes precedence. See sd_session_get_class(3) for a way to query the class of a session. The following session classes are defined: **Table 1. Session Classes** β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ **Name** β”‚ **Explanation** β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **user** β”‚ A regular interactive β”‚ β”‚ β”‚ user session. This is β”‚ β”‚ β”‚ the default class for β”‚ β”‚ β”‚ sessions for which a TTY β”‚ β”‚ β”‚ or X display is known at β”‚ β”‚ β”‚ session registration β”‚ β”‚ β”‚ time. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **user-early** β”‚ Similar to **user** but β”‚ β”‚ β”‚ sessions of this class β”‚ β”‚ β”‚ are not ordered after β”‚ β”‚ β”‚ systemd-user-sessions.service(8), β”‚ β”‚ β”‚ i.e. may be started β”‚ β”‚ β”‚ before regular sessions β”‚ β”‚ β”‚ are allowed to be β”‚ β”‚ β”‚ established. This β”‚ β”‚ β”‚ session class is the β”‚ β”‚ β”‚ default for sessions of β”‚ β”‚ β”‚ the root user that would β”‚ β”‚ β”‚ otherwise qualify for β”‚ β”‚ β”‚ the **user** class, see β”‚ β”‚ β”‚ above. (Added in v256.) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **user-light** β”‚ Similar to **user** , but sessions of β”‚ β”‚ β”‚ this class will not pull in the β”‚ β”‚ β”‚ [email protected](5) of the user, and β”‚ β”‚ β”‚ thus possibly have no service β”‚ β”‚ β”‚ manager of the user running. β”‚ β”‚ β”‚ (Added in v258.) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **user-early-light** β”‚ Similar to **user-early** , but β”‚ β”‚ β”‚ sessions of this class will not β”‚ β”‚ β”‚ pull in the [email protected](5) of β”‚ β”‚ β”‚ the user, and thus possibly have β”‚ β”‚ β”‚ no service manager of the user β”‚ β”‚ β”‚ running. (Added in v258.) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **user-incomplete** β”‚ Similar to **user** but for sessions β”‚ β”‚ β”‚ which are not fully set up yet, β”‚ β”‚ β”‚ i.e. have no home directory β”‚ β”‚ β”‚ mounted or similar. This is used β”‚ β”‚ β”‚ by systemd-homed.service(8) to β”‚ β”‚ β”‚ allow users to log in via ssh(1) β”‚ β”‚ β”‚ before their home directory is β”‚ β”‚ β”‚ mounted, delaying the mount until β”‚ β”‚ β”‚ the user provided the unlock β”‚ β”‚ β”‚ password. Sessions of this class β”‚ β”‚ β”‚ are upgraded to the regular **user** β”‚ β”‚ β”‚ class once the home directory is β”‚ β”‚ β”‚ activated. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **greeter** β”‚ Similar to **user** but for sessions β”‚ β”‚ β”‚ that are spawned by a display β”‚ β”‚ β”‚ manager ephemerally and which β”‚ β”‚ β”‚ prompt the user for login β”‚ β”‚ β”‚ credentials. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **lock-screen** β”‚ Similar to **user** but for sessions β”‚ β”‚ β”‚ that are spawned by a display β”‚ β”‚ β”‚ manager ephemerally and which β”‚ β”‚ β”‚ show a lock screen that can be β”‚ β”‚ β”‚ used to unlock locked user β”‚ β”‚ β”‚ accounts or sessions. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **background** β”‚ Used for background sessions, β”‚ β”‚ β”‚ such as those invoked by cron(8) β”‚ β”‚ β”‚ and similar tools. This is the β”‚ β”‚ β”‚ default class for sessions for β”‚ β”‚ β”‚ which no TTY or X display is β”‚ β”‚ β”‚ known at session registration β”‚ β”‚ β”‚ time. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **background-light** β”‚ Similar to **background** , but β”‚ β”‚ β”‚ sessions of this class will not β”‚ β”‚ β”‚ pull in the [email protected](5) of β”‚ β”‚ β”‚ the user, and thus possibly have β”‚ β”‚ β”‚ no service manager of the user β”‚ β”‚ β”‚ running. (Added in v256.) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **manager** β”‚ The [email protected](5) service of β”‚ β”‚ β”‚ the user is registered under this β”‚ β”‚ β”‚ session class. (Added in v256.) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **manager-early** β”‚ Similar to **manager** , but for the β”‚ β”‚ β”‚ root user. Compare with the **user** β”‚ β”‚ β”‚ vs. **user-early** situation. (Added β”‚ β”‚ β”‚ in v256.) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ **none** β”‚ Skips registering this session β”‚ β”‚ β”‚ with logind. No session scope β”‚ β”‚ β”‚ will be created, and the user β”‚ β”‚ β”‚ service manager will not be β”‚ β”‚ β”‚ started. (Added in v258.) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Added in version 197. _type=_ Takes a string argument which sets the session type. The _XDG_SESSION_TYPE_ environment variable (see below) takes precedence. One of **unspecified** , **tty** , **x11** , **wayland** , **mir** , or **web**. See sd_session_get_type(3) for details about the session type. Added in version 209. _desktop=_ Takes a single, short identifier string for the desktop environment. The _XDG_SESSION_DESKTOP_ environment variable (see below) takes precedence. This may be used to indicate the session desktop used, where this applies and if this information is available. For example: **GNOME** , or **KDE**. It is recommended to use the same identifiers and capitalization as for _$XDG_CURRENT_DESKTOP_ , as defined by the **Desktop Entry** **Specification******[2]. (However, note that the option only takes a single item, and not a colon-separated list like _$XDG_CURRENT_DESKTOP_.) See sd_session_get_desktop(3) for further details. Added in version 240. _area=_ Takes a filename as parameter. If specified and the user logs into their account the _$HOME_ environment variable will be set to ~/Areas/ suffixed by the specified string, but only if that directory exists. Moreover, the _$XDG_AREA_ variable will be set to the (unprefixed) parameter. This functionality may be used to maintain multiple separate secondary home directories within the primary home directory of the user. Typically, the area to log into is specified while logging in, if the account permits that (accounts provided by pam_systemd_home(8) do), but this parameter may be used to define a default if that's not provided. Note that this only adjusts _$HOME_ during login, it does not affect the otherwise reported home directory of the user. Specifically this means that sshd(8) will continue to look for SSH keys of the user only in the primary home directory of the user, not in any of their areas. Note that the default area to log into can also be configured as part of the user account. The area specified via _area=_ overrides the default area configured there. Also note that if the area is specified explicitly by the user at login time, it overrides both. Also note that setting this parameter to an empty string has the effect of undoing the effect of any default area configured as part of the user record, i.e. ensuring the user logs into the primary home directory of their account. For details on the area concept see pam_systemd_home(8). Added in version 258. _default-capability-bounding-set=_ , _default-capability-ambient-set=_ Takes a comma-separated list of process capabilities (e.g. **CAP_WAKE_ALARM** , **CAP_BLOCK_SUSPEND** , ...) to set for the invoked session's processes, if the user record does not encode appropriate sets of capabilities directly. See capabilities(7) for details on the capabilities concept. If not specified, the default bounding set is left as is (i.e. usually contains the full set of capabilities). The default ambient set is set to **CAP_WAKE_ALARM** for regular users if the PAM session is associated with a local seat or if it is invoked for the systemd user service [email protected]. Otherwise, defaults to the empty set. Added in version 254. _debug_[=] Takes an optional boolean argument. If yes or without the argument, the module will log debugging information as it operates. ## MODULE TYPES PROVIDED Only **session** is provided. ## ENVIRONMENT The following environment variables are initialized by the module and available to the processes of the user's session: _$XDG_SESSION_ID_ A short session identifier, suitable to be used in filenames. The string itself should be considered opaque, although often it is just the audit session ID as reported by /proc/self/sessionid. Each ID will be assigned only once during machine uptime. It may hence be used to uniquely label files or other resources of this session. Combine this ID with the boot identifier, as returned by sd_id128_get_boot(3), for a globally unique identifier. _$XDG_RUNTIME_DIR_ Path to a user-private user-writable directory that is bound to the user login time on the machine. It is automatically created the first time a user logs in and removed on the user's final logout. If a user logs in twice at the same time, both sessions will see the same _$XDG_RUNTIME_DIR_ and the same contents. If a user logs in once, then logs out again, and logs in again, the directory contents will have been lost in between, but applications should not rely on this behavior and must be able to deal with stale files. To store session-private data in this directory, the user should include the value of _$XDG_SESSION_ID_ in the filename. This directory shall be used for runtime file system objects such as **AF_UNIX** sockets, FIFOs, PID files and similar. It is guaranteed that this directory is local and offers the greatest possible file system feature set the operating system provides. For further details, see the **XDG Base Directory** **Specification******[3]._$XDG_RUNTIME_DIR_ is not set if the current user is not the original user of the session. _$TZ_ , _$EMAIL_ , _$LANG_ If a JSON user record is known for the user logging in these variables are initialized from the respective data in the record. Added in version 245. _$SHELL_PROMPT_PREFIX_ , _$SHELL_PROMPT_SUFFIX_ , _$SHELL_WELCOME_ These environment variables are initialized from the service credentials "shell.prompt.prefix", "shell.prompt.suffix" and "shell.welcome" if set. They are passed to the invoked session processes, where they are imported into any shell prompt (specifically _$SHELL_PROMPT_PREFIX_ is added as prefix to _$PS1_ , and _$SHELL_PROMPT_SUFFIX_ as suffix) or printed on screen when a shell first initializes. Added in version 257. The following environment variables are read by the module and may be used by the PAM service to pass metadata to the module. If these variables are not set when the PAM module is invoked but can be determined otherwise they are set by the module, so that these variables are initialized for the session and applications if known at all. _$XDG_SESSION_TYPE_ The session type. This may be used instead of _type=_ on the module parameter line, and is usually preferred. Added in version 209. _$XDG_SESSION_CLASS_ The session class. This may be used instead of _class=_ on the module parameter line, and is usually preferred. Added in version 209. _$XDG_SESSION_DESKTOP_ The desktop identifier. This may be used instead of _desktop=_ on the module parameter line, and is usually preferred. Added in version 209. _$XDG_SEAT_ The seat name the session shall be registered for, if any. Added in version 209. _$XDG_VTNR_ The VT number the session shall be registered for, if any. (Only applies to seats with a VT available, such as "seat0") Added in version 209. _$XDG_AREA_ If an area (secondary home directories of the user, within the primary home directory) to log into has been selected this variable is set to the area name (without any path prefix). It is otherwise unset. For details about areas, see above. Added in version 258. If not set, **pam_systemd** will initialize _$XDG_SEAT_ and _$XDG_VTNR_ based on the _$DISPLAY_ variable (if the latter is set). ## SESSION LIMITS PAM modules earlier in the stack, that is those that come before **pam_systemd.so** , can set session scope limits using the PAM context objects. The data for these objects is provided as **NUL** -terminated C strings and maps directly to the respective unit resource control directives. Note that these limits apply to individual sessions of the user, they do not apply to all user processes as a combined whole. In particular, the per-user **[email protected]** unit instance, which runs the **systemd --user** manager process and its children, and is tracked outside of any session, being shared by all the user's sessions, is not covered by these limits. See systemd.resource-control(5) for more information about the resources. Also, see pam_set_data(3) for additional information about how to set the context objects. _systemd.memory_max=_ Sets unit _MemoryMax=_. Added in version 239. _systemd.tasks_max=_ Sets unit _TasksMax=_. Added in version 239. _systemd.cpu_weight=_ Sets unit _CPUWeight=_. Added in version 239. _systemd.io_weight=_ Sets unit _IOWeight=_. Added in version 239. _systemd.runtime_max_sec=_ Sets unit _RuntimeMaxSec=_. Added in version 244. Example data as can be provided from an another PAM module: pam_set_data(handle, "systemd.memory_max", (void *)"200M", cleanup); pam_set_data(handle, "systemd.tasks_max", (void *)"50", cleanup); pam_set_data(handle, "systemd.cpu_weight", (void *)"100", cleanup); pam_set_data(handle, "systemd.io_weight", (void *)"340", cleanup); pam_set_data(handle, "systemd.runtime_max_sec", (void *)"3600", cleanup); ## EXAMPLE Here's an example PAM configuration fragment that allows users sessions to be managed by systemd-logind.service: #%PAM-1.0 -auth [success=done authtok_err=bad perm_denied=bad maxtries=bad default=ignore] pam_systemd_home.so auth sufficient pam_unix.so auth required pam_deny.so account required pam_nologin.so -account [success=done authtok_expired=bad new_authtok_reqd=bad maxtries=bad acct_expired=bad default=ignore] pam_systemd_home.so account required pam_unix.so -password sufficient pam_systemd_home.so password sufficient pam_unix.so sha512 shadow try_first_pass password required pam_deny.so -session optional pam_keyinit.so revoke -session optional pam_loginuid.so -session optional pam_systemd_home.so **-session optional pam_systemd.so** session required pam_unix.so ## NOTES 1. JSON User Records https://systemd.io/USER_RECORD 2. Desktop Entry Specification https://standards.freedesktop.org/desktop-entry-spec/latest/ 3. XDG Base Directory Specification https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html * * *
# tc-csum ## NAME csum - checksum update action ## SYNOPSIS **tc**... **action csum** _UPDATE_ _UPDATE_ := _TARGET_ [ _UPDATE_ ] _TARGET_ := { **ip4h** | **icmp** | **igmp** | **tcp** | **udp** | **udplite** | **sctp** | _SWEETS_ } _SWEETS_ := { **and** | **or** | **+**} ## DESCRIPTION The **csum** action triggers checksum recalculation of specified packet headers. It is commonly used to fix incorrect checksums after the **pedit** action has modified the packet content. ## OPTIONS _TARGET_ Specify which headers to update: IPv4 header (**ip4h**), ICMP header (**icmp**), IGMP header (**igmp**), TCP header (**tcp**), UDP header (**udp**), UDPLite header (**udplite**) or SCTP header (**sctp**). **SWEETS** These are merely syntactic sugar and ignored internally. ## EXAMPLES The following performs stateless NAT for incoming packets from 192.0.2.100 to new destination 198.51.100.1. Assuming these are UDP packets, both IP and UDP checksums have to be recalculated: # tc qdisc add dev eth0 ingress handle ffff: # tc filter add dev eth0 prio 1 protocol ip parent ffff: \ u32 match ip src 192.0.2.100/32 flowid :1 \ action pedit munge ip dst set 198.51.100.1 pipe \ csum ip and udp * * *
# logoutd ## NAME logoutd - enforce login time restrictions ## SYNOPSIS **logoutd** ## DESCRIPTION **logoutd** enforces the login time and port restrictions specified in /etc/porttime. **logoutd** should be started from /etc/rc. The /var/run/utmp file is scanned periodically and each user name is checked to see if the named user is permitted on the named port at the current time. Any login session which is violating the restrictions in /etc/porttime is terminated. ## FILES /etc/porttime File containing port access. /var/run/utmp List of current login sessions. * * *
# slappasswd ## NAME slappasswd - OpenLDAP password utility ## SYNOPSIS **SBINDIR/slappasswd**[**-v**] [**-u**] [**-g** |**-s** _secret_**|-T** _file_] [**-h** _hash_] [**-c** _salt-format_] [**-n**] [**-o** _option_[**=**_value_]] ## DESCRIPTION **Slappasswd** is used to generate an userPassword value suitable for use with ldapmodify(1), slapd.conf(5) _rootpw_ configuration directive or the slapd-config(5) _olcRootPW_ configuration directive. ## OPTIONS **-v** enable verbose mode. **-u** Generate RFC 2307 userPassword values (the default). Future versions of this program may generate alternative syntaxes by default. This option is provided for forward compatibility. **-s** _secret_ The secret to hash. If this, **-g** and **-T** are absent, the user will be prompted for the secret to hash. **-s** , **-g** and **-T** are mutually exclusive flags. **-g** Generate the secret. If this, **-s** and **-T** are absent, the user will be prompted for the secret to hash. **-s** , **-g** and **-T** are mutually exclusive flags. If this is present, _{CLEARTEXT}_ is used as scheme. **-g** and **-h** are mutually exclusive flags. **-T** _"file"_ Hash the contents of the file. If this, **-g** and **-s** are absent, the user will be prompted for the secret to hash. **-s** , **-g** and **-T** and mutually exclusive flags. **-h** _"scheme"_ If **-h** is specified, one of the following RFC 2307 schemes may be specified: **{CRYPT}** , **{MD5}** , **{SMD5}** , **{SSHA}** , and **{SHA}**. The default is **{SSHA}**. Note that scheme names may need to be protected, due to **{** and **}** , from expansion by the user's command interpreter. **{SHA}** and **{SSHA}** use the SHA-1 algorithm (FIPS 160-1), the latter with a seed. **{MD5}** and **{SMD5}** use the MD5 algorithm (RFC 1321), the latter with a seed. **{CRYPT}** uses the crypt(3). **{CLEARTEXT}** indicates that the new password should be added to userPassword as clear text. Unless _{CLEARTEXT}_ is used, this flag is incompatible with option **-g**. **-c** _crypt-salt-format_ Specify the format of the salt passed to crypt(3) when generating {CRYPT} passwords. This string needs to be in sprintf(3) format and may include one (and only one) **%s** conversion. This conversion will be substituted with a string of random characters from [A-Za-z0-9./]. For example, '**%.2s** ' provides a two character salt and '**$1$%.8s** ' tells some versions of crypt(3) to use an MD5 algorithm and provides 8 random characters of salt. The default is '**%s** '**,** which provides 31 characters of salt. **-n** Omit the trailing newline; useful to pipe the credentials into a command. **-o** _option_[**=**_value_] Specify an _option_ with a(n optional) _value_. Possible generic options/values are: module-path=<pathspec> (see `**modulepath** ' in slapd.conf(5)) module-load="<filename> [<arguments>...]" (see `**moduleload** ' in slapd.conf(5)) You can load a dynamically loadable password hash module by using this option. ## LIMITATIONS The practice of storing hashed passwords in userPassword violates Standard Track (RFC 4519) schema specifications and may hinder interoperability. A new attribute type, authPassword, to hold hashed passwords has been defined (RFC 3112), but is not yet implemented in slapd(8). It should also be noted that the behavior of crypt(3) is platform specific. ## SECURITY CONSIDERATIONS Use of hashed passwords does not protect passwords during protocol transfer. TLS or other eavesdropping protections should be in- place before using LDAP simple bind. The hashed password values should be protected as if they were clear text passwords. ## ACKNOWLEDGEMENTS **OpenLDAP Software** is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>. **OpenLDAP Software** is derived from the University of Michigan LDAP 3.3 Release. * * *
# systemd-veritysetup-generator ## NAME systemd-veritysetup-generator - Unit generator for verity protected block devices ## SYNOPSIS /usr/lib/systemd/system-generators/systemd-veritysetup-generator ## DESCRIPTION **systemd-veritysetup-generator** is a generator that translates kernel command line options configuring verity protected block devices into native systemd units early at boot and when configuration of the system manager is reloaded. This will create [email protected](8) units as necessary. Currently, only two verity devices may be set up with this generator, backing the root and /usr file systems of the OS. **systemd-veritysetup-generator** implements systemd.generator(7). ## KERNEL COMMAND LINE **systemd-veritysetup-generator** understands the following kernel command line parameters: _systemd.verity=_ , _rd.systemd.verity=_ Takes a boolean argument. Defaults to "yes". If "no", disables the generator entirely. _rd.systemd.verity=_ is honored only in the initrd while _systemd.verity=_ is honored by both the main system and in the initrd. Added in version 233. _veritytab=_ , _rd.veritytab=_ Takes a boolean argument. Defaults to "yes". If "no", causes the generator to ignore any devices configured in /etc/veritytab. _rd.veritytab=_ is honored only in the initrd while _veritytab=_ is honored by both the main system and in the initrd. Added in version 248. _roothash=_ Takes a root hash value for the root file system. Expects a hash value formatted in hexadecimal characters of the appropriate length (i.e. most likely 256 bit/64 characters, or longer). If not specified via _systemd.verity_root_data=_ and _systemd.verity_root_hash=_ , the hash and data devices to use are automatically derived from the specified hash value. Specifically, the data partition device is looked for under a GPT partition UUID derived from the first 128-bit of the root hash, the hash partition device is looked for under a GPT partition UUID derived from the last 128-bit of the root hash. Hence it is usually sufficient to specify the root hash to boot from a verity protected root file system, as device paths are automatically determined from it β€” as long as the partition table is properly set up. Added in version 233. _systemd.verity_root_data=_ , _systemd.verity_root_hash=_ These two settings take block device paths as arguments and may be used to explicitly configure the data partition and hash partition to use for setting up the verity protection for the root file system. If not specified, these paths are automatically derived from the _roothash=_ argument (see above). Added in version 233. _systemd.verity_root_options=_ Takes a comma-separated list of dm-verity options. Expects the following options **superblock=**_BOOLEAN_ , **format=**_NUMBER_ , **data-block-size=**_BYTES_ , **hash-block-size=**_BYTES_ , **data-blocks=**_BLOCKS_ , **hash-offset=**_BYTES_ , **salt=**_HEX_ , **uuid=**_UUID_ , **ignore-corruption** , **restart-on-corruption** , **ignore-zero-blocks** , **check-at-most-once** , **panic-on-corruption** , **hash=**_HASH_ , **fec-device=**_PATH_ , **fec-offset=**_BYTES_ , **fec-roots=**_NUM_ and **root-hash-signature=**_PATH_**|base64:**_HEX_. See veritysetup(8) for more details. Added in version 248. _usrhash=_ , _systemd.verity_usr_data=_ , _systemd.verity_usr_hash=_ , _systemd.verity_usr_options=_ Equivalent to their counterparts for the root file system as described above, but apply to the /usr/ file system instead. Added in version 250. * * *
# mapscrn ## NAME mapscrn - load screen output mapping table ## SYNOPSIS **mapscrn**[_options_] _mapfile_ ## DESCRIPTION The **mapscrn** command is obsolete - its function is now built-in into setfont. However, for backwards compatibility it is still available as a separate command. The _mapscrn_ command loads a user defined output character mapping table into the console driver. The console driver may be later put into **use user-defined mapping table** mode by outputting a special escape sequence to the console device. This sequence is _< esc>(K_ for the **G0** character set and _< esc>)K_ for the **G1** character set. When the _-o_ option is given, the old map is saved in _map.orig._ ## USE There are two kinds of mapping tables: direct-to-font tables, that give a font position for each user byte value, and user-to-unicode tables that give a unicode value for each user byte. The corresponding glyph is now found using the unicode index of the font. The command mapscrn trivial sets up a one-to-one direct-to-font table where user bytes directly address the font. This is useful for fonts that are in the same order as the character set one uses. A command like mapscrn 8859-2 sets up a user-to-unicode table that assumes that the user uses ISO 8859-2. ## INPUT FORMAT The _mapscrn_ command can read the map in either of two formats: 1. 256 or 512 bytes binary data 2. two-column text file Format (1) is a direct image of the translation _table. The_ _256-bytes tables are direct-to-font,_ the 512-bytes tables are user-to-unicode tables. Format (2) is used to fill the _table_ as follows: cell with offset mentioned in the first column is filled with the value mentioned in the second column. When values larger than 255 occur, or values are written using the U+xxxx notation, the table is assumed to be a user-to-unicode table, otherwise it is a direct-to-font table. Values in the file may be specified in one of several **formats:** **1. Decimal:** String of decimal digits not starting with '0' **2. Octal:** String of octal digits beginning with '0'. **3. Hexadecimal:** String of hexadecimal digits preceded by "0x". **4. Unicode:** String of four hexadecimal digits preceded by "U+". **5. Character:** Single character enclosed in single quotes. (And the binary value is used.) Note that blank, comma, tab character and '#' cannot be specified with this format. **6. UTF-8 Character:** Single (possibly multi-byte) UTF-8 character, enclosed in single quotes. Note that control characters (with codes < 32) cannot be re-mapped with _mapscrn_ because they have special meaning for the driver. ## OPTIONS **-o** , **--output** =_FILE_ save the old map to the _FILE_. **-C** , **--console** =_DEV_ the console device to be used. **-v** , **--verbose** be more verbose. **-V** , **--version** print version number. **-h** , **--help** print this usage message. ## FILES _/usr/local/share/consoletrans_ The default directory for screen mappings. * * *
# nss-mymachines ## NAME nss-mymachines, libnss_mymachines.so.2 - Hostname resolution for local container instances ## SYNOPSIS libnss_mymachines.so.2 ## DESCRIPTION **nss-mymachines** is a plug-in module for the GNU Name Service Switch (NSS) functionality of the GNU C Library (**glibc**), providing hostname resolution for the names of containers running locally that are registered with systemd-machined.service(8). The container names are resolved to the IP addresses of the specific container, ordered by their scope. This functionality only applies to containers using network namespacing (see the description of **--private-network** in systemd-nspawn(1)). Note that the name that is resolved is the one registered with **systemd-machined** , which may be different than the hostname configured inside of the container. Note that this NSS module only makes available names of the containers running immediately below the current system context. It does not provide host name resolution for containers running side-by-side with the invoking system context, or containers further up or down the container hierarchy. Or in other words, on the host system it provides host name resolution for the containers running immediately below the host environment. When used inside a container environment however, it will not be able to provide name resolution for containers running on the host (as those are siblings and not children of the current container environment), but instead only for nested containers running immediately below its own container environment. To activate the NSS module, add "mymachines" to the line starting with "hosts:" in /etc/nsswitch.conf. It is recommended to place "mymachines" before the "resolve" or "dns" entry of the "hosts:" line of /etc/nsswitch.conf in order to make sure that its mappings are preferred over other resolvers such as DNS. ## CONFIGURATION IN /ETC/NSSWITCH.CONF Here is an example /etc/nsswitch.conf file that enables **nss-mymachines** correctly: passwd: files systemd group: files [SUCCESS=merge] systemd shadow: files systemd gshadow: files systemd hosts: **mymachines** resolve [!UNAVAIL=return] files myhostname dns networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis ## EXAMPLE: MAPPINGS PROVIDED BY NSS-MYMACHINES The container "rawhide" is spawned using systemd-nspawn(1): # systemd-nspawn -M rawhide --boot --network-veth --private-users=pick Spawning container rawhide on /var/lib/machines/rawhide. Selected user namespace base 20119552 and range 65536. ... $ machinectl --max-addresses=3 MACHINE CLASS SERVICE OS VERSION ADDRESSES rawhide container systemd-nspawn fedora 30 169.254.40.164 fe80::94aa:3aff:fe7b:d4b9 $ ping -c1 rawhide PING rawhide(fe80::94aa:3aff:fe7b:d4b9%ve-rawhide (fe80::94aa:3aff:fe7b:d4b9%ve-rawhide)) 56 data bytes 64 bytes from fe80::94aa:3aff:fe7b:d4b9%ve-rawhide (fe80::94aa:3aff:fe7b:d4b9%ve-rawhide): icmp_seq=1 ttl=64 time=0.045 ms ... $ ping -c1 -4 rawhide PING rawhide (169.254.40.164) 56(84) bytes of data. 64 bytes from 169.254.40.164 (169.254.40.164): icmp_seq=1 ttl=64 time=0.064 ms ... # machinectl shell rawhide /sbin/ip a Connected to machine rawhide. Press ^] three times within 1s to exit session. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 ... 2: host0@if21: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 96:aa:3a:7b:d4:b9 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 169.254.40.164/16 brd 169.254.255.255 scope link host0 valid_lft forever preferred_lft forever inet6 fe80::94aa:3aff:fe7b:d4b9/64 scope link valid_lft forever preferred_lft forever Connection to machine rawhide terminated. * * *
# systemd-machined.service ## NAME systemd-machined.service, systemd-machined - Virtual machine and container registration manager ## SYNOPSIS systemd-machined.service /usr/lib/systemd/systemd-machined ## DESCRIPTION **systemd-machined** is a system service that keeps track of locally running virtual machines and containers. **systemd-machined** is useful for registering and keeping track of both OS containers (containers that share the host kernel but run a full init system of their own and behave in most regards like a full virtual operating system rather than just one virtualized app) and full virtual machines (virtualized hardware running normal operating systems and possibly different kernels). **systemd-machined** should _not_ be used for registering/keeping track of application sandbox containers. A _machine_ in the context of **systemd-machined** is supposed to be an abstract term covering both OS containers and full virtual machines, but not application sandboxes. Machines registered with machined are exposed in various ways in the system. For example: β€’ Tools like ps(1) will show to which machine a specific process belongs in a column of its own, and so will **gnome-system-monitor******[1] orsystemd-cgls(1). β€’ systemd's various tools (systemctl(1), journalctl(1), loginctl(1), hostnamectl(1), timedatectl(1), localectl(1), machinectl(1), ...) support the **-M** switch to operate on local containers instead of the host system. β€’ **systemctl list-machines** will show the system state of all local containers, connecting to the container's init system for that. β€’ systemctl's **--recursive** switch has the effect of not only showing the locally running services, but recursively showing the services of all registered containers. β€’ The **machinectl** command provides access to a number of useful operations on registered containers, such as introspecting them, rebooting, shutting them down, and getting a login prompt on them. β€’ The sd-bus(3) library exposes the sd_bus_open_system_machine(3) call to connect to the system bus of any registered container. β€’ The nss-mymachines(8) module makes sure all registered containers can be resolved via normal glibc gethostbyname(3) or getaddrinfo(3) calls. See systemd-nspawn(1) for some examples on how to run containers with OS tools. If you are interested in writing a VM or container manager that makes use of machined, please have look at **Writing Virtual Machine** **or Container Managers******[2]. Also see the**New Control Group** **Interfaces******[3]. The daemon provides both a C library interface (which is shared withsystemd-logind.service(8)) as well as a D-Bus interface and a Varlink interface. The library interface may be used to introspect and watch the state of virtual machines/containers. The bus interface provides the same but in addition may also be used to register or terminate machines. The Varlink interface may be used to register machines with optional extensions, e.g. with an SSH key / address; it can be queried with **varlinkctl introspect** **/run/systemd/machine/io.systemd.Machine io.systemd.Machine**. For more information please consult sd-login(3) and org.freedesktop.machine1(5) and org.freedesktop.LogControl1(5). A small companion daemon systemd-importd.service(8) is also available, which implements importing, exporting, and downloading of container and VM images. For each container registered with systemd-machined.service that employs user namespacing, users/groups are synthesized for the used UIDs/GIDs. These are made available to the system using the **User/Group Record Lookup API via Varlink******[4], and thus may be resolved withuserdbctl(1) or the usual glibc NSS calls. ## NOTES 1. gnome-system-monitor https://help.gnome.org/users/gnome-system-monitor/ 2. Writing Virtual Machine or Container Managers https://systemd.io/WRITING_VM_AND_CONTAINER_MANAGERS 3. New Control Group Interfaces https://systemd.io/CONTROL_GROUP_INTERFACE 4. User/Group Record Lookup API via Varlink https://systemd.io/USER_GROUP_API * * *
# rdma-link ## NAME rdma-link - rdma link configuration ## SYNOPSIS **rdma**[ _OPTIONS_ ] **link**{ _COMMAND_ | **help**} _OPTIONS_ := { **-V**[_ersion_] | **-d**[_etails_] } **rdma link show**[ _DEV/PORT_INDEX_ ] **rdma link add NAME type TYPE netdev NETDEV** **rdma link delete** NAME **rdma link help** ## DESCRIPTION **rdma link show - display rdma link attributes** _DEV/PORT_INDEX_ - specifies the RDMA link to show. If this argument is omitted all links are listed. **rdma link add NAME type TYPE netdev NETDEV - add an rdma link for the** **specified type to the network device** **NAME** - specifies the new name of the rdma link to add **TYPE** - specifies which rdma type to use. Link types: **rxe** - Soft RoCE driver **siw** - Soft iWARP driver **NETDEV** - specifies the network device to which the link is bound **rdma link delete NAME - delete an rdma link** **NAME** - specifies the name of the rdma link to delete ## EXAMPLES rdma link show Shows the state of all rdma links on the system. rdma link show mlx5_2/1 Shows the state of specified rdma link. rdma link add rxe_eth0 type rxe netdev eth0 Adds a RXE link named rxe_eth0 to network device eth0 rdma link del rxe_eth0 Removes RXE link rxe_eth0 * * *
# mkfs.bfs ## NAME mkfs.bfs - make an SCO bfs filesystem ## SYNOPSIS **mkfs.bfs**[options] _device_ [_block-count_] ## DESCRIPTION **mkfs.bfs** creates an SCO bfs filesystem on a block device (usually a disk partition or a file accessed via the loop device). The _block-count_ parameter is the desired size of the filesystem, in blocks. If nothing is specified, the entire partition will be used. ## OPTIONS **-N** , **--inodes** _number_ Specify the desired _number_ of inodes (at most 512). If nothing is specified, some default number in the range 48-512 is picked depending on the size of the partition. **-V** , **--vname** _label_ Specify the volume _label_. I have no idea if/where this is used. **-F** , **--fname** _name_ Specify the filesystem _name_. I have no idea if/where this is used. **--lock**[**=**_mode_] Use an exclusive BSD lock for the device or file that is operated upon. The optional argument _mode_ can be **yes**(**1**), **no** (**0**), or **nonblock**. If the _mode_ argument is omitted, it defaults to **yes**. This option overrides the environment variable **$LOCK_BLOCK_DEVICE**. The default is to not use any lock at all, but using a lock is recommended to avoid collisions with systemd-udevd(8) or other tools. **-v** , **--verbose** Explain what is being done. **-c** This option is silently ignored. **-l** This option is silently ignored. **-h** , **--help** Display help text and exit. **-V** , **--version** Display version and exit. Option **-V** only works as **--version** when it is the only option. ## EXIT STATUS The exit status returned by **mkfs.bfs** is 0 when all went well, and 1 when something went wrong. ## AVAILABILITY The **mkfs.bfs** command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the _util-linux_ (a random collection of Linux utilities) project. Information about the project can be found at ⟨https://www.kernel.org/pub/linux/utils/util-linux/⟩. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository ⟨git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-05.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is _not_ part of the original manual page), send a mail to [email protected] util-linux 2.42-start-521-ec46 2025-08-09 _MKFS.BFS_(8) * * *
# pam_faillock ## NAME pam_faillock - Module counting authentication failures during a specified interval ## SYNOPSIS **auth ... pam_faillock.so**{preauth|authfail|authsucc} [conf=_/path/to/config-file_] [dir=_/path/to/tally-directory_] [even_deny_root] [deny=_n_] [fail_interval=_n_] [unlock_time=_n_] [root_unlock_time=_n_] [admin_group=_name_] [audit] [silent] [no_log_info] **account ... pam_faillock.so**[dir=_/path/to/tally-directory_] [no_log_info] ## DESCRIPTION This module maintains a list of failed authentication attempts per user during a specified interval and locks the account in case there were more than _deny_ consecutive failed authentications. Normally, failed attempts to authenticate _root_ will **not** cause the root account to become blocked, to prevent denial-of-service: if your users aren't given shell accounts and root may only login via **su** or at the machine console (not telnet/rsh, etc), this is safe. ## OPTIONS **{preauth|authfail|authsucc}** This argument must be set accordingly to the position of this module instance in the PAM stack. The _preauth_ argument must be used when the module is called before the modules which ask for the user credentials such as the password. The module just examines whether the user should be blocked from accessing the service in case there were anomalous number of failed consecutive authentication attempts recently. This call is optional if _authsucc_ is used. The _authfail_ argument must be used when the module is called after the modules which determine the authentication outcome, failed. Unless the user is already blocked due to previous authentication failures, the module will record the failure into the appropriate user tally file. The _authsucc_ argument must be used when the module is called after the modules which determine the authentication outcome, succeeded. Unless the user is already blocked due to previous authentication failures, the module will then clear the record of the failures in the respective user tally file. Otherwise it will return authentication error. If this call is not done, the pam_faillock will not distinguish between consecutive and non-consecutive failed authentication attempts. The _preauth_ call must be used in such case. Due to complications in the way the PAM stack can be configured it is also possible to call _pam_faillock_ as an account module. In such configuration the module must be also called in the _preauth_ stage. **conf=/path/to/config-file** Use another configuration file instead of the default /etc/security/faillock.conf. The options for configuring the module behavior are described in the faillock.conf(5) manual page. The options specified on the module command line override the values from the configuration file. ## MODULE TYPES PROVIDED The **auth** and **account** module types are provided. ## RETURN VALUES PAM_AUTH_ERR An invalid option was given, the module was not able to retrieve the user name, no valid counter file was found, or too many failed logins. PAM_BUF_ERR Memory buffer error. PAM_CONV_ERR The conversation method supplied by the application failed to obtain the username. PAM_INCOMPLETE The conversation method supplied by the application returned PAM_CONV_AGAIN. PAM_SUCCESS Everything was successful. PAM_IGNORE User not present in passwd database. ## NOTES Configuring options on the module command line is not recommend. The /etc/security/faillock.conf should be used instead. The setup of _pam_faillock_ in the PAM stack is different from the _pam_tally2_ module setup. Individual files with the failure records are created as owned by the user. This allows **pam_faillock.so** module to work correctly when it is called from a screensaver. Note that using the module in **preauth** without the **silent** option specified in /etc/security/faillock.conf or with _requisite_ control field leaks an information about existence or non-existence of a user account in the system because the failures are not recorded for the unknown users. The message about the user account being locked is never displayed for non-existing user accounts allowing the adversary to infer that a particular account is not existing on a system. ## EXAMPLES Here are two possible configuration examples for /etc/pam.d/login. They make _pam_faillock_ to lock the account after 4 consecutive failed logins during the default interval of 15 minutes. Root account will be locked as well. The accounts will be automatically unlocked after 20 minutes. In the first example the module is called only in the _auth_ phase and the module does not print any information about the account being blocked by _pam_faillock_. The _preauth_ call can be added to tell users that their logins are blocked by the module and also to abort the authentication without even asking for password in such case. /etc/security/faillock.conf file example: deny=4 unlock_time=1200 silent /etc/pam.d/config file example: auth required pam_securetty.so auth required pam_env.so auth required pam_nologin.so # optionally call: auth requisite pam_faillock.so preauth # to display the message about account being locked auth [success=1 default=bad] pam_unix.so auth [default=die] pam_faillock.so authfail auth sufficient pam_faillock.so authsucc auth required pam_deny.so account required pam_unix.so password required pam_unix.so shadow session required pam_selinux.so close session required pam_loginuid.so session required pam_unix.so session required pam_selinux.so open In the second example the module is called both in the _auth_ and _account_ phases and the module informs the authenticating user when the account is locked if **silent** option is not specified in the faillock.conf. auth required pam_securetty.so auth required pam_env.so auth required pam_nologin.so auth required pam_faillock.so preauth # optionally use requisite above if you do not want to prompt for the password # on locked accounts auth sufficient pam_unix.so auth [default=die] pam_faillock.so authfail auth required pam_deny.so account required pam_faillock.so # if you drop the above call to pam_faillock.so the lock will be done also # on non-consecutive authentication failures account required pam_unix.so password required pam_unix.so shadow session required pam_selinux.so close session required pam_loginuid.so session required pam_unix.so session required pam_selinux.so open ## FILES /var/run/faillock/* the files logging the authentication failures for users Note: These files will disappear after reboot on systems configured with directory /var/run/faillock mounted on virtual memory. For persistent storage use the option _dir=_ in file /etc/security/faillock.conf. /etc/security/faillock.conf the config file for pam_faillock options * * *
# btrecord ## NAME btrecord - recreate IO loads recorded by blktrace ## SYNOPSIS **Usage:** btrecord [ _options_ ] <_dev_...> ## DESCRIPTION The _btrecord_ and _btreplay_ tools provide the ability to record and replay IOs captured by the _blktrace_ utility. Attempts are made to maintain ordering, CPU mappings and time-separation of IOs. The _blktrace_ utility provides the ability to collect detailed traces from the kernel for each IO processed by the block IO layer. The traces provide a complete timeline for each IO processed, including detailed information concerning when an IO was first received by the block IO layer β€” indicating the device, CPU number, time stamp, IO direction, sector number and IO size (number of sectors). Using this information, one is able to **replay** the IO again on the same machine or another set up entirely. The basic operating work-flow to replay IOs would be something like: - Run _blktrace_ to collect traces. Here you specify the device or devices that you wish to trace and later replay IOs upon. Note: the only traces you are interested in are **QUEUE** requests β€” thus, to save system resources (including storage for traces), one could specify the _-a queue_ command line option to _blktrace_. - While _blktrace_ is running, you run the workload that you are interested in. - When the work load has completed, you stop the _blktrace_ utility (thus saving all traces over the complete workload). - You extract the pertinent IO information from the traces saved by _blktrace_ using the _btrecord_ utility. This will parse each trace file created by _blktrace_ , and crafty IO descriptions to be used in the next phase of the workload processing. - Once _btrecord_ has successfully created a series of data files to be processed, you can run the _btreplay_ utility which attempts to generate the same IOs seen during the sample workload phase. ## OPTIONS -d <_dir_ > --input-directory=<_dir_ > Set input directory. This option requires a single parameter providing the directory name for where input files are to be found. The default directory is the current directory (_._). -D <_dir_ > --output-directory=<_dir_ > Set output directory. This option requires a single parameter providing the directory name for where output files are to be found. The default directory is the current directory (_._). -F --find-traces Find trace files automatically This option instructs _btreplay_ to go find all the trace files in the directory specified (either via the _-d_ option, or in the default directory (_._). -h --help Show help and exit. -V --version Show version number and exit. -m <_nanoseconds_ > --max-bunch-time=<_nanoseconds_ > The _-m_ option requires a single parameter which specifies an amount of time (in nanoseconds) to include in any one bunch of IOs that are to be processed. The smaller the value, the smaller the number of IOs processed at one time β€” perhaps yielding in more realistic replay. However, after a certain point the amount of overhead per bunch may result in additional real replay time, thus yielding less accurate replay times. The default value is 10,000,000 nanoseconds (10 milliseconds). -M <_num_ > --max-pkts=<_num_ > Set maximum number of packets per bunch. The _-M_ option requires a single parameter which specifies the maximum number of IOs to store in a single bunch. As with the _-m_ option, smaller values may or may not yield more accurate replay times. The default value is 8, with a maximum value of up to 512 being supported. -o <_basename_ > --output-base=<_basename_ > Set base name for output files. Each output file has 3 fields: 1. Device identifier (taken directly from the device name of the _blktrace_ output file). 2. _btrecord_ base name β€” by default ``replay''. 3. The CPU number (again, taken directly from the _blktrace_ output file name). This option requires a single parameter that will override the default name (replay), and replace it with the specified value. -v --verbose Enable verbose output. This option will output some simple statistics at the end of a successful run. Example output is: sdab:0: 580661 pkts (tot), 126030 pkts (replay), 89809 bunches, 1.4 pkts/bunch sdab:1: 2559775 pkts (tot), 430172 pkts (replay), 293029 bunches, 1.5 pkts/bunch sdab:2: 653559 pkts (tot), 136522 pkts (replay), 102288 bunches, 1.3 pkts/bunch sdab:3: 474773 pkts (tot), 117849 pkts (replay), 69572 bunches, 1.7 pkts/bunch The meaning of the columns is: 1. The first field contains the device name and CPU identifier. Thus: _sdab:0:_ means the device _sdab_ and traces on CPU 0. 2. The second field contains the total number of packets processed for each device file. 3. The next field shows the number of packets eligible for replay. 4. The fourth field contains the total number of IO bunches. 5. The last field shows the average number of IOs per bunch recorded. * * *
# cryptsetup-status ## NAME cryptsetup-status - report the status for a mapping ## SYNOPSIS **cryptsetup** _status_ **[ <options>] <name>** ## DESCRIPTION Reports the status for the mapping <name>. **< options> **can be [--header, --disable-locks]. ## OPTIONS **--batch-mode** , **-q** Suppresses all confirmation questions. Use with care! If the --verify-passphrase option is not specified, this option also switches off the passphrase verification. **--debug** or **--debug-json** Run in debug mode with full diagnostic logs. Debug output lines are always prefixed by **#**. If --debug-json is used, additional LUKS2 JSON data structures are printed. **--disable-locks** Disable lock protection for metadata on disk. This option is valid only for LUKS2 and is ignored for other formats. **WARNING:** Do not use this option unless you run cryptsetup in a restricted environment where locking is impossible to perform (where /run directory cannot be used). **--header** _< device or file storing the LUKS header>_ Use a detached (separated) metadata device or file where the LUKS header is stored. This option allows one to store the ciphertext and LUKS header on different devices. For commands that change the LUKS header (e.g., _luksAddKey_), specify the device or file with the LUKS header directly as the LUKS device. **--help** , **-?** Show help text and default parameters. **--usage** Show short option help. **--version** , **-V** Show the program version. ## CRYPTSETUP Part of cryptsetup project <https://gitlab.com/cryptsetup/cryptsetup/>. This page is part of the _Cryptsetup_ ((open-source disk encryption)) project. Information about the project can be found at ⟨https://gitlab.com/cryptsetup/cryptsetup⟩. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository ⟨https://gitlab.com/cryptsetup/cryptsetup.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-01.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is _not_ part of the original manual page), send a mail to [email protected] cryptsetup 2.8.1-git 2023-09-13 _CRYPTSETUP-STATUS_(8) * * *
# tc-tunnel_key ## NAME tunnel_key - Tunnel metadata manipulation ## SYNOPSIS **tc**... **action tunnel_key**{ **unset** | _SET_ } _SET_ := **set src_ip** _ADDRESS_ **dst_ip** _ADDRESS_ **id** _KEY_ID_ **dst_port** _UDP_PORT_ **tos** _TOS_ **ttl** _TTL_ [ **csum** | **nocsum**] ## DESCRIPTION The **tunnel_key** action combined with a shared IP tunnel device, allows one to perform IP tunnel en- or decapsulation on a packet, reflected by the operation modes _UNSET_ and _SET_. The _UNSET_ mode is optional - even without using it, the metadata information will be released automatically when packet processing will be finished. _UNSET_ function could be used in cases when traffic is forwarded between two tunnels, where the metadata from the first tunnel will be used for encapsulation done by the second tunnel. _SET_ mode requires the source and destination ip _ADDRESS_ and the tunnel key id _KEY_ID_ which will be used by the ip tunnel shared device to create the tunnel header. The **tunnel_key** action is useful only in combination with a **mirred redirect** action to a shared IP tunnel device which will use the metadata (for _SET_ ) and unset the metadata created by it (for _UNSET_ ). ## OPTIONS **unset** Unset the tunnel metadata created by the IP tunnel device. This function is not mandatory and might be used only in some specific use cases (as explained above). **set** Set tunnel metadata to be used by the IP tunnel device. Requires **src_ip** and **dst_ip** options. **id** , **dst_port** , **geneve_opts** , **vxlan_opts** and **erspan_opts** are optional. **id** Tunnel ID (for example VNI in VXLAN tunnel) **src_ip** Outer header source IP address (IPv4 or IPv6) **dst_ip** Outer header destination IP address (IPv4 or IPv6) **dst_port** Outer header destination UDP port **geneve_opts** Geneve variable length options. **geneve_opts** is specified in the form CLASS:TYPE:DATA, where CLASS is represented as a 16bit hexadecimal value, TYPE as an 8bit hexadecimal value and DATA as a variable length hexadecimal value. Additionally multiple options may be listed using a comma delimiter. **vxlan_opts** Vxlan metadata options. **vxlan_opts** is specified in the form GBP, as a 32bit number. Multiple options is not supported. **erspan_opts** Erspan metadata options. **erspan_opts** is specified in the form VERSION:INDEX:DIR:HWID, where VERSION is represented as a 8bit number, INDEX as an 32bit number, DIR and HWID as a 8bit number. Multiple options is not supported. Note INDEX is used when VERSION is 1, and DIR and HWID are used when VERSION is 2. **tos** Outer header TOS **ttl** Outer header TTL [**no**]**csum** Controls outer UDP checksum. When set to **csum**(which is default), the outer UDP checksum is calculated and included in the packets. When set to **nocsum** , outer UDP checksum is zero. Note that when using zero UDP checksums with IPv6, the other tunnel endpoint must be configured to accept such packets. In Linux, this would be the **udp6zerocsumrx** option for the VXLAN tunnel interface. If using **nocsum** with IPv6, be sure you know what you are doing. Zero UDP checksums provide weaker protection against corrupted packets. See RFC6935 for details. **nofrag** disallow IP fragmentation. ## EXAMPLES The following example encapsulates incoming ICMP packets on eth0 into a vxlan tunnel, by setting metadata to VNI 11, source IP 11.11.0.1 and destination IP 11.11.0.2, and by redirecting the packet with the metadata to device vxlan0, which will do the actual encapsulation using the metadata: #tc qdisc add dev eth0 handle ffff: ingress #tc filter add dev eth0 protocol ip parent ffff: \ flower \ ip_proto icmp \ action tunnel_key set \ src_ip 11.11.0.1 \ dst_ip 11.11.0.2 \ id 11 \ action mirred egress redirect dev vxlan0 Here is an example of the **unset** function: Incoming VXLAN traffic with outer IP's and VNI 11 is decapsulated by vxlan0 and metadata is unset before redirecting to tunl1 device: #tc qdisc add dev eth0 handle ffff: ingress #tc filter add dev vxlan0 protocol ip parent ffff: flower \ enc_src_ip 11.11.0.2 enc_dst_ip 11.11.0.1 enc_key_id 11 action tunnel_key unset action mirred egress redirect dev tunl1 * * *
# tc-sample ## NAME sample - packet sampling tc action ## SYNOPSIS **tc**... **action sample rate** _RATE_ **group** _GROUP_ [ **trunc** _SIZE_ ] [ **index** _INDEX_ ] **tc**... **action sample index** _INDEX_ ## DESCRIPTION The **sample** action allows sampling packets matching classifier. The packets are chosen randomly according to the **rate** parameter, and are sampled using the **psample** generic netlink channel. The user can also specify packet truncation to save user-kernel traffic. Each sample includes some informative metadata about the original packet, which is sent using netlink attributes, alongside the original packet data. The user can either specify the sample action parameters as presented in the first form above, or use an existing sample action using its index, as presented in the second form. ## SAMPLED PACKETS METADATA FIELDS The metadata are delivered to userspace applications using the **psample** generic netlink channel, where each sample includes the following netlink attributes: **PSAMPLE_ATTR_IIFINDEX** The input interface index of the packet, if there is one. **PSAMPLE_ATTR_OIFINDEX** The output interface index of the packet. This field is not relevant on ingress sampling **PSAMPLE_ATTR_ORIGSIZE** The size of the original packet (before truncation) **PSAMPLE_ATTR_SAMPLE_GROUP** The **psample** group the packet was sent to **PSAMPLE_ATTR_GROUP_SEQ** A sequence number of the sampled packet. This number is incremented with each sampled packet of the current **psample** group **PSAMPLE_ATTR_SAMPLE_RATE** The rate the packet was sampled with ## OPTIONS **rate** _RATE_ The packet sample rate. _RATE_ is the expected ratio between observed packets and sampled packets. For example, _RATE_ of 100 will lead to an average of one sampled packet out of every 100 observed. **trunc** _SIZE_ Upon set, defines the maximum size of the sampled packets, and causes truncation if needed **group** _GROUP_ The **psample** group the packet will be sent to. The **psample** module defines the concept of groups, which allows the user to match specific sampled packets in the case of multiple sampling rules, thus identify only the packets that came from a specific rule. **index** _INDEX_ Is a unique ID for an action. When creating new action instance, this parameter allows one to set the new action index. When using existing action, this parameter allows one to specify the existing action index. The index must 32bit unsigned integer greater than zero. ## EXAMPLES Sample one of every 100 packets flowing into interface eth0 to psample group 12: tc qdisc add dev eth0 handle ffff: ingress tc filter add dev eth0 parent ffff: matchall \ action sample rate 100 group 12 index 19 Use the same action instance to sample eth1 too: tc qdisc add dev eth1 handle ffff: ingress tc filter add dev eth1 parent ffff: matchall \ action sample index 19 * * *
# [email protected] ## NAME [email protected], systemd-fsck-root.service, systemd-fsck- usr.service, systemd-fsck - File system checker logic ## SYNOPSIS [email protected] systemd-fsck-root.service systemd-fsck-usr.service /usr/lib/systemd/systemd-fsck ## DESCRIPTION [email protected], systemd-fsck-root.service, and systemd-fsck-usr.service are services responsible for file system checks. They are instantiated for each device that is configured for file system checking. systemd-fsck-root.service and systemd-fsck-usr.service are responsible for file system checks on the root and /usr file system, respectively, but only if the root filesystem was not checked in the initrd. [email protected] is used for all other file systems and for the root file system in the initrd. These services are started at boot if **passno** in /etc/fstab for the file system is set to a value greater than zero, but only if it is also configured to be mounted at boot (i.e. without "noauto" option). The file system check for root is performed before the other file systems. Other file systems may be checked in parallel, except when they are on the same rotating disk. systemd-fsck does not know any details about specific filesystems, and simply executes file system checkers specific to each filesystem type (fsck._type_). These checkers will decide if the filesystem should actually be checked based on the time since last check, number of mounts, unclean unmount, etc. systemd-fsck-root.service and systemd-fsck-usr.service will activate reboot.target if fsck(8) returns the "System should reboot" condition, or emergency.target if **fsck** returns the "Filesystem errors left uncorrected" condition. [email protected] will fail if fsck(8) returns either the "System should reboot" or the "Filesystem errors left uncorrected" condition. For filesystems listed in /etc/fstab without "nofail" or "noauto" options, local-fs.target will then activate emergency.target. ## KERNEL COMMAND LINE **systemd-fsck** understands these kernel command line parameters: _fsck.mode=_ One of "auto", "force", "skip". Controls the mode of operation. The default is "auto", and ensures that file system checks are done when the file system checker deems them necessary. "force" unconditionally results in full file system checks. "skip" skips any file system checks. Added in version 186. _fsck.repair=_ One of "preen", "yes", "no". Controls the mode of operation. The default is "preen", and will automatically repair problems that can be safely fixed. "yes" will answer yes to all questions by fsck and "no" will answer no to all questions. Added in version 213. ## CREDENTIALS **systemd-fsck** supports the service credentials logic as implemented by _ImportCredential=_ /_LoadCredential=_ /_SetCredential=_ (see systemd.exec(5) for details). The following credentials are used when passed in: _fsck.mode_ , _fsck.repair_ The contents of the credentials are parsed as same as the kernel command line options with the same name. See above for more details. Added in version 258. Note that by default the [email protected], systemd-fsck-root.service, and systemd-fsck-usr.service unit files are set up to inherit both _fsck.mode_ and _fsck.repair_ credentials from the service manager. * * *
# cryptsetup-luksConvertKey ## NAME cryptsetup-luksConvertKey - converts an existing LUKS2 keyslot to new PBKDF parameters ## SYNOPSIS **cryptsetup** _luksConvertKey_ **[ <options>] <device>** ## DESCRIPTION Converts an existing LUKS2 keyslot to new PBKDF parameters. The passphrase for the keyslot to be converted must be supplied interactively or via --key-file. If no --pbkdf parameters are specified LUKS2 default PBKDF values will apply. If a keyslot is specified (via --key-slot), the passphrase for that keyslot must be given. If no keyslot is specified and there is still a free keyslot, the new parameters will be put into a free keyslot before the keyslot containing the old parameters is purged. If there is no free keyslot, the keyslot with the old parameters is directly overwritten. **WARNING:** If a keyslot is overwritten, a media failure during this operation can cause the overwrite to fail after the old parameters have been wiped, making the LUKS container inaccessible. **< options> **can be [--key-file, --keyfile-offset, --keyfile-size, --key-slot, --hash, --header, --disable-locks, --iter-time, --pbkdf, --pbkdf-force-iterations, --pbkdf-memory, --pbkdf-parallel, --keyslot-cipher, --keyslot-key-size, --timeout, --verify-passphrase]. ## OPTIONS **--batch-mode** , **-q** Suppresses all confirmation questions. Use with care! If the --verify-passphrase option is not specified, this option also switches off the passphrase verification. **--debug** or **--debug-json** Run in debug mode with full diagnostic logs. Debug output lines are always prefixed by **#**. If --debug-json is used, additional LUKS2 JSON data structures are printed. **--disable-locks** Disable lock protection for metadata on disk. This option is valid only for LUKS2 and is ignored for other formats. **WARNING:** Do not use this option unless you run cryptsetup in a restricted environment where locking is impossible to perform (where /run directory cannot be used). **--force-password** Do not use password quality checking for new LUKS passwords. This option is ignored if cryptsetup is built without password quality checking support. For more info about password quality check, see the manual page for **pwquality.conf**(5) and **passwdqc.conf**(5). **--hash** , **-h** _< hash-spec>_ The specified hash is used for PBKDF2 and the AF splitter. **--header** _< device or file storing the LUKS header>_ Use a detached (separated) metadata device or file where the LUKS header is stored. This option allows one to store the ciphertext and LUKS header on different devices. For commands that change the LUKS header (e.g., _luksAddKey_), specify the device or file with the LUKS header directly as the LUKS device. **--help** , **-?** Show help text and default parameters. **--iter-time** , **-i** _< number of milliseconds>_ The number of milliseconds to spend with PBKDF passphrase processing. Specifying 0 as a parameter selects the compiled-in default. **--key-file** , **-d** _file_ Read the passphrase from the file. If the name given is "-", then the passphrase will be read from stdin. In this case, reading will not stop at newline characters. See section _NOTES ON PASSPHRASE PROCESSING_ in cryptsetup(8) for more information. **--keyfile-offset** _value_ Skip _value_ bytes at the beginning of the key file. **--keyfile-size** , **-l** _value_ Read a maximum of _value_ bytes from the key file. The default is to read the whole file up to the compiled-in maximum that can be queried with --help. Supplying more data than the compiled-in maximum aborts the operation. This option is useful to cut trailing newlines, for example. If --keyfile-offset is also given, the size count starts after the offset. **--key-slot** , **-S** _< 0-N>_ For LUKS operations that add key material, this option allows you to specify which keyslot is selected for the new key. The maximum number of keyslots depends on the LUKS version. LUKS1 can have up to 8 keyslots. LUKS2 can have up to 32 keyslots based on keyslot area size and key size, but a valid keyslot ID can always be between 0 and 31 for LUKS2. **--keyslot-cipher** _< cipher-spec>_ This option can be used to set specific cipher encryption for the LUKS2 keyslot area. **--keyslot-key-size** _< bits>_ This option can be used to set a specific key size for the LUKS2 keyslot area. **--new-keyfile-offset** _value_ Skip _value_ bytes at the start when adding a new passphrase from the key file. **--new-keyfile-size** _value_ Read a maximum of _value_ bytes when adding a new passphrase from the key file. The default is to read the whole file up to the compiled-in maximum length that can be queried with --help. Supplying more than the compiled-in maximum aborts the operation. When --new-keyfile-offset is also given, reading starts after the offset. **--pbkdf** _< PBKDF spec>_ Set Password-Based Key Derivation Function (PBKDF) algorithm for LUKS keyslot. The PBKDF can be: _pbkdf2_ (for PBKDF2 according to RFC2898), _argon2i_ for Argon2i or _argon2id_ for Argon2id (see Argon2 <https://www.cryptolux.org/index.php/Argon2> for more info). For LUKS1, only PBKDF2 is accepted (no need to use this option). The default PBKDF for LUKS2 is set during compilation time and is available in the _cryptsetup --help_ output. A PBKDF is used for increasing the dictionary and brute-force attack cost for keyslot passwords. The parameters can be time, memory and parallel cost. For PBKDF2, only the time cost (number of iterations) applies. For Argon2i/id, there is also memory cost (memory required during the process of key derivation) and parallel cost (number of threads that run in parallel during the key derivation. Note that increasing memory cost also increases time, so the final parameter values are measured by a benchmark. The benchmark tries to find iteration time (--iter-time) with required memory cost --pbkdf-memory. If it is not possible, the memory cost is decreased as well. The parallel cost --pbkdf-parallel is constant and is checked against available CPU cores. You can see all PBKDF parameters for a particular LUKS2 keyslot with the cryptsetup-luksDump(8) command. If you do not want to use benchmark and want to specify all parameters directly, use --pbkdf-force-iterations with --pbkdf-memory and --pbkdf-parallel. This will override the values without benchmarking. Note it can cause extremely long unlocking time or cause out-of-memory conditions with unconditional process termination. Use only in specific cases, for example, if you know that the formatted device will be used on some small embedded system. **MINIMAL AND MAXIMAL PBKDF COSTS:** For **PBKDF2** , the minimum iteration count is 1000 and the maximum is 4294967295 (maximum for 32-bit unsigned integer). Memory and parallel costs are not supported for PBKDF2. For **Argon2i** and **Argon2id** , the minimum iteration count (CPU cost) is 4, and the maximum is 4294967295 (maximum for a 32-bit unsigned integer). Minimum memory cost is 32 KiB and maximum is 4 GiB. If the memory cost parameter is benchmarked (not specified by a parameter), it is always in the range from 64 MiB to 1 GiB. Memory cost above 1GiB (up to the 4GiB maximum) can be setup only by the --pbkdf-memory parameter. The parallel cost minimum is 1 and maximum 4 (if enough CPU cores are available, otherwise it is decreased by the available CPU cores). **WARNING:** Increasing PBKDF computational costs above the mentioned limits provides negligible additional security improvement. While elevated costs significantly increase brute-force overhead, they offer negligible protection against dictionary attacks. The marginal cost increase for processing an entire dictionary remains fundamentally insufficient. The hardcoded PBKDF limits represent engineered trade-offs between cryptographic security and operational usability. LUKS maintains portability and must be used within a reasonable time on resource-constrained systems. Cryptsetup deliberately restricts maximum memory cost (4 GiB) and parallel cost (4) parameters due to architectural limitations (like embedded and legacy systems). PBKDF memory cost mandates actual physical RAM allocation with intensive write operations that must remain in physical RAM. Any swap usage results in unacceptable performance degradation. Memory management often overcommits allocations beyond available physical memory, expecting most allocated memory to remain unused. In such situations, as PBKDF always uses all allocated memory, it frequently causes out-of-memory failures that abort cryptsetup operations. **--pbkdf-force-iterations** _number_ Avoid the PBKDF benchmark and set the time cost (iterations) directly. It can be used only for a LUKS/LUKS2 device. See --pbkdf option for more info. **--pbkdf-memory** _number_ Set the memory cost for PBKDF (for Argon2i/id, the number represents kilobytes). Note that it is the maximal value; PBKDF benchmark or available physical memory can decrease it. This option is not available for PBKDF2. **--pbkdf-parallel** _number_ Set the parallel cost for PBKDF (number of threads, up to 4). Note that it is the maximal value; it is decreased automatically if the CPU online count is lower. This option is not available for PBKDF2. **--timeout** , **-t** _seconds_ The number of seconds to wait before a timeout on passphrase input via terminal. It is relevant every time a passphrase is asked. It has no effect if used in conjunction with --key-file. This option is useful when the system should not stall if the user does not input a passphrase, e.g., during boot. The default is a value of 0 seconds, which means to wait forever. **--usage** Show short option help. **--verify-passphrase** , **-y** When interactively asking for a passphrase, ask for it twice and complain if both inputs do not match. Ignored on input from file or stdin. **--version** , **-V** Show the program version. ## CRYPTSETUP Part of cryptsetup project <https://gitlab.com/cryptsetup/cryptsetup/>. This page is part of the _Cryptsetup_ ((open-source disk encryption)) project. Information about the project can be found at ⟨https://gitlab.com/cryptsetup/cryptsetup⟩. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository ⟨https://gitlab.com/cryptsetup/cryptsetup.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-01.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is _not_ part of the original manual page), send a mail to [email protected] cryptsetup 2.8.1-git 2025-08-09 _CRYPTSETU...CONVERTKEY_(8) * * *
# pam_ftp ## NAME pam_ftp - PAM module for anonymous access module ## SYNOPSIS **pam_ftp.so**[debug] [ignore] [users=_XXX,YYY,_...] ## DESCRIPTION pam_ftp is a PAM module which provides a pluggable anonymous ftp mode of access. This module intercepts the user's name and password. If the name is _ftp_ or _anonymous_ , the user's password is broken up at the _@_ delimiter into a _PAM_RUSER_ and a _PAM_RHOST_ part; these pam-items being set accordingly. The username (_PAM_USER_) is set to _ftp_. In this case the module succeeds. Alternatively, the module sets the _PAM_AUTHTOK_ item with the entered password and fails. This module is not safe and easily spoofable. ## OPTIONS **debug** Print debug information. **ignore** Pay no attention to the email address of the user (if supplied). **ftp=**_XXX,YYY,..._ Instead of _ftp_ or _anonymous_ , provide anonymous login to the comma separated list of users: _XXX,YYY,..._. Should the applicant enter one of these usernames the returned username is set to the first in the list: _XXX_. ## MODULE TYPES PROVIDED Only the **auth** module type is provided. ## RETURN VALUES PAM_SUCCESS The authentication was successful. PAM_USER_UNKNOWN User not known. ## EXAMPLES Add the following line to /etc/pam.d/ftpd to handle ftp style anonymous login: # # ftpd; add ftp-specifics. These lines enable anonymous ftp over # standard UN*X access (the listfile entry blocks access to # users listed in /etc/ftpusers) # auth sufficient pam_ftp.so auth required pam_unix.so use_first_pass auth required pam_listfile.so \ onerr=succeed item=user sense=deny file=/etc/ftpusers * * *
# ibrouters ## NAME IBROUTERS - show InfiniBand router nodes in topology ## SYNOPSIS ibrouters [options] [<topology-file>] ## DESCRIPTION ibrouters is a script which either walks the IB subnet topology or uses an already saved topology file and extracts the router nodes. ## OPTIONS **-C, --Ca <ca_name> **use the specified ca_name. **-P, --Port <ca_port> **use the specified ca_port. **-t, --timeout <timeout_ms> **override the default timeout for the solicited mads. **-y, --m_key <key>** use the specified M_key for requests. If non-numeric value (like 'x') is specified then a value will be prompted for. **-h, --help** show the usage message **--config, -z <config_file> **Specify alternate config file. Default: /ssd11/FOSS/rdma-core/build/etc/infiniband-diags/ibdiag.conf **Local port Selection** Multiple port/Multiple CA support: when no IB device or port is specified (see the "local umad parameters" below), the libibumad library selects the port to use by the following criteria: 1. the first port that is ACTIVE. 2. if not found, the first port that is UP (physical link up). If a port and/or CA name is specified, the libibumad library attempts to fulfill the user request, and will fail if it is not possible. For example: ibaddr # use the first port (criteria #1 above) ibaddr -C mthca1 # pick the best port from "mthca1" only. ibaddr -P 2 # use the second (active/up) port from the first available IB device. ibaddr -C mthca0 -P 2 # use the specified port only. ## FILES **CONFIG FILE** /ssd11/FOSS/rdma-core/build/etc/infiniband-diags/ibdiag.conf A global config file is provided to set some of the common options for all tools. See supplied config file for details. **NODE NAME MAP FILE FORMAT** The node name map is used to specify user friendly names for nodes in the output. GUIDs are used to perform the lookup. This functionality is provided by the opensm-libs package. See **opensm**(8) for the file location for your installation. **Generically:** # comment <guid> "<name>" **Example:** # IB1 # Line cards 0x0008f104003f125c "IB1 (Rack 11 slot 1 ) ISR9288/ISR9096 Voltaire sLB-24D" 0x0008f104003f125d "IB1 (Rack 11 slot 1 ) ISR9288/ISR9096 Voltaire sLB-24D" 0x0008f104003f10d2 "IB1 (Rack 11 slot 2 ) ISR9288/ISR9096 Voltaire sLB-24D" 0x0008f104003f10d3 "IB1 (Rack 11 slot 2 ) ISR9288/ISR9096 Voltaire sLB-24D" 0x0008f104003f10bf "IB1 (Rack 11 slot 12 ) ISR9288/ISR9096 Voltaire sLB-24D" # Spines 0x0008f10400400e2d "IB1 (Rack 11 spine 1 ) ISR9288 Voltaire sFB-12D" 0x0008f10400400e2e "IB1 (Rack 11 spine 1 ) ISR9288 Voltaire sFB-12D" 0x0008f10400400e2f "IB1 (Rack 11 spine 1 ) ISR9288 Voltaire sFB-12D" 0x0008f10400400e31 "IB1 (Rack 11 spine 2 ) ISR9288 Voltaire sFB-12D" 0x0008f10400400e32 "IB1 (Rack 11 spine 2 ) ISR9288 Voltaire sFB-12D" # GUID Node Name 0x0008f10400411a08 "SW1 (Rack 3) ISR9024 Voltaire 9024D" 0x0008f10400411a28 "SW2 (Rack 3) ISR9024 Voltaire 9024D" 0x0008f10400411a34 "SW3 (Rack 3) ISR9024 Voltaire 9024D" 0x0008f104004119d0 "SW4 (Rack 3) ISR9024 Voltaire 9024D" ## DEPENDENCIES ibnetdiscover, ibnetdiscover format * * *
# cryptsetup ## NAME cryptsetup - utility for configuring and managing encrypted storage devices ## SYNOPSIS **cryptsetup <action> [<options>] <action args>** ## DESCRIPTION **Cryptsetup** is a utility for configuring and managing full-disk encryption on storage devices. It can encrypt block devices (such as hard drives or partitions) and containers (disk images stored as files). When you unlock an encrypted volume, **cryptsetup** creates a new device mapping that applications can access like any regular storage device. The actual encryption and decryption work is performed transparently by the kernel’s device-mapper dm-crypt driver. **Cryptsetup** works with two main volume types: plain encrypted volumes and LUKS (Linux Unified Key Setup) volumes. Plain volumes provide basic encryption, while LUKS volumes include a metadata header that enables advanced features like multiple keyslots and key management. Additionally, LUKS can be used to manage hardware-based encryption on OPAL-capable storage drives. **Cryptsetup** also provides limited support for volumes created by other encryption systems, including **loop-AES** , **TrueCrypt** , **VeraCrypt** , **BitLocker** , and **FileVault2**. For more information about a specific cryptsetup action, see **cryptsetup- <action>**(8), where **< action> **is the name of the cryptsetup action. Cryptsetup devices can be activated during boot through crypttab(5), which is part of systemd(1) or other system init scripts. ## BASIC ACTIONS The following are valid actions for all supported device types. **OPEN** **open <device> <name> --type <device_type>** Opens (creates a mapping with) <name> backed by device <device>. See cryptsetup-open(8). **CLOSE** **close <name>** Removes the existing mapping <name> and wipes the key from kernel memory. See cryptsetup-close(8). **STATUS** **status <name>** Reports the status for the mapping <name>. See cryptsetup-status(8). **RESIZE** **resize <name>** Resizes an active mapping <name>. See cryptsetup-resize(8). **REFRESH** **refresh <name>** Refreshes parameters of active mapping <name>. See cryptsetup-refresh(8). **REENCRYPT** **reencrypt <device> or --active-name <name> [<new_name>]** Run LUKS device reencryption. See cryptsetup-reencrypt(8). ## PLAIN MODE Plain dm-crypt encrypts the device sector-by-sector with a single, non-salted hash of the passphrase. No checks are performed, and no metadata is used. There is no formatting operation. When the raw device is mapped (opened), the usual device operations can be used on the mapped device, including filesystem creation. Mapped devices usually reside in /dev/mapper/<name>. The following are valid plain device type actions: **OPEN** **open --type plain <device> <name>** create <name> <device> (**OBSOLETE syntax**) Opens (creates a mapping with) <name> backed by device <device>. See cryptsetup-open(8). ## LUKS EXTENSION LUKS, the Linux Unified Key Setup, is a standard for disk encryption. It adds a standardized header at the start of the device, a keyslot area directly behind the header and the bulk data area behind that. The whole set is called a 'LUKS container'. The device that a LUKS container resides on is called a 'LUKS device'. For most purposes, both terms can be used interchangeably. LUKS can manage multiple passphrases that can be individually revoked or changed. Each passphrase uses an individual keyslot containing a volume key for data encryption. Keyslots can be securely scrubbed from persistent media due to the use of anti-forensic stripes. Passphrases are protected against brute-force attacks by the Password-Based Key Derivation Function (PBKDF). A passphrase stored in a file is called a key file. The only difference between a passphrase and a key file is that a key file can contain binary data. Both are processed the same. LUKS version 1 (or LUKS1) is the original metadata format, while LUKS2 is a new version that allows additional extensions like different PBKDF algorithms or authenticated encryption. You can format the device with a specific LUKS version with **--type luks1** or **--type luks2** in the **luksFormat** command. Normally, you do not need to specify any version as it is recognized automatically. The default format is LUKS2. The **< device> **parameter can also be specified by a LUKS UUID in the format UUID=<uuid>. The LUKS header can be detached from data (stored separately). To specify a detached header, the --header parameter can be used in all LUKS commands and always takes precedence over the positional **< device> **parameter. The following are valid LUKS actions: **FORMAT** **luksFormat <device> [<key file>]** Initializes a LUKS partition and sets the initial passphrase (for keyslot 0). See cryptsetup-luksFormat(8). **OPEN** **open --type luks <device> <name>** luksOpen <device> <name> (**old syntax**) Opens the LUKS device <device> and sets up a mapping <name> after successful verification of the supplied passphrase. See cryptsetup-open(8). **SUSPEND** **luksSuspend <name>** Suspends an active device (all IO operations will block and accesses to the device will wait indefinitely) and wipes the encryption key from kernel memory. See cryptsetup-luksSuspend(8). **RESUME** **luksResume <name>** Resumes a suspended device and reinstates the encryption key. See cryptsetup-luksResume(8). **ADD KEY** **luksAddKey <device> [<key file with new key>]** Adds a new passphrase using an existing passphrase. See cryptsetup-luksAddKey(8). **REMOVE KEY** **luksRemoveKey <device> [<key file with passphrase to be removed>]** Removes the supplied passphrase from the LUKS device. See cryptsetup-luksRemoveKey(8). **CHANGE KEY** **luksChangeKey <device> [<new key file>]** Changes an existing passphrase. See cryptsetup-luksChangeKey(8). **CONVERT KEY** **luksConvertKey <device>** Converts an existing LUKS2 keyslot to new PBKDF parameters. See cryptsetup-luksConvertKey(8). **KILL SLOT** **luksKillSlot <device> <number>** Wipe the keyslot with the <number> from the LUKS device. See cryptsetup-luksKillSlot(8). **ERASE** **erase <device>** luksErase <device> (**old syntax**) Erase all keyslots and make the LUKS container permanently inaccessible. See cryptsetup-erase(8). **UUID** **luksUUID <device>** Print or set the UUID of a LUKS device. See cryptsetup-luksUUID(8). **IS LUKS** **isLuks <device>** Returns true, if <device> is a LUKS device, false otherwise. See cryptsetup-isLuks(8). **DUMP** **luksDump <device>** Dump the header information of a LUKS device. See cryptsetup-luksDump(8). **HEADER BACKUP** **luksHeaderBackup <device> --header-backup-file <file>** Stores a binary backup of the LUKS header and keyslot area. See cryptsetup-luksHeaderBackup(8). **HEADER RESTORE** **luksHeaderRestore <device> --header-backup-file <file>** Restores a binary backup of the LUKS header and keyslot area from the specified file. See cryptsetup-luksHeaderRestore(8). **TOKEN** **token <add|remove|import|export> <device>** Manipulate token objects used for obtaining passphrases. See cryptsetup-token(8). **CONVERT** **convert <device> --type <format>** Converts the device between LUKS1 and LUKS2 format (if possible). See cryptsetup-convert(8). **CONFIG** **config <device>** Set permanent configuration options (store to LUKS header). See cryptsetup-config(8). ## LOOP-AES EXTENSION Cryptsetup supports mapping a loop-AES encrypted partition using a compatibility mode. **OPEN** **open --type loopaes <device> <name> --key-file <keyfile>** loopaesOpen <device> <name> --key-file <keyfile> (**old syntax**) Opens the loop-AES <device> and sets up a mapping <name>. See cryptsetup-open(8). See also section 7 of the FAQ and loop-AES <http://loop-aes.sourceforge.net> for more information regarding loop-AES. ## TCRYPT (TRUECRYPT AND VERACRYPT COMPATIBLE) EXTENSION Cryptsetup supports mapping of TrueCrypt, tcplay, or VeraCrypt encrypted partitions using a native Linux kernel API. Header formatting and TCRYPT header change are not supported; cryptsetup never changes the TCRYPT header on-device. TCRYPT extension requires the kernel userspace crypto API to be available. If you are configuring the kernel yourself, enable "User-space interface for symmetric key cipher algorithms" in "Cryptographic API" section (CRYPTO_USER_API_SKCIPHER .config option). Because the TCRYPT header is encrypted, you must always provide a valid passphrase and keyfiles. Cryptsetup should recognize all header variants, except legacy cipher chains using LRW encryption mode with a 64-bit encryption block (namely, Blowfish in LRW mode is not recognized; this is a limitation of the kernel crypto API). VeraCrypt is an extension of TrueCrypt with an increased iteration count, so unlocking can take quite a lot of time. To open a VeraCrypt device with a custom Personal Iteration Multiplier (PIM) value, use either the --veracrypt-pim PIM option to directly specify the PIM on the command line or use --veracrypt-query-pim to be prompted for the PIM. The PIM value affects the number of iterations applied during key derivation. Please refer to PIM <https://veracrypt.io/en/Personal%20Iterations%20Multiplier%20(PIM).html> for more detailed information. If you need to disable VeraCrypt device support, use --disable-veracrypt option. Activation with **tcryptOpen** is supported only for cipher chains using LRW or XTS encryption modes. The **tcryptDump** command should work for all recognized TCRYPT devices and doesn’t require superuser privilege. To map the system device (device with boot loader where the whole encrypted system resides), use --tcrypt-system option. Please read specific info in cryptsetup-tcryptOpen(8) --tcrypt-system option section as mapping system-encrypted device is tricky. To use a hidden header (and map hidden device, if available), use --tcrypt-hidden option. To explicitly use the backup (secondary) header, use --tcrypt-backup option. There is no protection for a hidden volume if the outer volume is mounted. The reason is that if there were any protection, it would require some metadata describing what to protect in the outer volume, and the hidden volume would become detectable. **OPEN** **open --type tcrypt <device> <name>** tcryptOpen_ <device> <name> (**old syntax**) Opens the TCRYPT (a TrueCrypt-compatible) <device> and sets up a mapping <name>. See cryptsetup-open(8). **DUMP** **tcryptDump <device>** Dump the header information of a TCRYPT device. See cryptsetup-tcryptDump(8). See also TrueCrypt <https://en.wikipedia.org/wiki/TrueCrypt> and VeraCrypt <https://en.wikipedia.org/wiki/VeraCrypt> pages for more information. Please note that cryptsetup does not use TrueCrypt or VeraCrypt code; please report all problems related to this compatibility extension to the cryptsetup project. ## BITLK (WINDOWS BITLOCKER COMPATIBLE) EXTENSION Cryptsetup supports mapping of BitLocker and BitLocker to Go encrypted partitions using a native Linux kernel API. Header formatting and BITLK header changes are not supported; cryptsetup never changes the BITLK header on-device. BITLK extension requires the kernel userspace crypto API to be available (for details, see the TCRYPT section). Cryptsetup should recognize all BITLK header variants, except the legacy header used in Windows Vista systems and partially decrypted BitLocker devices. Activation of legacy devices encrypted in CBC mode requires at least a Linux kernel version 5.3, and for devices using the Elephant diffuser, kernel 5.6. The **bitlkDump** command should work for all recognized BITLK devices and doesn’t require superuser privilege. For unlocking with the **open** , a password, a recovery passphrase, or a startup key must be provided. Additionally, unlocking using the volume key is supported. You must provide BitLocker Full Volume Encryption Key (FVEK) using the --volume-key-file option. The key must be decrypted and without the header (only 128/256/512 bits of key data depending on the used cipher and mode). Other unlocking methods (TPM, SmartCard) are not supported. **OPEN** **open --type bitlk <device> <name>** bitlkOpen <device> <name> (**old syntax**) Opens the BITLK (a BitLocker-compatible) <device> and sets up a mapping <name>. See cryptsetup-open(8). **DUMP** **bitlkDump <device>** Dump the header information of a BITLK device. See cryptsetup-bitlkDump(8). Please note that cryptsetup does not use any Windows BitLocker code; please report all problems related to this compatibility extension to the cryptsetup project. ## FVAULT2 (APPLE MACOS FILEVAULT2 COMPATIBLE) EXTENSION Cryptsetup supports the mapping of FileVault2 (FileVault2 full-disk encryption) by Apple for the macOS operating system using a native Linux kernel API. Cryptsetup supports only FileVault2 based on Core Storage and HFS+ filesystem (introduced in MacOS X 10.7 Lion). It does NOT support the new version of FileVault based on the APFS filesystem used in recent macOS versions. Header formatting and FVAULT2 header changes are not supported; cryptsetup never changes the FVAULT2 header on-device. FVAULT2 extension requires the kernel userspace crypto API to be available (for details, see the TCRYPT section) and a kernel driver for the HFS+ (hfsplus) filesystem. Cryptsetup should recognize the basic configuration for portable drives. The **fvault2Dump** command should work for all recognized FVAULT2 devices and doesn’t require superuser privilege. For unlocking with the **open** , a password must be provided. Other unlocking methods are not supported. **OPEN** **open --type fvault2 <device> <name>** fvault2Open <device> <name> (**old syntax**) Opens the FVAULT2 (a FileVault2-compatible) <device> (usually the second partition on the device) and sets up a mapping <name>. See cryptsetup-open(8). ## SED (SELF ENCRYPTING DRIVE) OPAL EXTENSION Cryptsetup supports using native hardware encryption on drives that provide an **OPAL** interface, both nested with **dm-crypt** and standalone. Passphrases, tokens and metadata are stored using the LUKS2 header format, and are thus compatible with any software or system that uses LUKS2 (e.g., tokens). OPAL support requires at least kernel v6.4. Resizing devices is not supported. The --hw-opal can be specified for OPAL + dm-crypt, and --hw-opal-only can be specified to use OPAL only, without a dm-crypt layer. Opening, closing and enrolling tokens work the same way as with LUKS2 and dm-crypt. The new parameters are only necessary when formatting; the LUKS2 metadata will ensure the right setup is performed when opening or closing. If no **subsystem** label is specified, it will be automatically set to **HW-OPAL** so that it is immediately apparent when a device uses OPAL. **FORMAT** **luksFormat --type luks2 --hw-opal <device> [<key file>]** Additionally specify --hw-opal-only instead of --hw-opal to avoid the dm-crypt layer. Other than the usual passphrase, an admin password will have to be specified when formatting the drive’s first partition, and will have to be re-supplied when formatting any other partition until a factory reset is performed. **ERASE** **erase <device>** Securely erase a partition or device. Requires admin password. Additionally specify --hw-opal-factory-reset for a FULL factory reset of the drive, using the drive’s **PSID**(typically printed on the label) instead of the admin password. PSID must be entered without dashes, spaces or underscores. **WARNING** : A factory reset will cause ALL data on the device to be lost, regardless of the partition it is run on, if any, and regardless of any LUKS2 header backup. ## MISCELLANEOUS ACTIONS **REPAIR** **repair <device>** Tries to repair the device metadata if possible. Currently supported only for LUKS device type. See cryptsetup-repair(8). **BENCHMARK** **benchmark <options>** Benchmarks, ciphers and KDF (key derivation function). See cryptsetup-benchmark(8). ## PLAIN MODE OR LUKS? Unless you understand the cryptographic background well, use LUKS. With plain mode, there are a number of possible user errors that massively decrease security. While LUKS cannot fix them all, it can lessen the impact for many of them. ## WARNINGS A lot of good information on the risks of using encrypted storage, on handling problems and on security aspects can be found in the Cryptsetup FAQ. Read it. Nonetheless, some risks deserve to be mentioned here. **Backup:** Storage media die. Encryption has no influence on that. Backup is mandatory for encrypted data as well, if the data has any worth. See the Cryptsetup FAQ for advice on how to back up an encrypted volume. **Character encoding:** If you enter a passphrase with special symbols, the passphrase can change depending on character encoding. Keyboard settings can also be changed, which can make blind input hard or impossible. For example, switching from some ASCII 8-bit variant to UTF-8 can lead to a different binary encoding and hence a different passphrase seen by cryptsetup, even if what you see on the terminal is exactly the same. It is therefore highly recommended to select passphrase characters only from 7-bit ASCII, as the encoding for 7-bit ASCII stays the same for all ASCII variants and UTF-8. **LUKS header:** If the header of a LUKS volume gets damaged, all data is permanently lost unless you have a header backup. If a keyslot is damaged, it can only be restored from a header backup or if another active keyslot with a known passphrase is undamaged. This risk is the result of a trade-off between security and safety, as LUKS is designed for fast and secure wiping by just overwriting the header and keyslot area. **Previously used partitions:** If a partition was previously used, it is a very good idea to wipe filesystem signatures, data, etc., before creating a LUKS or plain dm-crypt container. For a quick removal of filesystem signatures, use wipefs(8) with the --all option. Note that it does not remove data; it only invalidates known format signatures. For a full wipe, overwrite the whole partition before creating a container. If you do not know how to do that, the cryptsetup FAQ describes several options. ## EXAMPLES Example 1: Create LUKS 2 container on block device /dev/sdX. sudo cryptsetup --type luks2 luksFormat /dev/sdX Example 2: Add an additional passphrase to keyslot 5. sudo cryptsetup luksAddKey --key-slot 5 /dev/sdX Example 3: Create LUKS header backup and save it to a file. sudo cryptsetup luksHeaderBackup /dev/sdX --header-backup-file /var/tmp/NameOfBackupFile Example 4: Open LUKS container on /dev/sdX and map it to sdX_crypt. sudo cryptsetup open /dev/sdX sdX_crypt **WARNING: The command in example 5 will erase all keyslots.** You cannot use your LUKS container afterward anymore unless you have a backup to restore. Example 5: Erase all keyslots on /dev/sdX. sudo cryptsetup erase /dev/sdX Example 6: Restore LUKS header from backup file. sudo cryptsetup luksHeaderRestore /dev/sdX --header-backup-file /var/tmp/NameOfBackupFile ## RETURN CODES Cryptsetup returns **0** on success and a non-zero value on error. Error codes are: **1** wrong parameters, **2** no permission (bad passphrase), **3** out of memory, **4** wrong device specified, **5** device already exists or device is busy. ## NOTES **Passphrase processing for PLAIN mode** Note that no iterated hashing or salting is done in plain mode. If hashing is done, it is a single direct hash. This means that low-entropy passphrases are easy to attack in plain mode. **From a terminal** : The passphrase is read until the first newline, i.e., '\n'. The input without the newline character is processed with the default hash or the hash specified with --hash. The hash result will be truncated to the key size of the used cipher, or the size specified with -s. **From stdin** : Reading will continue until a newline (or until the maximum input size is reached), with the trailing newline stripped. The maximum input size is defined by the same compiled-in default as the maximum key file size and can be overwritten using the --keyfile-size option. The data read will be hashed with the default hash or the hash specified with --hash. The hash result will be truncated to the key size of the used cipher, or the size specified with -s. Note that if --key-file=- is used for reading the key from stdin, trailing newlines are not stripped from the input. If "plain" is used as an argument to --hash, the input data will not be hashed. Instead, it will be zero-padded (if shorter than the key size) or truncated (if longer than the key size) and used directly as the binary key. This is useful for directly specifying a binary key. No warning will be given if the amount of data read from stdin is less than the key size. **From a key file** : It will be truncated to the key size of the used cipher or the size given by -s and directly used as a binary key. The --hash argument is being ignored. The --hash option is usable only for stdin input in plain mode. If the key file is shorter than the key, cryptsetup will quit with an error. The maximum input size is defined by the same compiled-in default as the maximum key file size and can be overwritten using the --keyfile-size option. **Passphrase processing for LUKS** **From a terminal** : The passphrase is read until the first newline and then processed by PBKDF2 without the newline character. **From stdin** : LUKS will read passphrases from stdin up to the first newline character or the compiled-in maximum key file length. If --keyfile-size is given, it is ignored. **From key file** : The complete keyfile is read up to the compiled-in maximum size. Newline characters do not terminate the input. The --keyfile-size option can be used to limit what is read. LUKS uses **Password-Based Key Derivation Function**(PBKDF) to protect against brute-force attacks and to give some protection to low-entropy passphrases (see cryptsetup FAQ). LUKS1 supports the PBKDF2 algorithm only, while LUKS2 also supports memory-hard Argon2. PBKDFs are configured with costs: how long the iteration should run (CPU cost or iteration count), how much memory is used (memory cost), and how many parallel processes are used (parallel cost). PBKDF2 supports only iteration count. Cryptsetup uses PBKDF benchmarking to calculate optimal costs based on the computer where the new passphrase is being initialized. If needed, these costs can also be overwritten. Note that there are some hardcoded limits, for details see **MINIMAL AND MAXIMAL PBKDF COSTS** section in --pbkdf option description. Whenever a passphrase is added to a LUKS header (luksAddKey, luksFormat), the user may specify how much time the passphrase processing should consume. The time is used to determine the iteration count for PBKDF2, and higher times will offer better protection for low-entropy passphrases, but the open command will take longer to complete. For passphrases that have entropy higher than the used key length, higher iteration times will not increase security. The default setting of one or two seconds is sufficient for most practical cases. The only exception is a low-entropy passphrase used on a device with a slow CPU, as this will result in a low iteration count. On a slow device, it may be advisable to increase the iteration time using the --iter-time option to obtain a higher iteration count. This does slow down all later luksOpen operations accordingly. **Incoherent behavior for invalid passphrases/keys** LUKS checks for a valid passphrase when a keyslot is decrypted. The behavior of plain dm-crypt is different. It will always unlock the device with the passphrase given. If the given passphrase is wrong, the device mapped by plain dm-crypt will use the wrong encryption key, and the data will be unreadable. **Supported ciphers, modes, hashes and key sizes** The available combinations of ciphers, modes, hashes and key sizes depend on kernel support. See /proc/crypto for a list of available options. You might need to load additional kernel crypto modules to get more options. Cryptsetup processes many operations outside of the kernel, so the configured cryptographic library must also support selected algorithms. Some algorithms may be missing as cryptsetup can be compiled with various cryptographic backends (libraries). **Notes on passphrases** Mathematics can’t be bribed. Make sure you keep your passphrases safe. There are a few nice tricks for constructing a fallback when suddenly, out of the blue, your brain refuses to cooperate. These fallbacks need LUKS, as it’s only possible with LUKS to have multiple passphrases. Still, if your attacker model does not prevent it, storing your passphrase in a sealed envelope somewhere may be a good idea as well. **Notes on Random Number Generators** Random Number Generators (RNGs) used in cryptsetup are always the kernel RNGs without any modifications or additions to the data stream produced. There are two types of randomness that cryptsetup/LUKS needs. One type is used for salts, the AF splitter and for wiping deleted keyslots. The second type is used for the volume key. With recent kernels (Linux kernel 5.6), you do not need to worry about selecting RNG (/dev/random or /dev/urandom). In a low-entropy situation (embedded system), initialization of the kernel RNG can take a very long time, but this happens before cryptsetup can even be started. Use _cryptsetup --help_ to show the compiled-in default random number generator. See urandom(4) for more information. **Authenticated disk encryption (EXPERIMENTAL)** Normal disk encryption modes are length-preserving (the plaintext sector is the same size as a ciphertext sector) and can provide only confidentiality protection, not cryptographically sound data integrity protection. Authenticated modes require additional space per-sector for the authentication tag and use Authenticated Encryption with Additional Data (AEAD) algorithms. If you configure a LUKS2 device with data integrity protection, there will be an underlying dm-integrity device, which provides additional per-sector metadata space and data journal protection to ensure atomicity of data and metadata updates. Because there must be additional space for metadata and journal, the available space for the device will be smaller than for length-preserving modes. The dm-crypt device then resides on top of such a dm-integrity device. All activation and deactivation of this device stack is performed by cryptsetup; there is no difference in using **luksOpen** for integrity-protected devices. If you want to format a LUKS2 device with data integrity protection, use --integrity option (see cryptsetup-luksFormat(8)). Albeit Linux kernel 5.7 added TRIM support for standalone dm-integrity devices, cryptsetup(8) can’t offer support for discards (TRIM) in authenticated encryption mode, because the underlying dm-crypt kernel module does not support this functionality when dm-integrity is used as auth tag space allocator (see --allow-discards in cryptsetup-open(8)). Some integrity modes require two independent keys (a key for encryption and authentication). Both these keys are stored in one LUKS keyslot. Support for authenticated modes is experimental, and only some modes are available now. Note that very few authenticated encryption algorithms are suitable for disk encryption. You also cannot use CRC32 or other non-cryptographic checksums (other than the special integrity mode "none"). If, for some reason, you want to have integrity control without using authentication mode, then you should separately configure dm-integrity independently of LUKS2. **Notes on loopback device use** Cryptsetup is usually used directly on a block device (disk partition or LVM volume). However, if the device argument is a file, cryptsetup tries to allocate a loopback device and map it into this file. Of course, you can always map a file to a loop device manually. See the cryptsetup FAQ for an example. When device mapping is active, you can see the loop backing file in the status command output. Also see losetup(8). **LUKS2 header locking** The LUKS2 on-disk metadata is updated in several steps, and to achieve a proper atomic update, there is a locking mechanism. For an image in a file, the code uses the flock(2) system call. For a block device, lock is performed over a special file stored in a locking directory (by default **/run/cryptsetup**). The locking directory should be created with the proper security context by the distribution during the boot-up phase. Only LUKS2 uses locks; other formats do not use this mechanism. **LUKS on-disk format specification** For LUKS on-disk metadata specification, see LUKS1 <https://gitlab.com/cryptsetup/cryptsetup/wikis/Specification> and LUKS2 <https://gitlab.com/cryptsetup/LUKS2-docs>. ## CRYPTSETUP Part of cryptsetup project <https://gitlab.com/cryptsetup/cryptsetup/>. This page is part of the _Cryptsetup_ ((open-source disk encryption)) project. Information about the project can be found at ⟨https://gitlab.com/cryptsetup/cryptsetup⟩. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository ⟨https://gitlab.com/cryptsetup/cryptsetup.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-01.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is _not_ part of the original manual page), send a mail to [email protected] cryptsetup 2.8.1-git 2025-08-09 _CRYPTSETUP_(8) * * *
# cryptsetup-fvault2Dump ## NAME cryptsetup-fvault2Dump - dump the header information of a FVAULT2 (FileVault2 compatible) device ## SYNOPSIS **cryptsetup** _fvault2Dump_ **[ <options>] <device>** ## DESCRIPTION Dump the header information of a FVAULT2 (FileVault2 compatible) device. If the --dump-volume-key option is used, the FVAULT2 device volume key is dumped instead of header information. You have to provide a password or keyfile to dump the volume key. Beware that the volume key can be used to decrypt the data stored in the container without a passphrase. This means that if the volume key is compromised, the whole device has to be erased to prevent further access. Use this option carefully. **< options> **can be [--dump-volume-key, --volume-key-file, --key-file, --keyfile-offset, --keyfile-size, --timeout]. ## OPTIONS **--batch-mode** , **-q** Suppresses all confirmation questions. Use with care! If the --verify-passphrase option is not specified, this option also switches off the passphrase verification. **--debug** or **--debug-json** Run in debug mode with full diagnostic logs. Debug output lines are always prefixed by **#**. If --debug-json is used, additional LUKS2 JSON data structures are printed. **--dump-volume-key** , --dump-master-key (OBSOLETE alias) Print the volume key in the displayed information. Use with care, as the volume key can be used to bypass the passphrases, see also option --volume-key-file. **--help** , **-?** Show help text and default parameters. **--key-file** , **-d** _file_ Read the passphrase from the file. If the name given is "-", then the passphrase will be read from stdin. In this case, reading will not stop at newline characters. See section _NOTES ON PASSPHRASE PROCESSING_ in cryptsetup(8) for more information. **--keyfile-offset** _value_ Skip _value_ bytes at the beginning of the key file. **--keyfile-size** , **-l** _value_ Read a maximum of _value_ bytes from the key file. The default is to read the whole file up to the compiled-in maximum that can be queried with --help. Supplying more data than the compiled-in maximum aborts the operation. This option is useful to cut trailing newlines, for example. If --keyfile-offset is also given, the size count starts after the offset. **--timeout** , **-t** _seconds_ The number of seconds to wait before a timeout on passphrase input via terminal. It is relevant every time a passphrase is asked. It has no effect if used in conjunction with --key-file. This option is useful when the system should not stall if the user does not input a passphrase, e.g., during boot. The default is a value of 0 seconds, which means to wait forever. **--usage** Show short option help. **--version** , **-V** Show the program version. **--volume-key-file** _file_ , --master-key-file file (OBSOLETE alias) Use a volume key stored in a file. The volume key is stored in a file instead of being printed out to standard output. ## CRYPTSETUP Part of cryptsetup project <https://gitlab.com/cryptsetup/cryptsetup/>. This page is part of the _Cryptsetup_ ((open-source disk encryption)) project. Information about the project can be found at ⟨https://gitlab.com/cryptsetup/cryptsetup⟩. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository ⟨https://gitlab.com/cryptsetup/cryptsetup.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-01.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is _not_ part of the original manual page), send a mail to [email protected] cryptsetup 2.8.1-git 2025-08-09 _CRYPTSETUP-FVAULT2DUMP_(8) * * *
# tc-fq ## NAME FQ - Fair Queue traffic policing ## SYNOPSIS **tc qdisc ... fq**[ **limit** PACKETS ] [ **flow_limit** PACKETS ] [ **quantum** BYTES ] [ **initial_quantum** BYTES ] [ **maxrate** RATE ] [ **buckets** NUMBER ] [ **orphan_mask** NUMBER ] [ **pacing** | **nopacing**] [ **ce_threshold** TIME ] ## DESCRIPTION FQ (Fair Queue) is a classless packet scheduler meant to be mostly used for locally generated traffic. It is designed to achieve per flow pacing. FQ does flow separation, and is able to respect pacing requirements set by TCP stack. All packets belonging to a socket are considered as a 'flow'. For non local packets (router workload), packet hash is used as fallback. An application can specify a maximum pacing rate using the **SO_MAX_PACING_RATE** setsockopt call. This packet scheduler adds delay between packets to respect rate limitation set on each socket. Note that after linux-4.20, linux adopted EDT (Earliest Departure Time) and TCP directly sets the appropriate Departure Time for each skb. Dequeueing happens in a round-robin fashion. A special FIFO queue is reserved for high priority packets ( **TC_PRIO_CONTROL** priority), such packets are always dequeued first. FQ is non-work-conserving. TCP pacing is good for flows having idle times, as the congestion window permits TCP stack to queue a possibly large number of packets. This removes the 'slow start after idle' choice, badly hitting large BDP flows and applications delivering chunks of data such as video streams. ## PARAMETERS **limit** Hard limit on the real queue size. When this limit is reached, new packets are dropped. If the value is lowered, packets are dropped so that the new limit is met. Default is 10000 packets. **flow_limit** Hard limit on the maximum number of packets queued per flow. Default value is 100. **quantum** The credit per dequeue RR round, i.e. the amount of bytes a flow is allowed to dequeue at once. A larger value means a longer time period before the next flow will be served. Default is 2 * interface MTU bytes. **initial_quantum** The initial sending rate credit, i.e. the amount of bytes a new flow is allowed to dequeue initially. This is specifically meant to allow using IW10 without added delay. Default is 10 * interface MTU, i.e. 15140 for 'standard' ethernet. **maxrate** Maximum sending rate of a flow. Default is unlimited. Application specific setting via **SO_MAX_PACING_RATE** is ignored only if it is larger than this value. **buckets** The size of the hash table used for flow lookups. Each bucket is assigned a red-black tree for efficient collision sorting. Default: 1024. **orphan_mask** For packets not owned by a socket, fq is able to mask a part of skb->hash and reduce number of buckets associated with the traffic. This is a DDOS prevention mechanism, and the default is 1023 (meaning no more than 1024 flows are allocated for these packets) **[no]pacing** Enable or disable flow pacing. Default is enabled. **ce_threshold** sets a threshold above which all packets are marked with ECN Congestion Experienced. This is useful for DCTCP-style congestion control algorithms that require marking at very shallow queueing thresholds. ## EXAMPLES #tc qdisc add dev eth0 root fq ce_threshold 4ms #tc -s -d qdisc show dev eth0 qdisc fq 8001: dev eth0 root refcnt 2 limit 10000p flow_limit 100p buckets 1024 orphan_mask 1023 quantum 3028b initial_quantum 15140b low_rate_threshold 550Kbit refill_delay 40.0ms ce_threshold 4.0ms Sent 72149092 bytes 48062 pkt (dropped 2176, overlimits 0 requeues 0) backlog 1937920b 1280p requeues 0 flows 34 (inactive 17 throttled 0) gc 0 highprio 0 throttled 0 ce_mark 47622 flows_plimit 2176 * * *
# systemd-xdg-autostart-generator ## NAME systemd-xdg-autostart-generator - User unit generator for XDG autostart files ## SYNOPSIS /usr/lib/systemd/user-generators/systemd-xdg-autostart-generator ## DESCRIPTION systemd-xdg-autostart-generator is a generator that creates .service units for **XDG autostart******[1] files. This permits desktop environments to delegate startup of these applications tosystemd(1) . Units created by systemd-xdg-autostart-generator can be started by the desktop environment using "xdg-desktop-autostart.target". See systemd.special(7) for more details. XDG autostart may be conditionalized using both standardized and non-standardized keys. In order to handle these, the generator may create one or more _ExecCondition=_ entries. For non-standardized keys, well-known helper binaries provided by Desktop Environments are used. All external helpers _must_ detect their corresponding desktop environment and _must_ return success when run in a different environment. This is important as all _ExecCondition=_ directives must succeed for an application to be started. **Table 1. Special XDG desktop file entries that are processed** β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ **Entry** β”‚ **Handling** β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ _Hidden=_ , _X-systemd-skip=_ β”‚ No service will be β”‚ β”‚ β”‚ generated if set to true β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ _OnlyShowIn=_ , _NotShowIn=_ β”‚ _ExecCondition=_ using β”‚ β”‚ β”‚ systemd-xdg-autostart-condition β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ _TryExec=_ β”‚ No service will be generated if β”‚ β”‚ β”‚ the binary does not exist or β”‚ β”‚ β”‚ cannot be executed β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ _AutostartCondition=_ β”‚ _ExecCondition=_ using β”‚ β”‚ (GNOME extension) β”‚ gnome-systemd-autostart-condition β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ _X-GNOME-Autostart-Phase=_ β”‚ No service will be generated if β”‚ β”‚ β”‚ set to any value β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ _X-KDE-autostart-condition=_ β”‚ _ExecCondition=_ using β”‚ β”‚ β”‚ kde-systemd-start-condition β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ systemd-xdg-autostart-generator implements systemd.generator(7). ## NOTES 1. XDG autostart https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html * * *
# unix_update ## NAME unix_update - Helper binary that updates the password of a given user ## SYNOPSIS **unix_update**[...] ## DESCRIPTION _unix_update_ is a helper program for the _pam_unix_ module that updates the password of a given user. It is not intended to be run directly from the command line and logs a security violation if done so. The purpose of the helper is to enable tighter confinement of login and password changing services. The helper is thus called only when SELinux is enabled on the system. The interface of the helper - command line options, and input/output data format are internal to the _pam_unix_ module and it should not be called directly from applications. * * *
# setkeycodes ## NAME setkeycodes - load kernel scancode-to-keycode mapping table entries ## SYNOPSIS **setkeycodes**[_options_] _scancode keycode ..._ ## DESCRIPTION The _setkeycodes_ command reads its arguments two at a time, each pair of arguments consisting of a scancode (given in hexadecimal) and a keycode (given in decimal). For each such pair, it tells the kernel keyboard driver to map the specified scancode to the specified keycode. This command is useful only for people with slightly unusual keyboards, that have a few keys which produce scancodes that the kernel does not recognize. ## THEORY The usual PC keyboard produces a series of scancodes for each key press and key release. (Scancodes are shown by **showkey -s** , see showkey(1) ) The kernel parses this stream of scancodes, and converts it to a stream of keycodes (key press/release events). (Keycodes are shown by **showkey**.) Apart from a few scancodes with special meaning, and apart from the sequence produced by the Pause key, and apart from shiftstate related scancodes, and apart from the key up/down bit, the stream of scancodes consists of unescaped scancodes xx (7 bits) and escaped scancodes e0 xx (8+7 bits). To these scancodes or scancode pairs, a corresponding keycode can be assigned (in the range 1-127). For example, if you have a Macro key that produces e0 6f according to showkey(1), the command **setkeycodes e06f 112** will assign the keycode 112 to it, and then loadkeys(1) can be used to define the function of this key. Some older kernels might hardwire a low scancode range to the equivalent keycodes; setkeycodes will fail when you try to remap these. ## 2.6 KERNELS In 2.6 kernels key codes lie in the range 1-255, instead of 1-127. (It might be best to confine oneself to the range 1-239.) In 2.6 kernels raw mode, or scancode mode, is not very raw at all. The code returned by showkey -s will change after use of setkeycodes. A kernel bug. See also showkey(1). ## OPTIONS **-C** , **--console** =_DEV_ the console device to be used. **-V** , **--version** print version number. **-h** , **--help** print this usage message. ## BUGS The keycodes of X have nothing to do with those of Linux. Unusual keys can be made visible under Linux, but not under X. * * *