{"id":1095,"date":"2012-08-08T11:09:11","date_gmt":"2012-08-08T03:09:11","guid":{"rendered":"https:\/\/www.deepin.org\/?p=1095"},"modified":"2012-08-08T11:09:11","modified_gmt":"2012-08-08T03:09:11","slug":"install-and-use-systemd-on-linux-deepin","status":"publish","type":"post","link":"https:\/\/www.deepin.org\/zh\/install-and-use-systemd-on-linux-deepin\/","title":{"rendered":"\u5728 Linux Deepin \u4e0a\u5b89\u88c5\u548c\u4f7f\u7528 systemd"},"content":{"rendered":"<h2>\u4f55\u4e3a systemd\uff1f<\/h2>\n<p>systemd \u662f\u4e00\u4e2a Linux \u4e0b\u7684\u7cfb\u7edf\u548c\u4f1a\u8bdd\u7ba1\u7406\u5668\uff0c\u4e0e SysV \u548c LSB \u542f\u52a8\u811a\u672c\u517c\u5bb9\u3002systemd \u63d0\u4f9b\u4e86\u79ef\u6781\u7684\u5e76\u884c\u5904\u7406\u80fd\u529b\uff0c\u4f7f\u7528\u5957\u63a5\u5b57\uff08socket\uff09\u548c D-bus \u7684\u6fc0\u6d3b\u542f\u52a8\u670d\u52a1\uff0c\u53ef\u4f7f\u5b88\u62a4\u8fdb\u7a0b\u6309\u9700\u542f\u52a8\uff0c\u4f7f\u7528 Linux \u7684 cgroups \u4fdd\u6301\u5bf9\u8fdb\u7a0b\u7684\u8ffd\u8e2a\uff0c\u652f\u6301\u5bf9\u4e8e\u7cfb\u7edf\u72b6\u6001\u7684\u5907\u4efd\u4e0e\u6062\u590d\uff0c\u7ef4\u62a4\u624b\u52a8\u548c\u81ea\u52a8\u6302\u8f7d\u70b9\uff0c\u5b9e\u73b0\u4e86\u57fa\u4e8e\u4f9d\u8d56\u5173\u7cfb\u7684\u53ef\u6267\u884c\u670d\u52a1\u63a7\u5236\u903b\u8f91\u3002<\/p>\n<p>\u66f4\u591a\u4fe1\u606f\u53ef\u53c2\u89c1 <a href=\"http:\/\/www.freedesktop.org\/wiki\/Software\/systemd\">systemd \u4e3b\u9875<\/a>\u3002<\/p>\n<h2>\u4e2a\u4eba\u8f6f\u4ef6\u5305\u5b58\u6863\uff08PPA\uff09\u5730\u5740<\/h2>\n<p>systemd \u53ca\u76f8\u5173\u8f6f\u4ef6\u5305\u53ef\u5728<a href=\"https:\/\/launchpad.net\/~pitti\/+archive\/systemd\">\u6b64 PPA<\/a> \u627e\u5230\uff0c\u8981\u4f7f\u7528\u8be5 PPA\uff0c\u8bf7\u6309\u4e0b\u9762\u7684\u65b9\u6cd5\u5c06\u5176\u52a0\u5165\u5230\u60a8\u7684\u8f6f\u4ef6\u6e90\u5217\u8868\u5f53\u4e2d\uff1a<\/p>\n<pre>sudo add-apt-repository ppa:pitti\/systemd<\/pre>\n<pre>sudo apt-get update<\/pre>\n<h2>\u5b89\u88c5 systemd<\/h2>\n<p>systemd \u53ef\u4ece PPA \u4e2d\u6309\u5982\u4e0b\u65b9\u5f0f\u5b89\u88c5\uff1a<\/p>\n<pre>sudo apt-get install systemd libpam-systemd systemd-gui<\/pre>\n<p>\u8fd9\u4f1a\u4f7f systemd \u4e0e upstart \u5171\u5b58\u4e8e\u7cfb\u7edf\u4e2d\uff0c\u5982\u679c\u60a8\u60f3\u628a upstart \u6574\u4e2a\u66ff\u6362\u6389\uff0c\u60a8\u9700\u8981\u53e6\u5916\u5b89\u88c5 systemd-sysv \u8fd9\u4e2a\u8f6f\u4ef6\u5305\uff0c\u8fd9\u4e2a\u8f6f\u4ef6\u5305\u63d0\u4f9b\u7684 reboot \u7b49\u547d\u4ee4\u53ef\u5c06\u539f\u6765\u7684\u7a0b\u5e8f\u63d0\u4f9b\u7684\u540c\u6837\u7684\u547d\u4ee4\u66ff\u6362\u6389\u3002<br \/>\n<!--more--><\/p>\n<h2>\u5f15\u5bfc\u88c5\u8f7d\u7a0b\u5e8f\u7684\u914d\u7f6e<\/h2>\n<p>\u5728\u5b89\u88c5\u5b8c systemd \u4e4b\u540e\uff0c\u8ba1\u7b97\u673a\u53ef\u80fd\u8fd8\u662f\u4f1a\u9ed8\u8ba4\u4ee5 upstart \u542f\u52a8\uff0c\u4e3a\u4e86\u4f7f\u7cfb\u7edf\u4ee5 systemd \u4f7f\u7528\uff0c\u5fc5\u987b\u5728 grub \u914d\u7f6e\u6587\u4ef6\u4e2d\u7684 kernel \u547d\u4ee4\u884c\u6307\u5b9a\u4e0b\u9762\u7684\u53c2\u6570\uff1a<\/p>\n<pre>init=\/bin\/systemd<\/pre>\n<p>\u8981\u521b\u5efa\u4e00\u4e2a\u4ee5 systemd \u542f\u52a8\u7684 grub \u83dc\u5355\u9879\uff08menuentry\uff09\uff0c\u8bf7\u5728 \/boot\/grub\/grub.cfg \u4e2d\u627e\u5230\u4f60\u5f53\u524d\u4f7f\u7528\u7684\u542f\u52a8\u83dc\u5355\u9879\u4e00\u8282\uff0c\u5c06\u5176\u590d\u5236\u5230 \/etc\/grub.d\/40_custom \u4e2d\uff0c\u7136\u540e\uff1a<\/p>\n<ol>\n<li>\u4fee\u6539 grub \u83dc\u5355\u9879\u540d\u79f0<\/li>\n<li>\u5728 kernel \u4e00\u884c\u52a0\u5165 init=\/bin\/systemd<\/li>\n<\/ol>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a \/etc\/grub.d\/40_custom \u6587\u4ef6\u7684\u4f8b\u5b50\uff0c\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u76f4\u63a5\u590d\u5236\u8be5\u6587\u4ef6\u7684\u5185\u5bb9\u6765\u4f7f\u7528\uff0c\u5426\u5219\u5c06\u7531\u4e8e UUID \u4e0d\u9002\u7528\u4e8e\u4f60\u7684\u7cfb\u7edf\u800c\u65e0\u6cd5\u6b63\u5e38\u542f\u52a8\u3002<\/p>\n<pre>menuentry 'LinuxDeepin\uff0cLinux 3.2.0-27-generic-pae' --class linuxdeepin --class gnu-linux --class gnu --class os {\n        recordfail\n        gfxmode $linux_gfx_mode\n        insmod gzio\n        insmod part_gpt\n        insmod ext2\n        set root='(hd0,gpt2)'\n        search --no-floppy --fs-uuid --set=root 16189bfd-8ac1-43ef-a163-40e231c23fd2\n        linux   \/boot\/vmlinuz-3.2.0-27-generic-pae root=UUID=16189bfd-8ac1-43ef-a163-40e231c23fd2 ro init=\/bin\/systemd  quiet splash $vt_handoff\n        initrd  \/boot\/initrd.img-3.2.0-27-generic-pae\n}<\/pre>\n<p>\u8bf7\u6ce8\u610f\uff0csystemd \u4f4d\u4e8e \/bin \u800c\u975e \/sbin\u3002\u53e6\u5916\uff0c\u5982\u679c\u60a8\u7684\u7cfb\u7edf\u662f\u7531Linux Deepin\u7cfb\u7edf\u81ea\u8eab\u7684grub \u5f15\u5bfc\u7684\uff0c\u90a3\u4e48 grub \u914d\u7f6e\u6587\u4ef6\u5c06\u88ab\u81ea\u52a8\u66f4\u65b0\uff0c\u65e0\u9700\u8fdb\u884c\u8fd9\u4e00\u6b65\u7684\u914d\u7f6e\u3002<\/p>\n<h2>\/etc\/mtab<\/h2>\n<p>systemd \u542f\u52a8\u65f6\u5982\u51fa\u73b0\u4e0b\u9762\u7684\u8b66\u544a\u4fe1\u606f\uff1a<\/p>\n<pre>\/etc\/mtab is not a symlink or not pointing to \/proc\/self\/mounts. This is not supported anymore. Please make sure to replace this file by a symlink to avoid incorrect or misleading mount(8) output.<\/pre>\n<p>\u90a3\u4e48\uff0c\u6700\u597d\u6309\u7167\u5efa\u8bae\u7684\u90a3\u6837\u53bb\u505a\uff0c\u5c06 \/etc\/mtab \u66ff\u6362\u6389\u3002\u5426\u5219\u4e0d\u4ec5\u662f mount \u4f1a\u8fd0\u884c\u4e0d\u6b63\u5e38\uff0cdf\u4e5f\u662f\u4e00\u6837\uff0c\u800c\u4e14\u5176\u4ed6\u4f1a\u67e5\u770b\u6302\u8f7d\u5217\u8868\u7684\u7a0b\u5e8f\u4e5f\u5f88\u53ef\u80fd\u51fa\u95ee\u9898\u3002\u53ef\u4ee5\u50cf\u4e0b\u9762\u8fd9\u6837\u6539\uff1a<\/p>\n<pre>sudo ln -fs \/proc\/self\/mounts \/etc\/mtab<\/pre>\n<h2>systemd \u7684\u4f7f\u7528<\/h2>\n<h3>\u542f\u52a8<\/h3>\n<p>\u82e5\u4ee5 systemd \u65e0\u6cd5\u6b63\u5e38\u542f\u52a8\uff0c\u53ef\u4ee5\u8bd5\u4e00\u8bd5\u5728 grub \u914d\u7f6e\u4e2d\u7684kernel\u4e00\u884c\u52a0\u5165\u4e0b\u9762\u7684\u53c2\u6570\uff1a<\/p>\n<pre>init=\/bin\/systemd systemd.unit=emergency.service<\/pre>\n<p><strong>systemd.unit=<\/strong> \u6307\u5b9a\u4e86\u7cfb\u7edf\u8981\u542f\u52a8\u5230\u7684\u76ee\u6807\u72b6\u6001\uff08\u4e0e sysvinit \u6307\u5b9a\u8fd0\u884c\u7ea7\u522b\u76f8\u4f3c\uff09\u3002<br \/>\n<strong>emergency.service<\/strong> \u5728\u865a\u62df\u7ec8\u7aef\u542f\u52a8\u4e00\u4e2a\u7d27\u6025\u6a21\u5f0f\u7684 bash shell\uff0c\u5e76\u4e14\u4e0d\u5c1d\u8bd5\u542f\u52a8\u4efb\u4f55\u5176\u4ed6\u670d\u52a1\u3002<br \/>\n<a href=\"https:\/\/www.deepin.org\/wp-content\/uploads\/2012\/08\/systemd.jpeg\"><img class=\"aligncenter size-medium wp-image-1104\" title=\"systemd\" src=\"https:\/\/www.deepin.org\/wp-content\/uploads\/2012\/08\/1_systemd-300x179.jpg\" alt=\"\" width=\"300\" __height__=\"179\" \/><\/a><\/p>\n<h3>\u542f\u52a8\u540e\u63a7\u5236 systemd<\/h3>\n<p>\u63a7\u5236 systemd \u7684\u4e3b\u8981\u547d\u4ee4\u662f systemctl\u3002\u4e00\u4e9b\u5b50\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>systemctl list-units<\/strong> \u2014\u2014 \u5217\u51fa\u6240\u6709\u5355\u4f4d\uff08Unit\uff0c\u8be5\u672f\u8bed\u8868\u793a\u201c\u4efb\u52a1\u6216\u670d\u52a1\u201d\uff09<\/li>\n<li><strong>systemctl start [\u540d\u79f0...]<\/strong> \u2014\u2014 \u542f\u52a8\uff08\u6216\u6fc0\u6d3b\uff09\u4e00\u4e2a\u6216\u591a\u4e2a\u5355\u4f4d<\/li>\n<li><strong>systemctl stop [\u540d\u79f0...]<\/strong> \u2014\u2014 \u505c\u6b62\uff08\u6216\u6302\u8d77\uff09\u4e00\u4e2a\u6216\u591a\u4e2a\u5355\u4f4d<\/li>\n<li><strong>systemctl enable [\u540d\u79f0...]<\/strong> \u2014\u2014 \u542f\u7528\u4e00\u4e2a\u6216\u591a\u4e2a\u5355\u4f4d<\/li>\n<li><strong>systemctl disable [\u540d\u79f0...]<\/strong> \u2014\u2014 \u505c\u7528\u4e00\u4e2a\u6216\u591a\u4e2a\u5355\u4f4d<\/li>\n<li><strong>systemctl reboot<\/strong> \u2014\u2014 \u5173\u95ed\u6216\u91cd\u65b0\u542f\u52a8\u7cfb\u7edf<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u5982\u9700\u67e5\u770b\u6574\u4e2a\u547d\u4ee4\u5217\u8868\uff0c\u8bf7\u53c2\u89c1 systemctl(1)\u7684 man \u624b\u518c\u9875\u3002<br \/>\nsystemadm \u662f systemctl \u7684\u56fe\u5f62\u7528\u6237\u754c\u9762\u524d\u7aef\u3002","protected":false},"excerpt":{"rendered":"<p>\u4f55\u4e3a systemd\uff1f systemd \u662f\u4e00\u4e2a Linux \u4e0b\u7684\u7cfb\u7edf\u548c\u4f1a\u8bdd\u7ba1\u7406\u5668\uff0c\u4e0e SysV \u548c LSB \u542f\u52a8\u811a\u672c\u517c\u5bb9\u3002systemd \u63d0\u4f9b\u4e86\u79ef\u6781\u7684\u5e76\u884c\u5904\u7406\u80fd\u529b\uff0c\u4f7f\u7528\u5957\u63a5\u5b57\uff08socket\uff09\u548c D-bus \u7684\u6fc0\u6d3b\u542f\u52a8\u670d\u52a1\uff0c\u53ef\u4f7f\u5b88\u62a4\u8fdb\u7a0b\u6309\u9700\u542f\u52a8\uff0c\u4f7f\u7528 Linux \u7684 cgroups \u4fdd\u6301\u5bf9\u8fdb\u7a0b\u7684\u8ffd\u8e2a\uff0c\u652f\u6301\u5bf9\u4e8e\u7cfb\u7edf\u72b6\u6001\u7684\u5907\u4efd\u4e0e\u6062\u590d\uff0c\u7ef4\u62a4\u624b\u52a8\u548c\u81ea\u52a8\u6302\u8f7d\u70b9\uff0c\u5b9e\u73b0\u4e86\u57fa\u4e8e\u4f9d\u8d56\u5173\u7cfb\u7684\u53ef\u6267\u884c\u670d\u52a1\u63a7\u5236\u903b\u8f91\u3002 \u66f4\u591a\u4fe1 ...<a href=https:\/\/www.deepin.org\/zh\/install-and-use-systemd-on-linux-deepin\/>\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":27,"featured_media":9982,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[93],"tags":[],"_links":{"self":[{"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/posts\/1095"}],"collection":[{"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/comments?post=1095"}],"version-history":[{"count":0,"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/posts\/1095\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.deepin.org\/zh\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/media?parent=1095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/categories?post=1095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deepin.org\/zh\/wp-json\/wp\/v2\/tags?post=1095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}