update-alternatives.8 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. .\" update\-alternatives.8
  2. .\" This man page is copyright 1997 Charles Briscoe-Smith
  3. .\" This is free documentation; you can redistribute it and/or modify
  4. .\" it under the terms of the GNU General Public License as published
  5. .\" by the Free Software Foundation; either version 2 of the License, or
  6. .\" (at your option) any later version. There is NO WARRANTY. You can
  7. .\" find the GNU GPL in /usr/share/common-licenses/GPL on any Debian system.
  8. .TH update\-alternatives 8 "2009-04-13" "Debian Project" "dpkg utilities"
  9. .SH NAME
  10. update\-alternatives \- maintain symbolic links determining default commands
  11. .
  12. .SH SYNOPSIS
  13. .B update\-alternatives
  14. .RI [ options ]
  15. .I command
  16. .
  17. .SH DESCRIPTION
  18. .B update\-alternatives
  19. creates, removes, maintains and displays information about the symbolic
  20. links comprising the Debian alternatives system.
  21. .PP
  22. It is possible for several programs fulfilling the same or similar
  23. functions to be installed on a single system at the same time.
  24. For example, many systems have several text editors installed at once.
  25. This gives choice to the users of a system, allowing each to use a
  26. different editor, if desired, but makes it difficult for a program
  27. to make a good choice for an editor to invoke if the
  28. user has not specified a particular preference.
  29. .PP
  30. Debian's alternatives system aims to solve this problem.
  31. A generic name in the filesystem is
  32. shared by all files providing interchangeable functionality.
  33. The alternatives system and the system administrator
  34. together determine which actual file is referenced by this generic name.
  35. For example, if the text editors
  36. .BR ed (1)
  37. and
  38. .BR nvi (1)
  39. are both installed on the system, the alternatives system will cause
  40. the generic name
  41. .I /usr/bin/editor
  42. to refer to
  43. .I /usr/bin/nvi
  44. by default. The system administrator can override this and cause
  45. it
  46. to refer to
  47. .I /usr/bin/ed
  48. instead,
  49. and the alternatives system will not alter this setting until explicitly
  50. requested to do so.
  51. .PP
  52. The generic name is not a direct symbolic link to the selected alternative.
  53. Instead, it is a symbolic link to a name in the
  54. .I alternatives
  55. .IR directory ,
  56. which in turn is a symbolic link to the actual file referenced.
  57. This is done so that the system administrator's changes can be confined
  58. within the
  59. .I /etc
  60. directory: the FHS (q.v.) gives reasons why this is a Good Thing.
  61. .PP
  62. When each package
  63. providing a file with a particular functionality is
  64. installed, changed or removed,
  65. .B update\-alternatives
  66. is called to update information about that file in the alternatives system.
  67. .B update\-alternatives
  68. is usually called from the
  69. .B postinst
  70. (configure) or
  71. .B prerm
  72. (install) scripts in Debian packages.
  73. .PP
  74. It is often useful for a number of alternatives to be synchronised,
  75. so that they are changed as a group; for example, when several versions
  76. of the
  77. .BR vi (1)
  78. editor are installed, the man page referenced by
  79. .I /usr/share/man/man1/vi.1
  80. should correspond to the executable referenced by
  81. .IR /usr/bin/vi .
  82. .B update\-alternatives
  83. handles this by means of
  84. .I master
  85. and
  86. .I slave
  87. links; when the master is changed, any associated slaves are changed
  88. too.
  89. A master link and its associated slaves make up a
  90. .I link
  91. .IR group .
  92. .PP
  93. Each link group is, at any given time,
  94. in one of two modes: automatic or manual.
  95. When a group is in automatic mode, the alternatives system will
  96. automatically decide, as packages are installed and removed,
  97. whether and how to update the links.
  98. In manual mode, the alternatives system will retain the choice of
  99. the administrator and avoid changing the links (except when something is
  100. broken).
  101. .PP
  102. Link groups are in automatic mode when they are first introduced to
  103. the system.
  104. If the system administrator makes changes to the system's
  105. automatic settings,
  106. this will be noticed the next time
  107. .B update\-alternatives
  108. is run on the changed link's group,
  109. and the group will automatically be switched to manual mode.
  110. .PP
  111. Each alternative has a
  112. .I priority
  113. associated with it.
  114. When a link group is in automatic mode,
  115. the alternatives pointed to by members of the group
  116. will be those which have the highest priority.
  117. .PP
  118. When using the
  119. .I \-\-config
  120. option,
  121. .B update\-alternatives
  122. will list all of the choices for the link group
  123. of which given
  124. .I name
  125. is the master alternative name. The current choice is marked with a '*'.
  126. You will then be prompted for your choice regarding this link group.
  127. Depending on the choice made, the link group might no longer be in
  128. .I auto
  129. mode. You will need to use the
  130. .I \-\-auto
  131. option in order to return to the automatic mode (or you can rerun
  132. .I \-\-config
  133. and select the entry marked as automatic).
  134. .PP
  135. If you want to configure non-interactively you can use the
  136. .I \-\-set
  137. option instead (see below).
  138. .PP
  139. Different packages providing the same file need to do so
  140. .BR cooperatively .
  141. In other words, the usage of
  142. .B update\-alternatives
  143. is
  144. .B mandatory
  145. for all involved packages in such case. It is not possible to
  146. override some file in a package that does not employ the
  147. .B update\-alternatives
  148. mechanism.
  149. .
  150. .SH TERMINOLOGY
  151. Since the activities of
  152. .B update\-alternatives
  153. are quite involved, some specific terms will help to explain its
  154. operation.
  155. .TP
  156. generic name (or alternative link)
  157. A name, like
  158. .IR /usr/bin/editor ,
  159. which refers, via the alternatives system, to one of a number of
  160. files of similar function.
  161. .TP
  162. alternative name
  163. The name of a symbolic link in the alternatives directory.
  164. .TP
  165. alternative (or alternative path)
  166. The name of a specific file in the filesystem, which may be made
  167. accessible via a generic name using the alternatives system.
  168. .TP
  169. alternatives directory
  170. A directory, by default
  171. .IR /etc/alternatives ,
  172. containing the symlinks.
  173. .TP
  174. administrative directory
  175. A directory, by default
  176. .IR /var/lib/dpkg/alternatives ,
  177. containing
  178. .BR update\-alternatives '
  179. state information.
  180. .TP
  181. link group
  182. A set of related symlinks, intended to be updated as a group.
  183. .TP
  184. master link
  185. The alternative link in a link group which determines how the other links in the
  186. group are configured.
  187. .TP
  188. slave link
  189. An alternative link in a link group which is controlled by the setting of
  190. the master link.
  191. .TP
  192. automatic mode
  193. When a link group is in automatic mode,
  194. the alternatives system ensures that the links in the group
  195. point to the highest priority alternative
  196. appropriate for the group.
  197. .TP
  198. manual mode
  199. When a link group is in manual mode,
  200. the alternatives system will not make any changes
  201. to the system administrator's settings.
  202. .
  203. .SH COMMANDS
  204. .TP
  205. \fB\-\-install\fR \fIlink name path priority\fR [\fB\-\-slave\fR \fIlink name path\fR]...
  206. Add a group of alternatives to the system.
  207. .I link
  208. is the generic name for the master link,
  209. .I name
  210. is the name of its symlink in the alternatives directory, and
  211. .I path
  212. is the alternative being introduced for the master link.
  213. The arguments after \fB\-\-slave\fR are the generic name, symlink name in the
  214. alternatives directory and the alternative path for a slave link.
  215. Zero or more
  216. .B \-\-slave
  217. options, each followed by three arguments,
  218. may be specified. Note that the master alternative must exist or the call
  219. will fail. However if a slave alternative doesn't exist, the corresponding
  220. slave alternative link will simply not be installed (a warning will still
  221. be displayed). If some real file is installed where an alternative link
  222. has to be installed, it is kept unless \fB\-\-force\fR is used.
  223. .IP
  224. If the alternative name specified exists already
  225. in the alternatives system's records,
  226. the information supplied will be added as a new
  227. set of alternatives for the group.
  228. Otherwise, a new group, set to automatic mode,
  229. will be added with this information.
  230. If the group is in automatic mode,
  231. and the newly added alternatives' priority is higher than
  232. any other installed alternatives for this group,
  233. the symlinks will be updated to point to the newly added alternatives.
  234. .TP
  235. \fB\-\-set\fR \fIname path\fR
  236. Set the program
  237. .I path
  238. as alternative for
  239. .I name.
  240. This is equivalent to
  241. .IB \-\-config
  242. but is non-interactive and thus scriptable.
  243. .TP
  244. \fB\-\-remove\fR \fIname path\fR
  245. Remove an alternative and all of its associated slave links.
  246. .I name
  247. is a name in the alternatives directory, and
  248. .I path
  249. is an absolute filename to which
  250. .I name
  251. could be linked. If
  252. .I name
  253. is indeed linked to
  254. .IR path ,
  255. .I name
  256. will be updated to point to another appropriate alternative
  257. (and the group is put back in automatic mode), or
  258. removed if there is no such alternative left.
  259. Associated slave links will be updated or removed, correspondingly.
  260. If the link is not currently pointing to
  261. .IR path ,
  262. no links are changed;
  263. only the information about the alternative is removed.
  264. .TP
  265. \fB\-\-remove\-all\fR \fIname\fR
  266. Remove all alternatives and all of their associated slave links.
  267. .I name
  268. is a name in the alternatives directory.
  269. .TP
  270. .B \-\-all
  271. Call \fB\-\-config\fP on all alternatives. It can be usefully combined with
  272. \fB\-\-skip\-auto\fP to review and configure all alternatives which are
  273. not configured in automatic mode. Broken alternatives are also displayed.
  274. Thus a simple way to fix all broken alternatives is to call
  275. \fByes \[aq]\[aq] | update-alternatives \-\-force \-\-all\fR.
  276. .TP
  277. \fB\-\-auto\fR \fIname\fR
  278. Switch the link group behind the alternative for
  279. .I name
  280. to automatic mode.
  281. In the process, the master symlink and its slaves are updated
  282. to point to the highest priority installed alternatives.
  283. .TP
  284. \fB\-\-display\fR \fIname\fR
  285. Display information about the link group.
  286. Information displayed includes the group's mode
  287. (auto or manual),
  288. which alternative the master link currently points to,
  289. what other alternatives are available
  290. (and their corresponding slave alternatives),
  291. and the highest priority alternative currently installed.
  292. .TP
  293. \fB\-\-get\-selections\fR
  294. List all master alternative names (those controlling a link group)
  295. and their status. Each line contains up to 3 fields (separated by
  296. one or more spaces). The first field is the alternative name, the second
  297. one is the status (either "auto" or "manual"), and the last one contains
  298. the current choice in the alternative (beware: it's a filename and thus
  299. might contain spaces).
  300. .TP
  301. \fB\-\-set\-selections\fR
  302. Read configuration of alternatives on standard input in the format
  303. generated by \fBupdate-alternatives \-\-get\-selections\fR and reconfigure
  304. them accordingly.
  305. .TP
  306. \fB\-\-query\fR \fIname\fR
  307. Display information about the link group
  308. like \-\-display does, but in a machine parseable way
  309. (see section \fBQUERY FORMAT\fR below).
  310. .TP
  311. \fB\-\-list\fR \fIname\fR
  312. Display all targets of the link group.
  313. .TP
  314. \fB\-\-config\fR \fIname\fR
  315. Show available alternatives for a link group and allow the user to
  316. interactively select which one to use. The link group is updated.
  317. .TP
  318. .B \-\-help
  319. Show the usage message and exit.
  320. .TP
  321. .B \-\-version
  322. Show the version and exit.
  323. .
  324. .SH OPTIONS
  325. .TP
  326. .BI \-\-altdir " directory"
  327. Specifies the alternatives directory, when this is to be
  328. different from the default.
  329. .TP
  330. .BI \-\-admindir " directory"
  331. Specifies the administrative directory, when this is to be
  332. different from the default.
  333. .TP
  334. .BI \-\-log " file"
  335. Specifies the log file, when this is to be different from the default
  336. (/var/log/dpkg.log).
  337. .TP
  338. .BI \-\-force
  339. Let \fBupdate-alternatives\fR replace any real file that is installed
  340. where an alternative link has to be installed.
  341. .TP
  342. .BI \-\-skip\-auto
  343. Skip configuration prompt for alternatives which are properly configured
  344. in automatic mode. This option is only relevant with \fB\-\-config\fR or
  345. \fB\-\-all\fR.
  346. .TP
  347. .B \-\-verbose
  348. Generate more comments about what
  349. .B update\-alternatives
  350. is doing.
  351. .TP
  352. .B \-\-quiet
  353. Don't generate any comments unless errors occur.
  354. .
  355. .SH FILES
  356. .TP
  357. .I /etc/alternatives/
  358. The default alternatives directory.
  359. Can be overridden by the
  360. .B \-\-altdir
  361. option.
  362. .TP
  363. .I /var/lib/dpkg/alternatives/
  364. The default administration directory.
  365. Can be overridden by the
  366. .B \-\-admindir
  367. option.
  368. .
  369. .SH "EXIT STATUS"
  370. .IP 0
  371. The requested action was successfully performed.
  372. .IP 2
  373. Problems were encountered whilst parsing the command line
  374. or performing the action.
  375. .
  376. .SH "QUERY FORMAT"
  377. The \fBupdate\-alternatives\fP \fI\-\-query\fP format is using an
  378. RFC822-like flat format. It's made of \fIn\fP + 1 blocks where \fIn\fP is
  379. the number of alternatives available in the queried link group. The first
  380. block contains the following fields:
  381. .TP
  382. .BR Link: " <link>"
  383. The generic name of the alternative.
  384. .TP
  385. .BR Status: " <status>"
  386. The status of the alternative (\fBauto\fR or \fBmanual\fR).
  387. .TP
  388. .BR Best: " <best choice>"
  389. The path of the best alternative for this link group. Not present if
  390. there is no alternatives available.
  391. .TP
  392. .BR Value: " <currently selected alternative> "
  393. The path of the currently selected alternative. It can also take the magic
  394. value \fBnone\fR. It is used if the link doesn't exist.
  395. .TP
  396. .TP
  397. The other blocks describe the available alternatives in the queried link group:
  398. .TP
  399. .BR Alternative: " <path of this alternative>"
  400. Path to this block's alternative.
  401. .TP
  402. .BR Priority: " <priority value>"
  403. Value of the priority of this alternative.
  404. .TP
  405. .BR Slaves: " <list of slaves>"
  406. When this header is present, the \fBnext\fR lines hold all slave alternatives
  407. associated to the master link of the alternative. There is one slave per
  408. line. Each line contains one space, the generic name of the slave
  409. alternative, another space, and the path to the slave alternative.
  410. .
  411. .TP
  412. .BR Example
  413. .nf
  414. $ update\-alternatives \-\-query editor
  415. Link: editor
  416. Status: auto
  417. Best: /usr/bin/vim.gtk
  418. Value: /usr/bin/vim.gtk
  419. Alternative: /bin/ed
  420. Priority: \-100
  421. Slaves:
  422. editor.1.gz /usr/share/man/man1/ed.1.gz
  423. Alternative: /usr/bin/vim.gtk
  424. Priority: 50
  425. Slaves:
  426. editor.1.gz /usr/share/man/man1/vim.1.gz
  427. editor.ru.1.gz /usr/share/man/ru/man1/vim.1.gz
  428. editor.pl.ISO8859-2.1.gz /usr/share/man/pl.ISO8859-2/man1/vim.1.gz
  429. editor.it.ISO8859-1.1.gz /usr/share/man/it.ISO8859-1/man1/vim.1.gz
  430. editor.pl.UTF-8.1.gz /usr/share/man/pl.UTF-8/man1/vim.1.gz
  431. editor.it.1.gz /usr/share/man/it/man1/vim.1.gz
  432. editor.fr.UTF-8.1.gz /usr/share/man/fr.UTF-8/man1/vim.1.gz
  433. editor.fr.1.gz /usr/share/man/fr/man1/vim.1.gz
  434. editor.it.UTF-8.1.gz /usr/share/man/it.UTF-8/man1/vim.1.gz
  435. editor.pl.1.gz /usr/share/man/pl/man1/vim.1.gz
  436. editor.fr.ISO8859-1.1.gz /usr/share/man/fr.ISO8859-1/man1/vim.1.gz
  437. .fi
  438. .
  439. .SH DIAGNOSTICS
  440. With \fI--verbose\fR
  441. .B update\-alternatives
  442. chatters incessantly about its activities on its standard output channel.
  443. If problems occur,
  444. .B update\-alternatives
  445. outputs error messages on its standard error channel and
  446. returns an exit status of 2.
  447. These diagnostics should be self-explanatory;
  448. if you do not find them so, please report this as a bug.
  449. .
  450. .SH EXAMPLES
  451. There are several packages which provide a text editor compatible
  452. with \fBvi\fP, for example \fBnvi\fP and \fBvim\fP. Which one is used
  453. is controlled by the link group \fBvi\fP, which includes links for the
  454. program itself and the associated manpage.
  455. .PP
  456. To display the available packages which provide \fBvi\fP and the current
  457. setting for it, use the \fI\-\-display\fP action:
  458. .RS
  459. .PP
  460. .B update\-alternatives \-\-display vi
  461. .RE
  462. .PP
  463. To choose a particular \fBvi\fP implementation, use this command as root
  464. and then select a number from the list:
  465. .RS
  466. .PP
  467. .B update\-alternatives \-\-config vi
  468. .RE
  469. .PP
  470. To go back to having the \fBvi\fP implementation chosen automatically, do
  471. this as root:
  472. .RS
  473. .PP
  474. .B update\-alternatives \-\-auto vi
  475. .RE
  476. .
  477. .SH BUGS
  478. If you find a bug, please report it using the Debian bug-tracking system.
  479. .PP
  480. If you find any discrepancy between the operation of
  481. .B update\-alternatives
  482. and this manual page, it is a bug,
  483. either in the implementation or the documentation; please report it.
  484. .
  485. .SH AUTHORS
  486. Copyright \(co 1995 Ian Jackson
  487. .br
  488. Copyright \(co 2009 Rapha\[:e]l Hertzog
  489. .sp
  490. This is free software; see the GNU General Public Licence version 2 or
  491. later for copying conditions. There is NO WARRANTY.
  492. .PP
  493. This manual page is copyright 1997,1998 Charles Briscoe-Smith and
  494. others.
  495. .sp
  496. This is free documentation; see the GNU General Public Licence version 2 or
  497. later for copying conditions. There is NO WARRANTY.
  498. .
  499. .SH "SEE ALSO"
  500. .BR ln (1),
  501. FHS, the Filesystem Hierarchy Standard.