ubuntu-policy/ 0000755 0001750 0001750 00000000000 11216714641 014142 5 ustar cjwatson cjwatson ubuntu-policy/ubuntu-perl-policy.desc 0000644 0001750 0001750 00000001164 11061226146 020557 0 ustar cjwatson cjwatson Document: ubuntu-perl-policy Title: Ubuntu Perl Policy Manual Author: The Debian Policy Mailing list Abstract: This manual describes the policy requirements for the Perl system in the Ubuntu distribution, describing the rules regulating the building and installation of packages providing and using Perl and Perl modules. Section: Ubuntu Format: debiandoc-sgml Files: /usr/share/doc/ubuntu-policy/perl-policy.sgml.gz Format: text Files: /usr/share/doc/ubuntu-policy/perl-policy.txt.gz Format: HTML Index: /usr/share/doc/ubuntu-policy/perl-policy.html/index.html Files: /usr/share/doc/ubuntu-policy/perl-policy.html/*.html ubuntu-policy/fhs-2.3.html 0000644 0001750 0001750 00000546307 11054263224 016123 0 ustar cjwatson cjwatson
Copyright © 1994-2004 Daniel Quinlan
Copyright © 2001-2004 Paul 'Rusty' Russell
Copyright © 2003-2004 Christopher Yeoh
This standard consists of a set of requirements and guidelines for file and directory placement under UNIX-like operating systems. The guidelines are intended to support interoperability of applications, system administration tools, development tools, and scripts as well as greater uniformity of documentation for these systems.
All trademarks and copyrights are owned by their owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark.
Permission is granted to make and distribute verbatim copies of this standard provided the copyright and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this standard under the conditions for verbatim copying, provided also that the title page is labeled as modified including a reference to the original standard, provided that information on retrieving the original standard is included, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this standard into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the copyright holder.
This standard enables:
Software to predict the location of installed files and directories, and
Users to predict the location of installed files and directories.
We do this by:
Specifying guiding principles for each area of the filesystem,
Specifying the minimum files and directories required,
Enumerating exceptions to the principles, and
Enumerating specific cases where there has been historical conflict.
The FHS document is used by:
Independent software suppliers to create applications which are FHS compliant, and work with distributions which are FHS complaint,
OS creators to provide systems which are FHS compliant, and
Users to understand and maintain the FHS compliance of a system.
The FHS document has a limited scope:
Local placement of local files is a local issue, so FHS does not attempt to usurp system administrators.
FHS addresses issues where file placements need to be coordinated between multiple parties such as local sites, distributions, applications, documentation, etc.
We recommend that you read a typeset version of this document rather than the plain text version. In the typeset version, the names of files and directories are displayed in a constant-width font.
Components of filenames that vary are represented by a description of the contents enclosed in "<" and ">" characters, <thus>. Electronic mail addresses are also enclosed in "<" and ">" but are shown in the usual typeface.
Optional components of filenames are enclosed in "[" and "]" characters and may be combined with the "<" and ">" convention. For example, if a filename is allowed to occur either with or without an extension, it might be represented by <filename>[.<extension>].
Variable substrings of directory names and filenames are indicated by "*".
The sections of the text marked as Rationale are explanatory and are non-normative.
This standard assumes that the operating system underlying an FHS-compliant file system supports the same basic security features found in most UNIX filesystems.
It is possible to define two independent distinctions among files: shareable vs. unshareable and variable vs. static. In general, files that differ in either of these respects should be located in different directories. This makes it easy to store files with different usage characteristics on different filesystems.
"Shareable" files are those that can be stored on one host and used on others. "Unshareable" files are those that are not shareable. For example, the files in user home directories are shareable whereas device lock files are not.
"Static" files include binaries, libraries, documentation files and other files that do not change without system administrator intervention. "Variable" files are files that are not static.
![]() | Rationale |
---|---|
Shareable files can be stored on one host and used on several others. Typically, however, not all files in the filesystem hierarchy are shareable and so each system has local storage containing at least its unshareable files. It is convenient if all the files a system requires that are stored on a foreign host can be made available by mounting one or a few directories from the foreign host. Static and variable files should be segregated because static files, unlike variable files, can be stored on read-only media and do not need to be backed up on the same schedule as variable files. Historical UNIX-like filesystem hierarchies contained both static and variable files under both /usr and /etc. In order to realize the advantages mentioned above, the /var hierarchy was created and all variable files were transferred from /usr to /var. Consequently /usr can now be mounted read-only (if it is a separate filesystem). Variable files have been transferred from /etc to /var over a longer period as technology has permitted. Here is an example of a FHS-compliant system. (Other FHS-compliant layouts are possible.) |
The contents of the root filesystem must be adequate to boot, restore, recover, and/or repair the system.
To boot a system, enough must be present on the root partition to mount other filesystems. This includes utilities, configuration, boot loader information, and other essential start-up data. /usr, /opt, and /var are designed such that they may be located on other partitions or filesystems.
To enable recovery and/or repair of a system, those utilities needed by an experienced maintainer to diagnose and reconstruct a damaged system must be present on the root filesystem.
To restore a system, those utilities needed to restore from system backups (on floppy, tape, etc.) must be present on the root filesystem.
![]() | Rationale |
---|---|
The primary concern used to balance these considerations, which favor placing many things on the root filesystem, is the goal of keeping root as small as reasonably possible. For several reasons, it is desirable to keep the root filesystem small:
|
Applications must never create or require special files or subdirectories in the root directory. Other locations in the FHS hierarchy provide more than enough flexibility for any package.
![]() | Rationale |
---|---|
There are several reasons why creating a new subdirectory of the root filesystem is prohibited:
Distributions should not create new directories in the root hierarchy without extremely careful consideration of the consequences including for application portability. |
The following directories, or symbolic links to directories, are required in /.
Directory | Description |
---|---|
bin | Essential command binaries |
boot | Static files of the boot loader |
dev | Device files |
etc | Host-specific system configuration |
lib | Essential shared libraries and kernel modules |
media | Mount point for removeable media |
mnt | Mount point for mounting a filesystem temporarily |
opt | Add-on application software packages |
sbin | Essential system binaries |
srv | Data for services provided by this system |
tmp | Temporary files |
usr | Secondary hierarchy |
var | Variable data |
Each directory listed above is specified in detail in separate subsections below. /usr and /var each have a complete section in this document due to the complexity of those directories.
The following directories, or symbolic links to directories, must be in /, if the corresponding subsystem is installed:
Directory | Description |
---|---|
home | User home directories (optional) |
lib<qual> | Alternate format essential shared libraries (optional) |
root | Home directory for the root user (optional) |
Each directory listed above is specified in detail in separate subsections below.
/bin contains commands that may be used by both the system administrator and by users, but which are required when no other filesystems are mounted (e.g. in single user mode). It may also contain commands which are used indirectly by scripts. [1]
There must be no subdirectories in /bin.
The following commands, or symbolic links to commands, are required in /bin.
Command | Description |
---|---|
cat | Utility to concatenate files to standard output |
chgrp | Utility to change file group ownership |
chmod | Utility to change file access permissions |
chown | Utility to change file owner and group |
cp | Utility to copy files and directories |
date | Utility to print or set the system data and time |
dd | Utility to convert and copy a file |
df | Utility to report filesystem disk space usage |
dmesg | Utility to print or control the kernel message buffer |
echo | Utility to display a line of text |
false | Utility to do nothing, unsuccessfully |
hostname | Utility to show or set the system's host name |
kill | Utility to send signals to processes |
ln | Utility to make links between files |
login | Utility to begin a session on the system |
ls | Utility to list directory contents |
mkdir | Utility to make directories |
mknod | Utility to make block or character special files |
more | Utility to page through text |
mount | Utility to mount a filesystem |
mv | Utility to move/rename files |
ps | Utility to report process status |
pwd | Utility to print name of current working directory |
rm | Utility to remove files or directories |
rmdir | Utility to remove empty directories |
sed | The `sed' stream editor |
sh | The Bourne command shell |
stty | Utility to change and print terminal line settings |
su | Utility to change user ID |
sync | Utility to flush filesystem buffers |
true | Utility to do nothing, successfully |
umount | Utility to unmount file systems |
uname | Utility to print system information |
If /bin/sh is not a true Bourne shell, it must be a hard or symbolic link to the real shell command.
The [ and test commands must be placed together in either /bin or /usr/bin.
![]() | Rationale |
---|---|
For example bash behaves differently when called as sh or bash. The use of a symbolic link also allows users to easily see that /bin/sh is not a true Bourne shell. The requirement for the [ and test commands to be included as binaries (even if implemented internally by the shell) is shared with the POSIX.2 standard. |
The following programs, or symbolic links to programs, must be in /bin if the corresponding subsystem is installed:
Command | Description |
---|---|
csh | The C shell (optional) |
ed | The `ed' editor (optional) |
tar | The tar archiving utility (optional) |
cpio | The cpio archiving utility (optional) |
gzip | The GNU compression utility (optional) |
gunzip | The GNU uncompression utility (optional) |
zcat | The GNU uncompression utility (optional) |
netstat | The network statistics utility (optional) |
ping | The ICMP network test utility (optional) |
If the gunzip and zcat programs exist, they must be symbolic or hard links to gzip. /bin/csh may be a symbolic link to /bin/tcsh or /usr/bin/tcsh.
![]() | Rationale |
---|---|
The tar, gzip and cpio commands have been added to make restoration of a system possible (provided that / is intact). Conversely, if no restoration from the root partition is ever expected, then these binaries might be omitted (e.g., a ROM chip root, mounting /usr through NFS). If restoration of a system is planned through the network, then ftp or tftp (along with everything necessary to get an ftp connection) must be available on the root partition. |
This directory contains everything required for the boot process except configuration files not needed at boot time and the map installer. Thus /boot stores data that is used before the kernel begins executing user-mode programs. This may include saved master boot sectors and sector map files. [2]
The /dev directory is the location of special or device files.
If it is possible that devices in /dev will need to be manually created, /dev must contain a command named MAKEDEV, which can create devices as needed. It may also contain a MAKEDEV.local for any local devices.
If required, MAKEDEV must have provisions for creating any device that may be found on the system, not just those that a particular implementation installs.
The /etc hierarchy contains configuration files. A "configuration file" is a local file used to control the operation of a program; it must be static and cannot be an executable binary. [4]
No binaries may be located under /etc. [5]
The following directories, or symbolic links to directories are required in /etc:
The following directories, or symbolic links to directories must be in /etc, if the corresponding subsystem is installed:
The following files, or symbolic links to files, must be in /etc if the corresponding subsystem is installed: [6]
File | Description |
---|---|
csh.login | Systemwide initialization file for C shell logins (optional) |
exports | NFS filesystem access control list (optional) |
fstab | Static information about filesystems (optional) |
ftpusers | FTP daemon user access control list (optional) |
gateways | File which lists gateways for routed (optional) |
gettydefs | Speed and terminal settings used by getty (optional) |
group | User group file (optional) |
host.conf | Resolver configuration file (optional) |
hosts | Static information about host names (optional) |
hosts.allow | Host access file for TCP wrappers (optional) |
hosts.deny | Host access file for TCP wrappers (optional) |
hosts.equiv | List of trusted hosts for rlogin, rsh, rcp (optional) |
hosts.lpd | List of trusted hosts for lpd (optional) |
inetd.conf | Configuration file for inetd (optional) |
inittab | Configuration file for init (optional) |
issue | Pre-login message and identification file (optional) |
ld.so.conf | List of extra directories to search for shared libraries (optional) |
motd | Post-login message of the day file (optional) |
mtab | Dynamic information about filesystems (optional) |
mtools.conf | Configuration file for mtools (optional) |
networks | Static information about network names (optional) |
passwd | The password file (optional) |
printcap | The lpd printer capability database (optional) |
profile | Systemwide initialization file for sh shell logins (optional) |
protocols | IP protocol listing (optional) |
resolv.conf | Resolver configuration file (optional) |
rpc | RPC protocol listing (optional) |
securetty | TTY access control for root login (optional) |
services | Port names for network services (optional) |
shells | Pathnames of valid login shells (optional) |
syslog.conf | Configuration file for syslogd (optional) |
mtab does not fit the static nature of /etc: it is excepted for historical reasons. [7]
Host-specific configuration files for add-on application software packages must be installed within the directory /etc/opt/<subdir>, where <subdir> is the name of the subtree in /opt where the static data from that package is stored.
No structure is imposed on the internal arrangement of /etc/opt/<subdir>.
If a configuration file must reside in a different location in order for the package or system to function properly, it may be placed in a location other than /etc/opt/<subdir>.
![]() | Rationale |
---|---|
Refer to the rationale for /opt. |
/etc/X11 is the location for all X11 host-specific configuration. This directory is necessary to allow local control if /usr is mounted read only.
The following files, or symbolic links to files, must be in /etc/X11 if the corresponding subsystem is installed:
File | Description |
---|---|
Xconfig | The configuration file for early versions of XFree86 (optional) |
XF86Config | The configuration file for XFree86 versions 3 and 4 (optional) |
Xmodmap | Global X11 keyboard modification file (optional) |
Subdirectories of /etc/X11 may include those for xdm and for any other programs (some window managers, for example) that need them. [8] We recommend that window managers with only one configuration file which is a default .*wmrc file must name it system.*wmrc (unless there is a widely-accepted alternative name) and not use a subdirectory. Any window manager subdirectories must be identically named to the actual window manager binary.
Generic configuration files defining high-level parameters of the SGML systems are installed here. Files with names *.conf indicate generic configuration files. File with names *.cat are the DTD-specific centralized catalogs, containing references to all other catalogs needed to use the given DTD. The super catalog file catalog references all the centralized catalogs.
Generic configuration files defining high-level parameters of the XML systems are installed here. Files with names *.conf indicate generic configuration files. The super catalog file catalog references all the centralized catalogs.
/home is a fairly standard concept, but it is clearly a site-specific filesystem. [9] The setup will differ from host to host. Therefore, no program should rely on this location. [10]
User specific configuration files for applications are stored in the user's home directory in a file that starts with the '.' character (a "dot file"). If an application needs to create more than one dot file then they should be placed in a subdirectory with a name starting with a '.' character, (a "dot directory"). In this case the configuration files should not start with the '.' character. [11]
The /lib directory contains those shared library images needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin. [12]
At least one of each of the following filename patterns are required (they may be files, or symbolic links):
File | Description |
---|---|
libc.so.* | The dynamically-linked C library (optional) |
ld* | The execution time linker/loader (optional) |
If a C preprocessor is installed, /lib/cpp must be a reference to it, for historical reasons. [13]
The following directories, or symbolic links to directories, must be in /lib, if the corresponding subsystem is installed:
There may be one or more variants of the /lib directory on systems which support more than one binary format requiring separate libraries. [14]
If one or more of these directories exist, the requirements for their contents are the same as the normal /lib directory, except that /lib<qual>/cpp is not required. [15]
This directory contains subdirectories which are used as mount points for removeable media such as floppy disks, cdroms and zip disks.
![]() | Rationale |
---|---|
Historically there have been a number of other different places used to mount removeable media such as /cdrom, /mnt or /mnt/cdrom. Placing the mount points for all removeable media directly in the root directory would potentially result in a large number of extra directories in /. Although the use of subdirectories in /mnt as a mount point has recently been common, it conflicts with a much older tradition of using /mnt directly as a temporary mount point. |
The following directories, or symbolic links to directories, must be in /media, if the corresponding subsystem is installed:
Directory | Description |
---|---|
floppy | Floppy drive (optional) |
cdrom | CD-ROM drive (optional) |
cdrecorder | CD writer (optional) |
zip | Zip drive (optional) |
On systems where more than one device exists for mounting a certain type of media, mount directories can be created by appending a digit to the name of those available above starting with '0', but the unqualified name must also exist. [16]
This directory is provided so that the system administrator may temporarily mount a filesystem as needed. The content of this directory is a local issue and should not affect the manner in which any program is run.
This directory must not be used by installation programs: a suitable temporary directory not in use by the system must be used instead.
/opt is reserved for the installation of add-on application software packages.
A package to be installed in /opt must locate its static files in a separate /opt/<package> or /opt/<provider> directory tree, where <package> is a name that describes the software package and <provider> is the provider's LANANA registered name.
The directories /opt/bin, /opt/doc, /opt/include, /opt/info, /opt/lib, and /opt/man are reserved for local system administrator use. Packages may provide "front-end" files intended to be placed in (by linking or copying) these reserved directories by the local system administrator, but must function normally in the absence of these reserved directories.
Programs to be invoked by users must be located in the directory /opt/<package>/bin or under the /opt/<provider> hierarchy. If the package includes UNIX manual pages, they must be located in /opt/<package>/share/man or under the /opt/<provider> hierarchy, and the same substructure as /usr/share/man must be used.
Package files that are variable (change in normal operation) must be installed in /var/opt. See the section on /var/opt for more information.
Host-specific configuration files must be installed in /etc/opt. See the section on /etc for more information.
No other package files may exist outside the /opt, /var/opt, and /etc/opt hierarchies except for those package files that must reside in specific locations within the filesystem tree in order to function properly. For example, device lock files must be placed in /var/lock and devices must be located in /dev.
Distributions may install software in /opt, but must not modify or delete software installed by the local system administrator without the assent of the local system administrator.
![]() | Rationale |
---|---|
The use of /opt for add-on software is a well-established practice in the UNIX community. The System V Application Binary Interface [AT&T 1990], based on the System V Interface Definition (Third Edition), provides for an /opt structure very similar to the one defined here. The Intel Binary Compatibility Standard v. 2 (iBCS2) also provides a similar structure for /opt. Generally, all data required to support a package on a system must be present within /opt/<package>, including files intended to be copied into /etc/opt/<package> and /var/opt/<package> as well as reserved directories in /opt. The minor restrictions on distributions using /opt are necessary because conflicts are possible between distribution-installed and locally-installed software, especially in the case of fixed pathnames found in some binary software. The structure of the directories below /opt/<provider> is left up to the packager of the software, though it is recommended that packages are installed in /opt/<provider>/<package> and follow a similar structure to the guidelines for /opt/package. A valid reason for diverging from this structure is for support packages which may have files installed in /opt/<provider>/lib or /opt/<provider>/bin. |
Utilities used for system administration (and other root-only commands) are stored in /sbin, /usr/sbin, and /usr/local/sbin. /sbin contains binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin. [18] Programs executed after /usr is known to be mounted (when there are no problems) are generally placed into /usr/sbin. Locally-installed system administration programs should be placed into /usr/local/sbin. [19]
The following files, or symbolic links to files, must be in /sbin if the corresponding subsystem is installed:
Command | Description |
---|---|
fastboot | Reboot the system without checking the disks (optional) |
fasthalt | Stop the system without checking the disks (optional) |
fdisk | Partition table manipulator (optional) |
fsck | File system check and repair utility (optional) |
fsck.* | File system check and repair utility for a specific filesystem (optional) |
getty | The getty program (optional) |
halt | Command to stop the system (optional) |
ifconfig | Configure a network interface (optional) |
init | Initial process (optional) |
mkfs | Command to build a filesystem (optional) |
mkfs.* | Command to build a specific filesystem (optional) |
mkswap | Command to set up a swap area (optional) |
reboot | Command to reboot the system (optional) |
route | IP routing table utility (optional) |
swapon | Enable paging and swapping (optional) |
swapoff | Disable paging and swapping (optional) |
update | Daemon to periodically flush filesystem buffers (optional) |
/srv contains site-specific data which is served by this system.
![]() | Rationale |
---|---|
This main purpose of specifying this is so that users may find the location of the data files for particular service, and so that services which require a single tree for readonly data, writable data and scripts (such as cgi scripts) can be reasonably placed. Data that is only of interest to a specific user should go in that users' home directory. The methodology used to name subdirectories of /srv is unspecified as there is currently no consensus on how this should be done. One method for structuring data under /srv is by protocol, eg. ftp, rsync, www, and cvs. On large systems it can be useful to structure /srv by administrative context, such as /srv/physics/www, /srv/compsci/cvs, etc. This setup will differ from host to host. Therefore, no program should rely on a specific subdirectory structure of /srv existing or data necessarily being stored in /srv. However /srv should always exist on FHS compliant systems and should be used as the default location for such data. Distributions must take care not to remove locally placed files in these directories without administrator permission. [20] |
The /tmp directory must be made available for programs that require temporary files.
Programs must not assume that any files or directories in /tmp are preserved between invocations of the program.
![]() | Rationale |
---|---|
IEEE standard P1003.2 (POSIX, part 2) makes requirements that are similar to the above section. Although data stored in /tmp may be deleted in a site-specific manner, it is recommended that files and directories located in /tmp be deleted whenever the system is booted. FHS added this recommendation on the basis of historical precedent and common practice, but did not make it a requirement because system administration is not within the scope of this standard. |
/usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere.
Large software packages must not use a direct subdirectory under the /usr hierarchy.
Directory | Description |
---|---|
X11R6 | XWindow System, version 11 release 6 (optional) |
games | Games and educational binaries (optional) |
lib<qual> | Alternate Format Libraries (optional) |
src | Source code (optional) |
An exception is made for the X Window System because of considerable precedent and widely-accepted practice.
The following symbolic links to directories may be present. This possibility is based on the need to preserve compatibility with older systems until all implementations can be assumed to use the /var hierarchy.
/usr/spool -> /var/spool /usr/tmp -> /var/tmp /usr/spool/locks -> /var/lock |
Once a system no longer requires any one of the above symbolic links, the link may be removed, if desired.
This hierarchy is reserved for the X Window System, version 11 release 6, and related files.
To simplify matters and make XFree86 more compatible with the X Window System on other systems, the following symbolic links must be present if /usr/X11R6 exists:
/usr/bin/X11 -> /usr/X11R6/bin /usr/lib/X11 -> /usr/X11R6/lib/X11 /usr/include/X11 -> /usr/X11R6/include/X11 |
In general, software must not be installed or managed via the above symbolic links. They are intended for utilization by users only. The difficulty is related to the release version of the X Window System — in transitional periods, it is impossible to know what release of X11 is in use.
Host-specific data in /usr/X11R6/lib/X11 should be interpreted as a demonstration file. Applications requiring information about the current host must reference a configuration file in /etc/X11, which may be linked to a file in /usr/X11R6/lib. [21]
This is the primary directory of executable commands on the system.
The following directories, or symbolic links to directories, must be in /usr/bin, if the corresponding subsystem is installed:
/usr/bin/X11 must be a symlink to /usr/X11R6/bin if the latter exists.
The following files, or symbolic links to files, must be in /usr/bin, if the corresponding subsystem is installed:
Command | Description |
---|---|
perl | The Practical Extraction and Report Language (optional) |
python | The Python interpreted language (optional) |
tclsh | Simple shell containing Tcl interpreter (optional) |
wish | Simple Tcl/Tk windowing shell (optional) |
expect | Program for interactive dialog (optional) |
![]() | Rationale |
---|---|
Because shell script interpreters (invoked with #!<path> on the first line of a shell script) cannot rely on a path, it is advantageous to standardize their locations. The Bourne shell and C-shell interpreters are already fixed in /bin, but Perl, Python, and Tcl are often found in many different places. They may be symlinks to the physical location of the shell interpreters. |
This is where all of the system's general-use include files for the C programming language should be placed.
The following directories, or symbolic links to directories, must be in /usr/include, if the corresponding subsystem is installed:
The symbolic link /usr/include/X11 must link to /usr/X11R6/include/X11 if the latter exists.
/usr/lib includes object files, libraries, and internal binaries that are not intended to be executed directly by users or shell scripts. [22]
Applications may use a single subdirectory under /usr/lib. If an application uses a subdirectory, all architecture-dependent data exclusively used by the application must be placed within that subdirectory. [23]
For historical reasons, /usr/lib/sendmail must be a symbolic link to /usr/sbin/sendmail if the latter exists. [24]
If /lib/X11 exists, /usr/lib/X11 must be a symbolic link to /lib/X11, or to whatever /lib/X11 is a symbolic link to. [25]
/usr/lib<qual> performs the same role as /usr/lib for an alternate binary format, except that the symbolic links /usr/lib<qual>/sendmail and /usr/lib<qual>/X11 are not required. [26]
The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr.
Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr. [27]
The following directories, or symbolic links to directories, must be in /usr/local
Directory | Description |
---|---|
bin | Local binaries |
etc | Host-specific system configuration for local binaries |
games | Local game binaries |
include | Local C header files |
lib | Local libraries |
man | Local online manuals |
sbin | Local system binaries |
share | Local architecture-independent hierarchy |
src | Local source code |
No other directories, except those listed below, may be in /usr/local after first installing a FHS-compliant system.
If directories /lib<qual> or /usr/lib<qual> exist, the equivalent directories must also exist in /usr/local.
/usr/local/etc may be a symbolic link to /etc/local.
![]() | Rationale |
---|---|
The consistency of /usr/local/etc is beneficial to installers, and is already used in other systems. As all of /usr/local needs to be backed up to reproduce a system, it introduces no additional maintenance overhead, but a symlink to /etc/local is suitable if systems want alltheir configuration under one hierarchy. Note that /usr/etc is still not allowed: programs in /usr should place configuration files in /etc. |
The requirements for the contents of this directory are the same as /usr/share. The only additional constraint is that /usr/local/share/man and /usr/local/man directories must be synonomous (usually this means that one of them must be a symbolic link). [28]
The /usr/share hierarchy is for all read-only architecture independent data files. [30]
This hierarchy is intended to be shareable among all architecture platforms of a given OS; thus, for example, a site with i386, Alpha, and PPC platforms might maintain a single /usr/share directory that is centrally-mounted. Note, however, that /usr/share is generally not intended to be shared by different OSes or by different releases of the same OS.
Any program or package which contains or requires data that doesn't need to be modified should store that data in /usr/share (or /usr/local/share, if installed locally). It is recommended that a subdirectory be used in /usr/share for this purpose.
Game data stored in /usr/share/games must be purely static data. Any modifiable files, such as score files, game play logs, and so forth, should be placed in /var/games.
The following directories, or symbolic links to directories, must be in /usr/share, if the corresponding subsystem is installed:
Directory | Description |
---|---|
dict | Word lists (optional) |
doc | Miscellaneous documentation (optional) |
games | Static data files for /usr/games (optional) |
info | GNU Info system s primary directory (optional) |
locale | Locale information (optional) |
nls | Message catalogs for Native language support (optional) |
sgml | SGML data (optional) |
terminfo | Directories for terminfo database (optional) |
tmac | troff macros not distributed with groff (optional) |
xml | XML data (optional) |
zoneinfo | Timezone information and configuration (optional) |
It is recommended that application-specific, architecture-independent directories be placed here. Such directories include groff, perl, ghostscript, texmf, and kbd (Linux) or syscons (BSD). They may, however, be placed in /usr/lib for backwards compatibility, at the distributor's discretion. Similarly, a /usr/lib/games hierarchy may be used in addition to the /usr/share/games hierarchy if the distributor wishes to place some game data there.
This directory is the home for word lists on the system; Traditionally this directory contains only the English words file, which is used by look(1) and various spelling programs. words may use either American or British spelling.
![]() | Rationale |
---|---|
The reason that only word lists are located here is that they are the only files common to all spell checkers. |
The following files, or symbolic links to files, must be in /usr/share/dict, if the corresponding subsystem is installed:
Sites that require both American and British spelling may link words to /usr/share/dict/american-english or /usr/share/dict/british-english.
Word lists for other languages may be added using the English name for that language, e.g., /usr/share/dict/french, /usr/share/dict/danish, etc. These should, if possible, use an ISO 8859 character set which is appropriate for the language in question; if possible the Latin1 (ISO 8859-1) character set should be used (this is often not possible).
Other word lists must be included here, if present.
This section details the organization for manual pages throughout the system, including /usr/share/man. Also refer to the section on /var/cache/man.
The primary <mandir> of the system is /usr/share/man. /usr/share/man contains manual information for commands and data under the / and /usr filesystems. [31]
Manual pages are stored in <mandir>/<locale>/man<section>/<arch>. An explanation of <mandir>, <locale>, <section>, and <arch> is given below.
A description of each section follows:
man1: User programs Manual pages that describe publicly accessible commands are contained in this chapter. Most program documentation that a user will need to use is located here.
man2: System calls This section describes all of the system calls (requests for the kernel to perform operations).
man3: Library functions and subroutines Section 3 describes program library routines that are not direct calls to kernel services. This and chapter 2 are only really of interest to programmers.
man4: Special files Section 4 describes the special files, related driver functions, and networking support available in the system. Typically, this includes the device files found in /dev and the kernel interface to networking protocol support.
man5: File formats The formats for many data files are documented in the section 5. This includes various include files, program output files, and system files.
man6: Games This chapter documents games, demos, and generally trivial programs. Different people have various notions about how essential this is.
man7: Miscellaneous Manual pages that are difficult to classify are designated as being section 7. The troff and other text processing macro packages are found here.
man8: System administration Programs used by system administrators for system operation and maintenance are documented here. Some of these programs are also occasionally useful for normal users.
The following directories, or symbolic links to directories, must be in /usr/share/<mandir>/<locale>, unless they are empty: [32]
Directory | Description |
---|---|
man1 | User programs (optional) |
man2 | System calls (optional) |
man3 | Library calls (optional) |
man4 | Special files (optional) |
man5 | File formats (optional) |
man6 | Games (optional) |
man7 | Miscellaneous (optional) |
man8 | System administration (optional) |
The component <section> describes the manual section.
Provisions must be made in the structure of /usr/share/man to support manual pages which are written in different (or multiple) languages. These provisions must take into account the storage and reference of these manual pages. Relevant factors include language (including geographical-based differences), and character code set.
This naming of language subdirectories of /usr/share/man is based on Appendix E of the POSIX 1003.1 standard which describes the locale identification string — the most well-accepted method to describe a cultural environment. The <locale> string is:
<language>[_<territory>][.<character-set>][,<version>]
The <language> field must be taken from ISO 639 (a code for the representation of names of languages). It must be two characters wide and specified with lowercase letters only.
The <territory> field must be the two-letter code of ISO 3166 (a specification of representations of countries), if possible. (Most people are familiar with the two-letter codes used for the country codes in email addresses.) It must be two characters wide and specified with uppercase letters only. [33]
The <character-set> field must represent the standard describing the character set. If the <character-set> field is just a numeric specification, the number represents the number of the international standard describing the character set. It is recommended that this be a numeric representation if possible (ISO standards, especially), not include additional punctuation symbols, and that any letters be in lowercase.
A parameter specifying a <version> of the profile may be placed after the <character-set> field, delimited by a comma. This may be used to discriminate between different cultural needs; for instance, dictionary order versus a more systems-oriented collating order. This standard recommends not using the <version> field, unless it is necessary.
Systems which use a unique language and code set for all manual pages may omit the <locale> substring and store all manual pages in <mandir>. For example, systems which only have English manual pages coded with ASCII, may store manual pages (the man<section> directories) directly in /usr/share/man. (That is the traditional circumstance and arrangement, in fact.)
Countries for which there is a well-accepted standard character code set may omit the <character-set> field, but it is strongly recommended that it be included, especially for countries with several competing standards.
Various examples:
Language | Territory | Character Set | Directory |
---|---|---|---|
English | — | ASCII | /usr/share/man/en |
English | United Kingdom | ISO 8859-15 | /usr/share/man/en_GB |
English | United States | ASCII | /usr/share/man/en_US |
French | Canada | ISO 8859-1 | /usr/share/man/fr_CA |
French | France | ISO 8859-1 | /usr/share/man/fr_FR |
German | Germany | ISO 646 | /usr/share/man/de_DE.646 |
German | Germany | ISO 6937 | /usr/share/man/de_DE.6937 |
German | Germany | ISO 8859-1 | /usr/share/man/de_DE.88591 |
German | Switzerland | ISO 646 | /usr/share/man/de_CH.646 |
Japanese | Japan | JIS | /usr/share/man/ja_JP.jis |
Japanese | Japan | SJIS | /usr/share/man/ja_JP.sjis |
Japanese | Japan | UJIS (or EUC-J) | /usr/share/man/ja_JP.ujis |
Similarly, provision must be made for manual pages which are architecture-dependent, such as documentation on device-drivers or low-level system administration commands. These must be placed under an <arch> directory in the appropriate man<section> directory; for example, a man page for the i386 ctrlaltdel(8) command might be placed in /usr/share/man/<locale>/man8/i386/ctrlaltdel.8.
Manual pages for commands and data under /usr/local are stored in /usr/local/man. Manual pages for X11R6 are stored in /usr/X11R6/man. It follows that all manual page hierarchies in the system must have the same structure as /usr/share/man.
The cat page sections (cat<section>) containing formatted manual page entries are also found within subdirectories of <mandir>/<locale>, but are not required nor may they be distributed in lieu of nroff source manual pages.
The numbered sections "1" through "8" are traditionally defined. In general, the file name for manual pages located within a particular section end with .<section>.
In addition, some large sets of application-specific manual pages have an additional suffix appended to the manual page filename. For example, the MH mail handling system manual pages must have mh appended to all MH manuals. All X Window System manual pages must have an x appended to the filename.
The practice of placing various language manual pages in appropriate subdirectories of /usr/share/man also applies to the other manual page hierarchies, such as /usr/local/man and /usr/X11R6/man. (This portion of the standard also applies later in the section on the optional /var/cache/man structure.)
This directory contains miscellaneous architecture-independent files which don't require a separate subdirectory under /usr/share.
The following files, or symbolic links to files, must be in /usr/share/misc, if the corresponding subsystem is installed:
File | Description |
---|---|
ascii | ASCII character set table (optional) |
magic | Default list of magic numbers for the file command (optional) |
termcap | Terminal capability database (optional) |
termcap.db | Terminal capability database (optional) |
Other (application-specific) files may appear here, but a distributor may place them in /usr/lib at their discretion. [34]
/usr/share/sgml contains architecture-independent files used by SGML applications, such as ordinary catalogs (not the centralized ones, see /etc/sgml), DTDs, entities, or style sheets.
The following directories, or symbolic links to directories, must be in /usr/share/sgml, if the corresponding subsystem is installed:
Directory | Description |
---|---|
docbook | docbook DTD (optional) |
tei | tei DTD (optional) |
html | html DTD (optional) |
mathml | mathml DTD (optional) |
Other files that are not specific to a given DTD may reside in their own subdirectory.
/usr/share/xml contains architecture-independent files used by XML applications, such as ordinary catalogs (not the centralized ones, see /etc/sgml), DTDs, entities, or style sheets.
The following directories, or symbolic links to directories, must be in /usr/share/xml, if the corresponding subsystem is installed:
/var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
Some portions of /var are not shareable between different systems. For instance, /var/log, /var/lock, and /var/run. Other portions may be shared, notably /var/mail, /var/cache/man, /var/cache/fonts, and /var/spool/news.
/var is specified here in order to make it possible to mount /usr read-only. Everything that once went into /usr that is written to during system operation (as opposed to installation and software maintenance) must be in /var.
If /var cannot be made a separate partition, it is often preferable to move /var out of the root partition and into the /usr partition. (This is sometimes done to reduce the size of the root partition or when space runs low in the root partition.) However, /var must not be linked to /usr because this makes separation of /usr and /var more difficult and is likely to create a naming conflict. Instead, link /var to /usr/var.
Applications must generally not add directories to the top level of /var. Such directories should only be added if they have some system-wide implication, and in consultation with the FHS mailing list.
The following directories, or symbolic links to directories, are required in /var.
Directory | Description |
---|---|
cache | Application cache data |
lib | Variable state information |
local | Variable data for /usr/local |
lock | Lock files |
log | Log files and directories |
opt | Variable data for /opt |
run | Data relevant to running processes |
spool | Application spool data |
tmp | Temporary files preserved between system reboots |
Several directories are `reserved' in the sense that they must not be used arbitrarily by some new application, since they would conflict with historical and/or local practice. They are:
/var/backups /var/cron /var/msgs /var/preserve |
The following directories, or symbolic links to directories, must be in /var, if the corresponding subsystem is installed:
This directory holds the current active process accounting log and the composite process usage data (as used in some UNIX-like systems by lastcomm and sa).
/var/cache is intended for cached data from applications. Such data is locally generated as a result of time-consuming I/O or calculation. The application must be able to regenerate or restore the data. Unlike /var/spool, the cached files can be deleted without data loss. The data must remain valid between invocations of the application and rebooting the system.
Files located under /var/cache may be expired in an application specific manner, by the system administrator, or both. The application must always be able to recover from manual deletion of these files (generally because of a disk space shortage). No other requirements are made on the data format of the cache directories.
![]() | Rationale |
---|---|
The existence of a separate directory for cached data allows system administrators to set different disk and backup policies from other directories in /var. |
The directory /var/cache/fonts should be used to store any dynamically-created fonts. In particular, all of the fonts which are automatically generated by mktexpk must be located in appropriately-named subdirectories of /var/cache/fonts. [36]
Other dynamically created fonts may also be placed in this tree, under appropriately-named subdirectories of /var/cache/fonts.
This directory provides a standard location for sites that provide a read-only /usr partition, but wish to allow caching of locally-formatted man pages. Sites that mount /usr as writable (e.g., single-user installations) may choose not to use /var/cache/man and may write formatted man pages into the cat<section> directories in /usr/share/man directly. We recommend that most sites use one of the following options instead:
Preformat all manual pages alongside the unformatted versions.
Allow no caching of formatted man pages, and require formatting to be done each time a man page is brought up.
Allow local caching of formatted man pages in /var/cache/man.
The structure of /var/cache/man needs to reflect both the fact of multiple man page hierarchies and the possibility of multiple language support.
Given an unformatted manual page that normally appears in <path>/man/<locale>/man<section>, the directory to place formatted man pages in is /var/cache/man/<catpath>/<locale>/cat<section>, where <catpath> is derived from <path> by removing any leading usr and/or trailing share pathname components. (Note that the <locale> component may be missing.) [37]
Man pages written to /var/cache/man may eventually be transferred to the appropriate preformatted directories in the source man hierarchy or expired; likewise formatted man pages in the source man hierarchy may be expired if they are not accessed for a period of time.
If preformatted manual pages come with a system on read-only media (a CD-ROM, for instance), they must be installed in the source man hierarchy (e.g. /usr/share/man/cat<section>). /var/cache/man is reserved as a writable cache for formatted manual pages.
![]() | Rationale |
---|---|
Release 1.2 of the standard specified /var/catman for this hierarchy. The path has been moved under /var/cache to better reflect the dynamic nature of the formatted man pages. The directory name has been changed to man to allow for enhancing the hierarchy to include post-processed formats other than "cat", such as PostScript, HTML, or DVI. |
This directory holds system crash dumps. As of the date of this release of the standard, system crash dumps were not supported under Linux but may be supported by other systems which may comply with the FHS.
Any variable data relating to games in /usr should be placed here. /var/games should hold the variable data previously found in /usr; static data, such as help text, level descriptions, and so on, must remain elsewhere, such as /usr/share/games.
![]() | Rationale |
---|---|
/var/games has been given a hierarchy of its own, rather than leaving it merged in with the old /var/lib as in release 1.2. The separation allows local control of backup strategies, permissions, and disk usage, as well as allowing inter-host sharing and reducing clutter in /var/lib. Additionally, /var/games is the path traditionally used by BSD. |
This hierarchy holds state information pertaining to an application or the system. State information is data that programs modify while they run, and that pertains to one specific host. Users must never need to modify files in /var/lib to configure a package's operation.
State information is generally used to preserve the condition of an application (or a group of inter-related applications) between invocations and between different instances of the same application. State information should generally remain valid after a reboot, should not be logging output, and should not be spooled data.
An application (or a group of inter-related applications) must use a subdirectory of /var/lib for its data. There is one required subdirectory, /var/lib/misc, which is intended for state files that don't need a subdirectory; the other subdirectories should only be present if the application in question is included in the distribution. [38]
/var/lib/<name> is the location that must be used for all distribution packaging support. Different distributions may use different names, of course.
The following directories, or symbolic links to directories, must be in /var/lib, if the corresponding subsystem is installed:
These directories contain saved files generated by any unexpected termination of an editor (e.g., elvis, jove, nvi).
Other editors may not require a directory for crash-recovery files, but may require a well-defined place to store other information while the editor is running. This information should be stored in a subdirectory under /var/lib (for example, GNU Emacs would place lock files in /var/lib/emacs/lock).
Future editors may require additional state information beyond crash-recovery files and lock files — this information should also be placed under /var/lib/<editor>.
![]() | Rationale |
---|---|
Previous Linux releases, as well as all commercial vendors, use /var/preserve for vi or its clones. However, each editor uses its own format for these crash-recovery files, so a separate directory is needed for each editor. Editor-specific lock files are usually quite different from the device or resource lock files that are stored in /var/lock and, hence, are stored under /var/lib. |
This directory contains the file /var/lib/hwclock/adjtime.
![]() | Rationale |
---|---|
In FHS 2.1, this file was /etc/adjtime, but as hwclock updates it, that was obviously incorrect. |
Lock files should be stored within the /var/lock directory structure.
Lock files for devices and other resources shared by multiple applications, such as the serial device lock files that were originally found in either /usr/spool/locks or /usr/spool/uucp, must now be stored in /var/lock. The naming convention which must be used is "LCK.." followed by the base name of the device. For example, to lock /dev/ttyS0 the file "LCK..ttyS0" would be created. [40]
The format used for the contents of such lock files must be the HDB UUCP lock file format. The HDB format is to store the process identifier (PID) as a ten byte ASCII decimal number, with a trailing newline. For example, if process 1230 holds a lock file, it would contain the eleven characters: space, space, space, space, space, space, one, two, three, zero, and newline.
This directory contains miscellaneous log files. Most logs must be written to this directory or an appropriate subdirectory.
The following files, or symbolic links to files, must be in /var/log, if the corresponding subsystem is installed:
The mail spool must be accessible through /var/mail and the mail spool files must take the form <username>. [41]
User mailbox files in this location must be stored in the standard UNIX mailbox format.
![]() | Rationale |
---|---|
The logical location for this directory was changed from /var/spool/mail in order to bring FHS in-line with nearly every UNIX implementation. This change is important for inter-operability since a single /var/mail is often shared between multiple hosts and multiple UNIX implementations (despite NFS locking issues). It is important to note that there is no requirement to physically move the mail spool to this location. However, programs and header files must be changed to use /var/mail. |
Variable data of the packages in /opt must be installed in /var/opt/<subdir>, where <subdir> is the name of the subtree in /opt where the static data from an add-on software package is stored, except where superseded by another file in /etc. No structure is imposed on the internal arrangement of /var/opt/<subdir>.
![]() | Rationale |
---|---|
Refer to the rationale for /opt. |
This directory contains system information data describing the system since it was booted. Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process. Programs may have a subdirectory of /var/run; this is encouraged for programs that use more than one run-time file. [42] Process identifier (PID) files, which were originally placed in /etc, must be placed in /var/run. The naming convention for PID files is <program-name>.pid. For example, the crond PID file is named /var/run/crond.pid.
The internal format of PID files remains unchanged. The file must consist of the process identifier in ASCII-encoded decimal, followed by a newline character. For example, if crond was process number 25, /var/run/crond.pid would contain three characters: two, five, and newline.
Programs that read PID files should be somewhat flexible in what they accept; i.e., they should ignore extra whitespace, leading zeroes, absence of the trailing newline, or additional lines in the PID file. Programs that create PID files should use the simple specification located in the above paragraph.
The utmp file, which stores information about who is currently using the system, is located in this directory.
System programs that maintain transient UNIX-domain sockets must place them in this directory.
/var/spool contains data which is awaiting some kind of later processing. Data in /var/spool represents work to be done in the future (by a program, user, or administrator); often data is deleted after it has been processed. [43]
The following directories, or symbolic links to directories, must be in /var/spool, if the corresponding subsystem is installed:
The lock file for lpd, lpd.lock, must be placed in /var/spool/lpd. It is suggested that the lock file for each printer be placed in the spool directory for that specific printer and named lock.
This directory holds the rwhod information for other systems on the local net.
![]() | Rationale |
---|---|
Some BSD releases use /var/rwho for this data; given its historical location in /var/spool on other systems and its approximate fit to the definition of `spooled' data, this location was deemed more appropriate. |
The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.
Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.
This section is for additional requirements and recommendations that only apply to a specific operating system. The material in this section should never conflict with the base standard.
This is the annex for the Linux operating system.
On Linux systems, if the kernel is located in /, we recommend using the names vmlinux or vmlinuz, which have been used in recent Linux kernel source packages.
Linux systems which require them place these additional files into /bin:
setserial
The following devices must exist under /dev.
All data written to this device is discarded. A read from this device will return an EOF condition.
This device is a source of zeroed out data. All data written to this device is discarded. A read from this device will return as many bytes containing the value zero as was requested.
This device is a synonym for the controlling terminal of a process. Once this device is opened, all reads and writes will behave as if the actual controlling terminal device had been opened.
![]() | Rationale |
---|---|
Previous versions of the FHS had stricter requirements for /dev. Other devices may also exist in /dev. Device names may exist as symbolic links to other device nodes located in /dev or subdirectories of /dev. There is no requirement concerning major/minor number values. |
Linux systems which require them place these additional files into /etc.
lilo.conf
The 64-bit architectures PPC64, s390x, sparc64 and AMD64 must place 64-bit libraries in /lib64, and 32-bit (or 31-bit on s390) libraries in /lib.
The 64-bit architecture IA64 must place 64-bit libraries in /lib.
![]() | Rationale |
---|---|
This is a refinement of the general rules for /lib<qual> and /usr/lib<qual>. The architectures PPC64, s390x, sparc64 and AMD64 support support both 32-bit (for s390 more precise 31-bit) and 64-bit programs. Using lib for 32-bit binaries allows existing binaries from the 32-bit systems to work without any changes: such binaries are expected to be numerous. IA-64 uses a different scheme, reflecting the deprecation of 32-bit binaries (and hence libraries) on that architecture. |
The proc filesystem is the de-facto standard Linux method for handling process and system information, rather than /dev/kmem and other similar methods. We strongly encourage this for the storage and retrieval of process information as well as other kernel and memory information.
Linux systems place these additional files into /sbin.
Second extended filesystem commands (optional):
badblocks
dumpe2fs
e2fsck
mke2fs
mklost+found
tune2fs
Boot-loader map installer (optional):
lilo
Optional files for /sbin:
Static binaries:
ldconfig
sln
ssync
Static ln (sln) and static sync (ssync) are useful when things go wrong. The primary use of sln (to repair incorrect symlinks in /lib after a poorly orchestrated upgrade) is no longer a major concern now that the ldconfig program (usually located in /usr/sbin) exists and can act as a guiding hand in upgrading the dynamic libraries. Static sync is useful in some emergency situations. Note that these need not be statically linked versions of the standard ln and sync, but may be.
The ldconfig binary is optional for /sbin since a site may choose to run ldconfig at boot time, rather than only when upgrading the shared libraries. (It's not clear whether or not it is advantageous to run ldconfig on each boot.) Even so, some people like ldconfig around for the following (all too common) situation:
I've just removed /lib/<file>.
I can't find out the name of the library because ls is dynamically linked, I'm using a shell that doesn't have ls built-in, and I don't know about using "echo *" as a replacement.
I have a static sln, but I don't know what to call the link.
Miscellaneous:
ctrlaltdel
kbdrate
So as to cope with the fact that some keyboards come up with such a high repeat rate as to be unusable, kbdrate may be installed in /sbin on some systems.
Since the default action in the kernel for the Ctrl-Alt-Del key combination is an instant hard reboot, it is generally advisable to disable the behavior before mounting the root filesystem in read-write mode. Some init suites are able to disable Ctrl-Alt-Del, but others may require the ctrlaltdel program, which may be installed in /sbin on those systems.
These symbolic links are required if a C or C++ compiler is installed and only for systems not based on glibc.
/usr/include/asm -> /usr/src/linux/include/asm-<arch> /usr/include/linux -> /usr/src/linux/include/linux |
For systems based on glibc, there are no specific guidelines for this directory. For systems based on Linux libc revisions prior to glibc, the following guidelines and rationale apply:
The only source code that should be placed in a specific location is the Linux kernel source code. It is located in /usr/src/linux.
If a C or C++ compiler is installed, but the complete Linux kernel source code is not installed, then the include files from the kernel source code must be located in these directories:
/usr/src/linux/include/asm-<arch> /usr/src/linux/include/linux |
<arch> is the name of the system architecture.
![]() | Note |
---|---|
/usr/src/linux may be a symbolic link to a kernel source code tree. |
![]() | Rationale |
---|---|
It is important that the kernel include files be located in /usr/src/linux and not in /usr/include so there are no problems when system administrators upgrade their kernel version for the first time. |
This directory contains the variable data for the cron and at programs.
The FHS mailing list is located at <freestandards-fhs-discuss@lists.sourceforge.net>. You can subscribe to the mailing list at this page http://sourceforge.net/projects/freestandards/.
Thanks to Network Operations at the University of California at San Diego who allowed us to use their excellent mailing list server.
As noted in the introduction, please do not send mail to the mailing list without first contacting the FHS editor or a listed contributor.
The process of developing a standard filesystem hierarchy began in August 1993 with an effort to restructure the file and directory structure of Linux. The FSSTND, a filesystem hierarchy standard specific to the Linux operating system, was released on February 14, 1994. Subsequent revisions were released on October 9, 1994 and March 28, 1995.
In early 1995, the goal of developing a more comprehensive version of FSSTND to address not only Linux, but other UNIX-like systems was adopted with the help of members of the BSD development community. As a result, a concerted effort was made to focus on issues that were general to UNIX-like systems. In recognition of this widening of scope, the name of the standard was changed to Filesystem Hierarchy Standard or FHS for short.
Volunteers who have contributed extensively to this standard are listed at the end of this document. This standard represents a consensus view of those and other contributors.
Here are some of the guidelines that have been used in the development of this standard:
Solve technical problems while limiting transitional difficulties.
Make the specification reasonably stable.
Gain the approval of distributors, developers, and other decision-makers in relevant development groups and encourage their participation.
Provide a standard that is attractive to the implementors of different UNIX-like systems.
This document specifies a standard filesystem hierarchy for FHS filesystems by specifying the location of files and directories, and the contents of some system files.
This standard has been designed to be used by system integrators, package developers, and system administrators in the construction and maintenance of FHS compliant filesystems. It is primarily intended to be a reference and is not a tutorial on how to manage a conforming filesystem hierarchy.
The FHS grew out of earlier work on FSSTND, a filesystem organization standard for the Linux operating system. It builds on FSSTND to address interoperability issues not just in the Linux community but in a wider arena including 4.4BSD-based operating systems. It incorporates lessons learned in the BSD world and elsewhere about multi-architecture support and the demands of heterogeneous networking.
Although this standard is more comprehensive than previous attempts at filesystem hierarchy standardization, periodic updates may become necessary as requirements change in relation to emerging technology. It is also possible that better solutions to the problems addressed here will be discovered so that our solutions will no longer be the best possible solutions. Supplementary drafts may be released in addition to periodic updates to this document. However, a specific goal is backwards compatibility from one release of this document to the next.
Comments related to this standard are welcome. Any comments or suggestions for changes may be directed to the FHS editor (Daniel Quinlan <quinlan@pathname.com>) or the FHS mailing list. Typographical or grammatical comments should be directed to the FHS editor.
Before sending mail to the mailing list it is requested that you first contact the FHS editor in order to avoid excessive re-discussion of old topics.
Questions about how to interpret items in this document may occasionally arise. If you have need for a clarification, please contact the FHS editor. Since this standard represents a consensus of many participants, it is important to make certain that any interpretation also represents their collective opinion. For this reason it may not be possible to provide an immediate response unless the inquiry has been the subject of previous discussion.
The developers of the FHS wish to thank the developers, system administrators, and users whose input was essential to this standard. We wish to thank each of the contributors who helped to write, compile, and compose this standard.
The FHS Group also wishes to thank those Linux developers who supported the FSSTND, the predecessor to this standard. If they hadn't demonstrated that the FSSTND was beneficial, the FHS could never have evolved.
Brandon S. Allbery | <bsa@kf8nh.wariat.org> |
Keith Bostic | <bostic@cs.berkeley.edu> |
Drew Eckhardt | <drew@colorado.edu> |
Rik Faith | <faith@cs.unc.edu> |
Stephen Harris | <sweh@spuddy.mew.co.uk> |
Ian Jackson | <ijackson@cus.cam.ac.uk> |
Andreas Jaeger | <aj@suse.de> |
John A. Martin | <jmartin@acm.org> |
Ian McCloghrie | <ian@ucsd.edu> |
Chris Metcalf | <metcalf@lcs.mit.edu> |
Ian Murdock | <imurdock@debian.org> |
David C. Niemi | <niemidc@clark.net> |
Daniel Quinlan | <quinlan@pathname.com> |
Eric S. Raymond | <esr@thyrsus.com> |
Rusty Russell | <rusty@rustcorp.com.au> |
Mike Sangrey | <mike@sojurn.lns.pa.us> |
David H. Silber | <dhs@glowworm.firefly.com> |
Thomas Sippel-Dau | <t.sippel-dau@ic.ac.uk> |
Theodore Ts'o | <tytso@athena.mit.edu> |
Stephen Tweedie | <sct@dcs.ed.ac.uk> |
Fred N. van Kempen | <waltje@infomagic.com> |
Bernd Warken | <bwarken@mayn.de> |
Christopher Yeoh | <cyeoh@samba.org> |
[1] | Command binaries that are not essential enough to place into /bin must be placed in /usr/bin, instead. Items that are required only by non-root users (the X Window System, chsh, etc.) are generally not essential enough to be placed into the root partition. |
[2] | Programs necessary to arrange for the boot loader to be able to boot a file must be placed in /sbin. Configuration files for boot loaders must be placed in /etc. The GRUB bootloader reads its configurations file before booting, so that must be placed in /boot. However, it is a configuration file, so should be in /etc. The answer here is a symbolic link such as /etc/grub/menu.lst -> /boot/menu.lst. |
[3] | On some i386 machines, it may be necessary for /boot to be located on a separate partition located completely below cylinder 1024 of the boot device due to hardware constraints. Certain MIPS systems require a /boot partition that is a mounted MS-DOS filesystem or whatever other filesystem type is accessible for the firmware. This may result in restrictions with respect to usable filenames within /boot (only for affected systems). |
[4] | The setup of command scripts invoked at boot time may resemble System V, BSD or other models. Further specification in this area may be added to a future version of this standard. |
[5] | It is recommended that files be stored in subdirectories of /etc rather than directly in /etc. |
[6] | Systems that use the shadow password suite will have additional configuration files in /etc (/etc/shadow and others) and programs in /usr/sbin (useradd, usermod, and others). |
[7] | On some Linux systems, this may be a symbolic link to /proc/mounts, in which case this exception is not required. |
[8] | /etc/X11/xdm holds the configuration files for xdm. These are most of the files previously found in /usr/lib/X11/xdm. Some local variable data for xdm is stored in /var/lib/xdm. |
[9] | Different people prefer to place user accounts in a variety of places. This section describes only a suggested placement for user home directories; nevertheless we recommend that all FHS-compliant distributions use this as the default location for home directories. On small systems, each user's directory is typically one of the many subdirectories of /home such as /home/smith, /home/torvalds, /home/operator, etc. On large systems (especially when the /home directories are shared amongst many hosts using NFS) it is useful to subdivide user home directories. Subdivision may be accomplished by using subdirectories such as /home/staff, /home/guests, /home/students, etc. |
[10] | If you want to find out a user's home directory, you should use the getpwent(3) library function rather than relying on /etc/passwd because user information may be stored remotely using systems such as NIS. |
[11] | It is recommended that apart from autosave and lock files programs should refrain from creating non dot files or directories in a home directory without user intervention. |
[12] | Shared libraries that are only necessary for binaries in /usr (such as any X Window binaries) must not be in /lib. Only the shared libraries required to run binaries in /bin and /sbin may be here. In particular, the library libm.so.* may also be placed in /usr/lib if it is not required by anything in /bin or /sbin. |
[13] | The usual placement of this binary is /usr/bin/cpp. |
[14] | This is commonly used for 64-bit or 32-bit support on systems which support multiple binary formats, but require libraries of the same name. In this case, /lib32 and /lib64 might be the library directories, and /lib a symlink to one of them. |
[15] | /lib<qual>/cpp is still permitted: this allows the case where /lib and /lib<qual> are the same (one is a symbolic link to the other). |
[16] | A compliant implementation with two CDROM drives might have /media/cdrom0 and /media/cdrom1 with /media/cdrom a symlink to either of these. |
[17] | If the home directory of the root account is not stored on the root partition it will be necessary to make certain it will default to / if it can not be located. We recommend against using the root account for tasks that can be performed as an unprivileged user, and that it be used solely for system administration. For this reason, we recommend that subdirectories for mail and other applications not appear in the root account's home directory, and that mail for administration roles such as root, postmaster, and webmaster be forwarded to an appropriate user. |
[18] | Originally, /sbin binaries were kept in /etc. |
[19] | Deciding what things go into "sbin" directories is simple: if a normal (not a system administrator) user will ever run it directly, then it must be placed in one of the "bin" directories. Ordinary users should not have to place any of the sbin directories in their path. For example, files such as chfn which users only occasionally use must still be placed in /usr/bin. ping, although it is absolutely necessary for root (network recovery and diagnosis) is often used by users and must live in /bin for that reason. We recommend that users have read and execute permission for everything in /sbin except, perhaps, certain setuid and setgid programs. The division between /bin and /sbin was not created for security reasons or to prevent users from seeing the operating system, but to provide a good partition between binaries that everyone uses and ones that are primarily used for administration tasks. There is no inherent security advantage in making /sbin off-limits for users. |
[20] | This is particularly important as these areas will often contain both files initially installed by the distributor, and those added by the administrator. |
[21] | Examples of such configuration files include Xconfig, XF86Config, or system.twmrc) |
[22] | Miscellaneous architecture-independent application-specific static files and subdirectories must be placed in /usr/share. |
[23] | For example, the perl5 subdirectory for Perl 5 modules and libraries. |
[24] | Some executable commands such as makewhatis and sendmail have also been traditionally placed in /usr/lib. makewhatis is an internal binary and must be placed in a binary directory; users access only catman. Newer sendmail binaries are now placed by default in /usr/sbin. Additionally, systems using a sendmail-compatible mail transfer agent must provide /usr/sbin/sendmail as a symbolic link to the appropriate executable. |
[25] | Host-specific data for the X Window System must not be stored in /usr/lib/X11. Host-specific configuration files such as Xconfig or XF86Config must be stored in /etc/X11. This includes configuration data such as system.twmrc even if it is only made a symbolic link to a more global configuration file (probably in /usr/X11R6/lib/X11). |
[26] | The case where /usr/lib and /usr/lib<qual> are the same (one is a symbolic link to the other) these files and the per-application subdirectories will exist. |
[27] | Software placed in / or /usr may be overwritten by system upgrades (though we recommend that distributions do not overwrite data in /etc under these circumstances). For this reason, local software must not be placed outside of /usr/local without good reason. |
[28] | /usr/local/man may be deprecated in future FHS releases, so if all else is equal, making that one a symlink seems sensible. |
[29] | Locally installed system administration programs should be placed in /usr/local/sbin. |
[30] | Much of this data originally lived in /usr (man, doc) or /usr/lib (dict, terminfo, zoneinfo). |
[31] | Obviously, there are no manual pages in / because they are not required at boot time nor are they required in emergencies. Really. |
[32] | For example, if /usr/local/man has no manual pages in section 4 (Devices), then /usr/local/man/man4 may be omitted. |
[33] | A major exception to this rule is the United Kingdom, which is `GB' in the ISO 3166, but `UK' for most email addresses. |
[34] | Some such files include: airport, birthtoken, eqnchar, getopt, gprof.callg, gprof.flat, inter.phone, ipfw.samp.filters, ipfw.samp.scripts, keycap.pcvt, mail.help, mail.tildehelp, man.template, map3270, mdoc.template, more.help, na.phone, nslookup.help, operator, scsi_modes, sendmail.hf, style, units.lib, vgrindefs, vgrindefs.db, zipcodes |
[35] | Generally, source should not be built within this hierarchy. |
[36] | This standard does not currently incorporate the TeX Directory Structure (a document that describes the layout TeX files and directories), but it may be useful reading. It is located at ftp://ctan.tug.org/tex/ |
[37] | For example, /usr/share/man/man1/ls.1 is formatted into /var/cache/man/cat1/ls.1, and /usr/X11R6/man/<locale>/man3/XtClass.3x into /var/cache/man/X11R6/<locale>/cat3/XtClass.3x. |
[38] | An important difference between this version of this standard and previous ones is that applications are now required to use a subdirectory of /var/lib. |
[39] | This hierarchy should contain files stored in /var/db in current BSD releases. These include locate.database and mountdtab, and the kernel symbol database(s). |
[40] | Then, anything wishing to use /dev/ttyS0 can read the lock file and act accordingly (all locks in /var/lock should be world-readable). |
[41] | Note that /var/mail may be a symbolic link to another directory. |
[42] | /var/run should be unwritable for unprivileged users (root or users running daemons); it is a major security problem if any user can write in this directory. |
[43] | UUCP lock files must be placed in /var/lock. See the above section on /var/lock. |
[44] | NIS should not be confused with Sun NIS+, which uses a different directory, /var/nis. |
as a "create
some space here" tag, and more often than not put it at the end of a
paragraph, rather than using is as a container element (which is what
it is, really).
* Re did the control files, making them more robust
* re did the rules file, making it more general, and easier to maintain
by putting in a layer of abstractions.
-- Manoj Srivastava
This manual is free software; you may redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2, or (at your option) any later version.
This is distributed in the hope that it will be useful, but
without any warranty; without even the implied
warranty of merchantability or fitness for a particular
purpose. See the GNU General Public License for more
details.
A copy of the GNU General Public License is available as
/usr/doc/copyright/GPL in the Debian GNU/Linux
distribution or on the World Wide Web at
This document is distributed as the menu-policy files
in the Debian package
This document has been extracted and separated from the
Menu package to: Increase the visibility of the Menu sub policy
Reduce the coupling between policy and
implementation. If this separation is not made, every
time we want to change menu policy, we have to arrange
to get the maintainer to release a new version of the
package, even if the package has not otherwise
changed. It also involves yet another layer, making the
policy changes that much harder to implement.
If you have a package which doesn't fit within the existing
menu hierarchy, please bring it up on the debian-devel mailing
list. If you have other proposals for changing the menu
hierarchy, or making other changes to menu policy, please
bring it up on debian-policy.
Here is the authoritative list of Debian's menu
structure. Packages must be placed in leaf sections.
Normal applications Tools to aid people with disabilities or for machines
lacking usual input devices. Examples: gok, yasr, dasher. Anything relating to HAM radio. Examples: baken, hamsoft, twlog Interactive database programs, collection managers,
address books, bibliography tools, etc. gaby, alexandria, mdbtools Editors, other than office word processors, for
text-based information. Examples: ksubtile, nano, hexedit Educational and training softwares. Examples: gtypist, gcompris, quiz Software that allows you to run non-native
software or more than one OS at a time. Examples: wine, dosemu, qemu Tools for file management, archiving,
searching, CD/DVD burning, backup, etc. Examples: file-roller, mc, baobab 2D and 3D graphics manipulation software. Examples: gimp, inkscape, imagemagick Software that allows you to interface with mobile
devices (phones, PDAs, etc.). Examples: kandy, gnokii, gnome-pilot Mail, USENET news, chat, instant messaging,
IP telephony, video conferencing software, etc. Examples: xchat, gaim, mutt File transfer software such as download
managers, FTP clients, P2P clients, etc. Examples: amule, gftp, d4x Network monitoring software Examples: gip, ettercap, iptstate Web browsers, tools for offline browsing, etc. Examples: elinks, epiphany-browser, webhttrack Web feed (RSS, Atom, etc.) and podcast aggregators.
Examples: akregator, kitty, liferea Office suites, word processors, spreadsheets,
CRM, ERP, financial sofware, etc. Examples: openoffice.org, tinyerp-client, gnucash IDEs, debuggers, etc. Examples: anjuta, gdb, eclipse Timetable managers, group task trackers,
bug tracking software, etc. Examples: planner, bugzilla, gnotime Astronomy-related software. Examples: celestia, spacechart, stellarium Biology-related software. Examples: arb, ncbi-tools-x11, seaview Chemistry-related software. Examples: chemtool, kalzium, xdrawchem Software designed for processing, extracting,
and presenting generic scientific data. Examples: fityk, ygraph, mn-fit Circuit design tools, simulators and
assemblers for microprocessors, etc Examples: geda, gnucap, tkgate CAD, UML tools, diagram-drawing and
other engineering-related software. Examples: tcm, dia, qcad Geoscience-related software. Examples: earth3d, qgis, therion Mathematics-related software. Examples: gcalctool, snappea, xeukleides Medicine-related software. Examples: mssstest, gnumed-client, xmedcon Physics-related software. Examples: kxterm, ifrit, paw Social sciences-related software. Examples: gnomesword, hanzim, bibletime Various shells to be used inside a terminal emulator. Examples: bash, ksh, zsh Sound players, editors, and rippers/recorders. Examples: beep-media-player, grip, audacity Administrative and system configuration utilities,
also tools for personal user settings. Examples: gnome-control-center, configure-debian, gksu Tools for manipulating specific hardware,
especially non-standard laptop hardware. Examples: toshutils, nvclock-gtk, nvtv This section is reserved for language-env as a
special case. System information and monitoring tools, log viewers,
etc. Examples: top, hal-device-manager, gtkdiskfree Package managers and related tools. Examples: aptitude, deborphan, smartpm Security, cryptography and privacy related software,
antiviruses, tools to track and report bugs, etc. Examples: gpgkeys, bastille, avscan Graphical terminal emulators. Examples: xterm, gnome-terminal, rxvt Text oriented tools like dictionaries, OCR,
translation, text analysis software, etc. Examples: kdrill, stardict, turkey TV-in, TV-out, FM radio, teletext browsers, etc. Examples: gradio, gatos, alevt Software for viewing images, documents
and other (non-video) media. Examples: gqview, evince, gthumb Video players, editors, and rippers/recorders. Examples: istanbul, totem, kino Software for web site editing, web
programming, and site administration. Examples: bluefish, screem, gphpedit Games that involve a lot of action
and require fast reflexes. Examples: xsoldier, supertux, xmoto Role playing and adventure games,
interactive movies and stories, etc. Examples: beneath-a-steel-sky, egoboo, kq Tetris-like games involving falling blocks. Examples: crack-attack, frozen-bubble, netris Games played on a board. Examples: phalanx, xshogi, xboard Games involving a deck of cards. Examples: pysol, ace-of-penguins, xpat2 Tests of ingenuity and logic. Examples: xmpuzzles, sgt-puzzles, enigma Simulations of the real world
in all detail and complexity. Examples: flightgear, torcs Games involving long-term strategic thinking. Examples: wesnoth, widelands, netpanzer Server browsers, configurators, editors, and other
game-related tools that are not games themselves. Examples: xqf, crystalspace Amusements, eye-candy, entertaining
demos, screen hacks (screensavers), etc. Examples: xdesktopwaves, xphoon, xpenguins programs that provide user documentation Examples: debian-reference, apt-howto, dhelp Tools for blanking the screen. Entries of screen hacks and
configuration GUIs should go to other appropriate sections.
Examples: xscreensaver, xlockmore Tools for locking the screen. Examples: xscreensaver, xlockmore X window managers. Examples: fluxbox, metacity, waimea FVWM-based window manager modules. As only modules related to
the running window-manager are displayed, do not create
subsections for specific window-managers. Examples: fvwm, fvwm-gnome, fvwm95 This section is reserved for wmaker as a special case. All wmaker specific entries must go here.
This manual is free software; you may redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2, or (at your option) any later version.
This is distributed in the hope that it will be useful, but
without any warranty; without even the implied
warranty of merchantability or fitness for a particular
purpose. See the GNU General Public License for more
details.
A copy of the GNU General Public License is available as
This manual describes the policy requirements for the Ubuntu
distribution. This includes the structure and
contents of the Ubuntu archive and several design issues of the
operating system, as well as technical requirements that
each package must satisfy to be included in the
distribution.
This manual also describes Ubuntu policy as it relates to
creating Ubuntu packages. It is not a tutorial on how to build
packages, nor is it exhaustive where it comes to describing
the behavior of the packaging system. Instead, this manual
attempts to define the interface to the package management
system that the developers have to be conversant with.
The footnotes present in this manual are
merely informative, and are not part of Ubuntu policy itself.
The appendices to this manual are not necessarily normative,
either. Please see for more information.
In the normative part of this manual,
the words must, should and
may, and the adjectives required,
recommended and optional, are used to
distinguish the significance of the various guidelines in
this policy document. Packages that do not conform to the
guidelines denoted by must (or required)
will generally not be considered acceptable for the Ubuntu
distribution. Non-conformance with guidelines denoted by
should (or recommended) will generally be
considered a bug, but will not necessarily render a package
unsuitable for distribution. Guidelines denoted by
may (or optional) are truly optional and
adherence is left to the maintainer's discretion.
These classifications are roughly equivalent to the bug
severities serious (for must or
required directive violations), minor,
normal or important
(for should or recommended directive
violations) and wishlist (for optional
items).
Much of the information presented in this manual will be
useful even when building a package which is to be
distributed in some other way or is intended for local use
only.
The Ubuntu distribution differs from its parent Debian
distribution in a number of significant ways. In this
document, these are marked with the tag Ubuntu:.
This manual is distributed via the Ubuntu package
The
Originally called "Debian GNU/Linux Policy Manual", this
manual was initially written in 1996 by Ian Jackson.
It was revised on November 27th, 1996 by David A. Morris.
Christian Schwarz added new sections on March 15th, 1997,
and reworked/restructured it in April-July 1997.
Christoph Lameter contributed the "Web Standard".
Julian Gilbey largely restructured it in 2001.
Since September 1998, the responsibility for the contents of
the Debian version of
this document lies on the
The Ubuntu branch of this manual is maintained by the
While the authors of this document have tried hard to avoid
typos and other errors, these do still occur. If you discover
an error in this manual or if you want to give any
comments, suggestions, or criticisms please send an email to
the Debian Policy List,
Please do not try to reach the individual authors or maintainers
of the Policy Manual regarding changes to the Policy.
There are several other documents other than this Policy Manual
that are necessary to fully understand some Debian policies and
procedures.
The external "sub-policy" documents are referred to in:
In addition to those, which carry the weight of policy, there
is the Debian Developer's Reference. This document describes
procedures and resources for Debian developers, but it is
not normative; rather, it includes things that don't
belong in the Policy, such as best practices for developers.
The Developer's Reference is available in the
The following terms are used in this Policy Manual:
The Ubuntu system is maintained and distributed as a
collection of packages. Since there are so many of
them (currently well over 15000), they are split into
sections and given priorities to simplify
the handling of them.
The effort of the Ubuntu project is to build a free operating
system, but not every package we want to make accessible is
free in our sense (see the Ubuntu Licensing
Policy, below), or may be imported/exported without
restrictions. Thus, the archive is split into areas
The aims of this are:
The Ubuntu Licensing Policy forms our definition of "free
software". The following guidelines apply to the
main and universe categories of the
archive:
Ubuntu contains licensed and copyrighted works that are not
application software. For example, the default Ubuntu
installation includes documentation, images, sounds, video
clips and firmware. The Ubuntu community will make decisions
on the inclusion of these works on a case-by-case basis,
ensuring that these works do not restrict our ability to
make Ubuntu available free of charge, and that Ubuntu
remains re-distributable by you.
Every package in main must comply with the
Ubuntu Licensing Policy.
In addition, the packages in main
Every package in restricted must comply with the
Ubuntu Licensing Policy, with the exceptions that source
code may not be available and that modification may not be
permitted.
In addition, the packages in restricted
The Ubuntu team recognises that many users have vital
hardware in their computer that requires drivers that are
currently only available in binary format. We urge all
hardware vendors to insist that their suppliers provide
open source drivers for their components, but we recognise
that in some cases binary drivers are the only way to make
your hardware work. As a result, Ubuntu includes several
of these drivers on the CD and in the repository, clearly
separated from the rest of the software by being placed in
the restricted archive area.
Binary drivers are a poor choice, if you have a choice.
Without source code, Ubuntu cannot support this software,
we only provide it for users who require it to be able to
run the Free Software we provide in main. Also, we cannot
make binary drivers available on other architectures (such
as the Mac or IPAQ) if we don't have the ability to port
the software source code ourselves. If your hardware is
fully supported with open source drivers you can simply
remove the restricted archive area, and we would
encourage you to do so.
The restricted archive area may not include
application software, only hardware drivers.
Every package in universe must comply with the
Ubuntu Licensing Policy.
Packages in the universe archive area are not
supported by the core Ubuntu developers and Canonical Ltd.
Packages may be moved between main and
universe as their support status changes.
In addition, the packages in universe
Every package in multiverse must comply with the
Ubuntu Licensing Policy, with the exceptions that source
code may not be available, that modification may not be
permitted, that rights may not be passed on along with the
software, that they may discriminate against persons,
groups or fields of endeavour, and that their license may
be specific to Ubuntu. (In other words, they must be
redistributable without a fee and must not contaminate
other software licenses.)
Packages must be placed in multiverse if they are
not compliant with the parts of the Ubuntu Licensing
Policy that cover other categories of the archive, or if
they are encumbered by patents or other legal issues that
make their distribution problematic.
Packages in the multiverse archive area are not
supported by the core Ubuntu developers and Canonical Ltd.
In addition, the packages in multiverse
Every package must be accompanied by a verbatim copy of
its copyright and distribution license in the file
We reserve the right to restrict files from being included
anywhere in our archives if
Programs whose authors encourage the user to make
donations are fine for the main distribution, provided
that the authors do not claim that not donating is
immoral, unethical, illegal or something similar; in such
a case they must go in multiverse.
Packages whose copyright permission notices (or patent
problems) do not even allow redistribution of binaries
only, and where no special permission has been obtained,
must not be placed on the Ubuntu FTP site and its mirrors
at all.
Note that under international copyright law (this applies
in the United States, too), no distribution or
modification of a work is allowed without an explicit
notice saying so. Therefore a program without a copyright
notice is copyrighted and you may not do anything
to it without risking being sued! Likewise if a program
has a copyright notice but no statement saying what is
permitted then nothing is permitted.
Many authors are unaware of the problems that restrictive
copyrights (or lack of copyright notices) can cause for
the users of their supposedly-free software. It is often
worthwhile contacting such authors diplomatically to ask
them to modify their license terms. However, this can be a
politically difficult thing to do and you should ask for
advice on the ubuntu-archive mailing list first, as
explained below.
When in doubt about a copyright, send mail to
The packages in the archive areas main,
restricted, universe and
multiverse are grouped further into
sections to simplify handling.
The archive area and section for each package should be
specified in the package's Section control record (see
). However, the maintainer of the Ubuntu
archive may override this selection to ensure the consistency of
the Ubuntu distribution. The Section field should be
of the form:
The Ubuntu archive maintainers provide the authoritative
list of sections. At present, they are:
admin, cli-mono, comm, database,
devel, debug, doc, editors,
electronics, embedded, fonts,
games, gnome, graphics, gnu-r,
gnustep, hamradio, haskell,
httpd, interpreters, java, kde,
kernel, libs, libdevel, lisp,
localization, mail, math,
metapackages, misc,
net, news, ocaml, oldlibs,
otherosfs, perl, php, python,
ruby, science, shells, sound,
tex, text, utils, vcs,
video, web, x11, xfce,
zope.
Ubuntu: The metapackages section exists for the benefit
of package management tools. When removing a package in that
section, its dependencies will not be automatically considered for
removal by tools which track the distinction between packages that
were installed explicitly and packages that were only installed to
satisfy dependencies.
Each package should have a priority value, which is
included in the package's control record
(see ).
This information is used by the Ubuntu package management tools to
separate high-priority packages from less-important packages.
The following priority levels are recognized by the
Ubuntu package management tools.
Packages must not depend on packages with lower priority
values (excluding build-time dependencies). In order to
ensure this, the priorities of one or more packages may need
to be adjusted.
The Ubuntu distribution is based on the Debian
package management system, called
Every package must have a name that's unique within the Ubuntu
archive.
The package name is included in the control field
Package, the format of which is described
in .
The package name is also included as a part of the file name
of the .deb file.
Every package has a version number recorded in its
Version control file field, described in
.
The package management system imposes an ordering on version
numbers, so that it can tell whether packages are being up- or
downgraded and so that package system front end applications
can tell whether a package it finds available is newer than
the one installed on the system. The version number format
has the most significant parts (as far as comparison is
concerned) at the beginning.
If an upstream package has problematic version numbers they
should be converted to a sane form for use in the
Version field.
In general, Ubuntu packages should use the same version
numbers as the upstream sources.
However, in some cases where the upstream version number is
based on a date (e.g., a development "snapshot" release) the
package management system cannot handle these version
numbers without epochs. For example, dpkg will consider
"96May01" to be greater than "96Dec24".
To prevent having to use epochs for every new upstream
version, the date based portion of the version number
should be changed to the following format in such cases:
"19960501", "19961224". It is up to the maintainer whether
they want to bother the upstream maintainer to change
the version numbers upstream, too.
Note that other version formats based on dates which are
parsed correctly by the package management system should
not be changed.
Native Debian or Ubuntu packages (i.e., packages which have been
written especially for Debian or Ubuntu) whose version numbers include
dates should always use the "YYYYMMDD" format.
Every package must have a Debian maintainer (the
maintainer may be one person or a group of people
reachable from a common email address, such as a mailing
list). The maintainer is responsible for ensuring that
the package is placed in the appropriate distributions.
The maintainer must be specified in the
Maintainer control field with their correct name
and a working email address. If one person maintains
several packages, they should try to avoid having
different forms of their name and email address in
the Maintainer fields of those packages.
The format of the Maintainer control field is
described in .
If the maintainer of a package quits from the Debian
project, "Debian QA Group"
Ubuntu: Packages that are modified in Ubuntu should have an
Ubuntu-specific Maintainer field.
Every Ubuntu package must have an extended description
stored in the appropriate field of the control record.
The technical information about the format of the
Description field is in .
The description should describe the package (the program) to a
user (system administrator) who has never met it before so that
they have enough information to decide whether they want to
install it. This description should not just be copied verbatim
from the program's documentation.
Put important information first, both in the synopsis and
extended description. Sometimes only the first part of the
synopsis or of the description will be displayed. You can
assume that there will usually be a way to see the whole
extended description.
The description should also give information about the
significant dependencies and conflicts between this package
and others, so that the user knows why these dependencies and
conflicts have been declared.
Instructions for configuring or using the package should
not be included (that is what installation scripts,
manual pages, info files, etc., are for). Copyright
statements and other administrivia should not be included
either (that is what the copyright file is for).
The single line synopsis should be kept brief - certainly
under 80 characters.
Do not include the package name in the synopsis line. The
display software knows how to display this already, and you
do not need to state it. Remember that in many situations
the user may only see the synopsis line - make it as
informative as you can.
Do not try to continue the single line synopsis into the
extended description. This will not work correctly when
the full description is displayed, and makes no sense
where only the summary (the single line synopsis) is
available.
The extended description should describe what the package
does and how it relates to the rest of the system (in terms
of, for example, which subsystem it is which part of).
The description field needs to make sense to anyone, even
people who have no idea about any of the things the
package deals with.
Every package must specify the dependency information
about other packages that are required for the first to
work correctly.
For example, a dependency entry must be provided for any
shared libraries required by a dynamically-linked executable
binary in a package.
Packages are not required to declare any dependencies they
have on other packages which are marked Essential
(see below), and should not do so unless they depend on a
particular version of that package.
Essential is needed in part to avoid unresolvable dependency
loops on upgrade. If packages add unnecessary dependencies
on packages in this set, the chances that there
will be an unresolvable dependency loop
caused by forcing these Essential packages to be configured
first before they need to be is greatly increased. It also
increases the chances that frontends will be unable to
calculate an upgrade path, even if one
exists.
Also, functionality is rarely ever removed from the
Essential set, but packages have been removed from
the Essential set when the functionality moved to a
different package. So depending on these packages just
in case they stop being essential does way more harm
than good.
Sometimes, a package requires another package to be installed
and configured before it can be installed. In this
case, you must specify a Pre-Depends entry for
the package.
You should not specify a Pre-Depends entry for a
package before this has been discussed on the
ubuntu-devel mailing list and a consensus about
doing that has been reached.
The format of the package interrelationship control fields is
described in .
Sometimes, there are several packages which offer
more-or-less the same functionality. In this case, it's
useful to define a virtual package whose name
describes that common functionality. (The virtual
packages only exist logically, not physically; that's why
they are called virtual.) The packages with this
particular function will then provide the virtual
package. Thus, any other package requiring that function
can simply depend on the virtual package without having to
specify all possible packages individually.
All packages should use virtual package names where
appropriate, and arrange to create new ones if necessary.
They should not use virtual package names (except privately,
amongst a cooperating group of packages) unless they have
been agreed upon and appear in the list of virtual package
names. (See also )
The latest version of the authoritative list of virtual
package names can be found in the debian-policy package.
It is also available from the Debian web mirrors at
The procedure for updating the list is described in the preface
to the list.
The base system is a minimum subset of the Ubuntu
system that is installed before everything else
on a new system. Only very few packages are allowed to form
part of the base system, in order to keep the required disk
usage very small.
The base system consists of all those packages with priority
required or important. Many of them will
be tagged essential (see below).
Essential is defined as the minimal set of functionality that
must be available and usable on the system at all times, even
when packages are in an unconfigured (but unpacked) state.
Packages are tagged essential for a system using the
Essential control file field. The format of the
Essential control field is described in .
Since these packages cannot be easily removed (one has to
specify an extra force option to
Since dpkg will not prevent upgrading of other packages
while an essential package is in an unconfigured
state, all essential packages must supply all of
their core functionality even when unconfigured. If the
package cannot satisfy this requirement it must not be
tagged as essential, and any packages depending on this
package must instead have explicit dependency fields as
appropriate.
Maintainers should take great care in adding any programs,
interfaces, or functionality to essential packages.
Packages may assume that functionality provided by
essential packages is always available without
declaring explicit dependencies, which means that removing
functionality from the Essential set is very difficult and is
almost never done. Any capability added to an
essential package therefore creates an obligation to
support that capability as part of the Essential set in
perpetuity.
You must not tag any packages essential before
this has been discussed on the ubuntu-devel
mailing list and a consensus about doing that has been
reached.
The package installation scripts should avoid producing
output which is unnecessary for the user to see and
should rely on
Errors which occur during the execution of an installation
script must be checked and the installation must not
continue after an error.
Note that in general applies to package
maintainer scripts, too.
You should not use
All packages which supply an instance of a common command
name (or, in general, filename) should generally use
Package maintainer scripts may prompt the user if
necessary. Prompting must be done by communicating
through a program, such as
Packages which are essential, or which are dependencies of
essential packages, may fall back on another prompting method
if no such interface is available when they are executed.
The Debian Configuration Management Specification is included
in the
Packages which use the Debian Configuration Management
Specification may contain an additional
Packages which use the Debian Configuration Management
Specification must allow for translation of their user-visible
messages by using a gettext-based system such as the one
provided by the
Packages should try to minimize the amount of prompting
they need to do, and they should ensure that the user
will only ever be asked each question once. This means
that packages should try to use appropriate shared
configuration files (such as
It also means that an upgrade should not ask the same
questions again, unless the user has used
dpkg --purge to remove the package's configuration.
The answers to configuration questions should be stored in an
appropriate place in
If a package has a vitally important piece of
information to pass to the user (such as "don't run me
as I am, you must edit the following configuration files
first or you risk your system emitting badly-formatted
messages"), it should display this in the
Any necessary prompting should almost always be confined
to the
Source packages should specify the most recent version number
of this policy document with which your package complied
when it was last updated.
This information may be used to file bug reports
automatically if your package becomes too much out of date.
The version is specified in the Standards-Version
control field.
The format of the Standards-Version field is
described in .
You should regularly, and especially if your package has
become out of date, check for the newest Policy Manual
available and update your package, if necessary. When your
package complies with the new standards you should update the
Standards-Version source package field and
release it.
Source packages should specify which binary packages they
require to be installed or not to be installed in order to
build correctly. For example, if building a package
requires a certain compiler, then the compiler should be
specified as a build-time dependency.
It is not necessary to explicitly specify build-time
relationships on a minimal set of packages that are always
needed to compile, link and put in an Ubuntu package a
standard "Hello World!" program written in C or C++. The
required packages are called build-essential, and
an informational list can be found in
When specifying the set of build-time dependencies, one
should list only those packages explicitly required by the
build. It is not necessary to list packages which are
required merely because some other package in the list of
build-time dependencies depends on them.
If build-time dependencies are specified, it must be
possible to build the package and produce working binaries
on a system with only essential and build-essential
packages installed and also those required to satisfy the
build-time relationships (including any implied
relationships). In particular, this means that version
clauses should be used rigorously in build-time
relationships so that one cannot produce bad or
inconsistently configured packages when the relationships
are properly satisfied.
If changes to the source code are made that are not
specific to the needs of the Ubuntu system, they should be
sent to the upstream authors in whatever form they prefer
so as to be included in the upstream version of the
package.
If you need to configure the package differently for
Ubuntu or for Linux, and the upstream source doesn't
provide a way to do so, you should add such configuration
facilities (for example, a new
You should make sure that the
If you need to edit a
Changes in the Ubuntu version of the package should be
briefly explained in the Ubuntu changelog file
Mistakes in changelogs are usually best rectified by
making a new changelog entry rather than "rewriting
history" by editing old changelog entries.
The format of the
That format is a series of entries like this:
package and version are the source
package name and version number.
distribution(s) lists the distributions where
this version should be installed when it is uploaded - it
is copied to the Distribution field in the
urgency is the value for the Urgency
field in the
The change details may in fact be any series of lines
starting with at least two spaces, but conventionally each
change starts with an asterisk and a separating space and
continuation lines are indented so as to bring them in
line with the start of the text above. Blank lines may be
used here to separate groups of changes, if desired.
If this upload resolves bugs recorded in the Debian Bug Tracking
System (BTS), they may be automatically closed on the
inclusion of this package into the Debian archive by
including the string: closes: Bug#nnnnn
in the change details.
Ubuntu: If this upload resolves bugs recorded in Launchpad,
they may be automatically closed on the inclusion of this
package into the Ubuntu archive by including the string:
LP: #nnnnn in the change
details.
The maintainer name and email address used in the changelog
should be the details of the person uploading this
version. They are not necessarily those of the
usual package maintainer. The information here will be
copied to the Changed-By field in the
.changes file (see ),
and then later used to send an acknowledgement when the
upload has been installed.
The date must be in RFC822 format
The first "title" line with the package name must start
at the left hand margin. The "trailer" line with the
maintainer and date details must be preceded by exactly
one space. The maintainer details and the date must be
separated by exactly two spaces.
The entire changelog must be encoded in UTF-8.
For more information on placement of the changelog files
within binary packages, please see .
Every package must be accompanied by a verbatim copy of
its copyright and distribution license in the file
When
Every time you put more than one shell command (this
includes using a loop) in a makefile command you
must make sure that errors are trapped. For
simple compound commands, such as changing directory and
then running a program, using && rather
than semicolon as a command separator is sufficient. For
more complex commands including most loops and
conditionals you should include a separate set -e
command at the start of every makefile command that's
actually one of these miniature shell scripts.
Maintainers should preserve the modification times of the
upstream source files in a package, as far as is reasonably
possible.
The source package may not contain any hard links
This is not currently detected when building source
packages, but only when extracting
them.
Hard links may be permitted at some point in the
future, but would require a fair amount of
work.
This file must be an executable makefile, and contains the
package-specific recipes for compiling the package and
building binary package(s) from the source.
It must start with the line #!/usr/bin/make -f,
so that it can be invoked by saying its name rather than
invoking
Since an interactive
The targets are as follows (required unless stated otherwise):
The build target should perform all the
configuration and compilation of the package.
If a package has an interactive pre-build
configuration routine, the Debianized source package
must either be built after this has taken place (so
that the binary package can be built without rerunning
the configuration) or the configuration routine
modified to become non-interactive. (The latter is
preferable if there are architecture-specific features
detected by the configuration routine.)
For some packages, notably ones where the same
source tree is compiled in different ways to produce
two binary packages, the build target
does not make much sense. For these packages it is
good enough to provide two (or more) targets
(build-a and build-b or whatever)
for each of the ways of building the package, and a
build target that does nothing. The
binary target will have to build the
package in each of the possible ways and make the
binary package out of each.
The build target must not do anything
that might require root privilege.
The build target may need to run the
clean target first - see below.
When a package has a configuration and build routine
which takes a long time, or when the makefiles are
poorly designed, or when build needs to
run clean first, it is a good idea to
touch build when the build process is
complete. This will ensure that if debian/rules
build is run again it will not rebuild the whole
program.
A package may also provide both of the targets
build-arch and build-indep.
The build-arch target, if provided, should
perform all the configuration and compilation required
for producing all architecture-dependant binary packages
(those packages for which the body of the
Architecture field in debian/control
is not all).
Similarly, the build-indep target, if
provided, should perform all the configuration and
compilation required for producing all
architecture-independent binary packages
(those packages for which the body of the
Architecture field in debian/control
is all).
The build target should depend on those of the
targets build-arch and build-indep that
are provided in the rules file.
If one or both of the targets build-arch and
build-indep are not provided, then invoking
The build-arch and build-indep targets
must not do anything that might require root privilege.
The binary target must be all that is
necessary for the user to build the binary package(s)
produced from this source package. It is
split into two parts:
binary may be (and commonly is) a target with
no commands which simply depends on
binary-arch and binary-indep.
Both binary-* targets should depend on the
build target, or on the appropriate
build-arch or build-indep target, if
provided, so that the package is built if it has not
been already. It should then create the relevant
binary package(s), using
Both the binary-arch and
binary-indep targets must exist.
If one of them has nothing to do (which will always be
the case if the source generates only a single binary
package, whether architecture-dependent or not), it
must still exist and must always succeed.
The binary targets must be invoked as
root.
This must undo any effects that the build
and binary targets may have had, except
that it should leave alone any output files created in
the parent directory by a run of a binary
target.
If a build file is touched at the end of
the build target, as suggested above, it
should be removed as the first action that
clean performs, so that running
build again after an interrupted
clean doesn't think that everything is
already done.
The clean target may need to be
invoked as root if binary has been
invoked since the last clean, or if
build has been invoked as root (since
build may create directories, for
example).
This target fetches the most recent version of the
original source package from a canonical archive site
(via FTP or WWW, for example), does any necessary
rearrangement to turn it into the original source
tar file format described below, and leaves it in the
current directory.
This target may be invoked in any directory, and
should take care to clean up any temporary files it
may have left.
This target is optional, but providing it if
possible is a good idea.
This target performs whatever additional actions are
required to make the source ready for editing (unpacking
additional upstream archives, applying patches, etc.).
It is recommended to be implemented for any package where
dpkg-source -x does not result in source ready
for additional modification. See
.
The build, binary and
clean targets must be invoked with the current
directory being the package's top-level directory.
Additional targets may exist in
The architectures we build on and build for are determined
by
Backward compatibility can be provided in the rules file
by setting the needed variables to suitable default
values; please refer to the documentation of
It is important to understand that the DEB_*_ARCH
string only determines which Debian architecture we are
building on or for. It should not be used to get the CPU
or system information; the GNU style variables should be
used for that.
Supporting the standardized environment variable
DEB_BUILD_OPTIONS is recommended. This variable can
contain several flags to change how a package is compiled and
built. Each flag must be in the form flag or
flag=options. If multiple flags are
given, they must be separated by whitespace.
The meaning of the following tags has been standardized:
Unknown flags must be ignored by
The following makefile snippet is an example of how one may
implement the build options; you will probably have to
massage this example in order to make it work for your
package.
When
The
See
This is an optional, recommended control file for the
uscan utility which defines how to automatically
scan ftp or http sites for newly available updates of the
package. This is used by
This file is not a permanent part of the source tree; it
is used while building packages to record which files are
being generated.
It should not exist in a shipped source package, and so it
(and any backup files or temporary files such as
When
If a package upload includes files besides the source
package and any binary packages whose control files were
made with
Some software packages include in their distribution convenience
copies of code from other software packages, generally so that
users compiling from source don't have to download multiple
packages. Ubuntu packages should not make use of these
convenience copies unless the included package is explicitly
intended to be used in this way.
If running
This explanation may refer to a documentation file installed by
one of the package's build dependencies provided that the
referenced documentation clearly explains these tasks and is not
a general reference manual.
The package management system manipulates data represented in
a common format, known as control data, stored in
control files.
Control files are used for source packages, binary packages and
the
A control file consists of one or more paragraphs of
fields
Each paragraph consists of a series of data fields; each
field consists of the field name, followed by a colon and
then the data/value associated with that field. It ends at
the end of the (logical) line. Horizontal whitespace
(spaces and tabs) may occur immediately before or after the
value and is ignored there; it is conventional to put a
single space after the colon. For example, a field might
be:
Many fields' values may span several lines; in this case
each continuation line must start with a space or a tab.
Any trailing spaces or tabs at the end of individual
lines of a field value are ignored.
In fields where it is specified that lines may not wrap,
only a single line of data is allowed and whitespace is not
significant in a field body. Whitespace must not appear
inside names (of packages, architectures, files or anything
else) or version numbers, or between the characters of
multi-character version relationships.
Field names are not case-sensitive, but it is usual to
capitalize the field names using mixed case as shown below.
Blank lines, or lines consisting only of spaces and tabs,
are not allowed within field values or between fields - that
would mean a new paragraph.
All control files must be encoded in UTF-8.
The
The first paragraph of the control file contains information about
the source package in general. The subsequent sets each describe a
binary package that the source tree builds.
The fields in the general paragraph (the first one, for the source
package) are:
The fields in the binary package paragraphs are:
The syntax and semantics of the fields are described below.
These fields are used by
The fields here may contain variable references - their
values will be substituted by
In addition to the control file syntax described
The
The fields in this file are:
This file contains a series of fields, identified and
separated just like the fields in the control file of
a binary package. The fields are listed below; their
syntax is described above, in .
The source package control file is generated by
The .changes files are used by the Ubuntu archive maintenance
software to process updates to packages. They contain one
paragraph which contains information from the
debian/control file and other data about the
source package gathered via debian/changelog
and debian/rules.
The fields in this file are:
This field identifies the source package name.
In
In a binary package control file or a
Package names must consist only of lower case letters
(a-z), digits (0-9), plus (+)
and minus (-) signs, and periods (.).
They must be at least two characters long and must start
with an alphanumeric character.
The package maintainer's name and email address. The name
should come first, then the email address inside angle
brackets <> (in RFC822 format).
If the maintainer's name contains a full stop then the
whole field will not work directly as an email address due
to a misfeature in the syntax specified in RFC822; a
program using this field as an address must check for this
and correct the problem if necessary (for example by
putting the name in round brackets and moving it to the
end, and bringing the email address forward).
List of the names and email addresses of co-maintainers of
the package, if any. If the package has other maintainers
beside the one named in the
Any parser that interprets the Uploaders field in
The name and email address of the person who changed the
said package. Usually the name of the maintainer.
All the rules for the Maintainer field apply here, too.
This field specifies an application area into which the package
has been classified. See .
When it appears in the
This field represents how important that it is that the user
have the package installed. See .
When it appears in the
The name of the binary package.
Package names must consist only of lower case letters
(a-z), digits (0-9), plus (+)
and minus (-) signs, and periods (.).
They must be at least two characters long and must start
with an alphanumeric character.
Depending on context and the control file used, the
Architecture field can include the following sets of
values:
In the main
Specifying any indicates that the source package
isn't dependent on any particular architecture and should
compile fine on any one. The produced binary package(s)
will be specific to whatever the current build architecture
is.
Specifying a list of architectures indicates that the source
will build an architecture-dependent package, and will only
work correctly on the listed architectures.
In a
See for information how to get the
architecture for the build process.
This is a boolean field which may occur only in the
control file of a binary package or in a per-package fields
paragraph of a main source control data file.
If set to yes then the package management system
will refuse to remove the package (upgrading and replacing
it is still possible). The other possible value is no,
which is the same as not having the field at all.
These fields describe the package's relationships with
other packages. Their syntax and semantics are described
in .
The most recent version of the standards (the policy
manual and associated texts) with which the package
complies.
The version number has four components: major and minor
version number and major and minor patch level. When the
standards change in a way that requires every package to
change the major number will be changed. Significant
changes that will require work in many packages will be
signaled by a change to the minor number. The major patch
level will be changed for any change to the meaning of the
standards, however small; the minor patch level will be
changed when only cosmetic, typographical or other edits
are made which neither change the meaning of the document
nor affect the contents of packages.
Thus only the first three components of the policy version
are significant in the Standards-Version control
field, and so either these three components or the all
four components may be specified.
Ubuntu: Packages should not include the Ubuntu revision of
the policy manual (e.g. "ubuntu1" in "3.8.0.1ubuntu1") in
their Standards-Version field. This tends to
create unnecessary diffs relative to Debian. For the same
reason, Ubuntu developers should not generally change the
Standards-Version field in packages originating
in Debian.
The version number of a package. The format is:
[epoch:]upstream_version[-debian_revision]
The three components here are:
This is a single (generally small) unsigned integer. It
may be omitted, in which case zero is assumed. If it is
omitted then the upstream_version may not
contain any colons.
It is provided to allow mistakes in the version numbers
of older versions of a package, and also a package's
previous version numbering schemes, to be left behind.
This is the main part of the version number. It is
usually the version number of the original ("upstream")
package from which the
The comparison behavior of the package management system
with respect to the upstream_version is
described below. The upstream_version
portion of the version number is mandatory.
The upstream_version may contain only
alphanumerics
This part of the version number specifies the version of
the Ubuntu package based on the upstream version. It
may contain only alphanumerics and the characters
+ . ~ (plus, full stop,
tilde) and is compared in the same way as the
upstream_version is.
It is optional; if it isn't present then the
upstream_version may not contain a hyphen.
This format represents the case where a piece of
software was written specifically to be turned into a
Debian or Ubuntu package, and so there is only one "debianisation"
of it and therefore no revision indication is required.
It is conventional to restart the
debian_revision at 1 each time the
upstream_version is increased.
The package management system will break the version
number apart at the last hyphen in the string (if there
is one) to determine the upstream_version and
debian_revision. The absence of a
debian_revision is equivalent to a
debian_revision of 0.
Ubuntu: The string "ubuntu" in a version number instructs the
archive management software not to copy newer versions of the
package from Debian automatically. It should therefore be used
when modifying packages relative to Debian, taking care that the
Ubuntu version number compares less than the next expected
version in Debian. For example, the first Ubuntu modification of
version 1.0-1 in Debian would be 1.0-1ubuntu1.
When comparing two version numbers, first the epoch
of each are compared, then the upstream_version if
epoch is equal, and then debian_revision
if upstream_version is also equal.
epoch is compared numerically. The
upstream_version and debian_revision
parts are compared by the package management system using the
following algorithm:
The strings are compared from left to right.
First the initial part of each string consisting entirely of
non-digit characters is determined. These two parts (one of
which may be empty) are compared lexically. If a difference
is found it is returned. The lexical comparison is a
comparison of ASCII values modified so that all the letters
sort earlier than all the non-letters and so that a tilde
sorts before anything, even the end of a part. For example,
the following parts are in sorted order from earliest to
latest: ~~, ~~a, ~, the empty part,
a.
Then the initial part of the remainder of each string which
consists entirely of digit characters is determined. The
numerical values of these two parts are compared, and any
difference found is returned as the result of the comparison.
For these purposes an empty string (which can only occur at
the end of one or both version strings being compared) counts
as zero.
These two steps (comparing and removing initial non-digit
strings and initial digit strings) are repeated until a
difference is found or both strings are exhausted.
Note that the purpose of epochs is to allow us to leave behind
mistakes in version numbering, and to cope with situations
where the version numbering scheme changes. It is
not intended to cope with version numbers containing
strings of letters which the package management system cannot
interpret (such as ALPHA or pre-), or with
silly orderings (the author of this manual has heard of a
package whose versions went 1.1, 1.2,
1.3, 1, 2.1, 2.2,
2 and so forth).
In a source or binary control file, the Description
field contains a description of the binary package, consisting
of two parts, the synopsis or the short description, and the
long description. The field's format is as follows:
The lines in the extended description can have these formats:
Do not use tab characters. Their effect is not predictable.
See for further information on this.
In a
The part of the field before the first newline is empty;
thereafter each line has the name of a binary package and
the summary description line from that binary package.
Each line is indented by one space.
In a
You should list all distributions that the
package should be installed into.
More information is available in the Debian Developer's
Reference, section "The Debian archive".
This field includes the date the package was built or last edited.
The value of this field is usually extracted from the
This field specifies a format revision for the file.
The most current format described in the Policy Manual
is version 1.5. The syntax of the
format value is the same as that of a package version
number except that no epoch or Debian revision is allowed
- see .
This is a description of how important it is to upgrade to
this version from previous ones. It consists of a single
keyword taking one of the values low,
medium, high, emergency, or
critical
The value of this field is usually extracted from the
This field contains the human-readable changes data, describing
the differences between the last version and the current one.
There should be nothing in this field before the first
newline; all the subsequent lines must be indented by at
least one space; blank lines must be represented by a line
consisting only of a space and a full stop.
The value of this field is usually extracted from the
Each version's change information should be preceded by a
"title" line giving at least the version, distribution(s)
and urgency, in a human-readable way.
If data from several versions is being returned the entry
for the most recent version should be returned first, and
entries should be separated by the representation of a
blank line (the "title" line may also be followed by the
representation of blank line).
This field is a list of binary packages.
When it appears in the
When it appears in a
The syntax is a list of binary packages separated by
commas
This field appears in the control files of binary
packages, and in the
The disk space is represented in kilobytes as a simple
decimal number.
This field contains a list of files with information about
each one. The exact information and syntax varies with
the context. In all cases the part of the field
contents on the same line as the field name is empty. The
remainder of the field is one line per file, each line
being indented by one space and containing a number of
sub-fields separated by spaces.
In the
In the
The special value byhand for the section in a
.changes file indicates that the file in question
is not an ordinary package file and must by installed by
hand by the distribution maintainers. If the section is
byhand the priority should be -.
If a new Ubuntu revision of a package is being shipped and
no new original source archive is being distributed the
.dsc must still contain the Files field
entry for the original source archive
A space-separated list of Debian bug report numbers that the upload
governed by the .changes file closes.
A space-separated list of Launchpad bug report numbers that the upload
governed by the .changes file closes.
The URL of the web site for this package, preferably (when
applicable) the site from which the original source can be
obtained and any additional upstream documentation or
information may be found. The content of this field is a
simple URL without any surrounding characters such as
<>.
Additional user-defined fields may be added to the
source package control file. Such fields will be
ignored, and not copied to (for example) binary or
source package control files or upload control files.
If you wish to add additional unsupported fields to
these output files you should use the mechanism
described here.
Fields in the main source control information file with
names starting X, followed by one or more of
the letters BCS and a hyphen -, will
be copied to the output files. Only the part of the
field name after the hyphen will be used in the output
file. Where the letter B is used the field
will appear in binary package control files, where the
letter S is used in source package control
files and where C is used in upload control
(.changes) files.
For example, if the main source information control file
contains the field
It is possible to supply scripts as part of a package which
the package management system will run for you when your
package is installed, upgraded or removed.
These scripts are the files
The package management system looks at the exit status from
these scripts. It is important that they exit with a
non-zero status if there is an error, so that the package
management system can stop its processing. For shell
scripts this means that you almost always need to
use set -e (this is usually true when writing shell
scripts, in fact). It is also important, of course, that
they exit with a zero status if everything went well.
Additionally, packages interacting with users using
debconf in the
When a package is upgraded a combination of the scripts from
the old and new packages is called during the upgrade
procedure. If your scripts are going to be at all
complicated you need to be aware of this, and may need to
check the arguments to your scripts.
Broadly speaking the
Programs called from maintainer scripts should not normally
have a path prepended to them. Before installation is
started, the package management system checks to see if the
programs
It is necessary for the error recovery procedures that the
scripts be idempotent. This means that if it is run
successfully, and then it is called again, it doesn't bomb
out or cause any harm, but just ensures that everything is
the way it ought to be. If the first call failed, or
aborted half way through for some reason, the second call
should merely do the things that were left undone the first
time, if any, and exit with a success status if everything
is OK.
The maintainer scripts are guaranteed to run with a
controlling terminal and can interact with the user.
Because these scripts may be executed with standard output
redirected into a pipe for logging purposes, Perl scripts
should set unbuffered output by setting $|=1 so
that the output is printed immediately rather than being
buffered.
Each script must return a zero exit status for
success, or a nonzero one for failure, since the package
management system looks for the exit status of these scripts
and determines what action to take next based on that datum.
The procedure on installation/upgrade/overwrite/disappear
(i.e., when running dpkg --unpack, or the unpack
stage of dpkg --install) is as follows. In each
case, if a major error occurs (unless listed below) the
actions are, in general, run backwards - this means that the
maintainer scripts are run with different arguments in
reverse order. These are the "error unwind" calls listed
below.
If that works, then
If it fails, then the old version is left
in an "Half-Installed" state.
The new package's files are unpacked, overwriting any
that may be on the system already, for example any
from the old version of the same package or from
another package. Backups of the old files are kept
temporarily, and if anything goes wrong the package
management system will attempt to put them back as
part of the error unwind.
It is an error for a package to contain files which
are on the system in another package, unless
Replaces is used (see ).
It is a more serious error for a package to contain a
plain file or other kind of non-directory where another
package has a directory (again, unless
Replaces is used). This error can be
overridden if desired using
--force-overwrite-dir, but this is not
advisable.
Packages which overwrite each other's files produce
behavior which, though deterministic, is hard for the
system administrator to understand. It can easily
lead to "missing" programs if, for example, a package
is installed which overwrites a file from another
package, and is then removed again.
A directory will never be replaced by a symbolic link
to a directory or vice versa; instead, the existing
state (symlink or not) will be left alone and
This is the point of no return - if
The new package's status is now sane, and recorded as
"unpacked".
Here is another point of no return - if the
conflicting package's removal fails we do not unwind
the rest of the installation; the conflicting package
is left in a half-removed limbo.
When we configure a package (this happens with dpkg
--install and dpkg --configure), we first
update any conffiles and then call:
No attempt is made to unwind after errors during
configuration. If the configuration fails, the package is in
a "Failed Config" state, and an error message is generated.
If there is no most recently configured version
Historical note: Truly ancient (pre-1997) versions of
If prerm fails during replacement due to conflict
If this fails, the package is in a "Failed-Config"
state, or else it remains "Installed".
If it fails, there's no error unwind, and the package is in
an "Half-Installed" state.
All the maintainer scripts except the
If we aren't purging the package we stop here. Note
that packages which have no
If this fails, the package remains in a "Config-Files"
state.
These fields all have a uniform syntax. They are a list of
package names separated by commas.
In the Depends, Recommends,
Suggests, Pre-Depends,
Build-Depends and Build-Depends-Indep
control file fields of the package, which declare
dependencies on other packages, the package names listed may
also include lists of alternative package names, separated
by vertical bar (pipe) symbols |. In such a case,
if any one of the alternative packages is installed, that
part of the dependency is considered to be satisfied.
All of the fields except for Provides may restrict
their applicability to particular versions of each named
package. This is done in parentheses after each individual
package name; the parentheses should contain a relation from
the list below followed by a version number, in the format
described in .
The relations allowed are <<, <=,
=, >= and >> for
strictly earlier, earlier or equal, exactly equal, later or
equal and strictly later, respectively. The deprecated
forms < and > were used to mean
earlier/later or equal, rather than strictly earlier/later,
so they should not appear in new packages (though
Whitespace may appear at any point in the version
specification subject to the rules in , and must appear where it's necessary to
disambiguate; it is not otherwise significant. All of the
relationship fields may span multiple lines. For
consistency and in case of future changes to
For example, a list of dependencies might appear as:
All fields that specify build-time relationships
(Build-Depends, Build-Depends-Indep,
Build-Conflicts and Build-Conflicts-Indep)
may be restricted to a certain set of architectures. This
is indicated in brackets after each individual package name and
the optional version specification. The brackets enclose a
list of Debian architecture names separated by whitespace.
Exclamation marks may be prepended to each of the names.
(It is not permitted for some names to be prepended with
exclamation marks while others aren't.) If the current Debian
host architecture is not in this list and there are no
exclamation marks in the list, or it is in the list with a
prepended exclamation mark, the package name and the
associated version specification are ignored completely for
the purposes of defining the relationships.
For example:
If the architecture-restricted dependency is part of a set of
alternatives using |, that alternative is ignored
completely on architectures that do not match the restriction.
For example:
Note that the binary package relationship fields such as
Depends appear in one of the binary package
sections of the control file, whereas the build-time
relationships such as Build-Depends appear in the
source package section of the control file (which is the
first section).
Packages can declare in their control file that they have
certain relationships to other packages - for example, that
they may not be installed at the same time as certain other
packages, and/or that they depend on the presence of others.
This is done using the Depends, Pre-Depends,
Recommends, Suggests, Enhances,
Breaks and Conflicts control file fields.
These seven fields are used to declare a dependency
relationship by one package on another. Except for
Enhances and Breaks, they appear in the
depending (binary) package's control file.
(Enhances appears in the recommending package's
control file, and Breaks appears in the version of
depended-on package which causes the named package to
break).
A Depends field takes effect only when a
package is to be configured. It does not prevent a package
being on the system in an unconfigured state while its
dependencies are unsatisfied, and it is possible to replace
a package whose dependencies are satisfied and which is
properly installed with a different version whose
dependencies are not and cannot be satisfied; when this is
done the depending package will be left unconfigured (since
attempts to configure it will give errors) and will not
function properly. If it is necessary, a
Pre-Depends field can be used, which has a partial
effect even when a package is being unpacked, as explained
in detail below. (The other three dependency fields,
Recommends, Suggests and
Enhances, are only used by the various front-ends
to
For this reason packages in an installation run are usually
all unpacked first and all configured later; this gives
later versions of packages with dependencies on later
versions of other packages the opportunity to have their
dependencies satisfied.
In case of circular dependencies, since installation or
removal order honoring the dependency order can't be
established, dependency loops are broken at some point
(based on rules below), and some packages may not be able to
rely on their dependencies being present when being
installed or removed, depending on which side of the break
of the circular dependency loop they happen to be on. If one
of the packages in the loop has no postinst script, then the
cycle will be broken at that package, so as to ensure that
all postinst scripts run with the dependencies properly
configured if this is possible. Otherwise the breaking point
is arbitrary.
The Depends field thus allows package maintainers
to impose an order in which packages should be configured.
The meaning of the five dependency fields is as follows:
This declares an absolute dependency. A package will
not be configured unless all of the packages listed in
its Depends field have been correctly
configured.
The Depends field should be used if the
depended-on package is required for the depending
package to provide a significant amount of
functionality.
The Depends field should also be used if the
This declares a strong, but not absolute, dependency.
The Recommends field should list packages
that would be found together with this one in all but
unusual installations.
This field is like Depends, except that it
also forces
When a package declaring a pre-dependency is about to
be unpacked the pre-dependency can be
satisfied if the depended-on package is either fully
configured, or even if the depended-on
package(s) are only unpacked or half-configured,
provided that they have been configured correctly at
some point in the past (and not removed or partially
removed since). In this case, both the
previously-configured and currently unpacked or
half-configured versions must satisfy any version
clause in the Pre-Depends field.
When the package declaring a pre-dependency is about
to be configured, the pre-dependency will be
treated as a normal Depends, that is, it will
be considered satisfied only if the depended-on
package has been correctly configured.
Pre-Depends should be used sparingly,
preferably only by packages whose premature upgrade or
installation would hamper the ability of the system to
continue with any upgrade that might be in progress.
Pre-Depends are also required if the
When selecting which level of dependency to use you should
consider how important the depended-on package is to the
functionality of the one declaring the dependency. Some
packages are composed of components of varying degrees of
importance. Such a package should list using
Depends the package(s) which are required by the
more important components. The other components'
requirements may be mentioned as Suggestions or
Recommendations, as appropriate to the components' relative
importance.
Using Breaks may cause problems for upgrades from older
versions of Debian and should not be used until the stable
release of Debian supports Breaks.
Ubuntu: Breaks may safely be used in Ubuntu packages, as
all supported upgrade paths to current releases involve upgrading
When one binary package declares that it breaks another,
A package will not be regarded as causing breakage merely
because its configuration files are still installed; it must
be at least half-installed.
A special exception is made for packages which declare that
they break their own package name or a virtual package which
they provide (see below): this does not count as a real
breakage.
Normally a Breaks entry will have an "earlier than"
version clause; such a Breaks is introduced in the
version of an (implicit or explicit) dependency which
violates an assumption or reveals a bug in earlier versions
of the broken package. This use of Breaks will
inform higher-level package management tools that broken
package must be upgraded before the new one.
If the breaking package also overwrites some files from the
older package, it should use Replaces (not
Conflicts) to ensure this goes smoothly.
When one binary package declares a conflict with another
using a Conflicts field,
If one package is to be installed, the other must be removed
first - if the package being installed is marked as
replacing (see ) the one on the system,
or the one on the system is marked as deselected, or both
packages are marked Essential, then
A package will not cause a conflict merely because its
configuration files are still installed; it must be at least
half-installed.
A special exception is made for packages which declare a
conflict with their own package name, or with a virtual
package which they provide (see below): this does not
prevent their installation, and allows a package to conflict
with others providing a replacement for it. You use this
feature when you want the package in question to be the only
package providing some feature.
A Conflicts entry should almost never have an
"earlier than" version clause. This would prevent
As well as the names of actual ("concrete") packages, the
package relationship fields Depends,
Recommends, Suggests, Enhances,
Pre-Depends, Breaks, Conflicts,
Build-Depends, Build-Depends-Indep,
Build-Conflicts and Build-Conflicts-Indep
may mention "virtual packages".
A virtual package is one which appears in the
Provides control file field of another package.
The effect is as if the package(s) which provide a
particular virtual package name had been listed by name
everywhere the virtual package name appears. (See also )
If there are both concrete and virtual packages of the same
name, then the dependency may be satisfied (or the conflict
caused) by either the concrete package with the name in
question or any other concrete package which provides the
virtual package with the name in question. This is so that,
for example, supposing we have
If a relationship field has a version number attached
then only real packages will be considered to see whether
the relationship is satisfied (or the prohibition violated,
for a conflict or breakage) - it is assumed that a real
package which provides the virtual package is not of the
"right" version. So, a Provides field may not
contain version numbers, and the version number of the
concrete package which provides a particular virtual package
will not be looked at when considering a dependency on or
conflict with the virtual package name.
It is likely that the ability will be added in a future
release of
If you want to specify which of a set of real packages
should be the default to satisfy a particular dependency on
a virtual package, you should list the real package as an
alternative before the virtual one.
Packages can declare in their control file that they should
overwrite files in certain other packages, or completely
replace other packages. The Replaces control file
field has these two distinct purposes.
Firstly, as mentioned before, it is usually an error for a
package to contain files which are on the system in
another package.
However, if the overwriting package declares that it
Replaces the one containing the file being
overwritten, then
If a package is completely replaced in this way, so that
Replaces is a one way relationship -- you have to
install the replacing package after the replaced
package.
For this usage of Replaces, virtual packages (see
) are not considered when looking at a
Replaces field - the packages declared as being
replaced must be mentioned by their real names.
Furthermore, this usage of Replaces only takes
effect when both packages are at least partially on the
system at once, so that it can only happen if they do not
conflict or if the conflict has been overridden.
Secondly, Replaces allows the packaging system to
resolve which package should be removed when there is a
conflict - see . This usage only
takes effect when the two packages do conflict,
so that the two usages of this field do not interfere with
each other.
In this situation, the package declared as being replaced
can be a virtual package, so for example, all mail
transport agents (MTAs) would have the following fields in
their control files:
Source packages that require certain binary packages to be
installed or absent at the time of building the package
can declare relationships to those binary packages.
This is done using the Build-Depends,
Build-Depends-Indep, Build-Conflicts and
Build-Conflicts-Indep control file fields.
Build-dependencies on "build-essential" binary packages can be
omitted. Please see for more information.
The dependencies and conflicts they define must be satisfied
(as defined earlier for binary packages) in order to invoke
the targets in debian/rules, as follows:
If you make "build-arch" or "binary-arch", you need
Build-Depends. If you make "build-indep" or
"binary-indep", you need Build-Depends and
Build-Depends-Indep. If you make "build" or "binary",
you need both.
There is no Build-Depends-Arch; this role is essentially
met with Build-Depends. Anyone building the
build-indep and binary-indep targets
is basically assumed to be building the whole package
anyway and so installs all build dependencies. The
autobuilders use dpkg-buildpackage -B, which
calls build (not build-arch, since it
does not yet know how to check for its existence) and
binary-arch.
The purpose of the original split, I recall, was so that
the autobuilders wouldn't need to install extra packages
needed only for the binary-indep targets. But without a
build-arch/build-indep split, this didn't work, since
most of the work is done in the build target, not in the
binary target.
Packages containing shared libraries must be constructed with
a little care to make sure that the shared library is always
available. This is especially important for packages whose
shared libraries are vitally important, such as the C library
(currently libc6).
Packages involving shared libraries should be split up into
several binary packages. This section mostly deals with how
this separation is to be accomplished; rules for files within
the shared library packages are in instead.
The run-time shared library needs to be placed in a package
whose name changes whenever the shared object version
changes.
Since it is common place to install several versions of a
package that just provides shared libraries, it is a
good idea that the library package should not
contain any extraneous non-versioned files, unless they
happen to be in versioned directories.
If you have several shared libraries built from the same
source tree you may lump them all together into a single
shared library package, provided that you change all of
their sonames at once (so that you don't get filename
clashes if you try to install different versions of the
combined shared libraries package).
The package should install the shared libraries under
their normal names. For example, the
Shared libraries should not be installed executable, since
the dynamic linker does not require this and trying to
execute a shared library usually results in a core dump.
The run-time library package should include the symbolic link that
Any package installing shared libraries in one of the default
library directories of the dynamic linker (which are currently
The package maintainer scripts must only call
During install or upgrade, the preinst is called before
the new files are installed, so calling "ldconfig" is
pointless. The preinst of an existing package can also be
called if an upgrade fails. However, this happens during
the critical time when a shared libs may exist on-disk
under a temporary name. Thus, it is dangerous and
forbidden by current policy to call "ldconfig" at this
time.
When a package is installed or upgraded, "postinst
configure" runs after the new files are safely on-disk.
Since it is perfectly safe to invoke ldconfig
unconditionally in a postinst, it is OK for a package to
simply put ldconfig in its postinst without checking the
argument. The postinst can also be called to recover from
a failed upgrade. This happens before any new files are
unpacked, so there is no reason to call "ldconfig" at this
point.
For a package that is being removed, prerm is
called with all the files intact, so calling ldconfig is
useless. The other calls to "prerm" happen in the case of
upgrade at a time when all the files of the old package
are on-disk, so again calling "ldconfig" is pointless.
postrm, on the other hand, is called with the "remove"
argument just after the files are removed, so this is
the proper time to call "ldconfig" to notify the system
of the fact that the shared libraries from the package
are removed. The postrm can be called at several other
times. At the time of "postrm purge", "postrm
abort-install", or "postrm abort-upgrade", calling
"ldconfig" is useless because the shared lib files are
not on-disk. However, when "postrm" is invoked with
arguments "upgrade", "failed-upgrade", or "disappear", a
shared lib may exist on-disk under a temporary filename.
If your package contains files whose names do not change with
each change in the library shared object version, you must not
put them in the shared library package. Otherwise, several
versions of the shared library cannot be installed at the same
time without filename clashes, making upgrades and transitions
unnecessarily difficult.
It is recommended that supporting files and run-time support
programs that do not need to be invoked manually by users, but
are nevertheless required for the package to function, be placed
(if they are binary) in a subdirectory of
Run-time support programs that use the shared library but are
not required for the library to function or files used by the
shared library that can be used by any version of the shared
library package should instead be put in a separate package.
This package might typically be named
Files and support programs only useful when compiling software
against the library should be included in the development
package for the library.
The static library (
In some cases, it is acceptable for a library to be
available in static form only; these cases include:
The development files associated to a shared library need to be
placed in a package called
In case several development versions of a library exist, you may
need to use
The development package should contain a symlink for the associated
shared library without a version number. For example, the
Typically the development version should have an exact
version dependency on the runtime library, to make sure that
compilation and linking happens correctly. The
${binary:Version} substitution variable can be
useful for this purpose.
If a package contains a binary or library which links to a
shared library, we must ensure that when the package is
installed on the system, all of the libraries needed are
also installed. This requirement led to the creation of the
shlibs system, which is very simple in its design:
any package which provides a shared library also
provides information on the package dependencies required to
ensure the presence of this library, and any package which
uses a shared library uses this information to
determine the dependencies it requires. The files which
contain the mapping from shared libraries to the necessary
dependency information are called
Thus, when a package is built which contains any shared
libraries, it must provide a
In the past, the shared libraries linked to were
determined by calling
We say that a binary foo directly uses
a library libbar if it is explicitly linked
with that library (that is, it uses the flag
-lbar during the linking stage). Other
libraries that are needed by libbar are linked
indirectly to foo, and the dynamic
linker will load them automatically when it loads
libbar. A package should depend on
the libraries it directly uses, and the dependencies for
those libraries should automatically pull in the other
libraries.
Unfortunately, the
A good example of where this helps is the following. We
could update libimlib with a new version that
supports a new graphics format called dgf (but retaining
the same major version number). If we used the old
In the following sections, we will first describe where the
various shlibs files are to be found, then how to
use
There are several places where shlibs files are
found. The following list gives them in the order in which
they are read by
This lists overrides for this package. Its use is
described below (see ).
This lists global overrides. This list is normally
empty. It is maintained by the local system
administrator.
When packages are being built, any
These are the
This file lists any shared libraries whose packages
have failed to provide correct
Put a call to
This command puts the dependency information into the
If
If you have multiple binary packages, you will need to call
If you are creating a udeb for use in the Debian Installer, you
will need to specify that
For more details on dpkg-shlibdeps, please see
and
Each
We will explain this by reference to the example of the
zlib1g package, which (at the time of writing)
installs the shared library
type is an optional element that indicates the type
of package for which the line is valid. The only type currently
in use is udeb. The colon and space after the type are
required.
library-name is the name of the shared library,
in this case libz. (This must match the name part
of the soname, see below.)
soname-version is the version part of the soname of
the library. The soname is the thing that must exactly match
for the library to be recognized by the dynamic linker, and is
usually of the form
name.so.major-version, in our
example, libz.so.1.
dependencies has the same syntax as a dependency
field in a binary package control file. It should give
details of which packages are required to satisfy a binary
built against the version of the library contained in the
package. See for details.
In our example, if the first version of the zlib1g
package which contained a minor number of at least
1.3 was 1:1.1.3-1, then the
shlibs entry for this library could say:
As zlib1g also provides a udeb containing the shared library,
there would also be a second line:
If your package provides a shared library, you need to create
a
As
This file is intended only as a temporary fix if
your binaries or libraries depend on a library whose package
does not yet provide a correct
We will assume that you are trying to package a binary
foo. When you try running
As soon as the maintainer of bar1 provides a
correct
The location of all installed files and directories must
comply with the Filesystem Hierarchy Standard (FHS),
version 2.3, with the exceptions noted below, and except
where doing so would violate other terms of Ubuntu
Policy. The following exceptions to the FHS apply:
The optional rules related to user specific
configuration files for applications are stored in
the user's home directory are relaxed. It is
recommended that such files start with the
'.' character (a "dot file"), and if an
application needs to create more than one dot file
then the preferred placement is in a subdirectory
with a name starting with a '.' character, (a "dot
directory"). In this case it is recommended the
configuration files not start with the '.'
character.
The requirement for amd64 to use
The requirement that
The requirement that windowmanagers with a single
configuration file call it
The requirement that boot manager configuration
files live in
The version of this document referred here can be
found in the ubuntu-policy package or on
As mandated by the FHS, packages must not place any
files in
However, the package may create empty directories below
Note, that this applies only to directories below
Since
For example, the emacsen-common package could
contain something like
If you do create a directory in
However, because
The
The system-wide mail directory is
The Ubuntu system can be configured to use either plain or
shadow passwords.
Some user ids (UIDs) and group ids (GIDs) are reserved
globally for use by certain packages. Because some
packages need to include files which are owned by these
users or groups, or need the ids compiled into binaries,
these ids must be used on any Ubuntu system only for the
purpose for which they are allocated. This is a serious
restriction, and we should avoid getting in the way of
local administration policies. In particular, many sites
allocate users and/or local system groups starting at 100.
Apart from this we should have dynamically allocated ids,
which should by default be arranged in some sensible
order, but the behavior should be configurable.
Packages other than base-passwd must not modify
The UID and GID numbers are divided into classes as
follows:
Globally allocated by the Debian project, the same
on every Debian and Ubuntu system. These ids will appear in
the
Packages which need a single statically allocated
uid or gid should use one of these; their
maintainers should ask the base-passwd
maintainer for ids.
Dynamically allocated system users and groups.
Packages which need a user or group, but can have
this user or group allocated dynamically and
differently on each system, should use adduser
--system to create the group and/or user.
Dynamically allocated user accounts. By default
Reserved.
Globally allocated by the Debian project, but only
created on demand. The ids are allocated centrally
and statically, but the actual accounts are only
created on users' systems on demand.
These ids are for packages which are obscure or
which require many statically-allocated ids. These
packages should check for and create the accounts in
Reserved.
User nobody. The corresponding gid refers
to the group nogroup.
(uid_t)(-1) == (gid_t)(-1) must
not be used, because it is the error return
sentinel value.
The
There are at least two different, yet functionally
equivalent, ways of handling these scripts. For the sake
of simplicity, this document describes only the symbolic
link method. However, it must not be assumed by maintainer
scripts that this method is being used, and any automated
manipulation of the various runlevel behaviors by
maintainer scripts must be performed using
These scripts are referenced by symbolic links in the
The names of the links all have the form
When
For example, if we are changing from runlevel 2 to
runlevel 3, init will first execute all of the K
prefixed scripts it finds in
The two-digit number mm is used to determine
the order in which to run the scripts: low-numbered links
have their scripts run first. For example, the
K20 scripts will be executed before the
K30 scripts. This is used when a certain service
must be started before another. For example, the name
server
The two runlevels 0 (halt) and 6 (reboot) are slightly
different. In these runlevels, the links with an
S prefix are still called after those with a
K prefix, but they too are called with the single
argument stop.
Packages that include daemons for system services should
place scripts in cause the configuration of the service to be
reloaded without actually stopping and restarting
the service,
The
If a service reloads its configuration automatically (as
in the case of
The
These scripts should not fail obscurely when the
configuration files remain but the package has been
removed, as configuration files remain on the system after
the package has been removed. Only when
Often there are some variables in the
To ensure that vital configurable values are always
available, the
Maintainers should use the abstraction layer provided by
the
Directly managing the /etc/rc?.d links and directly
invoking the
The program
You must not include any
By default
To get the default behavior for your package, put in your
This will use a default sequence number of 20. If it does
not matter when or in which order the
For more information about using update-rc.d,
please consult its man page
The program
The package maintainer scripts must use
By default,
Most packages will simply need to change:
A package should register its initscript services using
For more information about using
There used to be another directory,
An example on which you can base your
This section describes the formats to be used for messages
written to standard output by the
Here is a list of overall rules that should be used for
messages generated by
init.d script should use the following standard
message formats for the situations enumerated below.
When daemons are started
If the script starts one or more daemons, the output
should look like this (a single line, no leading
spaces):
For example, the output of
This can be achieved by saying
When a system parameter is being set
If you have to set up different system parameters
during the system boot, you should use this format:
You can use a statement such as the following to get
the quotes right:
Note that the same symbol (") is used for the left
and right quotation marks. A grave accent (`) is
not a quote character; neither is an apostrophe
(').
When a daemon is stopped or restarted
When you stop or restart a daemon, you should issue a
message identical to the startup message, except that
Starting is replaced with Stopping
or Restarting respectively.
For example, stopping the printer daemon will look like
this:
When something is executed
There are several examples where you have to run a
program at system startup or shutdown to perform a
specific task, for example, setting the system's clock
using When the configuration is reloaded
When a daemon is forced to reload its configuration
files you should use the following format:
Packages must not modify the configuration file
If a package wants to install a job that has to be executed
via cron, it should place a file with the name of the
package in one or more of the following directories:
All files installed in any of these directories must be
scripts (e.g., shell scripts or Perl scripts) so that they
can easily be modified by the local system administrator.
In addition, they must be treated as configuration files.
If a certain job has to be executed at some other frequency or
at a specific time, the package should install a file
The scripts or crontab entries in these directories should
check if all necessary programs are installed before they
try to execute them. Otherwise, problems will arise when a
package was removed but not purged since configuration files
are kept on the system in this situation.
The Debian menu package provides a standard
interface between packages providing applications and
menu programs (either X window managers or
text-based menu programs such as
All packages that provide applications that need not be
passed any special command line arguments for normal
operation should register a menu entry for those
applications, so that users of the menu package
will automatically get menu entries in their window
managers, as well in shells like pdmenu.
Menu entries should follow the current menu policy.
The menu policy can be found in the menu-policy
files in the debian-policy package.
It is also available from the Debian web mirrors at
Please also refer to the Debian Menu System
documentation that comes with the
MIME (Multipurpose Internet Mail Extensions, RFCs 2045-2049)
is a mechanism for encoding files and data streams and
providing meta-information about them, in particular their
type (e.g. audio or video) and format (e.g. PNG, HTML,
MP3).
Registration of MIME type handlers allows programs like mail
user agents and web browsers to invoke these handlers to
view, edit or display MIME types they don't support directly.
Packages which provide the ability to view/show/play,
compose, edit or print MIME types should register themselves
as such following the current MIME support policy.
The MIME support policy can be found in the mime-policy
files in the debian-policy package.
It is also available from the Debian web mirrors at
To achieve a consistent keyboard configuration so that all
applications interpret a keyboard event the same way, all
programs in the Ubuntu distribution must be configured to
comply with the following guidelines.
The following keys must have the specified interpretations:
The following list explains how the different programs
should be set up to achieve this:
This will solve the problem except for the following
cases:
A program must not depend on environment variables to get
reasonable defaults. (That's because these environment
variables would have to be set in a system-wide
configuration file like
If a program usually depends on environment variables for its
configuration, the program should be changed to fall back to
a reasonable default configuration if these environment
variables are not present. If this cannot be done easily
(e.g., if the source code of a non-free program is not
available), the program must be replaced by a small
"wrapper" shell script which sets the environment variables
if they are not already defined, and calls the original program.
Here is an example of a wrapper script for this purpose:
Furthermore, as
The
Please refer to the documentation that comes with the
Two different packages must not install programs with
different functionality but with the same filenames. (The
case of two programs having the same functionality but
different implementations is handled via "alternatives" or
the "Conflicts" mechanism. See and
respectively.) If this case happens,
one of the programs must be renamed. The maintainers should
report this to the ubuntu-devel mailing list and
try to find a consensus about which program will have to be
renamed. If a consensus cannot be reached, both
programs must be renamed.
By default, when a package is being built, any binaries
created should include debugging information, as well as
being compiled with optimization. You should also turn on
as many reasonable compilation warnings as possible; this
makes life easier for porters, who can then look at build
logs for possible problems. For the C programming language,
this means the following compilation parameters should be
used:
Note that by default all installed binaries should be stripped,
either by using the -s flag to
Although binaries in the build tree should be compiled with
debugging information by default, it can often be difficult to
debug programs if they are also subjected to compiler
optimization. For this reason, it is recommended to support the
standardized environment variable DEB_BUILD_OPTIONS
(see ). This variable can contain
several flags to change how a package is compiled and built.
It is up to the package maintainer to decide what
compilation options are best for the package. Certain
binaries (such as computationally-intensive programs) will
function better with certain flags (-O3, for
example); feel free to use them. Please use good judgment
here. Don't use flags for the sake of it; only use them
if there is good reason to do so. Feel free to override
the upstream author's ideas about which compilation
options are best: they are often inappropriate for our
environment.
If the package is architecture: any, then
the shared library compilation and linking flags must have
-fPIC, or the package shall not build on some of
the supported architectures
If you are using GCC, -fPIC produces code with
relocatable position independent code, which is required for
most architectures to create a shared library, with i386 and
perhaps some others where non position independent code is
permitted in a shared library.
Position independent code may have a performance penalty,
especially on i386. However, in most cases the
speed penalty must be measured against the memory wasted on
the few architectures where non position independent code is
even possible.
Some of the reasons why this might be required is if the
library contains hand crafted assembly code that is not
relocatable, the speed penalty is excessive for compute
intensive libs, and similar reasons.
As to the static libraries, the common case is not to have
relocatable code, since there is no benefit, unless in specific
cases; therefore the static version must not be compiled
with the -fPIC flag. Any exception to this rule
should be discussed on the mailing list
ubuntu-devel@lists.ubuntu.com, and the reasons for
compiling with the -fPIC flag must be recorded in
the file README.Debian.
Some of the reasons for linking static libraries with
the -fPIC flag are if, for example, one needs a
Perl API for a library that is under rapid development,
and has an unstable API, so shared libraries are
pointless at this phase of the library's development. In
that case, since Perl needs a library with relocatable
code, it may make sense to create a static library with
relocatable code. Another reason cited is if you are
distilling various libraries into a common shared
library, like mklibs does in the Debian
installer project.
In other words, if both a shared and a static library is
being built, each source unit (*.c, for example,
for C files) will need to be compiled twice, for the normal
case.
You must specify the gcc option -D_REENTRANT
when building a library (either static or shared) to make
the library compatible with LinuxThreads.
Although not enforced by the build tools, shared libraries
must be linked against all libraries that they use symbols from
in the same way that binaries are. This ensures the correct
functioning of the
All installed shared libraries should be stripped with
Note that under some circumstances it may be useful to
install a shared library unstripped, for example when
building a separate package to support debugging.
Shared object files (often
Packages containing shared libraries that may be linked to
by other packages' binaries, but which for some
compelling reason can not be installed in
An ever increasing number of packages are using
Packages that use
You must make sure that you use only released versions of
shared libraries to build your packages; otherwise other
users will not be able to run your binaries
properly. Producing source packages that depend on
unreleased compilers is also usually a bad
idea.
This section has moved to .
All command scripts, including the package maintainer
scripts inside the package and used by
In the case of Perl scripts this should be
#!/usr/bin/perl.
When scripts are installed into a directory in the system
PATH, the script name should not include an extension such
as .sh or .pl that denotes the scripting
language currently used to implement it.
Shell scripts (
Scripts may assume that
You may wish to restrict your script to SUSv3 features plus the
above set when possible so that it may use
Perl scripts should check for errors when making any
system calls, including open, print,
close, rename and system.
Any scripts which create files in world-writeable
directories (e.g., in
The Ubuntu base system provides the
In general, symbolic links within a top-level directory
should be relative, and symbolic links pointing from one
top-level directory into another should be absolute. (A
top-level directory is a sub-directory of the root
directory
In addition, symbolic links should be specified as short as
possible, i.e., link targets like
Note that when creating a relative link using
For example, in your
A symbolic link pointing to a compressed file should always
have the same file extension as the referenced file. (For
example, if a file
Packages must not include device files in the package file
tree.
If a package needs any special device files that are not
included in the base system, it must call
Packages must not remove any device files in the
Ubuntu uses the serial devices
The distinction between these two is important; they are
not interchangeable concepts. Almost all
conffiles are configuration files, but many
configuration files are not conffiles.
As noted elsewhere,
Any configuration files created or used by your package
must reside in
If your package creates or uses configuration files
outside of
Configuration file handling must conform to the following
behavior:
The easy way to achieve this behavior is to make the
configuration file a conffile. This is
appropriate only if it is possible to distribute a default
version that will work for most installations, although
some system administrators may choose to modify it. This
implies that the default version will be part of the
package distribution, and must not be modified by the
maintainer scripts during installation (or at any other
time).
In order to ensure that local changes are preserved
correctly, no package may contain or make hard links to
conffiles.
The other way to do it is via the maintainer scripts. In
this case, the configuration file must not be listed as a
conffile and must not be part of the package
distribution. If the existence of a file is required for
the package to be sensibly configured it is the
responsibility of the package maintainer to provide
maintainer scripts which correctly create, update and
maintain the file and remove it on purge. (See for more information.) These
scripts must be idempotent (i.e., must work correctly if
The scripts are not required to configure every possible
option for the package, but only those necessary to get
the package running on a given system. Ideally the
sysadmin should not have to do any configuration other
than that done (semi-)automatically by the
A common practice is to create a script called
These two styles of configuration file handling must
not be mixed, for that way lies madness:
Packages which specify the same file as a
conffile must be tagged as conflicting
with each other. (This is an instance of the general rule
about not sharing files. Note that neither alternatives
nor diversions are likely to be appropriate in this case;
in particular,
The maintainer scripts must not alter a conffile
of any package, including the one the scripts
belong to.
If two or more packages use the same configuration file
and it is reasonable for both to be installed at the same
time, one of these packages must be defined as
owner of the configuration file, i.e., it will be
the package which handles that file as a configuration
file. Other packages that use the configuration file must
depend on the owning package if they require the
configuration file to operate. If the other package will
use the configuration file if present, but is capable of
operating without it, no dependency need be declared.
If it is desirable for two or more related packages to
share a configuration file and for all of the
related packages to be able to modify that configuration
file, then the following should be done:
Sometimes it's appropriate to create a new package which
provides the basic infrastructure for the other packages
and which manages the shared configuration files. (The
sgml-base package is a good example.)
The files in
Therefore, if a program needs a dotfile to exist in
advance in
However, programs that require dotfiles in order to
operate sensibly are a bad thing, unless they do create
the dotfiles themselves automatically.
Furthermore, programs should be configured by the Ubuntu
default installation to behave as closely to the upstream
default behavior as possible.
Therefore, if a program in a Ubuntu package needs to be
configured in some way in order to operate sensibly, that
should be done using a site-wide configuration file placed
in
Log files should usually be named
Log files must be rotated occasionally so that they don't
grow indefinitely; the best way to do this is to drop a log
rotation configuration file into the directory
The traditional approach to log files has been to set up
ad hoc log rotation schemes using simple shell
scripts and cron. While this approach is highly
customizable, it requires quite a lot of sysadmin work.
Even though the original Ubuntu system helped a little
by automatically installing a system which can be used
as a template, this was deemed not enough.
The use of
Log files should be removed when the package is
purged (but not when it is only removed). This should be
done by the
The rules in this section are guidelines for general use.
If necessary you may deviate from the details below.
However, if you do so you must make sure that what is done
is secure and you should try to be as consistent as possible
with the rest of the system. You should probably also
discuss it on
Files should be owned by root:root, and made
writable only by the owner and universally readable (and
executable, if appropriate), that is mode 644 or 755.
Directories should be mode 755 or (for group-writability)
mode 2775. The ownership of the directory should be
consistent with its mode: if a directory is mode 2775, it
should be owned by the group that needs write access to
it.
When a package is upgraded, and the owner or permissions
of a file included in the package has changed, dpkg
arranges for the ownership and permissions to be
correctly set upon installation. However, this does not
extend to directories; the permissions and ownership of
directories already on the system does not change on
install or upgrade of packages. This makes sense, since
otherwise common directories like /usr would
always be in flux. To correctly change permissions of a
directory the package owns, explicit action is required,
usually in the postinst script. Care must be
taken to handle downgrades as well, in that case.
Setuid and setgid executables should be mode 4755 or 2755
respectively, and owned by the appropriate user or group.
They should not be made unreadable (modes like 4711 or
2711 or even 4111); doing so achieves no extra security,
because anyone can find the binary in the freely available
Ubuntu package; it is merely inconvenient. For the same
reason you should not restrict read or execute permissions
on non-set-id executables.
Some setuid programs need to be restricted to particular
sets of users, using file permissions. In this case they
should be owned by the uid to which they are set-id, and by
the group which should be allowed to execute them. They
should have mode 4754; again there is no point in making
them unreadable to those users who must not be allowed to
execute them.
It is possible to arrange that the system administrator can
reconfigure the package to correspond to their local
security policy by changing the permissions on a binary:
they can do this by using
If you need to create a new user or group for your package
there are two possibilities. Firstly, you may need to
make some files in the binary package be owned by this
user or group, or you may need to compile the user or
group id (rather than just the name) into the binary
(though this latter should be avoided if possible, as in
this case you need a statically allocated id).
If you need a statically allocated id, you must ask for a
user or group id from the base-passwd maintainer,
and must not release the package until you have been
allocated one. Once you have been allocated one you must
either make the package depend on a version of the
base-passwd package with the id present in
On the other hand, the program might be able to determine
the uid or gid from the user or group name at runtime, so
that a dynamically allocated id can be used. In this case
you should choose an appropriate user or group name,
discussing this on
Note that changing the numeric value of an id associated
with a name is very difficult, and involves searching the
file system for all appropriate files. You need to think
carefully whether a static or dynamic id is required, since
changing your mind later will cause problems.
This section is not intended as policy, but as a
description of the use of
If a system administrator wishes to have a file (or
directory or other such thing) installed with owner and
permissions different from those in the distributed Ubuntu
package, they can use the
Given the above,
If a program needs to specify an architecture specification
string in some place, it should select one of the
strings provided by dpkg-architecture -L. The
strings are in the format
os-arch, though the OS part
is sometimes elided, as when the OS is Linux. Currently, the strings are:
i386 ia64 alpha amd64 armeb arm hppa m32r m68k mips
mipsel powerpc ppc64 s390 s390x sh3 sh3eb sh4 sh4eb
sparc darwin-i386 darwin-ia64 darwin-alpha darwin-amd64
darwin-armeb darwin-arm darwin-hppa darwin-m32r
darwin-m68k darwin-mips darwin-mipsel darwin-powerpc
darwin-ppc64 darwin-s390 darwin-s390x darwin-sh3
darwin-sh3eb darwin-sh4 darwin-sh4eb darwin-sparc
freebsd-i386 freebsd-ia64 freebsd-alpha freebsd-amd64
freebsd-armeb freebsd-arm freebsd-hppa freebsd-m32r
freebsd-m68k freebsd-mips freebsd-mipsel freebsd-powerpc
freebsd-ppc64 freebsd-s390 freebsd-s390x freebsd-sh3
freebsd-sh3eb freebsd-sh4 freebsd-sh4eb freebsd-sparc
kfreebsd-i386 kfreebsd-ia64 kfreebsd-alpha
kfreebsd-amd64 kfreebsd-armeb kfreebsd-arm kfreebsd-hppa
kfreebsd-m32r kfreebsd-m68k kfreebsd-mips
kfreebsd-mipsel kfreebsd-powerpc kfreebsd-ppc64
kfreebsd-s390 kfreebsd-s390x kfreebsd-sh3 kfreebsd-sh3eb
kfreebsd-sh4 kfreebsd-sh4eb kfreebsd-sparc knetbsd-i386
knetbsd-ia64 knetbsd-alpha knetbsd-amd64 knetbsd-armeb
knetbsd-arm knetbsd-hppa knetbsd-m32r knetbsd-m68k
knetbsd-mips knetbsd-mipsel knetbsd-powerpc
knetbsd-ppc64 knetbsd-s390 knetbsd-s390x knetbsd-sh3
knetbsd-sh3eb knetbsd-sh4 knetbsd-sh4eb knetbsd-sparc
netbsd-i386 netbsd-ia64 netbsd-alpha netbsd-amd64
netbsd-armeb netbsd-arm netbsd-hppa netbsd-m32r
netbsd-m68k netbsd-mips netbsd-mipsel netbsd-powerpc
netbsd-ppc64 netbsd-s390 netbsd-s390x netbsd-sh3
netbsd-sh3eb netbsd-sh4 netbsd-sh4eb netbsd-sparc
openbsd-i386 openbsd-ia64 openbsd-alpha openbsd-amd64
openbsd-armeb openbsd-arm openbsd-hppa openbsd-m32r
openbsd-m68k openbsd-mips openbsd-mipsel openbsd-powerpc
openbsd-ppc64 openbsd-s390 openbsd-s390x openbsd-sh3
openbsd-sh3eb openbsd-sh4 openbsd-sh4eb openbsd-sparc
hurd-i386 hurd-ia64 hurd-alpha hurd-amd64 hurd-armeb
hurd-arm hurd-hppa hurd-m32r hurd-m68k hurd-mips
hurd-mipsel hurd-powerpc hurd-ppc64 hurd-s390 hurd-s390x
hurd-sh3 hurd-sh3eb hurd-sh4 hurd-sh4eb hurd-sparc
Note that we don't want to use
arch-debian-linux to apply to the rule
architecture-vendor-os
since this would make our programs incompatible with other
Linux distributions. We also don't use something like
arch-unknown-linux, since the
unknown does not look very good.
The configuration files
If a package requires a new entry in one of these files, the
maintainer should get in contact with the
The configuration file
If a package wants to install an example entry into
Some programs need to create pseudo-ttys. This should be done
using Unix98 ptys if the C library supports it. The resulting
program must not be installed setuid root, unless that
is required for other functionality.
The files
Some programs have the ability to launch an editor or pager
program to edit or display a text document. Since there are
lots of different editors and pagers available in the Ubuntu
distribution, the system administrator and each user should
have the possibility to choose their preferred editor and
pager.
In addition, every program should choose a good default
editor/pager if none is selected by the user or system
administrator.
Thus, every program that launches an editor or pager must
use the EDITOR or PAGER environment variable to determine
the editor or pager the user wishes to use. If these
variables are not set, the programs
These two files are managed through the
If it is very hard to adapt a program to make use of the
EDITOR or PAGER variables, that program may be configured to
use
A program may also use the VISUAL environment variable to
determine the user's choice of editor. If it exists, it
should take precedence over EDITOR. This is in fact what
It is not required for a package to depend on
editor and pager, nor is it required for a
package to provide such virtual packages.
This section describes the locations and URLs that should
be used by all web servers and web applications in the
Ubuntu system.
Access to HTML documents
HTML documents for a package are stored in
The web server should restrict access to the document
tree so that only clients on the same host can read
the documents. If the web server does not support such
access controls, then it should not provide access at
all, or ask about providing access during installation.
Access to images
It is recommended that images for a package be stored
in /usr/share/images/package and
may be referred to through an alias /images/
as
Web Document Root
Web Applications should try to avoid storing files in
the Web Document Root. Instead they should use the
/usr/share/doc/package directory for
documents and register the Web Application via the
Providing httpd and/or httpd-cgi
All web servers should provide the virtual package
httpd. If a web server has CGI support it should
provide httpd-cgi additionally.
All web applications which do not contain CGI scripts should
depend on httpd, all those web applications which
do contain CGI scripts, should depend on
httpd-cgi.
Ubuntu packages which process electronic mail, whether mail
user agents (MUAs) or mail transport agents (MTAs), must
ensure that they are compatible with the configuration
decisions below. Failure to do this may result in lost
mail, broken From: lines, and other serious brain
damage!
The mail spool is
All Ubuntu MUAs, MTAs, MDAs and other mailbox accessing
programs (such as IMAP daemons) must lock the mailbox in an
NFS-safe way. This means that fcntl() locking must
be combined with dot locking. To avoid deadlocks, a program
should use fcntl() first and dot locking after
this, or alternatively implement the two locking methods in
a non blocking way
Mailboxes are generally either mode 600 and owned by
user or mode 660 and owned by
user:mail
The mail spool is 2775 root:mail, and MUAs should
be setgid mail to do the locking mentioned above (and
must obviously avoid accessing other users' mailboxes
using this privilege).
The convention of writing forward to
address in the mailbox itself is not
supported. Use a .forward file instead.
The
If your package needs to know what hostname to use on (for
example) outgoing news and mail messages which are generated
locally, you should use the file
Such a package should check for the existence of this file
when it is being configured. If it exists, it should be
used without comment, although an MTA's configuration script
may wish to prompt the user even if it finds that this file
exists. If the file does not exist, the package should
prompt the user for the value (preferably using
All the configuration files related to the NNTP (news)
servers and clients should be located under
There are some configuration issues that apply to a number
of news clients and server packages on the machine. These
are:
Programs that can be configured with support for the X
Window System must be configured to do so and must declare
any package dependencies necessary to satisfy their
runtime requirements when using the X Window System. If
such a package is of higher priority than the X packages
on which it depends, it is required that either the
X-specific components be split into a separate package, or
that an alternative version of the package, which includes
X support, be provided, or that the package's priority be
lowered.
Packages that provide an X server that, directly or
indirectly, communicates with real input and display
hardware should declare in their control data that they
provide the virtual package xserver.
Packages that provide a terminal emulator for the X Window
System which meet the criteria listed below should declare
in their control data that they provide the virtual
package x-terminal-emulator. They should also
register themselves as an alternative for
To be an x-terminal-emulator, a program must:
Packages that provide a window manager should declare in
their control data that they provide the virtual package
x-window-manager. They should also register
themselves as an alternative for
If the Maintainer field is modified, then the old
value must be saved in a field named
XSBC-Original-Maintainer. Because it is mandated and
very common, it is not necessary or appropriate to document this
change in
where * is either BUILD for specification of
the build machine or HOST for specification of the
host machine.
If a shell script requires non-SUSv3 features from the shell
interpreter other than those listed above, the appropriate shell
must be specified in the first line of the script (e.g.,
#!/bin/bash) and the package must depend on the package
providing the shell (unless the shell package is marked
"Essential", as in the case of
Packages that provide fonts for the X Window
System
Application defaults files must be installed in the
directory
Customization of programs' X resources may also be
supported with the provision of a file with the same name
as that of the package placed in the
Packages using the X Window System should not be
configured to install files under the
Programs that use GNU
The installation of files into subdirectories
of
Packages should install any relevant files into the
directories
These libraries used to be all symbolic
links. However, with X11R7,
/usr/include/X11 and /usr/lib/X11
are now real directories, and packages
should ship their files here instead
of in /usr/X11R6/{include,lib}/X11.
x11-common (>= 1:7.0.0) is the package
responsible for converting these symlinks into
directories.
Programs that require the non-DFSG-compliant OSF/Motif or
OpenMotif libraries
Both Motif-linked versions are dependent upon non-DFSG-compliant software and thus cannot be uploaded to the main distribution; if the software is itself DFSG-compliant it may be uploaded to the contrib distribution. While known existing versions of Motif permit unlimited redistribution of binaries linked against the library (whether statically or dynamically), it is the package maintainer's responsibility to determine whether this is permitted by the license of the copy of Motif in their possession.
Ubuntu: Packages that provide icons in a subdirectory of
/usr/share/icons must invoke
If
Perl programs and modules should follow the current Perl policy.
The Perl policy can be found in the perl-policy
files in the debian-policy package.
It is also available from the Debian web mirrors at
Please refer to the "Debian Emacs Policy" for details of how to package emacs lisp programs.
The Emacs policy is available in
The permissions on
Each game decides on its own security policy.
Games which require protected, privileged access to high-score files, saved games, etc., may be made set-group-id (mode 2755) and owned by root:games, and use files and directories with appropriate permissions (770 root:games, for example). They must not be made set-user-id, as this causes security problems. (If an attacker can subvert any set-user-id game they can overwrite the executable of any other, causing other players of these games to run a Trojan horse program. With a set-group-id game the attacker only gets access to less important game data, and if they can get at the other players' accounts at all it will take considerably more effort.)
Some packages, for example some fortune cookie programs, are
configured by the upstream authors to install with their
data files or other static information made unreadable so
that they can only be accessed through set-id programs
provided. You should not do this in an Ubuntu package: anyone can
download the
As described in the FHS, binaries of games should be
installed in the directory
You should install manual pages in
Each program, utility, and function should have an associated manual page included in the same package. It is suggested that all configuration files also have a manual page included as well. Manual pages for protocols and other auxiliary things are optional.
If no manual page is available, this is considered as a bug
and should be reported to the Ubuntu Bug Tracking System (the
maintainer of the package is allowed to write this bug report
themselves, if they so desire). Do not close the bug report
until a proper man page is available.
You may forward a complaint about a missing man page to the upstream authors, and mark the bug as forwarded in the Ubuntu bug tracking system. Even though the GNU Project do not in general consider the lack of a man page to be a bug, we do; if they tell you that they don't consider it a bug you should leave the bug in our bug tracking system open anyway.
Manual pages should be installed compressed using gzip -9.
If one man page needs to be accessible via several names it
is better to use a symbolic link than the
Manual pages in locale-specific subdirectories of
A country name (the DE in de_DE) should not be
included in the subdirectory name unless it indicates a
significant difference in the language, as this excludes
speakers of the language in other countries.
Due to limitations in current implementations, all characters
in the manual page source should be representable in the usual
legacy encoding for that language, even if the file is
actually encoded in UTF-8. Safe alternative ways to write many
characters outside that range may be found in
Info documents should be installed in
Your package should call
It is a good idea to specify a section for the location of
your program; this is done with the --section
switch. To determine which section to use, you should look
at
You should remove the entries in the
If
Any additional documentation that comes with the package may
be installed at the discretion of the package maintainer.
Plain text documentation should be installed in the directory
If a package comes with large amounts of documentation which many users of the package will not require you should create a separate binary package to contain it, so that it does not take up disk space on the machines of users who do not need or want it installed.
It is often a good idea to put text information files
(
Packages must not require the existence of any files in
Please note that this does not override the section on
changelog files below, so the file
Former Debian releases placed all additional documentation
in
The unification of Ubuntu documentation is being carried out via HTML.
If your package comes with extensive documentation in a
markup format that can be converted to various other formats
you should if possible ship HTML versions in a binary
package, in the directory
Other formats such as PostScript may be provided at the package maintainer's discretion.
Every package must be accompanied by a verbatim copy of its
copyright and distribution license in the file
In addition, the copyright file must say where the upstream sources (if any) were obtained. It should name the original authors of the package and the Ubuntu maintainer(s) who were involved with its creation.
A copy of the file which will be installed in
Packages distributed under the UCB BSD license, the Apache
license (version 2.0), the Artistic license, the GNU GPL
(version 2 or 3), the GNU LGPL (versions 2, 2.1, or 3), and the
GNU FDL (versions 1.2 or 1.3) should refer to the corresponding
files under
In particular,
You should not use the copyright file as a general
Any examples (configurations, source files, whatever),
should be installed in a directory
If the purpose of a package is to provide examples, then the
example files may be installed into
Packages that are not Debian-native must contain a
compressed copy of the
If an upstream changelog is available, it should be accessible as
All of these files should be installed compressed using gzip -9, as they will become large with time even if they start out small.
If the package has only one changelog which is used both as
the Debian changelog and the upstream one because there is
no separate upstream maintainer then that changelog should
usually be installed as
For details about the format and contents of the Debian changelog file, please see .
These appendices are taken essentially verbatim from the now-deprecated Packaging Manual, version 3.2.1.0. They are the chapters which are likely to be of use to package maintainers and which have not already been included in the policy document itself. Most of these sections are very likely not relevant to policy; they should be treated as documentation for the packaging system. Please note that these appendices are included for convenience, and for historical reasons: they used to be part of policy package, and they have not yet been incorporated into dpkg documentation. However, they still have value, and hence they are presented here.
They have not yet been checked to ensure that they are compatible with the contents of policy, and if there are any contradictions, the version in the main policy document takes precedence. The remaining chapters of the old Packaging Manual have also not been read in detail to ensure that there are not parts which have been left out. Both of these will be done in due course.
Certain parts of the Packaging manual were integrated into the Policy Manual proper, and removed from the appendices. Links have been placed from the old locations to the new ones.
The binary packages are designed for the management of installed executable programs (usually compiled binaries) and their associated data, though source code examples and documentation are provided as part of some packages.
This manual describes the technical aspects of creating Debian
binary packages (
It also documents the interaction between
This manual does not go into detail about the options and usage of the package building and installation tools. It should therefore be read in conjunction with those programs' man pages.
The utility programs which are provided with
It is assumed that the reader is reasonably familiar with the
The Debian version of the FSF's GNU hello program is provided
as an example for people wishing to create Debian
packages. The Debian
The binary package has two main sections. The first part
consists of various control information files and scripts used
by
The second part is an archive containing the files and directories to be installed.
In the future binary packages may also contain other
components, such as checksums and digital signatures. The
format for the archive is described in full in the
All manipulation of binary package files is done by
In order to create a binary package you must make a
directory tree which contains all the files and directories
you want to have in the file system data part of the package.
In Debian-format source packages this directory is usually
They should have the locations (relative to the root of the directory tree you're constructing) ownerships and permissions which you want them to have on the system when they are installed.
With current versions of
You need to add one special directory to the root of the
miniature file system tree you're creating:
The
When you've prepared the package, you should invoke:
This will build the package in
See the man page
The control information portion of a binary package is a
collection of files with names known to
It is possible to put other files in the package control area, but this is not generally a good idea (though they will largely be ignored).
Here is a brief list of the control info files supported by
This is the key description file used by
It is usually generated automatically from information
in the source package by the
These are executable files (usually scripts) which
It is very important to make these scripts idempotent.
See .
The maintainer scripts are guaranteed to run with a
controlling terminal and can interact with the user.
See .
The most important control information file used by
The binary package control files of packages built from
Debian sources are made by a special tool,
The fields in binary package control files are listed in .
A description of the syntax of control files and the purpose of the fields is available in .
See .
The Debian binary packages in the distribution are generated from Debian sources, which are in a special format to assist the easy and automatic building of binaries.
Various tools are provided for manipulating source packages; they pack and unpack sources and help build of binary packages and help manage the distribution of new versions.
They are introduced and typical uses described here; see
For examples of how to construct a Debian source package,
and how to use those utilities that are used by Debian
source packages, please see the
This program is frequently used by hand, and is also
called from package-independent automated building scripts
such as
To unpack a package it is typically invoked with
with the
To create a packed source archive it is typically invoked:
This will create the
See also .
It is usually invoked by hand from the top level of the
built or unbuilt source directory. It may be invoked with
no arguments; useful arguments include:
Do not sign the .changes file or the
source package .dsc file, respectively.
Invoke sign-command instead of finding
gpg or pgp on the
When root privilege is required, invoke the command
root-command. root-command
should invoke its first argument as a command, from
the
Two types of binary-only build and upload - see
This program is usually called from
This is usually done just before the files and directories in the
temporary directory tree where the package is being built have their
permissions and ownerships set and the package is constructed using
It is also necessary for
For a package which generates only one binary package, and
which builds it in
Sources which build several binaries will typically need
something like:
This program is usually called from
Its arguments are executables and shared libraries
They may be specified either in the locations in the
source tree where they are created or in the locations
in the temporary build tree where they are installed
prior to binary package creation.
If some of the found shared libraries should only warrant a Recommends or Suggests, or if some warrant a Pre-Depends, this can be achieved by using the -ddependency-field option before those executable(s). (Each -d option takes effect until the next -d.)
For example, a package that generates an essential part
which requires dependencies, and optional parts that
which only require a recommendation, would separate those
two sets of dependencies into two different fields.
Sources which produce several binary packages with
different shared library dependency requirements can use
the -pvarnameprefix option to override
the default shlibs: prefix (one invocation of
Some packages' uploads need to include files other than the source and binary package files.
It is usually invoked from the binary target of
The section and priority are passed
unchanged into the resulting
This program is usually called by package-independent
automatic building scripts such as
It is usually called in the top level of a built source
tree, and when invoked with no arguments will print out a
straightforward
This program is used internally by
This program can be used manually, but is also invoked by
dpkg-buildpackage or
The source archive scheme described later is intended to allow a Debianised source tree with some associated control information to be reproduced and transported easily. The Debianised source tree is a version of the original program with certain files added for the benefit of the Debianisation process, and with any other changes required made to the rest of the source code and installation scripts.
The extra files created for Debian are in the subdirectory
See .
See .
It is possible to use a different format to the standard one, by providing a parser for the format you wish to use.
In order to have dpkg-parsechangelog run your
parser, you must include a line within the last 40 lines
of your file matching the Perl regular expression:
\schangelog-format:\s+([0-9a-z]+)\W The part in
parentheses should be the name of the format. For
example, you might say:
If such a line exists then dpkg-parsechangelog
will look for the parser as
The parser will be invoked with the changelog open on standard input at the start of the file. It should read the file (it may seek if it wishes) to determine the information required and return the parsed information to standard output in the form of a series of control fields in the standard format. By default it should return information about only the most recent version in the changelog; it should accept a -vversion option to return changes information from all versions present strictly after version, and it should then be an error for version not to be present in the changelog.
The fields are:
If several versions are being returned (due to the use of -v), the urgency value should be of the highest urgency code listed at the start of any of the versions requested followed by the concatenated (space-separated) comments from all the versions requested; the maintainer, version, distribution and date should always be from the most recent version.
For the format of the Changes field see .
If the changelog format which is being parsed always or almost always leaves a blank line between individual change notes these blank lines should be stripped out, so as to make the resulting output compact.
If the changelog format does not contain date or package name information this information should be omitted from the output. The parser should not attempt to synthesize it or find it from other sources.
If the changelog does not have the expected format the parser should exit with a nonzero exit status, rather than trying to muddle through and possibly generating incorrect output.
A changelog parser may not interact with the user at all.
See .
See .
This is the canonical temporary location for the
construction of binary packages by the binary
target. The directory
If several binary packages are generated from the same
source tree it is usual to use several
Whatever
As it exists on the FTP site, a Debian source package consists of three related files. You must have the right versions of all three to be able to use them.
This is a compressed (with gzip -9)
This is a unified context diff (diff -u)
giving the changes which are required to turn the
original source into the Debian source. These changes
may only include editing and creating plain files.
The permissions of files, the targets of symbolic
links and the characteristics of special files or
pipes may not be changed and no files may be removed
or renamed.
All the directories in the diff must exist, except the
The
If there is no original source code - for example, if the
package is specially prepared for Debian or the Debian
maintainer is the same as the upstream maintainer - the
format is slightly different: then there is no diff, and the
tarfile is named
dpkg-source -x is the recommended way to unpack a
Debian source package. However, if it is not available it
is possible to unpack a Debian source archive as follows:
Untar the tarfile, which will create a Rename the
Create the subdirectory Apply the diff using patch -p0. Untar the tarfile again if you want a copy of the original
source code alongside the Debianised version.
It is not possible to generate a valid Debian source archive
without using
The source package may not contain any hard links
The source packaging tools manage the changes between the
original and Debianised source using Adding or removing symbolic links, sockets or pipes. Changing the targets of symbolic links. Creating directories, other than Changes to the contents of binary files.
Removing files, directories or symlinks.
Changed text files which are missing the usual final
newline (either in the original or the modified
source tree).
Changing the permissions of files (other than
Changes which cause
Changes which are not represented, but which are not detected by
The
Many of the tools in the
See .
It is important to note that there are several fields which
are optional as far as
See .
This section now contains only the fields that didn't belong to the Policy manual.
These fields in Packages files give the filename(s) of (the parts of) a package in the distribution directories, relative to the root of the Debian hierarchy. If the package has been split into several parts the parts are all listed in order, separated by spaces.
These fields in
This field in
If a package is not installed or not configured, this
field in
This field in
These are still recognized by
Whether this mechanism is appropriate depends on a number of factors, but basically there are two approaches to any particular configuration file.
The easy method is to ship a best-effort configuration in the
package, and use
The hard method is to build the configuration file from
scratch in the
A package may contain a control area file called conffiles. This file should be a list of filenames of configuration files needing automatic handling, separated by newlines. The filenames should be absolute pathnames, and the files referred to should actually exist in the package.
When a package is upgraded
For each file it checks to see whether the version of the file included in the package is the same as the one that was included in the last version of the package (the one that is being upgraded from); it also compares the version currently installed on the system with the one shipped with the last version.
If neither the user nor the package maintainer has changed the file, it is left alone. If one or the other has changed their version, then the changed version is preferred - i.e., if the user edits their file, but the package maintainer doesn't ship a different version, the user's changes will stay, silently, but if the maintainer ships a new version and the user hasn't edited it the new version will be installed (with an informative message). If both have changed their version the user is prompted about the problem and must resolve the differences themselves.
The comparisons are done by calculating the MD5 message digests of the files, and storing the MD5 of the file as it was included in the most recent version of the package.
When a package is installed for the first time
However, note that
Note that a package should not modify a
For files which contain site-specific information such as
the hostname and networking details and so forth, it is
better to create the file in the package's
This will typically involve examining the state of the rest of the system to determine values and other information, and may involve prompting the user for some information which can't be obtained some other way.
When using this method there are a couple of important issues which should be considered:
If you discover a bug in the program which generates the configuration file, or if the format of the file changes from one version to the next, you will have to arrange for the postinst script to do something sensible - usually this will mean editing the installed configuration file to remove the problem or change the syntax. You will have to do this very carefully, since the user may have changed the file, perhaps to fix the very problem that your script is trying to deal with - you will have to detect these situations and deal with them correctly.
If you do go down this route it's probably a good idea to
make the program that generates the configuration file(s) a
separate program in
When several packages all provide different versions of the same program or file it is useful to have the system select a default, but to allow the system administrator to change it and have their decisions respected.
For example, there are several versions of the
If all the packages involved cooperate, this can be done with
Each package provides its own version under its own name, and
calls
See the man page
If
It is possible to have
This can be used locally to override a package's version of a file, or by one package to override another's version (or provide a wrapper for it).
Before deciding to use a diversion, read to see if you really want a diversion rather than several alternative versions of a program.
There is a diversion list, which is read by
When a package wishes to divert a file from another, it should
call
The postrm has to do the reverse:
Do not attempt to divert a file which is vitally important for
the system's operation - when using