{"id":172046,"date":"2020-02-15T09:04:58","date_gmt":"2020-02-15T01:04:58","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=172046"},"modified":"2020-02-11T15:30:46","modified_gmt":"2020-02-11T07:30:46","slug":"boot-process-details","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/boot-process-details.html","title":{"rendered":"Linux \u5f00\u673a\u5f15\u5bfc\u548c\u542f\u52a8"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u7406\u89e3\u64cd\u4f5c\u7cfb\u7edf\u5f00\u673a\u5f15\u5bfc\u548c\u542f\u52a8\u8fc7\u7a0b\u5bf9\u4e8e\u914d\u7f6e\u64cd\u4f5c\u7cfb\u7edf\u548c\u89e3\u51b3\u76f8\u5173\u542f\u52a8\u95ee\u9898\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u8be5\u6587\u7ae0\u9648\u8ff0\u4e86 GRUB2 \u5f15\u5bfc\u88c5\u8f7d\u7a0b\u5e8f\u5f00\u673a\u5f15\u5bfc\u88c5\u8f7d\u5185\u6838\u7684\u8fc7\u7a0b\u548c systemd \u521d\u59cb\u5316\u7cfb\u7edf\u6267\u884c\u5f00\u673a\u542f\u52a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u8fc7\u7a0b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u4e8b\u5b9e\u4e0a\uff0c\u64cd\u4f5c\u7cfb\u7edf\u7684\u542f\u52a8\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5\uff1a\u5f15\u5bfcboot\u548c\u542f\u52a8startup\u3002\u5f15\u5bfc\u9636\u6bb5\u5f00\u59cb\u4e8e\u6253\u5f00\u7535\u6e90\u5f00\u5173\uff0c\u7ed3\u675f\u4e8e\u5185\u6838\u521d\u59cb\u5316\u5b8c\u6210\u548c systemd \u8fdb\u7a0b\u6210\u529f\u8fd0\u884c\u3002\u542f\u52a8\u9636\u6bb5\u63a5\u7ba1\u4e86\u5269\u4f59\u5de5\u4f5c\uff0c\u76f4\u5230\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u5165\u53ef\u64cd\u4f5c\u72b6\u6001\u3002<\/p>\n \u603b\u4f53\u6765\u8bf4\uff0cLinux \u7684\u5f00\u673a\u5f15\u5bfc\u548c\u542f\u52a8\u8fc7\u7a0b\u662f\u76f8\u5f53\u5bb9\u6613\u7406\u89e3\uff0c\u4e0b\u6587\u5c06\u5206\u8282\u5bf9\u4e8e\u4e0d\u540c\u6b65\u9aa4\u8fdb\u884c\u8be6\u7ec6\u8bf4\u660e\u3002<\/p>\n BIOS \u4e0a\u7535\u81ea\u68c0\uff08POST\uff09<\/p>\n \u5f15\u5bfc\u88c5\u8f7d\u7a0b\u5e8f (GRUB2)<\/p>\n \u5185\u6838\u521d\u59cb\u5316<\/p>\n \u542f\u52a8 systemd\uff0c\u5176\u662f\u6240\u6709\u8fdb\u7a0b\u4e4b\u7236\u3002<\/p>\n \u6ce8\u610f\uff0c\u672c\u6587\u4ee5 GRUB2 \u548c systemd \u4e3a\u8f7d\u4f53\u8bb2\u8ff0\u64cd\u4f5c\u7cfb\u7edf\u7684\u5f00\u673a\u5f15\u5bfc\u548c\u542f\u52a8\u8fc7\u7a0b\uff0c\u662f\u56e0\u4e3a\u8fd9\u4e8c\u8005\u662f\u76ee\u524d\u4e3b\u6d41\u7684 linux \u53d1\u884c\u7248\u672c\u6240\u4f7f\u7528\u7684\u5f15\u5bfc\u88c5\u8f7d\u7a0b\u5e8f\u548c\u521d\u59cb\u5316\u8f6f\u4ef6\u3002\u5f53\u7136\u53e6\u5916\u4e00\u4e9b\u8fc7\u53bb\u4f7f\u7528\u7684\u76f8\u5173\u8f6f\u4ef6\u4ecd\u7136\u5728\u4e00\u4e9b Linux \u53d1\u884c\u7248\u672c\u4e2d\u4f7f\u7528\u3002<\/p>\n \u5f15\u5bfc\u8fc7\u7a0b<\/strong><\/div>\n \u5f15\u5bfc\u8fc7\u7a0b\u80fd\u4ee5\u4e24\u79cd\u65b9\u5f0f\u4e4b\u4e00\u521d\u59cb\u5316\u3002\u5176\u4e00\uff0c\u5982\u679c\u7cfb\u7edf\u5904\u4e8e\u5173\u673a\u72b6\u6001\uff0c\u90a3\u4e48\u6253\u5f00\u7535\u6e90\u6309\u94ae\u5c06\u5f00\u542f\u7cfb\u7edf\u5f15\u5bfc\u8fc7\u7a0b\u3002\u5176\u4e8c\uff0c\u5982\u679c\u64cd\u4f5c\u7cfb\u7edf\u5df2\u7ecf\u8fd0\u884c\u5728\u4e00\u4e2a\u672c\u5730\u7528\u6237\uff08\u8be5\u7528\u6237\u53ef\u4ee5\u662f root \u6216\u5176\u4ed6\u975e\u7279\u6743\u7528\u6237\uff09\uff0c\u90a3\u4e48\u7528\u6237\u53ef\u4ee5\u501f\u52a9\u56fe\u5f62\u754c\u9762\u6216\u547d\u4ee4\u884c\u754c\u9762\u901a\u8fc7\u7f16\u7a0b\u65b9\u5f0f\u53d1\u8d77\u4e00\u4e2a\u91cd\u542f\u64cd\u4f5c\uff0c\u4ece\u800c\u89e6\u53d1\u7cfb\u7edf\u5f15\u5bfc\u8fc7\u7a0b\u3002\u91cd\u542f\u5305\u62ec\u4e86\u4e00\u4e2a\u5173\u673a\u548c\u91cd\u65b0\u5f00\u59cb\u7684\u64cd\u4f5c\u3002<\/p>\n BIOS \u4e0a\u7535\u81ea\u68c0\uff08POST\uff09<\/strong><\/span><\/div>\n \u4e0a\u7535\u81ea\u68c0\u8fc7\u7a0b\u4e2d\u5176\u5b9e Linux \u6ca1\u6709\u4ec0\u4e48\u4e5f\u6ca1\u505a\uff0c\u4e0a\u7535\u81ea\u68c0\u4e3b\u8981\u7531\u786c\u4ef6\u7684\u90e8\u5206\u6765\u5b8c\u6210\uff0c\u8fd9\u5bf9\u4e8e\u6240\u6709\u64cd\u4f5c\u7cfb\u7edf\u90fd\u4e00\u6837\u3002\u5f53\u7535\u8111\u63a5\u901a\u7535\u6e90\uff0c\u7535\u8111\u5f00\u59cb\u6267\u884c BIOS\uff08\u57fa\u672c\u8f93\u5165\u8f93\u51fa\u7cfb\u7edfBasic I\/O System\uff09\u7684 POST\uff08\u4e0a\u7535\u81ea\u68c0Power On Self Test\uff09\u8fc7\u7a0b\u3002<\/p>\n \u5728 1981 \u5e74\uff0cIBM \u8bbe\u8ba1\u7684\u7b2c\u4e00\u53f0\u4e2a\u4eba\u7535\u8111\u4e2d\uff0cBIOS \u88ab\u8bbe\u8ba1\u4e3a\u7528\u6765\u521d\u59cb\u5316\u786c\u4ef6\u7ec4\u4ef6\u3002POST \u4f5c\u4e3a BIOS \u7684\u7ec4\u6210\u90e8\u5206\uff0c\u7528\u4e8e\u68c0\u9a8c\u7535\u8111\u786c\u4ef6\u57fa\u672c\u529f\u80fd\u662f\u5426\u6b63\u5e38\u3002\u5982\u679c POST \u5931\u8d25\uff0c\u90a3\u4e48\u8fd9\u4e2a\u7535\u8111\u5c31\u4e0d\u80fd\u4f7f\u7528\uff0c\u5f15\u5bfc\u8fc7\u7a0b\u4e5f\u5c06\u5c31\u6b64\u4e2d\u65ad\u3002<\/p>\n BIOS \u4e0a\u7535\u81ea\u68c0\u786e\u8ba4\u786c\u4ef6\u7684\u57fa\u672c\u529f\u80fd\u6b63\u5e38\uff0c\u7136\u540e\u4ea7\u751f\u4e00\u4e2a BIOS \u4e2d\u65ad INT 13H\uff0c\u8be5\u4e2d\u65ad\u6307\u5411\u67d0\u4e2a\u63a5\u5165\u7684\u53ef\u5f15\u5bfc\u8bbe\u5907\u7684\u5f15\u5bfc\u6247\u533a\u3002\u5b83\u6240\u627e\u5230\u7684\u5305\u542b\u6709\u6548\u7684\u5f15\u5bfc\u8bb0\u5f55\u7684\u7b2c\u4e00\u4e2a\u5f15\u5bfc\u6247\u533a\u5c06\u88ab\u88c5\u8f7d\u5230\u5185\u5b58\u4e2d\uff0c\u5e76\u4e14\u63a7\u5236\u6743\u4e5f\u5c06\u4ece\u5f15\u5bfc\u6247\u533a\u8f6c\u79fb\u5230\u6b64\u6bb5\u4ee3\u7801\u3002<\/p>\n \u5f15\u5bfc\u6247\u533a\u662f\u5f15\u5bfc\u52a0\u8f7d\u5668\u771f\u6b63\u7684\u7b2c\u4e00\u9636\u6bb5\u3002\u5927\u591a\u6570 Linux \u53d1\u884c\u7248\u672c\u4f7f\u7528\u7684\u5f15\u5bfc\u52a0\u8f7d\u5668\u6709\u4e09\u79cd\uff1aGRUB\u3001GRUB2 \u548c LILO\u3002GRUB2 \u662f\u6700\u65b0\u7684\uff0c\u4e5f\u662f\u76f8\u5bf9\u4e8e\u5176\u4ed6\u8001\u7684\u540c\u7c7b\u7a0b\u5e8f\u4f7f\u7528\u6700\u5e7f\u6cdb\u7684\u3002<\/p>\n GRUB2<\/strong><\/span><\/div>\n GRUB2 \u5168\u79f0\u662f GRand Unified BootLoader\uff0cVersion 2\uff08\u7b2c\u4e8c\u7248\u5927\u4e00\u7edf\u5f15\u5bfc\u88c5\u8f7d\u7a0b\u5e8f\uff09\u3002\u5b83\u662f\u76ee\u524d\u6d41\u884c\u7684\u5927\u90e8\u5206 Linux \u53d1\u884c\u7248\u672c\u7684\u4e3b\u8981\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u3002GRUB2 \u662f\u4e00\u4e2a\u7528\u4e8e\u8ba1\u7b97\u673a\u5bfb\u627e\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u5e76\u52a0\u8f7d\u5176\u5230\u5185\u5b58\u7684\u667a\u80fd\u7a0b\u5e8f\u3002\u7531\u4e8e GRUB \u8fd9\u4e2a\u5355\u8bcd\u6bd4 GRUB2 \u66f4\u6613\u4e8e\u4e66\u5199\u548c\u9605\u8bfb\uff0c\u5728\u4e0b\u6587\u4e2d\uff0c\u9664\u7279\u6b8a\u6307\u660e\u4ee5\u5916\uff0cGRUB \u5c06\u4ee3\u6307 GRUB2\u3002<\/p>\n GRUB \u88ab\u8bbe\u8ba1\u4e3a\u517c\u5bb9\u64cd\u4f5c\u7cfb\u7edf\u591a\u91cd\u5f15\u5bfc\u89c4\u8303\uff0c\u5b83\u80fd\u591f\u7528\u6765\u5f15\u5bfc\u4e0d\u540c\u7248\u672c\u7684 Linux \u548c\u5176\u4ed6\u7684\u5f00\u6e90\u64cd\u4f5c\u7cfb\u7edf\uff1b\u5b83\u8fd8\u80fd\u94fe\u5f0f\u52a0\u8f7d\u4e13\u6709\u64cd\u4f5c\u7cfb\u7edf\u7684\u5f15\u5bfc\u8bb0\u5f55\u3002<\/p>\n GRUB \u5141\u8bb8\u7528\u6237\u4ece\u4efb\u4f55\u7ed9\u5b9a\u7684 Linux \u53d1\u884c\u7248\u672c\u7684\u51e0\u4e2a\u4e0d\u540c\u5185\u6838\u4e2d\u9009\u62e9\u4e00\u4e2a\u8fdb\u884c\u5f15\u5bfc\u3002\u8fd9\u4e2a\u7279\u6027\u4f7f\u5f97\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5728\u56e0\u4e3a\u5173\u952e\u8f6f\u4ef6\u4e0d\u517c\u5bb9\u6216\u5176\u5b83\u67d0\u4e9b\u539f\u56e0\u5347\u7ea7\u5931\u8d25\u65f6\uff0c\u5177\u5907\u5f15\u5bfc\u5230\u5148\u524d\u7248\u672c\u7684\u5185\u6838\u7684\u80fd\u529b\u3002GRUB \u80fd\u591f\u901a\u8fc7\u6587\u4ef6 \/boot\/grub\/grub.conf \u8fdb\u884c\u914d\u7f6e\u3002\uff08LCTT \u8bd1\u6ce8\uff1a\u6b64\u5904\u6307 GRUB1\uff09<\/p>\n GRUB1 \u73b0\u5728\u5df2\u7ecf\u9010\u6b65\u88ab\u5f03\u7528\uff0c\u5728\u5927\u591a\u6570\u73b0\u4ee3\u53d1\u884c\u7248\u4e0a\u5b83\u5df2\u7ecf\u88ab GRUB2 \u6240\u66ff\u6362\uff0cGRUB2 \u662f\u5728 GRUB1 \u7684\u57fa\u7840\u4e0a\u91cd\u5199\u5b8c\u6210\u3002\u57fa\u4e8e Red Hat \u7684\u53d1\u884c\u7248\u5927\u7ea6\u662f\u5728 Fedora 15 \u548c CentOS\/RHEL 7 \u65f6\u5347\u7ea7\u5230 GRUB2 \u7684\u3002GRUB2 \u63d0\u4f9b\u4e86\u4e0e GRUB1 \u540c\u6837\u7684\u5f15\u5bfc\u529f\u80fd\uff0c\u4f46\u662f GRUB2 \u4e5f\u662f\u4e00\u4e2a\u7c7b\u4f3c\u4e3b\u6846\u67b6\uff08mainframe\uff09\u7cfb\u7edf\u4e0a\u7684\u57fa\u4e8e\u547d\u4ee4\u884c\u7684\u524d\u7f6e\u64cd\u4f5c\u7cfb\u7edf\uff08Pre-OS\uff09\u73af\u5883\uff0c\u4f7f\u5f97\u5728\u9884\u5f15\u5bfc\u9636\u6bb5\u914d\u7f6e\u66f4\u4e3a\u65b9\u4fbf\u548c\u6613\u64cd\u4f5c\u3002GRUB2 \u901a\u8fc7 \/boot\/grub2\/grub.cfg \u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n \u4e24\u4e2a GRUB \u7684\u6700\u4e3b\u8981\u4f5c\u7528\u90fd\u662f\u5c06\u5185\u6838\u52a0\u8f7d\u5230\u5185\u5b58\u5e76\u8fd0\u884c\u3002\u4e24\u4e2a\u7248\u672c\u7684 GRUB \u7684\u57fa\u672c\u5de5\u4f5c\u65b9\u5f0f\u4e00\u81f4\uff0c\u5176\u4e3b\u8981\u9636\u6bb5\u4e5f\u4fdd\u6301\u76f8\u540c\uff0c\u90fd\u53ef\u5206\u4e3a 3 \u4e2a\u9636\u6bb5\u3002\u5728\u672c\u6587\u5c06\u4ee5 GRUB2 \u4e3a\u4f8b\u8fdb\u884c\u8ba8\u8bba\u5176\u5de5\u4f5c\u8fc7\u7a0b\u3002GRUB \u6216 GRUB2 \u7684\u914d\u7f6e\uff0c\u4ee5\u53ca GRUB2 \u7684\u547d\u4ee4\u4f7f\u7528\u5747\u8d85\u8fc7\u672c\u6587\u8303\u56f4\uff0c\u4e0d\u4f1a\u5728\u6587\u4e2d\u8fdb\u884c\u4ecb\u7ecd\u3002<\/p>\n \u867d\u7136 GRUB2 \u5e76\u672a\u5728\u5176\u4e09\u4e2a\u5f15\u5bfc\u9636\u6bb5\u4e2d\u6b63\u5f0f\u4f7f\u7528\u8fd9\u4e9b\u9636\u6bb5stage\u540d\u8bcd\uff0c\u4f46\u662f\u4e3a\u4e86\u8ba8\u8bba\u65b9\u4fbf\uff0c\u6211\u4eec\u5728\u672c\u6587\u4e2d\u4f7f\u7528\u5b83\u4eec\u3002<\/p>\n \u9636\u6bb5 1<\/strong><\/span><\/div>\n \u5982\u4e0a\u6587 POST\uff08\u4e0a\u7535\u81ea\u68c0\uff09\u9636\u6bb5\u63d0\u5230\u7684\uff0c\u5728 POST \u9636\u6bb5\u7ed3\u675f\u65f6\uff0cBIOS \u5c06\u67e5\u627e\u5728\u63a5\u5165\u7684\u78c1\u76d8\u4e2d\u67e5\u627e\u5f15\u5bfc\u8bb0\u5f55\uff0c\u5176\u901a\u5e38\u4f4d\u4e8e MBR\uff08\u4e3b\u5f15\u5bfc\u8bb0\u5f55Master Boot Record\uff09\uff0c\u5b83\u52a0\u8f7d\u5b83\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5f15\u5bfc\u8bb0\u5f55\u4e2d\u5230\u5185\u5b58\u4e2d\uff0c\u5e76\u5f00\u59cb\u6267\u884c\u6b64\u4ee3\u7801\u3002\u5f15\u5bfc\u4ee3\u7801\uff08\u53ca\u9636\u6bb5 1 \u4ee3\u7801\uff09\u5fc5\u987b\u975e\u5e38\u5c0f\uff0c\u56e0\u4e3a\u5b83\u5fc5\u987b\u8fde\u540c\u5206\u533a\u8868\u653e\u5230\u786c\u76d8\u7684\u7b2c\u4e00\u4e2a 512 \u5b57\u8282\u7684\u6247\u533a\u4e2d\u3002 \u5728\u4f20\u7edf\u7684\u5e38\u89c4 MBR \u4e2d\uff0c\u5f15\u5bfc\u4ee3\u7801\u5b9e\u9645\u6240\u5360\u7528\u7684\u7a7a\u95f4\u5927\u5c0f\u4e3a 446 \u5b57\u8282\u3002\u8fd9\u4e2a\u9636\u6bb5 1 \u7684 446 \u5b57\u8282\u7684\u6587\u4ef6\u901a\u5e38\u88ab\u53eb\u505a\u5f15\u5bfc\u955c\u50cf\uff08boot.img\uff09\uff0c\u5176\u4e2d\u4e0d\u5305\u542b\u8bbe\u5907\u7684\u5206\u533a\u4fe1\u606f\uff0c\u5206\u533a\u662f\u4e00\u822c\u5355\u72ec\u6dfb\u52a0\u5230\u5f15\u5bfc\u8bb0\u5f55\u4e2d\u3002<\/p>\n \u7531\u4e8e\u5f15\u5bfc\u8bb0\u5f55\u5fc5\u987b\u975e\u5e38\u7684\u5c0f\uff0c\u5b83\u4e0d\u53ef\u80fd\u975e\u5e38\u667a\u80fd\uff0c\u4e14\u4e0d\u80fd\u7406\u89e3\u6587\u4ef6\u7cfb\u7edf\u7ed3\u6784\u3002\u56e0\u6b64\u9636\u6bb5 1 \u7684\u552f\u4e00\u529f\u80fd\u5c31\u662f\u5b9a\u4f4d\u5e76\u52a0\u8f7d\u9636\u6bb5 1.5 \u7684\u4ee3\u7801\u3002\u4e3a\u4e86\u5b8c\u6210\u6b64\u4efb\u52a1\uff0c\u9636\u6bb5 1.5 \u7684\u4ee3\u7801\u5fc5\u987b\u4f4d\u4e8e\u5f15\u5bfc\u8bb0\u5f55\u4e0e\u8bbe\u5907\u7b2c\u4e00\u4e2a\u5206\u533a\u4e4b\u95f4\u7684\u4f4d\u7f6e\u3002\u5728\u52a0\u8f7d\u9636\u6bb5 1.5 \u4ee3\u7801\u8fdb\u5165\u5185\u5b58\u540e\uff0c\u63a7\u5236\u6743\u5c06\u7531\u9636\u6bb5 1 \u8f6c\u79fb\u5230\u9636\u6bb5 1.5\u3002<\/p>\n \u9636\u6bb5 1.5<\/strong><\/span><\/div>\n \u5982\u4e0a\u6240\u8ff0\uff0c\u9636\u6bb5 1.5 \u7684\u4ee3\u7801\u5fc5\u987b\u4f4d\u4e8e\u5f15\u5bfc\u8bb0\u5f55\u4e0e\u8bbe\u5907\u7b2c\u4e00\u4e2a\u5206\u533a\u4e4b\u95f4\u7684\u4f4d\u7f6e\u3002\u8be5\u7a7a\u95f4\u7531\u4e8e\u5386\u53f2\u4e0a\u7684\u6280\u672f\u539f\u56e0\u800c\u7a7a\u95f2\u3002\u7b2c\u4e00\u4e2a\u5206\u533a\u7684\u5f00\u59cb\u4f4d\u7f6e\u5728\u6247\u533a 63 \u548c MBR\uff08\u6247\u533a 0\uff09\u4e4b\u95f4\u9057\u7559\u4e0b 62 \u4e2a 512 \u5b57\u8282\u7684\u6247\u533a\uff08\u5171 31744 \u5b57\u8282\uff09\uff0c\u8be5\u533a\u57df\u7528\u4e8e\u5b58\u50a8\u9636\u6bb5 1.5 \u7684\u4ee3\u7801\u955c\u50cf core.img \u6587\u4ef6\u3002\u8be5\u6587\u4ef6\u5927\u5c0f\u4e3a 25389 \u5b57\u8282\uff0c\u6545\u6b64\u533a\u57df\u6709\u8db3\u591f\u5927\u5c0f\u7684\u7a7a\u95f4\u7528\u6765\u5b58\u50a8 core.img\u3002<\/p>\n \u56e0\u4e3a\u6709\u66f4\u5927\u7684\u5b58\u50a8\u7a7a\u95f4\u7528\u4e8e\u9636\u6bb5 1.5\uff0c\u4e14\u8be5\u7a7a\u95f4\u8db3\u591f\u5bb9\u7eb3\u4e00\u4e9b\u901a\u7528\u7684\u6587\u4ef6\u7cfb\u7edf\u9a71\u52a8\u7a0b\u5e8f\uff0c\u5982\u6807\u51c6\u7684 EXT \u548c\u5176\u5b83\u7684 Linux \u6587\u4ef6\u7cfb\u7edf\uff0c\u5982 FAT \u548c NTFS \u7b49\u3002GRUB2 \u7684 core.img \u8fdc\u6bd4\u66f4\u8001\u7684 GRUB1 \u9636\u6bb5 1.5 \u66f4\u590d\u6742\u4e14\u66f4\u5f3a\u5927\u3002\u8fd9\u610f\u5473\u7740 GRUB2 \u7684\u9636\u6bb5 2 \u80fd\u591f\u653e\u5728\u6807\u51c6\u7684 EXT \u6587\u4ef6\u7cfb\u7edf\u5185\uff0c\u4f46\u662f\u4e0d\u80fd\u653e\u5728\u903b\u8f91\u5377\u5185\u3002\u6545\u9636\u6bb5 2 \u7684\u6587\u4ef6\u53ef\u4ee5\u5b58\u653e\u4e8e \/boot \u6587\u4ef6\u7cfb\u7edf\u4e2d\uff0c\u4e00\u822c\u5728 \/boot\/grub2 \u76ee\u5f55\u4e0b\u3002<\/p>\n \u6ce8\u610f \/boot \u76ee\u5f55\u5fc5\u987b\u653e\u5728\u4e00\u4e2a GRUB \u6240\u652f\u6301\u7684\u6587\u4ef6\u7cfb\u7edf\uff08\u5e76\u4e0d\u662f\u6240\u6709\u7684\u6587\u4ef6\u7cfb\u7edf\u5747\u53ef\uff09\u3002\u9636\u6bb5 1.5 \u7684\u529f\u80fd\u662f\u5f00\u59cb\u6267\u884c\u5b58\u653e\u9636\u6bb5 2 \u6587\u4ef6\u7684 \/boot \u6587\u4ef6\u7cfb\u7edf\u7684\u9a71\u52a8\u7a0b\u5e8f\uff0c\u5e76\u52a0\u8f7d\u76f8\u5173\u7684\u9a71\u52a8\u7a0b\u5e8f\u3002<\/p>\n \u9636\u6bb5 2<\/strong><\/span><\/div>\n GRUB \u9636\u6bb5 2 \u6240\u6709\u7684\u6587\u4ef6\u90fd\u5df2\u5b58\u653e\u4e8e \/boot\/grub2 \u76ee\u5f55\u53ca\u5176\u51e0\u4e2a\u5b50\u76ee\u5f55\u4e4b\u4e0b\u3002\u8be5\u9636\u6bb5\u6ca1\u6709\u4e00\u4e2a\u7c7b\u4f3c\u4e8e\u9636\u6bb5 1 \u4e0e\u9636\u6bb5 1.5 \u7684\u955c\u50cf\u6587\u4ef6\u3002\u76f8\u5e94\u5730\uff0c\u8be5\u9636\u6bb5\u4e3b\u8981\u9700\u8981\u4ece \/boot\/grub2\/i386-pc \u76ee\u5f55\u4e0b\u52a0\u8f7d\u4e00\u4e9b\u5185\u6838\u8fd0\u884c\u65f6\u6a21\u5757\u3002<\/p>\n GRUB \u9636\u6bb5 2 \u7684\u4e3b\u8981\u529f\u80fd\u662f\u5b9a\u4f4d\u548c\u52a0\u8f7d Linux \u5185\u6838\u5230\u5185\u5b58\u4e2d\uff0c\u5e76\u8f6c\u79fb\u63a7\u5236\u6743\u5230\u5185\u6838\u3002\u5185\u6838\u7684\u76f8\u5173\u6587\u4ef6\u4f4d\u4e8e \/boot \u76ee\u5f55\u4e0b\uff0c\u8fd9\u4e9b\u5185\u6838\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u5176\u6587\u4ef6\u540d\u8fdb\u884c\u8bc6\u522b\uff0c\u5176\u6587\u4ef6\u540d\u5747\u5e26\u6709\u524d\u7f00 vmlinuz\u3002\u4f60\u53ef\u4ee5\u5217\u51fa \/boot \u76ee\u5f55\u4e2d\u7684\u5185\u5bb9\u6765\u67e5\u770b\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u5f53\u524d\u5df2\u7ecf\u5b89\u88c5\u7684\u5185\u6838\u3002<\/p>\n GRUB2 \u8ddf GRUB1 \u7c7b\u4f3c\uff0c\u652f\u6301\u4ece Linux \u5185\u6838\u9009\u62e9\u4e4b\u4e00\u5f15\u5bfc\u542f\u52a8\u3002Red Hat \u5305\u7ba1\u7406\u5668\uff08DNF\uff09\u652f\u6301\u4fdd\u7559\u591a\u4e2a\u5185\u6838\u7248\u672c\uff0c\u4ee5\u9632\u6700\u65b0\u7248\u672c\u5185\u6838\u53d1\u751f\u95ee\u9898\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u6062\u590d\u8001\u7248\u672c\u7684\u5185\u6838\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cGRUB \u63d0\u4f9b\u4e86\u4e00\u4e2a\u5df2\u5b89\u88c5\u5185\u6838\u7684\u9884\u5f15\u5bfc\u83dc\u5355\uff0c\u5176\u4e2d\u5305\u62ec\u95ee\u9898\u8bca\u65ad\u83dc\u5355\uff08recuse\uff09\u4ee5\u53ca\u6062\u590d\u83dc\u5355\uff08\u5982\u679c\u914d\u7f6e\u5df2\u7ecf\u8bbe\u7f6e\u6062\u590d\u955c\u50cf\uff09\u3002<\/p>\n \u9636\u6bb5 2 \u52a0\u8f7d\u9009\u5b9a\u7684\u5185\u6838\u5230\u5185\u5b58\u4e2d\uff0c\u5e76\u8f6c\u79fb\u63a7\u5236\u6743\u5230\u5185\u6838\u4ee3\u7801\u3002<\/p>\n \u5185\u6838<\/strong><\/span><\/div>\n \u5185\u6838\u6587\u4ef6\u90fd\u662f\u4ee5\u4e00\u79cd\u81ea\u89e3\u538b\u7684\u538b\u7f29\u683c\u5f0f\u5b58\u50a8\u4ee5\u8282\u7701\u7a7a\u95f4\uff0c\u5b83\u4e0e\u4e00\u4e2a\u521d\u59cb\u5316\u7684\u5185\u5b58\u6620\u50cf\u548c\u5b58\u50a8\u8bbe\u5907\u6620\u5c04\u8868\u90fd\u5b58\u50a8\u4e8e \/boot \u76ee\u5f55\u4e4b\u4e0b\u3002<\/p>\n \u5728\u9009\u5b9a\u7684\u5185\u6838\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\u5e76\u5f00\u59cb\u6267\u884c\u540e\uff0c\u5728\u5176\u8fdb\u884c\u4efb\u4f55\u5de5\u4f5c\u4e4b\u524d\uff0c\u5185\u6838\u6587\u4ef6\u9996\u5148\u5fc5\u987b\u4ece\u538b\u7f29\u683c\u5f0f\u89e3\u538b\u81ea\u8eab\u3002\u4e00\u65e6\u5185\u6838\u81ea\u89e3\u538b\u5b8c\u6210\uff0c\u5219\u52a0\u8f7d systemd \u8fdb\u7a0b\uff08\u5176\u662f\u8001\u5f0f System V \u7cfb\u7edf\u7684 init \u7a0b\u5e8f\u7684\u66ff\u4ee3\u54c1)\uff0c\u5e76\u8f6c\u79fb\u63a7\u5236\u6743\u5230 systemd\u3002<\/p>\n \u8fd9\u5c31\u662f\u5f15\u5bfc\u8fc7\u7a0b\u7684\u7ed3\u675f\u3002\u6b64\u523b\uff0cLinux \u5185\u6838\u548c systemd \u5904\u4e8e\u8fd0\u884c\u72b6\u6001\uff0c\u4f46\u662f\u7531\u4e8e\u6ca1\u6709\u5176\u4ed6\u4efb\u4f55\u7a0b\u5e8f\u5728\u6267\u884c\uff0c\u6545\u5176\u4e0d\u80fd\u6267\u884c\u4efb\u4f55\u6709\u5173\u7528\u6237\u7684\u529f\u80fd\u6027\u4efb\u52a1\u3002<\/p>\n \u542f\u52a8\u8fc7\u7a0b<\/strong><\/div>\n \u542f\u52a8\u8fc7\u7a0b\u7d27\u968f\u5f15\u5bfc\u8fc7\u7a0b\u4e4b\u540e\uff0c\u542f\u52a8\u8fc7\u7a0b\u4f7f Linux \u7cfb\u7edf\u8fdb\u5165\u53ef\u64cd\u4f5c\u72b6\u6001\uff0c\u5e76\u80fd\u591f\u6267\u884c\u7528\u6237\u529f\u80fd\u6027\u4efb\u52a1\u3002<\/p>\n systemd<\/strong><\/span><\/div>\n systemd \u662f\u6240\u6709\u8fdb\u7a0b\u7684\u7236\u8fdb\u7a0b\u3002\u5b83\u8d1f\u8d23\u5c06 Linux \u4e3b\u673a\u5e26\u5230\u4e00\u4e2a\u7528\u6237\u53ef\u64cd\u4f5c\u72b6\u6001\uff08\u53ef\u4ee5\u6267\u884c\u529f\u80fd\u4efb\u52a1\uff09\u3002systemd \u7684\u4e00\u4e9b\u529f\u80fd\u8fdc\u8f83\u65e7\u5f0f init \u7a0b\u5e8f\u66f4\u4e30\u5bcc\uff0c\u53ef\u4ee5\u7ba1\u7406\u8fd0\u884c\u4e2d\u7684 Linux \u4e3b\u673a\u7684\u8bb8\u591a\u65b9\u9762\uff0c\u5305\u62ec\u6302\u8f7d\u6587\u4ef6\u7cfb\u7edf\uff0c\u4ee5\u53ca\u5f00\u542f\u548c\u7ba1\u7406 Linux \u4e3b\u673a\u7684\u7cfb\u7edf\u670d\u52a1\u7b49\u3002\u4f46\u662f systemd \u7684\u4efb\u4f55\u4e0e\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u65e0\u5173\u7684\u529f\u80fd\u5747\u4e0d\u5728\u6b64\u6587\u7684\u8ba8\u8bba\u8303\u56f4\u3002<\/p>\n \u9996\u5148\uff0csystemd \u6302\u8f7d\u5728 \/etc\/fstab \u4e2d\u914d\u7f6e\u7684\u6587\u4ef6\u7cfb\u7edf\uff0c\u5305\u62ec\u5185\u5b58\u4ea4\u6362\u6587\u4ef6\u6216\u5206\u533a\u3002\u636e\u6b64\uff0csystemd \u5fc5\u987b\u80fd\u591f\u8bbf\u95ee\u4f4d\u4e8e \/etc \u76ee\u5f55\u4e0b\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5305\u62ec\u5b83\u81ea\u5df1\u7684\u3002systemd \u501f\u52a9\u5176\u914d\u7f6e\u6587\u4ef6 \/etc\/systemd\/system\/default.target \u51b3\u5b9a Linux \u7cfb\u7edf\u5e94\u8be5\u542f\u52a8\u8fbe\u5230\u54ea\u4e2a\u72b6\u6001\uff08\u6216\u76ee\u6807\u6001target\uff09\u3002default.target \u662f\u4e00\u4e2a\u771f\u5b9e\u7684 target \u6587\u4ef6\u7684\u7b26\u53f7\u94fe\u63a5\u3002\u5bf9\u4e8e\u684c\u9762\u7cfb\u7edf\uff0c\u5176\u94fe\u63a5\u5230 graphical.target\uff0c\u8be5\u6587\u4ef6\u76f8\u5f53\u4e8e\u65e7\u5f0f systemV init \u65b9\u5f0f\u7684 runlevel 5\u3002\u5bf9\u4e8e\u4e00\u4e2a\u670d\u52a1\u5668\u64cd\u4f5c\u7cfb\u7edf\u6765\u8bf4\uff0cdefault.target \u66f4\u591a\u662f\u9ed8\u8ba4\u94fe\u63a5\u5230 multi-user.target\uff0c \u76f8\u5f53\u4e8e systemV \u7cfb\u7edf\u7684 runlevel 3\u3002emergency.target \u76f8\u5f53\u4e8e\u5355\u7528\u6237\u6a21\u5f0f\u3002<\/p>\n \uff08LCTT \u8bd1\u6ce8\uff1a\u201ctarget\u201d \u662f systemd \u65b0\u5f15\u5165\u7684\u6982\u5ff5\uff0c\u76ee\u524d\u5c1a\u672a\u53d1\u73b0\u6709\u5b98\u65b9\u7684\u51c6\u786e\u8bd1\u540d\uff0c\u8003\u8651\u5230\u5176\u4f5c\u7528\u548c\u4f7f\u7528\u7684\u4e0a\u4e0b\u6587\u73af\u5883\uff0c\u6211\u4eec\u8ba4\u4e3a\u7ffb\u8bd1\u4e3a\u201c\u76ee\u6807\u6001\u201d\u6bd4\u8f83\u8d34\u5207\u3002\u4ee5\u53ca\uff0c\u201cunit\u201d \u662f\u6307 systemd \u4e2d\u670d\u52a1\u548c\u76ee\u6807\u6001\u7b49\u5404\u4e2a\u5bf9\u8c61\/\u6587\u4ef6\uff0c\u5728\u6b64\u4f9d\u7167\u8bed\u5883\u8bd1\u4f5c\u201c\u5355\u5143\u201d\u3002\uff09<\/p>\n \u6ce8\u610f\uff0c\u6240\u6709\u7684\u76ee\u6807\u6001target\u548c\u670d\u52a1service\u5747\u662f systemd \u7684\u5355\u5143unit\u3002<\/p>\n \u5982\u4e0b\u8868 1 \u662f systemd \u542f\u52a8\u7684\u76ee\u6807\u6001target\u548c\u8001\u7248 systemV init \u542f\u52a8\u8fd0\u884c\u7ea7\u522brunlevel\u7684\u5bf9\u6bd4\u3002\u8fd9\u4e2a systemd \u76ee\u6807\u6001\u522b\u540d \u662f\u4e3a\u4e86 systemd \u5411\u524d\u517c\u5bb9 systemV \u800c\u63d0\u4f9b\u3002\u8fd9\u4e2a\u76ee\u6807\u6001\u522b\u540d\u5141\u8bb8\u7cfb\u7edf\u7ba1\u7406\u5458\uff08\u5305\u62ec\u6211\u81ea\u5df1\uff09\u7528 systemV \u547d\u4ee4\uff08\u4f8b\u5982 init 3\uff09\u6539\u53d8\u8fd0\u884c\u7ea7\u522b\u3002\u5f53\u7136\uff0c\u8be5 systemV \u547d\u4ee4\u662f\u88ab\u8f6c\u53d1\u5230 systemd \u8fdb\u884c\u89e3\u91ca\u548c\u6267\u884c\u7684\u3002<\/p>\n <\/p>\n <\/p>\n \u8868 1 \u8001\u7248\u672c systemV \u7684 \u8fd0\u884c\u7ea7\u522b\u4e0e systemd \u4e0e\u76ee\u6807\u6001target\u6216\u76ee\u6807\u6001\u522b\u540d\u7684\u6bd4\u8f83<\/p>\n \u6bcf\u4e2a\u76ee\u6807\u6001target\u6709\u4e00\u4e2a\u5728\u5176\u914d\u7f6e\u6587\u4ef6\u4e2d\u63cf\u8ff0\u7684\u4f9d\u8d56\u96c6\uff0csystemd \u9700\u8981\u9996\u5148\u542f\u52a8\u5176\u6240\u9700\u4f9d\u8d56\uff0c\u8fd9\u4e9b\u4f9d\u8d56\u670d\u52a1\u662f Linux \u4e3b\u673a\u8fd0\u884c\u5728\u7279\u5b9a\u7684\u529f\u80fd\u7ea7\u522b\u6240\u8981\u6c42\u7684\u670d\u52a1\u3002\u5f53\u914d\u7f6e\u6587\u4ef6\u4e2d\u6240\u6709\u7684\u4f9d\u8d56\u670d\u52a1\u90fd\u52a0\u8f7d\u5e76\u8fd0\u884c\u540e\uff0c\u5373\u8bf4\u660e\u7cfb\u7edf\u8fd0\u884c\u4e8e\u8be5\u76ee\u6807\u7ea7\u522b\u3002<\/p>\n systemd \u4e5f\u4f1a\u67e5\u770b\u8001\u5f0f\u7684 systemV init \u76ee\u5f55\u4e2d\u662f\u5426\u5b58\u5728\u76f8\u5173\u542f\u52a8\u6587\u4ef6\uff0c\u82e5\u5b58\u5728\uff0c\u5219 systemd \u6839\u636e\u8fd9\u4e9b\u914d\u7f6e\u6587\u4ef6\u7684\u5185\u5bb9\u542f\u52a8\u5bf9\u5e94\u7684\u670d\u52a1\u3002\u5728 Fedora \u7cfb\u7edf\u4e2d\uff0c\u8fc7\u65f6\u7684\u7f51\u7edc\u670d\u52a1\u5c31\u662f\u901a\u8fc7\u8be5\u65b9\u5f0f\u542f\u52a8\u7684\u4e00\u4e2a\u5b9e\u4f8b\u3002<\/p>\n \u5982\u4e0b\u56fe 1 \u662f\u76f4\u63a5\u4ece bootup \u7684 man \u9875\u9762\u62f7\u8d1d\u800c\u6765\u3002\u5b83\u5c55\u793a\u4e86\u5728 systemd \u542f\u52a8\u8fc7\u7a0b\u4e2d\u4e00\u822c\u7684\u4e8b\u4ef6\u5e8f\u5217\u548c\u786e\u4fdd\u6210\u529f\u7684\u542f\u52a8\u7684\u57fa\u672c\u7684\u987a\u5e8f\u8981\u6c42\u3002<\/p>\n sysinit.target \u548c basic.target \u76ee\u6807\u6001\u53ef\u4ee5\u88ab\u89c6\u4f5c\u542f\u52a8\u8fc7\u7a0b\u4e2d\u7684\u72b6\u6001\u68c0\u67e5\u70b9\u3002\u5c3d\u7ba1 systemd \u7684\u8bbe\u8ba1\u521d\u8877\u662f\u5e76\u884c\u542f\u52a8\u7cfb\u7edf\u670d\u52a1\uff0c\u4f46\u662f\u90e8\u5206\u670d\u52a1\u6216\u529f\u80fd\u76ee\u6807\u6001\u662f\u5176\u5b83\u670d\u52a1\u6216\u76ee\u6807\u6001\u7684\u542f\u52a8\u7684\u524d\u63d0\u3002\u7cfb\u7edf\u5c06\u6682\u505c\u4e8e\u68c0\u67e5\u70b9\u76f4\u5230\u5176\u6240\u8981\u6c42\u7684\u670d\u52a1\u548c\u76ee\u6807\u6001\u90fd\u6ee1\u8db3\u4e3a\u6b62\u3002<\/p>\n sysinit.target \u72b6\u6001\u7684\u5230\u8fbe\u662f\u4ee5\u5176\u6240\u4f9d\u8d56\u7684\u6240\u6709\u8d44\u6e90\u6a21\u5757\u90fd\u6b63\u5e38\u542f\u52a8\u4e3a\u524d\u63d0\u7684\uff0c\u6240\u6709\u5176\u5b83\u7684\u5355\u5143\uff0c\u5982\u6587\u4ef6\u7cfb\u7edf\u6302\u8f7d\u3001\u4ea4\u6362\u6587\u4ef6\u8bbe\u7f6e\u3001\u8bbe\u5907\u7ba1\u7406\u5668\u7684\u542f\u52a8\u3001\u968f\u673a\u6570\u751f\u6210\u5668\u79cd\u5b50\u8bbe\u7f6e\u3001\u4f4e\u7ea7\u522b\u7cfb\u7edf\u670d\u52a1\u521d\u59cb\u5316\u3001\u52a0\u89e3\u5bc6\u670d\u52a1\u542f\u52a8\uff08\u5982\u679c\u4e00\u4e2a\u6216\u8005\u591a\u4e2a\u6587\u4ef6\u7cfb\u7edf\u52a0\u5bc6\u7684\u8bdd\uff09\u7b49\u90fd\u5fc5\u987b\u5b8c\u6210\uff0c\u4f46\u662f\u5728 sysinit.target \u4e2d\u8fd9\u4e9b\u670d\u52a1\u4e0e\u6a21\u5757\u662f\u53ef\u4ee5\u5e76\u884c\u542f\u52a8\u7684\u3002<\/p>\n sysinit.target \u542f\u52a8\u6240\u6709\u7684\u4f4e\u7ea7\u522b\u670d\u52a1\u548c\u7cfb\u7edf\u521d\u5177\u529f\u80fd\u6240\u9700\u7684\u5355\u5143\uff0c\u8fd9\u4e9b\u90fd\u662f\u8fdb\u5165\u4e0b\u4e00\u9636\u6bb5 basic.target \u7684\u5fc5\u8981\u524d\u63d0\u3002<\/p>\n <\/p>\n \u56fe 1\uff1asystemd \u7684\u542f\u52a8\u6d41\u7a0b<\/p>\n \u5728 sysinit.target \u7684\u6761\u4ef6\u6ee1\u8db3\u4ee5\u540e\uff0csystemd \u63a5\u4e0b\u6765\u542f\u52a8 basic.target\uff0c\u542f\u52a8\u5176\u6240\u8981\u6c42\u7684\u6240\u6709\u5355\u5143\u3002basic.target \u901a\u8fc7\u542f\u52a8\u4e0b\u4e00\u76ee\u6807\u6001\u6240\u9700\u7684\u5355\u5143\u800c\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u529f\u80fd\uff0c\u8fd9\u5305\u62ec\u5404\u79cd\u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u8def\u5f84\u3001\u901a\u4fe1 sockets\uff0c\u4ee5\u53ca\u5b9a\u65f6\u5668\u7b49\u3002<\/p>\n \u6700\u540e\uff0c\u7528\u6237\u7ea7\u76ee\u6807\u6001\uff08multi-user.target \u6216 graphical.target\uff09 \u53ef\u4ee5\u521d\u59cb\u5316\u4e86\uff0c\u5e94\u8be5\u6ce8\u610f\u7684\u662f multi-user.target \u5fc5\u987b\u5728\u6ee1\u8db3\u56fe\u5f62\u5316\u76ee\u6807\u6001 graphical.target \u7684\u4f9d\u8d56\u9879\u4e4b\u524d\u5148\u8fbe\u6210\u3002<\/p>\n \u56fe 1 \u4e2d\uff0c\u4ee5 * \u5f00\u5934\u7684\u76ee\u6807\u6001\u662f\u901a\u7528\u7684\u542f\u52a8\u72b6\u6001\u3002\u5f53\u5230\u8fbe\u5176\u4e2d\u7684\u67d0\u4e00\u76ee\u6807\u6001\uff0c\u5219\u8bf4\u660e\u7cfb\u7edf\u5df2\u7ecf\u542f\u52a8\u5b8c\u6210\u4e86\u3002\u5982\u679c multi-user.target \u662f\u9ed8\u8ba4\u7684\u76ee\u6807\u6001\uff0c\u5219\u6210\u529f\u542f\u52a8\u7684\u7cfb\u7edf\u5c06\u4ee5\u547d\u4ee4\u884c\u767b\u5f55\u754c\u9762\u5448\u73b0\u4e8e\u7528\u6237\u3002\u5982\u679c graphical.target \u662f\u9ed8\u8ba4\u7684\u76ee\u6807\u6001\uff0c\u5219\u6210\u529f\u542f\u52a8\u7684\u7cfb\u7edf\u5c06\u4ee5\u56fe\u5f62\u767b\u5f55\u754c\u9762\u5448\u73b0\u4e8e\u7528\u6237\uff0c\u754c\u9762\u7684\u5177\u4f53\u6837\u5f0f\u5c06\u6839\u636e\u7cfb\u7edf\u6240\u914d\u7f6e\u7684\u663e\u793a\u7ba1\u7406\u5668\u800c\u5b9a\u3002<\/p>\n \u6545\u969c\u8ba8\u8bba<\/strong><\/div>\n \u6700\u8fd1\u6211\u9700\u8981\u6539\u53d8\u4e00\u53f0\u4f7f\u7528 GRUB2 \u7684 Linux \u7535\u8111\u7684\u9ed8\u8ba4\u5f15\u5bfc\u5185\u6838\u3002\u6211\u53d1\u73b0\u4e00\u4e9b GRUB2 \u7684\u547d\u4ee4\u5728\u6211\u7684\u7cfb\u7edf\u4e0a\u4e0d\u80fd\u7528\uff0c\u4e5f\u53ef\u80fd\u662f\u6211\u4f7f\u7528\u65b9\u6cd5\u4e0d\u6b63\u786e\u3002\u81f3\u4eca\uff0c\u6211\u4ecd\u7136\u4e0d\u77e5\u9053\u662f\u4f55\u539f\u56e0\u5bfc\u81f4\uff0c\u6b64\u95ee\u9898\u9700\u8981\u8fdb\u4e00\u6b65\u63a2\u7a76\u3002<\/p>\n grub2-set-default \u547d\u4ee4\u6ca1\u80fd\u5728\u914d\u7f6e\u6587\u4ef6 \/etc\/default\/grub \u4e2d\u6210\u529f\u5730\u8bbe\u7f6e\u9ed8\u8ba4\u5185\u6838\u7d22\u5f15\uff0c\u4ee5\u81f3\u4e8e\u671f\u671b\u7684\u66ff\u4ee3\u5185\u6838\u5e76\u6ca1\u6709\u88ab\u5f15\u5bfc\u542f\u52a8\u3002\u6545\u5728\u8be5\u914d\u7f6e\u6587\u4ef6\u4e2d\u6211\u624b\u52a8\u66f4\u6539 GRUB_DEFAULT=saved \u4e3a GRUB_DEFAULT=2\uff0c2 \u662f\u6211\u9700\u8981\u5f15\u5bfc\u7684\u5b89\u88c5\u597d\u7684\u5185\u6838\u6587\u4ef6\u7684\u7d22\u5f15\u3002\u7136\u540e\u6211\u6267\u884c\u547d\u4ee4 grub2-mkconfig > \/boot\/grub2\/grub.cfg \u521b\u5efa\u4e86\u65b0\u7684 GRUB \u914d\u7f6e\u6587\u4ef6\uff0c\u8be5\u65b9\u6cd5\u5982\u9884\u671f\u7684\u89c4\u907f\u4e86\u95ee\u9898\uff0c\u5e76\u6210\u529f\u5f15\u5bfc\u4e86\u66ff\u4ee3\u7684\u5185\u6838\u3002<\/p>\n \u7ed3\u8bba<\/strong><\/div>\n GRUB2\u3001systemd \u521d\u59cb\u5316\u7cfb\u7edf\u662f\u5927\u591a\u6570\u73b0\u4ee3 Linux \u53d1\u884c\u7248\u5f15\u5bfc\u548c\u542f\u52a8\u7684\u5173\u952e\u7ec4\u4ef6\u3002\u5c3d\u7ba1\u5728\u5b9e\u9645\u4e2d\uff0csystemd \u7684\u4f7f\u7528\u8fd8\u5b58\u5728\u4e00\u4e9b\u4e89\u8bae\uff0c\u4f46\u662f GRUB2 \u4e0e systemd \u53ef\u4ee5\u5bc6\u5207\u5730\u914d\u5408\u5148\u52a0\u8f7d\u5185\u6838\uff0c\u7136\u540e\u542f\u52a8\u4e00\u4e2a\u4e1a\u52a1\u7cfb\u7edf\u6240\u9700\u8981\u7684\u7cfb\u7edf\u670d\u52a1\u3002<\/p>\n \u5c3d\u7ba1 GRUB2 \u548c systemd \u90fd\u6bd4\u5176\u524d\u4efb\u8981\u66f4\u52a0\u590d\u6742\uff0c\u4f46\u662f\u5b83\u4eec\u66f4\u52a0\u5bb9\u6613\u5b66\u4e60\u548c\u7ba1\u7406\u3002\u5728 man \u9875\u9762\u6709\u5927\u91cf\u5173\u4e8e systemd \u7684\u5e2e\u52a9\u8bf4\u660e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u4e8b\u5b9e\u4e0a\uff0c\u64cd\u4f5c\u7cfb\u7edf\u7684\u542f\u52a8\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5\uff1a\u5f15\u5bfcboot\u548c\u542f\u52a8startup\u3002\u5f15\u5bfc\u9636\u6bb5\u5f00\u59cb\u4e8e\u6253\u5f00\u7535\u6e90\u5f00\u5173\uff0c\u7ed3\u675f\u4e8e\u5185\u6838\u521d […]<\/p>\n","protected":false},"author":1479,"featured_media":4576,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-172046","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/172046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=172046"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/172046\/revisions"}],"predecessor-version":[{"id":172102,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/172046\/revisions\/172102"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/4576"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=172046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=172046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=172046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} |