/usr/share/debian-reference/ch03.en.html is in debian-reference-en 2.72.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Chapter 3. The system initialization</title>
<link rel="stylesheet" type="text/css" href="debian-reference.css"/>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="home" href="index.en.html" title="Debian Reference"/>
<link rel="up" href="index.en.html" title="Debian Reference"/>
<link rel="prev" href="ch02.en.html" title="Chapter 2. Debian package management"/>
<link rel="next" href="ch04.en.html" title="Chapter 4. Authentication"/>
</head>
<body>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 3. The system initialization</th>
</tr>
<tr>
<td align="left"><a accesskey="p" href="ch02.en.html"><img src="images/prev.png" alt="Prev"/></a> </td>
<th width="60%" align="center"> </th>
<td align="right"> <a accesskey="n" href="ch04.en.html"><img src="images/next.png" alt="Next"/></a></td>
</tr>
</table>
<hr/>
</div>
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title"><a id="_the_system_initialization"/>Chapter 3. The system initialization</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<strong>Table of Contents</strong>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="ch03.en.html#_an_overview_of_the_boot_strap_process">3.1. An overview of the boot strap process</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch03.en.html#_stage_1_the_bios">3.1.1. Stage 1: the BIOS</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_stage_2_the_boot_loader">3.1.2. Stage 2: the boot loader</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_stage_3_the_mini_debian_system">3.1.3. Stage 3: the mini-Debian system</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_stage_4_the_normal_debian_system">3.1.4. Stage 4: the normal Debian system</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch03.en.html#_systemd_init">3.2. Systemd init</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch03.en.html#_the_hostname">3.2.1. The hostname</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_the_filesystem">3.2.2. The filesystem</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_network_interface_initialization">3.2.3. Network interface initialization</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_the_kernel_message">3.2.4. The kernel message</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_the_system_message">3.2.5. The system message</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_system_management_under_systemd">3.2.6. System management under systemd</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch03.en.html#_customizing_systemd">3.2.7. Customizing systemd</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch03.en.html#_the_udev_system">3.3. The udev system</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch03.en.html#_the_kernel_module_initialization">3.3.1. The kernel module initialization</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<p>It is wise for you as the system administrator to know roughly how the Debian system is started and configured. Although the exact details are in the source files of the packages installed and their documentations, it is a bit overwhelming for most of us.</p>
<p>I did my best to provide a quick overview of the key points of the Debian system and their configuration for your reference, based on the current and previous knowledge of mine and others. Since the Debian system is a moving target, the situation over the system may have been changed. Before making any changes to the system, you should refer to the latest documentation for each package.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p><span class="citerefentry"><span class="refentrytitle">bootup</span>(7)</span> describes the system bootup process based on <code class="literal">systemd</code> . (Recent Debian)</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p><span class="citerefentry"><span class="refentrytitle">boot</span>(7)</span> describes the system bootup process based on UNIX System V Release 4. (Older Debian)</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_an_overview_of_the_boot_strap_process"/>3.1. An overview of the boot strap process</h2>
</div>
</div>
</div>
<p>The computer system undergoes several phases of <a class="ulink" href="http://en.wikipedia.org/wiki/Booting">boot strap processes</a> from the power-on event until it offers the fully functional operating system (OS) to the user.</p>
<p>For simplicity, I limit discussion to the typical PC platform with the default installation.</p>
<p>The typical boot strap process is like a four-stage rocket. Each stage rocket hands over the system control to the next stage one.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
<a class="xref" href="ch03.en.html#_stage_1_the_bios" title="3.1.1. Stage 1: the BIOS">Section 3.1.1, “Stage 1: the BIOS”</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.1.2. Stage 2: the boot loader">Section 3.1.2, “Stage 2: the boot loader”</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="ch03.en.html#_stage_3_the_mini_debian_system" title="3.1.3. Stage 3: the mini-Debian system">Section 3.1.3, “Stage 3: the mini-Debian system”</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="ch03.en.html#_stage_4_the_normal_debian_system" title="3.1.4. Stage 4: the normal Debian system">Section 3.1.4, “Stage 4: the normal Debian system”</a>
</p>
</li>
</ul>
</div>
<p>Of course, these can be configured differently. For example, if you compiled your own kernel, you may be skipping the step with the mini-Debian system. So please do not assume this is the case for your system until you check it yourself.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>For non-legacy PC platform such as the SUN or the Macintosh system, the BIOS on ROM and the partition on the disk may be quite different (<a class="xref" href="ch09.en.html#_disk_partition_configuration" title="9.5.2. Disk partition configuration">Section 9.5.2, “Disk partition configuration”</a>). Please seek the platform specific documentations elsewhere for such a case.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_stage_1_the_bios"/>3.1.1. Stage 1: the BIOS</h3>
</div>
</div>
</div>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/BIOS">BIOS</a> is the 1st stage of the boot process which is started by the power-on event. The <a class="ulink" href="http://en.wikipedia.org/wiki/BIOS">BIOS</a> residing on the <a class="ulink" href="http://en.wikipedia.org/wiki/Read-only_memory">read only memory (ROM)</a> is executed from the particular memory address to which the program counter of CPU is initialized by the power-on event.</p>
<p>This BIOS performs the basic initialization of the hardware (<a class="ulink" href="http://en.wikipedia.org/wiki/Power-on_self-test">POST: power on self test</a>) and hands the system control to the next step which you provide. The BIOS is usually provided with the hardware.</p>
<p>The BIOS startup screen usually indicates what key(s) to press to enter the BIOS setup screen to configure the BIOS behavior. Popular keys used are F1, F2, F10, Esc, Ins, and Del. If your BIOS startup screen is hidden by a nice graphics screen, you may press some keys such as Esc to disable this. These keys are highly dependent on the hardware.</p>
<p>The hardware location and the priority of the code started by the BIOS can be selected from the BIOS setup screen. Typically, the first few sectors of the first found selected device (hard disk, floppy disk, CD-ROM, …) are loaded to the memory and this initial code is executed. This initial code can be any one of the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
The boot loader code
</p>
</li>
<li class="listitem">
<p>
The kernel code of the stepping stone OS such as <a class="ulink" href="http://www.freedos.org/">FreeDOS</a>
</p>
</li>
<li class="listitem">
<p>
The kernel code of the target OS if it fits in this small space
</p>
</li>
</ul>
</div>
<p>Typically, the system is booted from the specified partition of the primary hard disk partition. First 2 sectors of the hard disk on legacy PC contain the <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record">master boot record (MBR)</a>. The disk partition information including the boot selection is recorded at the end of this MBR. The first boot loader code executed from the BIOS occupies the rest of this MBR.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_stage_2_the_boot_loader"/>3.1.2. Stage 2: the boot loader</h3>
</div>
</div>
</div>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Boot_loader">boot loader</a> is the 2nd stage of the boot process which is started by the BIOS. It loads the system kernel image and the <a class="ulink" href="http://en.wikipedia.org/wiki/Initrd">initrd</a> image to the memory and hands control over to them. This initrd image is the root filesystem image and its support depends on the bootloader used.</p>
<p>The Debian system normally uses the Linux kernel as the default system kernel. The initrd image for the current 2.6/3.x Linux kernel is technically the initramfs (initial RAM filesystem) image. The initramfs image is a gzipped cpio archive of files in the root filesystem.</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Warning]" src="images/warning.png"/>
</td>
<th align="left">Warning</th>
</tr>
<tr>
<td align="left" valign="top">
<p>The above is no longer true with the new multi-segment initramfs. See <a class="ulink" href="https://bugs.debian.org/790100">Bug #790100</a>.</p>
</td>
</tr>
</table>
</div>
<p>The default install of the Debian system places first-stage GRUB boot loader code into the <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record">MBR</a> for the PC platform. There are many boot loaders and configuration options available.</p>
<div class="table">
<a id="listofbootloaders"/>
<p class="title">
<strong>Table 3.1. List of boot loaders</strong>
</p>
<div class="table-contents">
<table class="table" summary="List of boot loaders" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
package
</th>
<th style="text-align: left">
popcon
</th>
<th style="text-align: left">
size
</th>
<th style="text-align: left">
initrd
</th>
<th style="text-align: left">
bootloader
</th>
<th style="text-align: left">
description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/grub-legacy">
grub-legacy
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=grub-legacy">V:0, I:2</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/grub-legacy.html">710</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
<a class="ulink" href="http://en.wikipedia.org/wiki/GNU_GRUB">GRUB Legacy</a>
</td>
<td style="text-align: left">
This is smart enough to understand disk partitions and filesystems such as vfat, ext3, ….
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/grub-pc">
grub-pc
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=grub-pc">V:29, I:849</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/grub-pc.html">584</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
<a class="ulink" href="http://en.wikipedia.org/wiki/GNU_GRUB">GRUB 2</a>
</td>
<td style="text-align: left">
This is smart enough to understand disk partitions and filesystems such as vfat, ext4, …. (default)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/grub-rescue-pc">
grub-rescue-pc
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=grub-rescue-pc">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/grub-rescue-pc.html">6294</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
<a class="ulink" href="http://en.wikipedia.org/wiki/GNU_GRUB">GRUB 2</a>
</td>
<td style="text-align: left">
This is GRUB 2 bootable rescue images (CD and floppy) (PC/BIOS version)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/lilo">
lilo
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=lilo">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/lilo.html">693</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
<a class="ulink" href="http://en.wikipedia.org/wiki/LILO_(boot_loader)">Lilo</a>
</td>
<td style="text-align: left">
This relies on the sector locations of data on the hard disk. (Old)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/syslinux">
syslinux
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=syslinux">V:5, I:59</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/syslinux.html">299</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
<a class="ulink" href="http://en.wikipedia.org/wiki/SYSLINUX">Isolinux</a>
</td>
<td style="text-align: left">
This understands the ISO9660 filesystem. This is used by the boot CD.
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/syslinux">
syslinux
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=syslinux">V:5, I:59</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/syslinux.html">299</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
<a class="ulink" href="http://en.wikipedia.org/wiki/SYSLINUX">Syslinux</a>
</td>
<td style="text-align: left">
This understands the <a class="ulink" href="http://en.wikipedia.org/wiki/File_Allocation_Table">MSDOS filesystem (FAT)</a>. This is used by the boot floppy.
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/loadlin">
loadlin
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=loadlin">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/loadlin.html">84</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Loadlin">Loadlin</a>
</td>
<td style="text-align: left">
New system is started from the FreeDOS/MSDOS system.
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/mbr">
mbr
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=mbr">V:0, I:10</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/m/mbr.html">50</a>
</td>
<td style="text-align: left">
Not supported
</td>
<td style="text-align: left">
<a class="ulink" href="http://www.chiark.greenend.org.uk/~neilt/">MBR by Neil Turton</a>
</td>
<td style="text-align: left">
This is free software which substitutes MSDOS <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record">MBR</a>. This only understands disk partitions.
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Warning]" src="images/warning.png"/>
</td>
<th align="left">Warning</th>
</tr>
<tr>
<td align="left" valign="top">
<p>Do not play with boot loaders without having bootable rescue media (USB memory stick, CD or floppy) created from images in the <code class="literal">grub-rescue-pc</code> package. It makes you boot your system even without functioning bootloader on the hard disk.</p>
</td>
</tr>
</table>
</div>
<p>For GRUB Legacy, the menu configuration file is located at "<code class="literal">/boot/grub/menu.lst</code>". For example, it has entries as the following.</p>
<pre class="screen">title Debian GNU/Linux
root (hd0,2)
kernel /vmlinuz root=/dev/hda3 ro
initrd /initrd.img</pre>
<p>For GRUB 2, the menu configuration file is located at "<code class="literal">/boot/grub/grub.cfg</code>". It is automatically generated by "<code class="literal">/usr/sbin/update-grub</code>" using templates from "<code class="literal">/etc/grub.d/*</code>" and settings from "<code class="literal">/etc/default/grub</code>". For example, it has entries as the following.</p>
<pre class="screen">menuentry "Debian GNU/Linux" {
set root=(hd0,3)
linux /vmlinuz root=/dev/hda3
initrd /initrd.img
}</pre>
<p>For these examples, these GRUB parameters mean the following.</p>
<div class="table">
<a id="themeaningofgrubparameters"/>
<p class="title">
<strong>Table 3.2. The meaning of GRUB parameters</strong>
</p>
<div class="table-contents">
<table class="table" summary="The meaning of GRUB parameters" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
GRUB parameter
</th>
<th style="text-align: left">
meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<code class="literal">root</code>
</td>
<td style="text-align: left">
use 3rd partition on the primary disk by setting it as "<code class="literal">(hd0,2)</code>" in GRUB legacy or as "<code class="literal">(hd0,3)</code>" in GRUB 2
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">kernel</code>
</td>
<td style="text-align: left">
use kernel located at "<code class="literal">/vmlinuz</code>" with kernel parameter: "<code class="literal">root=/dev/hda3 ro</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">initrd</code>
</td>
<td style="text-align: left">
use <a class="ulink" href="http://en.wikipedia.org/wiki/Initrd">initrd/initramfs</a> image located at "<code class="literal">/initrd.img</code>"
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>The value of the partition number used by GRUB legacy program is one less than normal one used by Linux kernel and utility tools. GRUB 2 program fixes this problem.</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier">UUID</a> (see <a class="xref" href="ch09.en.html#_accessing_partition_using_uuid" title="9.5.3. Accessing partition using UUID">Section 9.5.3, “Accessing partition using UUID”</a>) may be used to identify a block special device instead of its file name such as "<code class="literal">/dev/hda3</code>", e.g."<code class="literal">root=UUID=81b289d5-4341-4003-9602-e254a17ac232 ro</code>".</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>If <a class="ulink" href="http://en.wikipedia.org/wiki/GNU_GRUB">GRUB</a> is used, the kernel boot parameter is set in <code class="literal">/boot/grub/grub.cfg</code>. On Debian system, you should not edit <code class="literal">/boot/grub/grub.cfg</code> directly. You should edit the <code class="literal">GRUB_CMDLINE_LINUX_DEFAULT</code> value in <code class="literal">/etc/default/grub</code> and run <span class="citerefentry"><span class="refentrytitle">update-grub</span>(8)</span> to update <code class="literal">/boot/grub/grub.cfg</code>.</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>You can start a boot loader from another boot loader using techniques called <a class="ulink" href="http://en.wikipedia.org/wiki/Chain_loading">chain loading</a>.</p>
</td>
</tr>
</table>
</div>
<p>See "<code class="literal">info grub</code>" and <span class="citerefentry"><span class="refentrytitle">grub-install</span>(8)</span>.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_stage_3_the_mini_debian_system"/>3.1.3. Stage 3: the mini-Debian system</h3>
</div>
</div>
</div>
<p>The mini-Debian system is the 3rd stage of the boot process which is started by the boot loader. It runs the system kernel with its root filesystem on the memory. This is an optional preparatory stage of the boot process.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>The term "the mini-Debian system" is coined by the author to describe this 3rd stage boot process for this document. This system is commonly referred as the <a class="ulink" href="http://en.wikipedia.org/wiki/Initrd">initrd</a> or initramfs system. Similar system on the memory is used by <a class="ulink" href="https://www.debian.org/devel/debian-installer/">the Debian Installer</a>.</p>
</td>
</tr>
</table>
</div>
<p>The "<code class="literal">/init</code>" program is executed as the first program in this root filesystem on the memory. It is a program which initializes the kernel in user space and hands control over to the next stage. This mini-Debian system offers flexibility to the boot process such as adding kernel modules before the main boot process or mounting the root filesystem as an encrypted one.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
The "<code class="literal">/init</code>" program is a shell script program if initramfs was created by <code class="literal">initramfs-tools</code>.
<span class="strong"><strong> You can interrupt this part of the boot process to gain root shell by providing "<code class="literal">break=init</code>" etc. to the kernel boot parameter. See the "<code class="literal">/init</code>" script for more break conditions. This shell environment is sophisticated enough to make a good inspection of your machine's hardware.
</strong></span> Commands available in this mini-Debian system are stripped down ones and mainly provided by a GNU tool called <span class="citerefentry"><span class="refentrytitle">busybox</span>(1)</span>.
</p>
</li>
<li class="listitem">
<p>
The "<code class="literal">/init</code>" program is a binary <code class="literal">systemd</code> program if initramfs was created by <code class="literal">dracut</code>.
** Commands available in this mini-Debian system are stripped down <span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span> environment.
</p>
</li>
</ul>
</div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Caution]" src="images/caution.png"/>
</td>
<th align="left">Caution</th>
</tr>
<tr>
<td align="left" valign="top">
<p>You need to use "<code class="literal">-n</code>" option for <code class="literal">mount</code> command when you are on the readonly root filesystem.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_stage_4_the_normal_debian_system"/>3.1.4. Stage 4: the normal Debian system</h3>
</div>
</div>
</div>
<p>The normal Debian system is the 4th stage of the boot process which is started by the mini-Debian system. The system kernel for the mini-Debian system continues to run in this environment. The root filesystem is switched from the one on the memory to the one on the real hard disk filesystem.</p>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Init">init</a> program is executed as the first program with PID=1 to perform the main boot process of starting many programs. The default file path for the init program is "<code class="literal">/sbin/init</code>" but it can be changed by the kernel boot parameter as "<code class="literal">init=/path/to/init_program</code>".</p>
<p>The default init program has been changing:</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Debian before <code class="literal">squeeze</code> uses the simple <a class="ulink" href="http://en.wikipedia.org/wiki/UNIX_System_V">SysV</a>-style init.
</p>
</li>
<li class="listitem">
<p>
Debian <code class="literal">wheezy</code> improves the SysV-style init by ordering the boot sequence with LSB header and starting boot scripts in parallel.
</p>
</li>
<li class="listitem">
<p>
Debian <code class="literal">jessie</code> switches its default init to the <a class="ulink" href="http://en.wikipedia.org/wiki/Systemd">systemd</a> for the event-driven and parallel initialization.
</p>
</li>
</ul>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>The actual init command on your system can be verified by the "<code class="literal">ps --pid 1 -f</code>" command.</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>"<code class="literal">/sbin/init</code>" is symlinked to "<code class="literal">/lib/systemd/systemd</code>" after Debian <code class="literal">jessie</code>.</p>
</td>
</tr>
</table>
</div>
<div class="table">
<a id="listofbootutilitrthedebiansystem"/>
<p class="title">
<strong>Table 3.3. List of boot utilities for the Debian system</strong>
</p>
<div class="table-contents">
<table class="table" summary="List of boot utilities for the Debian system" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
package
</th>
<th style="text-align: left">
popcon
</th>
<th style="text-align: left">
size
</th>
<th style="text-align: left">
description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/systemd">
<code class="literal">systemd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=systemd">V:703, I:805</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/systemd.html">11933</a>
</td>
<td style="text-align: left">
event-based <span class="citerefentry"><span class="refentrytitle">init</span>(8)</span> daemon for concurrency (alternative to <code class="literal">sysvinit</code>)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/systemd-sysv">
<code class="literal">systemd-sysv</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=systemd-sysv">V:684, I:798</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/systemd-sysv.html">112</a>
</td>
<td style="text-align: left">
the manual pages and links needed for <code class="literal">systemd</code> to replace <code class="literal">sysvinit</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/systemd-cron">
<code class="literal">systemd-cron</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=systemd-cron">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/systemd-cron.html">133</a>
</td>
<td style="text-align: left"><code class="literal">systemd</code> units to provide <code class="literal">cron</code> daemon and <code class="literal">anacron</code> functionality
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/init-system-helpers">
<code class="literal">init-system-helpers</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=init-system-helpers">V:704, I:826</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/i/init-system-helpers.html">129</a>
</td>
<td style="text-align: left">
helper tools for switching between <code class="literal">sysvinit</code> and <code class="literal">systemd</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/initscripts">
<code class="literal">initscripts</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=initscripts">V:284, I:667</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/i/initscripts.html">205</a>
</td>
<td style="text-align: left">
scripts for initializing and shutting down the system
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/sysvinit-core">
<code class="literal">sysvinit-core</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=sysvinit-core">V:13, I:17</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/sysvinit-core.html">225</a>
</td>
<td style="text-align: left">
System-V-like <span class="citerefentry"><span class="refentrytitle">init</span>(8)</span> utilities
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/sysv-rc">
<code class="literal">sysv-rc</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=sysv-rc">V:477, I:673</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/sysv-rc.html">123</a>
</td>
<td style="text-align: left">
System-V-like runlevel change mechanism
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/sysvinit-utils">
<code class="literal">sysvinit-utils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=sysvinit-utils">V:791, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/sysvinit-utils.html">110</a>
</td>
<td style="text-align: left">
System-V-like utilities (<span class="citerefentry"><span class="refentrytitle">startpar</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">bootlogd</span>(8)</span>, …)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/lsb-base">
<code class="literal">lsb-base</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=lsb-base">V:877, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/lsb-base.html">49</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Standard_Base">Linux Standard Base</a> 3.2 init script functionality
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/insserv">
<code class="literal">insserv</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=insserv">V:539, I:660</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/i/insserv.html">140</a>
</td>
<td style="text-align: left">
tool to organize boot sequence using LSB init.d script dependencies
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/uswsusp">
<code class="literal">uswsusp</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=uswsusp">V:4, I:11</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/u/uswsusp.html">699</a>
</td>
<td style="text-align: left">
tools to use userspace software suspend provided by Linux
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/kexec-tools">
<code class="literal">kexec-tools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=kexec-tools">V:1, I:8</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/k/kexec-tools.html">270</a>
</td>
<td style="text-align: left">
kexec tool for <span class="citerefentry"><span class="refentrytitle">kexec</span>(8)</span> reboots (warm reboot)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/systemd-bootchart">
<code class="literal">systemd-bootchart</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=systemd-bootchart">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/systemd-bootchart.html">122</a>
</td>
<td style="text-align: left">
boot process performance analyser
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/bootchart2">
<code class="literal">bootchart2</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=bootchart2">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/bootchart2.html">94</a>
</td>
<td style="text-align: left">
boot process performance analyser
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/pybootchartgui">
<code class="literal">pybootchartgui</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=pybootchartgui">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/pybootchartgui.html">177</a>
</td>
<td style="text-align: left">
boot process performance analyser (visualisation)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/mingetty">
<code class="literal">mingetty</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=mingetty">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/m/mingetty.html">35</a>
</td>
<td style="text-align: left">
console-only <span class="citerefentry"><span class="refentrytitle">getty</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/mgetty">
<code class="literal">mgetty</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=mgetty">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/m/mgetty.html">301</a>
</td>
<td style="text-align: left">
smart modem <span class="citerefentry"><span class="refentrytitle">getty</span>(8)</span> replacement
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>See <a class="ulink" href="https://wiki.debian.org/BootProcessSpeedup">Debian wiki: BootProcessSpeedup</a> for the latest tips to speed up the boot process.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_systemd_init"/>3.2. Systemd init</h2>
</div>
</div>
</div>
<p>This section describes how system is started by the <span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span> program with <code class="literal">PID=1</code> (i.e., init process).</p>
<p>The <code class="literal">systemd</code> init process spawns processes in parallel based on the unit configuration files (see <span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span>) which are written in declarative style instead of SysV-like procedural style. These are loaded from a set of paths (see <span class="citerefentry"><span class="refentrytitle">systemd-system.conf</span>(5)</span>) as follows:</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
"<code class="literal">/lib/systemd/system</code>": OS default configuration files
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">/etc/systemd/system</code>": system administrator configuration files which override the OS default configuration files
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">/run/systemd/system</code>": run-time generated configuration files which override the installed configuration files
</p>
</li>
</ul>
</div>
<p>Their inter-dependencies are specified by the directives "<code class="literal">Wants=</code>", "<code class="literal">Requires=</code>", "<code class="literal">Before=</code>", "<code class="literal">After=</code>", … (see "MAPPING OF UNIT PROPERTIES TO THEIR INVERSES" in <span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span>). The resource controls are also defined (see <span class="citerefentry"><span class="refentrytitle">systemd.resource-control</span>(5)</span>).</p>
<p>The suffix of the unit configuration file encodes their types as:</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="strong"><strong>*.service</strong></span> describes the process controlled and supervised by <code class="literal">systemd</code>. See <span class="citerefentry"><span class="refentrytitle">systemd.service</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.device</strong></span> describes the device exposed in the <span class="citerefentry"><span class="refentrytitle">sysfs</span>(5)</span> as <span class="citerefentry"><span class="refentrytitle">udev</span>(7)</span> device tree. See <span class="citerefentry"><span class="refentrytitle">systemd.device</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.mount</strong></span> describes the file system mount point controlled and supervised by <code class="literal">systemd</code>. See <span class="citerefentry"><span class="refentrytitle">systemd.mount</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.automount</strong></span> describes the file system auto mount point controlled and supervised by <code class="literal">systemd</code>. See <span class="citerefentry"><span class="refentrytitle">systemd.automount</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.swap</strong></span> describes the swap device or file controlled and supervised by <code class="literal">systemd</code>. See <span class="citerefentry"><span class="refentrytitle">systemd.swap</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.path</strong></span> describes the path monitored by <code class="literal">systemd</code> for path-based activation. See <span class="citerefentry"><span class="refentrytitle">systemd.path</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.socket</strong></span> describes the socket controlled and supervised by <code class="literal">systemd</code> for socket-based activation. See <span class="citerefentry"><span class="refentrytitle">systemd.socket</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.timer</strong></span> describes the timer controlled and supervised by <code class="literal">systemd</code> for timer-based activation. See <span class="citerefentry"><span class="refentrytitle">systemd.timer</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.slice</strong></span> manages resources with the <span class="citerefentry"><span class="refentrytitle">cgroups</span>(7)</span>. See <span class="citerefentry"><span class="refentrytitle">systemd.slice</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.scope</strong></span> is created programmatically using the bus interfaces of <code class="literal">systemd</code> to manages a set of system processes. See <span class="citerefentry"><span class="refentrytitle">systemd.scope</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p><span class="strong"><strong>*.target</strong></span> groups other unit configuration files to create the synchronization point during start-up. See <span class="citerefentry"><span class="refentrytitle">systemd.target</span>(5)</span>.
</p>
</li>
</ul>
</div>
<p>Upon system start up (i.e., init), the <code class="literal">systemd</code> process tries to start the "<code class="literal">/lib/systemd/system/default.target</code> (normally symlinked to "<code class="literal">graphical.target</code>"). First, some special target units (see <span class="citerefentry"><span class="refentrytitle">systemd.special</span>(7)</span>) such as "<code class="literal">local-fs.target</code>", "<code class="literal">swap.target</code>" and "<code class="literal">cryptsetup.target</code>" are pulled in to mount the filesystems. Then, other target units are also pulled in by the target unit dependencies. For details, read <span class="citerefentry"><span class="refentrytitle">bootup</span>(7)</span>.</p>
<p><code class="literal">systemd</code> offers backward compatibility features. SysV-style boot scripts in "<code class="literal">/etc/init.d/rc[0123456S].d/[KS]<name></code>" are still parsed and <span class="citerefentry"><span class="refentrytitle">telinit</span>(8)</span> is translated into systemd unit activation requests.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Caution]" src="images/caution.png"/>
</td>
<th align="left">Caution</th>
</tr>
<tr>
<td align="left" valign="top">
<p>Emulated runlevel 2 to 4 are all symlinked to the same "<code class="literal">multi-user.target</code>".</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_hostname"/>3.2.1. The hostname</h3>
</div>
</div>
</div>
<p>The kernel maintains the system <span class="strong"><strong>hostname</strong></span>. The system unit started by <code class="literal">systemd-hostnamed.service</code> sets the system hostname at boot time to the name stored in "<code class="literal">/etc/hostname</code>". This file should contain <span class="strong"><strong>only</strong></span> the system hostname, not a fully qualified domain name.</p>
<p>To print out the current hostname run <span class="citerefentry"><span class="refentrytitle">hostname</span>(1)</span> without an argument.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_filesystem"/>3.2.2. The filesystem</h3>
</div>
</div>
</div>
<p>The mount options of normal disk and network filesystems are set in "<code class="literal">/etc/fstab</code>". See <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span> and <a class="xref" href="ch09.en.html#_optimization_of_filesystem_by_mount_options" title="9.5.7. Optimization of filesystem by mount options">Section 9.5.7, “Optimization of filesystem by mount options”</a>.</p>
<p>The configuration of the encrypted filesystem is set in "<code class="literal">/etc/crypttab</code>". See <span class="citerefentry"><span class="refentrytitle">crypttab</span>(5)</span></p>
<p>The configuration of software RAID with <span class="citerefentry"><span class="refentrytitle">mdadm</span>(8)</span> is set in "<code class="literal">/etc/mdadm/mdadm.conf</code>". See <span class="citerefentry"><span class="refentrytitle">mdadm.conf</span>(5)</span>.</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Warning]" src="images/warning.png"/>
</td>
<th align="left">Warning</th>
</tr>
<tr>
<td align="left" valign="top">
<p>After mounting all the filesystems, temporary files in "<code class="literal">/tmp</code>", "<code class="literal">/var/lock</code>", and "<code class="literal">/var/run</code>" are cleaned for each boot up.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_network_interface_initialization"/>3.2.3. Network interface initialization</h3>
</div>
</div>
</div>
<p>Network interfaces are typically initialized in "<code class="literal">networking.service</code>" for the <code class="literal">lo</code> interface and "<code class="literal">NetworkManager.service</code>" for other interfaces on modern Debian desktop system under <code class="literal">systemd</code>.</p>
<p>See <a class="xref" href="ch05.en.html" title="Chapter 5. Network setup">Chapter 5, <em>Network setup</em></a> for how to configure them.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_kernel_message"/>3.2.4. The kernel message</h3>
</div>
</div>
</div>
<p>The kernel error message displayed to the console can be configured by setting its threshold level.</p>
<pre class="screen"># dmesg -n3</pre>
<div class="table">
<a id="listofkernelerrorlevels"/>
<p class="title">
<strong>Table 3.4. List of kernel error levels</strong>
</p>
<div class="table-contents">
<table class="table" summary="List of kernel error levels" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
error level value
</th>
<th style="text-align: left">
error level name
</th>
<th style="text-align: left">
meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
0
</td>
<td style="text-align: left">
KERN_EMERG
</td>
<td style="text-align: left">
system is unusable
</td>
</tr>
<tr>
<td style="text-align: left">
1
</td>
<td style="text-align: left">
KERN_ALERT
</td>
<td style="text-align: left">
action must be taken immediately
</td>
</tr>
<tr>
<td style="text-align: left">
2
</td>
<td style="text-align: left">
KERN_CRIT
</td>
<td style="text-align: left">
critical conditions
</td>
</tr>
<tr>
<td style="text-align: left">
3
</td>
<td style="text-align: left">
KERN_ERR
</td>
<td style="text-align: left">
error conditions
</td>
</tr>
<tr>
<td style="text-align: left">
4
</td>
<td style="text-align: left">
KERN_WARNING
</td>
<td style="text-align: left">
warning conditions
</td>
</tr>
<tr>
<td style="text-align: left">
5
</td>
<td style="text-align: left">
KERN_NOTICE
</td>
<td style="text-align: left">
normal but significant condition
</td>
</tr>
<tr>
<td style="text-align: left">
6
</td>
<td style="text-align: left">
KERN_INFO
</td>
<td style="text-align: left">
informational
</td>
</tr>
<tr>
<td style="text-align: left">
7
</td>
<td style="text-align: left">
KERN_DEBUG
</td>
<td style="text-align: left">
debug-level messages
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_system_message"/>3.2.5. The system message</h3>
</div>
</div>
</div>
<p>Under <code class="literal">systemd</code>, both kernel and system messages are logged by the journal service <code class="literal">systemd-journald.service</code> (a.k.a <code class="literal">journald</code>) either into a persistent binary data below "<code class="literal">/var/log/journal</code>" or into a volatile binary data below "<code class="literal">/run/log/journal/</code>". These binary log data are accessed by the <span class="citerefentry"><span class="refentrytitle">journalctl</span>(1)</span> command.</p>
<p>Under <code class="literal">systemd</code>, the system logging utility <span class="citerefentry"><span class="refentrytitle">rsyslogd</span>(8)</span> changes its behavior to read the volatile binary log data (instead of pre-systemd default "<code class="literal">/dev/log</code>") and to create traditional permanent ASCII system log data.</p>
<p>The system message can be customized by "<code class="literal">/etc/default/rsyslog</code>" and "<code class="literal">/etc/rsyslog.conf</code>" for both the log file and on-screen display. See <span class="citerefentry"><span class="refentrytitle">rsyslogd</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">rsyslog.conf</span>(5)</span>. See also <a class="xref" href="ch09.en.html#_log_analyzer" title="9.2.2. Log analyzer">Section 9.2.2, “Log analyzer”</a>.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_system_management_under_systemd"/>3.2.6. System management under systemd</h3>
</div>
</div>
</div>
<p>The <code class="literal">systemd</code> offers not only init system but also generic system management functionalities such as journal logging, login management, time management, network management. etc..</p>
<p>The <span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span> is managed by several commands:</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
the <span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span> command controls the <code class="literal">systemd</code> system and service manager (CLI),
</p>
</li>
<li class="listitem">
<p>
the <span class="citerefentry"><span class="refentrytitle">systemsdm</span>(1)</span> command controls the <code class="literal">systemd</code> system and service manager (GUI),
</p>
</li>
<li class="listitem">
<p>
the <span class="citerefentry"><span class="refentrytitle">journalctl</span>(1)</span> command queries the <code class="literal">systemd</code> journal,
</p>
</li>
<li class="listitem">
<p>
the <span class="citerefentry"><span class="refentrytitle">loginctl</span>(1)</span> command controls the <code class="literal">systemd</code> login manager, and
</p>
</li>
<li class="listitem">
<p>
the <span class="citerefentry"><span class="refentrytitle">systemd-analyze</span>(1)</span> analyzes system boot-up performance.
</p>
</li>
</ul>
</div>
<p>Here are a list of typical <code class="literal">systemd</code> management command snippets. For the exact meanings, please read the pertinent manpages.</p>
<div class="table">
<a id="listoftypicalsystcommandsnippets"/>
<p class="title">
<strong>Table 3.5. List of typical <code class="literal">systemd</code> management command snippets</strong>
</p>
<div class="table-contents">
<table class="table" summary="List of typical systemd management command snippets" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
Operation
</th>
<th style="text-align: left">
Type
</th>
<th style="text-align: left">
Command snippets
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
GUI for service manager
</td>
<td style="text-align: left">
GUI
</td>
<td style="text-align: left">
"<code class="literal">systemadm</code>" (<code class="literal">systemd-ui</code> package)
</td>
</tr>
<tr>
<td style="text-align: left">
List all target unit configuration
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl list-units --type=target</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
List all service unit configuration
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl list-units --type=service</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
List all unit configuration types
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl list-units --type=help</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
List all socket units in memory
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl list-sockets</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
List all timer units in memory
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl list-timers</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Start "<code class="literal">$unit</code>"
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl start $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Stop "<code class="literal">$unit</code>"
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl stop $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Reload service-specific configuration
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl reload $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Stop and start all "<code class="literal">$unit</code>"
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl restart $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Start "<code class="literal">$unit</code>" and stop all others
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl isolate $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Switch to "<code class="literal">graphical</code>" (GUI system)
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl isolate graphical</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Switch to "<code class="literal">multi-user</code>" (CLI system)
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl isolate multi-user</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Switch to "<code class="literal">rescue</code>" (single user CLI system)
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl isolate rescue</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Send kill signal to "<code class="literal">$unit</code>"
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl kill $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Send kill signal to "<code class="literal">$unit</code>"
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl kill $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Check if "<code class="literal">$unit</code>" service is active
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl is-active $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Check if "<code class="literal">$unit</code>" service is failed
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl is-failed $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Check status of "<code class="literal">$unit|$PID|device</code>"
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl status $unit|$PID|$device</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Show properties of "<code class="literal">$unit|$job</code>"
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl show $unit|$job</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Reset failed "<code class="literal">$unit</code>"
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl reset-failed $unit"</code>
</td>
</tr>
<tr>
<td style="text-align: left">
List dependency of all unit services
</td>
<td style="text-align: left">
Unit
</td>
<td style="text-align: left">
"<code class="literal">systemctl list-dependencies --all</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
List unit files installed on the system
</td>
<td style="text-align: left">
Unit file
</td>
<td style="text-align: left">
"<code class="literal">systemctl list-unit-files</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Enable "<code class="literal">$unit</code>" (add symlink)
</td>
<td style="text-align: left">
Unit file
</td>
<td style="text-align: left">
"<code class="literal">systemctl enable $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Disable "<code class="literal">$unit</code>" (remove symlink)
</td>
<td style="text-align: left">
Unit file
</td>
<td style="text-align: left">
"<code class="literal">systemctl disable $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Unmask "<code class="literal">$unit</code>" (remove symlink to "<code class="literal">/dev/null</code>")
</td>
<td style="text-align: left">
Unit file
</td>
<td style="text-align: left">
"<code class="literal">systemctl unmask $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Mask "<code class="literal">$unit</code>" (add symlink to "<code class="literal">/dev/null</code>")
</td>
<td style="text-align: left">
Unit file
</td>
<td style="text-align: left">
"<code class="literal">systemctl mask $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Get default-target setting
</td>
<td style="text-align: left">
Unit file
</td>
<td style="text-align: left">
"<code class="literal">systemctl get-default</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Set default-target to "<code class="literal">graphical</code>" (GUI system)
</td>
<td style="text-align: left">
Unit file
</td>
<td style="text-align: left">
"<code class="literal">systemctl set-default graphical</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Set default-target to "<code class="literal">multi-user</code>" (CLI system)
</td>
<td style="text-align: left">
Unit file
</td>
<td style="text-align: left">
"<code class="literal">systemctl set-default multi-user</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Show job environment
</td>
<td style="text-align: left">
Environment
</td>
<td style="text-align: left">
"<code class="literal">systemctl show-environment</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Set job environment "<code class="literal">variable</code>" to "<code class="literal">value</code>"
</td>
<td style="text-align: left">
Environment
</td>
<td style="text-align: left">
"<code class="literal">systemctl set-environment variable=value</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Unset job environment "<code class="literal">variable</code>"
</td>
<td style="text-align: left">
Environment
</td>
<td style="text-align: left">
"<code class="literal">systemctl unset-environment variable</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Reload all unit files and daemons
</td>
<td style="text-align: left">
Lifecycle
</td>
<td style="text-align: left">
"<code class="literal">systemctl daemon-reload</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Shut down the system
</td>
<td style="text-align: left">
System
</td>
<td style="text-align: left">
"<code class="literal">systemctl poweroff</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Shut down and reboot the system
</td>
<td style="text-align: left">
System
</td>
<td style="text-align: left">
"<code class="literal">systemctl reboot</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Suspend the system
</td>
<td style="text-align: left">
System
</td>
<td style="text-align: left">
"<code class="literal">systemctl suspend</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Hibernate the system
</td>
<td style="text-align: left">
System
</td>
<td style="text-align: left">
"<code class="literal">systemctl hibernate</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
View job log of "<code class="literal">$unit</code>"
</td>
<td style="text-align: left">
Journal
</td>
<td style="text-align: left">
"<code class="literal">journalctl -u $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
View job log of "<code class="literal">$unit</code>" ("<code class="literal">tail -f</code>" style)
</td>
<td style="text-align: left">
Journal
</td>
<td style="text-align: left">
"<code class="literal">journalctl -u $unit -f</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Show time spent for each initialization steps
</td>
<td style="text-align: left">
Analyze
</td>
<td style="text-align: left">
"<code class="literal">systemd-analyze time</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
List of all units by the time to initialize
</td>
<td style="text-align: left">
Analyze
</td>
<td style="text-align: left">
"<code class="literal">systemd-analyze blame</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Load and detect errors in "<code class="literal">$unit</code>" file
</td>
<td style="text-align: left">
Analyze
</td>
<td style="text-align: left">
"<code class="literal">systemd-analyze verify $unit</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Track boot process by the <span class="citerefentry"><span class="refentrytitle">cgroups</span>(7)</span>
</td>
<td style="text-align: left">
Cgroup
</td>
<td style="text-align: left">
"<code class="literal">systemd-cgls</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Track boot process by the <span class="citerefentry"><span class="refentrytitle">cgroups</span>(7)</span>
</td>
<td style="text-align: left">
Cgroup
</td>
<td style="text-align: left">
"<code class="literal">ps xawf -eo pid,user,cgroup,args</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
Track boot process by the <span class="citerefentry"><span class="refentrytitle">cgroups</span>(7)</span>
</td>
<td style="text-align: left">
Cgroup
</td>
<td style="text-align: left">
Read <a class="ulink" href="http://en.wikipedia.org/wiki/Sysfs">sysfs</a> under "<code class="literal">/sys/fs/cgroup/systemd/</code>"
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>Here, "<code class="literal">$unit</code>" in the above examples may be a single unit name (suffix such as <code class="literal">.service</code> and <code class="literal">.target</code> are optional) or, in many cases, multiple unit specifications (shell-style globs "<code class="literal">*</code>", "<code class="literal">?</code>", "<code class="literal">[]</code>" using <span class="citerefentry"><span class="refentrytitle">fnmatch</span>(3)</span> which will be matched against the primary names of all units currently in memory).</p>
<p>System state changing commands in the above examples are typically preceded by the "<code class="literal">sudo</code>" to attain the required administrative privilege.</p>
<p>The output of the "<code class="literal">systemctl status $unit|$PID|$device</code>" uses color of the dot ("●") to summarize the unit state at a glance.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
White "●" indicates an "inactive" or "deactivating" state.
</p>
</li>
<li class="listitem">
<p>
Red "●" indicates a "failed" or "error" state.
</p>
</li>
<li class="listitem">
<p>
Green "●" indicates an "active", "reloading" or "activating" state.
</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_customizing_systemd"/>3.2.7. Customizing systemd</h3>
</div>
</div>
</div>
<p>With default installation, many network services (see <a class="xref" href="ch06.en.html" title="Chapter 6. Network applications">Chapter 6, <em>Network applications</em></a>) are started as daemon processes after <code class="literal">network.target</code> at boot time by <code class="literal">systemd</code>. The "<code class="literal">sshd</code>" is no exception. Let's change this to on-demand start of "<code class="literal">sshd</code>" as a customization example.</p>
<p>First, disable system installed service unit.</p>
<pre class="screen"> $ sudo systemctl stop sshd.service
$ sudo systemctl mask sshd.service</pre>
<p>The on-demand socket activation system of the classic Unix services was through the <code class="literal">indetd</code> superserver. Under <code class="literal">systemd</code>, the equivalent can be enabled by adding <span class="strong"><strong>*.socket</strong></span> and <span class="strong"><strong>*.service</strong></span> unit configuration files.</p>
<p><code class="literal">sshd.socket</code> for specifying a socket to listen on</p>
<pre class="screen">[Unit]
Description=SSH Socket for Per-Connection Servers
[Socket]
ListenStream=22
Accept=yes
[Install]
WantedBy=sockets.target</pre>
<p><code class="literal">sshd@.service</code> as the matching service file of <code class="literal">sshd.socket</code></p>
<pre class="screen">[Unit]
Description=SSH Per-Connection Server
[Service]
ExecStart=-/usr/sbin/sshd -i
StandardInput=socket</pre>
<p>Then reload.</p>
<pre class="screen"> $ sudo systemctl daemon-reload</pre>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_the_udev_system"/>3.3. The udev system</h2>
</div>
</div>
</div>
<p>For Linux kernel 2.6 and newer, <a class="ulink" href="http://en.wikipedia.org/wiki/Udev">the udev system</a> provides mechanism for the automatic hardware discovery and initialization (see <span class="citerefentry"><span class="refentrytitle">udev</span>(7)</span>). Upon discovery of each device by the kernel, the udev system starts a user process which uses information from the <a class="ulink" href="http://en.wikipedia.org/wiki/Sysfs">sysfs</a> filesystem (see <a class="xref" href="ch01.en.html#_procfs_and_sysfs" title="1.2.12. procfs and sysfs">Section 1.2.12, “procfs and sysfs”</a>), loads required kernel modules supporting it using the <span class="citerefentry"><span class="refentrytitle">modprobe</span>(8)</span> program (see <a class="xref" href="ch03.en.html#_the_kernel_module_initialization" title="3.3.1. The kernel module initialization">Section 3.3.1, “The kernel module initialization”</a>), and creates corresponding device nodes.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>If "<code class="literal">/lib/modules/<kernel-version>/modules.dep</code>" was not generated properly by <span class="citerefentry"><span class="refentrytitle">depmod</span>(8)</span> for some reason, modules may not be loaded as expected by the udev system. Execute "<code class="literal">depmod -a</code>" to fix it.</p>
</td>
</tr>
</table>
</div>
<p>The name of device nodes can be configured by udev rule files in "<code class="literal">/etc/udev/rules.d/</code>". Current default rules tend to create dynamically generated names resulting non-static device names except for cd and network devices. By adding your custom rules similar to what cd and network devices do, you can generate static device names for other devices such as USB memory sticks, too. See "<a class="ulink" href="http://www.reactivated.net/writing_udev_rules.html">Writing udev rules</a>" or "<code class="literal">/usr/share/doc/udev/writing_udev_rules/index.html</code>".</p>
<p>Since the udev system is somewhat a moving target, I leave details to other documentations and describe the minimum information here.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>For mounting rules in "<code class="literal">/etc/fstab</code>", device nodes do not need to be static ones. You can use <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier">UUID</a> to mount devices instead of device names such as "<code class="literal">/dev/sda</code>". See <a class="xref" href="ch09.en.html#_accessing_partition_using_uuid" title="9.5.3. Accessing partition using UUID">Section 9.5.3, “Accessing partition using UUID”</a>.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_kernel_module_initialization"/>3.3.1. The kernel module initialization</h3>
</div>
</div>
</div>
<p>The <span class="citerefentry"><span class="refentrytitle">modprobe</span>(8)</span> program enables us to configure running Linux kernel from user process by adding and removing kernel modules. The udev system (see <a class="xref" href="ch03.en.html#_the_udev_system" title="3.3. The udev system">Section 3.3, “The udev system”</a>) automates its invocation to help the kernel module initialization.</p>
<p>There are non-hardware modules and special hardware driver modules as the following which need to be pre-loaded by listing them in the "<code class="literal">/etc/modules</code>" file (see <span class="citerefentry"><span class="refentrytitle">modules</span>(5)</span>).</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/TUN/TAP">TUN/TAP</a> modules providing virtual Point-to-Point network device (TUN) and virtual Ethernet network device (TAP),
</p>
</li>
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Netfilter">netfilter</a> modules providing netfilter firewall capabilities (<span class="citerefentry"><span class="refentrytitle">iptables</span>(8)</span>, <a class="xref" href="ch05.en.html#_netfilter_infrastructure" title="5.10. Netfilter infrastructure">Section 5.10, “Netfilter infrastructure”</a>), and
</p>
</li>
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Watchdog_timer">watchdog timer</a> driver modules.
</p>
</li>
</ul>
</div>
<p>The configuration files for the <span class="citerefentry"><span class="refentrytitle">modprobe</span>(8)</span> program are located under the "<code class="literal">/etc/modprobes.d/</code>" directory as explained in <span class="citerefentry"><span class="refentrytitle">modprobe.conf</span>(5)</span>. (If you want to avoid some kernel modules to be auto-loaded, consider to blacklist them in the "<code class="literal">/etc/modprobes.d/blacklist</code>" file.)</p>
<p>The "<code class="literal">/lib/modules/<version>/modules.dep</code>" file generated by the <span class="citerefentry"><span class="refentrytitle">depmod</span>(8)</span> program describes module dependencies used by the <span class="citerefentry"><span class="refentrytitle">modprobe</span>(8)</span> program.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>If you experience module loading issues with boot time module loading or with <span class="citerefentry"><span class="refentrytitle">modprobe</span>(8)</span>, "<code class="literal">depmod -a</code>" may resolve these issues by reconstructing "<code class="literal">modules.dep</code>".</p>
</td>
</tr>
</table>
</div>
<p>The <span class="citerefentry"><span class="refentrytitle">modinfo</span>(8)</span> program shows information about a Linux kernel module.</p>
<p>The <span class="citerefentry"><span class="refentrytitle">lsmod</span>(8)</span> program nicely formats the contents of the "<code class="literal">/proc/modules</code>", showing what kernel modules are currently loaded.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>You can identify exact hardware on your system. See <a class="xref" href="ch09.en.html#_hardware_identification" title="9.4.3. Hardware identification">Section 9.4.3, “Hardware identification”</a>.</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>You may configure hardware at boot time to activate expected hardware features. See <a class="xref" href="ch09.en.html#_hardware_configuration" title="9.4.4. Hardware configuration">Section 9.4.4, “Hardware configuration”</a>.</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>You can probably add support for your special device by recompiling the kernel. See <a class="xref" href="ch09.en.html#_the_kernel" title="9.9. The kernel">Section 9.9, “The kernel”</a>.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="navfooter">
<hr/>
<table width="100%" summary="Navigation footer">
<tr>
<td align="left"><a accesskey="p" href="ch02.en.html"><img src="images/prev.png" alt="Prev"/></a> </td>
<td align="center"> </td>
<td align="right"> <a accesskey="n" href="ch04.en.html"><img src="images/next.png" alt="Next"/></a></td>
</tr>
<tr>
<td align="left" valign="top">Chapter 2. Debian package management </td>
<td align="center">
<a accesskey="h" href="index.en.html">
<img src="images/home.png" alt="Home"/>
</a>
</td>
<td align="right" valign="top"> Chapter 4. Authentication</td>
</tr>
</table>
</div>
</body>
</html>
|