1dpkg-divert(1) dpkg suite dpkg-divert(1)
2
3
4
6 dpkg-divert - override a package's version of a file
7
9 dpkg-divert [option...] command
10
12 dpkg-divert is the utility used to set up and update the list of
13 diversions.
14
15 File diversions are a way of forcing dpkg(1) not to install a file into
16 its location, but to a diverted location. Diversions can be used
17 through the Debian package scripts to move a file away when it causes a
18 conflict. System administrators can also use it to override some
19 package's configuration file, or whenever some files (which aren't
20 marked as “conffiles”) need to be preserved by dpkg, when installing a
21 newer version of a package which contains those files.
22
24 [--add] file
25 Add a diversion for file. The file is currently not renamed, see
26 --rename.
27
28 --remove file
29 Remove a diversion for file. The file is currently not renamed,
30 see --rename.
31
32 --list [glob-pattern]
33 List all diversions, or ones matching glob-pattern.
34
35 --listpackage file
36 Print the name of the package that diverts file (since dpkg
37 1.15.0). Prints LOCAL if file is locally diverted and nothing if
38 file is not diverted.
39
40 --truename file
41 Print the real name for a diverted file.
42
44 --admindir directory
45 Set the administrative directory to directory. Defaults to
46 «/var/lib/dpkg» if DPKG_ADMINDIR has not been set.
47
48 --instdir directory
49 Set the installation directory, which refers to the directory where
50 packages get installed (since dpkg 1.19.2). Defaults to «/» if
51 DPKG_ROOT has not been set.
52
53 --root directory
54 Set the root directory to directory, which sets the installation
55 directory to «directory» and the administrative directory to
56 «directory/var/lib/dpkg» (since dpkg 1.19.2) if DPKG_ROOT has not
57 been set.
58
59 --divert divert-to
60 divert-to is the location where the versions of file, as provided
61 by other packages, will be diverted.
62
63 --local
64 Specifies that all packages' versions of this file are diverted.
65 This means, that there are no exceptions, and whatever package is
66 installed, the file is diverted. This can be used by an admin to
67 install a locally modified version.
68
69 --package package
70 package is the name of a package whose copy of file will not be
71 diverted. i.e. file will be diverted for all packages except
72 package.
73
74 --quiet
75 Quiet mode, i.e. no verbose output.
76
77 --rename
78 Actually move the file aside (or back). dpkg-divert will abort
79 operation in case the destination file already exists. This is the
80 common behavior used for diversions of files from the non-Essential
81 package set (see --no-rename for more details).
82
83 --no-rename
84 Specifies that the file should not be renamed while adding or
85 removing the diversion into the database (since dpkg 1.19.1). This
86 is intended for diversions of files from the Essential package set,
87 where the temporary disappearance of the original file is not
88 acceptable, as it can render the system non-functional. This is
89 the default behavior, but that will change in the dpkg 1.20.x
90 cycle.
91
92 --test
93 Test mode, i.e. don't actually perform any changes, just
94 demonstrate.
95
96 -?, --help
97 Show the usage message and exit.
98
99 --version
100 Show the version and exit.
101
103 0 The requested action was successfully performed.
104
105 2 Fatal or unrecoverable error due to invalid command-line usage, or
106 interactions with the system, such as accesses to the database,
107 memory allocations, etc.
108
110 DPKG_ROOT
111 If set and the --instdir or --root options have not been specified,
112 it will be used as the filesystem root directory (since dpkg
113 1.19.2).
114
115 DPKG_ADMINDIR
116 If set and the --admindir or --root options have not been
117 specified, it will be used as the dpkg data directory.
118
119 DPKG_MAINTSCRIPT_PACKAGE
120 If set and the --local and --package options have not been
121 specified, dpkg-divert will use it as the package name.
122
123 DPKG_COLORS
124 Sets the color mode (since dpkg 1.18.5). The currently accepted
125 values are: auto (default), always and never.
126
128 /var/lib/dpkg/diversions
129 File which contains the current list of diversions of the system.
130 It is located in the dpkg administration directory, along with
131 other files important to dpkg, such as status or available.
132
133 Note: dpkg-divert preserves the old copy of this file, with
134 extension -old, before replacing it with the new one.
135
137 When adding, default is --local and --divert original.distrib. When
138 removing, --package or --local and --divert must match if specified.
139
140 Directories can't be diverted with dpkg-divert.
141
142 Care should be taken when diverting shared libraries, ldconfig(8)
143 creates a symbolic link based on the DT_SONAME field embedded in the
144 library. Because ldconfig doesn't honour diverts (only dpkg does), the
145 symlink may end up pointing at the diverted library, if a diverted
146 library has the same SONAME as the undiverted one.
147
149 To divert all copies of a /usr/bin/example to /usr/bin/example.foo,
150 i.e. directs all packages providing /usr/bin/example to install it as
151 /usr/bin/example.foo, performing the rename if required:
152
153 dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
154
155 To remove that diversion:
156
157 dpkg-divert --rename --remove /usr/bin/example
158
159 To divert any package trying to install /usr/bin/example to
160 /usr/bin/example.foo, except your own wibble package:
161
162 dpkg-divert --package wibble --divert /usr/bin/example.foo \
163 --rename /usr/bin/example
164
165 To remove that diversion:
166
167 dpkg-divert --package wibble --rename --remove /usr/bin/example
168
170 dpkg(1).
171
172
173
1741.21.8 2022-05-25 dpkg-divert(1)