{"id":100304,"date":"2020-05-01T23:39:34","date_gmt":"2020-05-01T15:39:34","guid":{"rendered":"http:\/\/4563.org\/?p=100304"},"modified":"2020-05-01T23:39:34","modified_gmt":"2020-05-01T15:39:34","slug":"chroot-%e5%a4%a7%e5%ae%b6%e4%b8%80%e8%88%ac%e5%9c%a8%e4%bb%80%e4%b9%88%e5%9c%ba%e6%99%af%e7%94%a8","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=100304","title":{"rendered":"chroot \u5927\u5bb6\u4e00\u822c\u5728\u4ec0\u4e48\u573a\u666f\u7528"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  chroot \u5927\u5bb6\u4e00\u822c\u5728\u4ec0\u4e48\u573a\u666f\u7528               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pythonee <\/span>  <span><i><\/i> 51<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6700\u8fd1\u5728\u7406\u89e3\u8fd9\u4e2a\u547d\u4ee4\uff0c\u6709\u770b\u5230\u4e00\u6761\u662f\u8bf4\u53ef\u80fd\u5efa\u7acb\u72ec\u7acb\u3001\u9694\u79bb\u7684\u7a7a\u95f4<\/p>\n<p>\u90a3\u5c82\u4e0d\u662f docker\u3001virtualenv \u8fd9\u4e9b\u90fd\u53ef\u4ee5\u4f11\u606f\u4e86\uff1f\u8fd9\u4e2a\u4e0d\u662f\u6700\u5feb\u7684\u5efa\u7acb\u72ec\u7acb\u7a7a\u95f4\u7684\u529e\u6cd5\u5417<\/p>\n<p>https:\/\/www.ibm.com\/developerworks\/cn\/linux\/l-cn-chroot\/index.html      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"777512\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lihongjie0209 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u7ef4\u62a4\u4e00\u4e2a PCB, PCB \u4e2d\u6709\u4e00\u4e2a\u5b57\u6bb5 root, \u5f53\u4f60\u8bbf\u95ee \/opt \u7684\u65f6\u5019, \/ \u5c31\u662f\u8fd9\u4e2a root.<\/p>\n<p>\u6240\u4ee5\u8fd9\u4e2a\u53ea\u80fd\u505a\u5230\u6587\u4ef6\u7cfb\u7edf\u7684\u4e00\u4e2a\u9694\u79bb. \u4f60\u5982\u679c\u8981\u9650\u5236 CPU, \u9650\u5236\u5185\u5b58, \u8fd8\u6709\u7f51\u7edc\u7aef\u53e3\u53f7\u7684\u547d\u540d\u7a7a\u95f4, \u90a3\u4e48\u4f60\u4f7f\u7528 chroot \u662f\u6ca1\u529e\u6cd5\u5b9e\u73b0\u7684.                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777513\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : msg7086 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             docker \u4e0d\u5c31\u662f chroot \u7684\u540e\u7ee7\u8005\u5417\uff1f<br \/>chroot \u53ea\u662f\u7a0b\u5e8f\u73af\u5883\u72ec\u7acb\uff0c\u50cf\u4e0a\u8bf4\u7684 CPU \u5185\u5b58\u7f51\u7edc\u8fd9\u4e9b\u90fd\u6ca1\u6709\u529e\u6cd5\u9694\u79bb\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777514\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jinliming2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u88c5\u7cfb\u7edf\u7684\u65f6\u5019\u7528\u2026\u2026<br \/>\u5728 nomultilib \u7684 64 \u4f4d\u7cfb\u7edf\u4e0a\u8fd0\u884c steam \u5ba2\u6237\u7aef\u7684\u65f6\u5019\u7528\u2026\u2026<br \/>\u4e3a\u542f\u52a8\u7684\u670d\u52a1\u578b\u8f6f\u4ef6\u521b\u5efa\u9694\u79bb\u73af\u5883\u7684\u65f6\u5019\u7528\uff08 systemd \uff09\u2026\u2026<br \/>\u4e4b\u524d\u5199\u6bd5\u8bbe\u7684\u65f6\u5019\uff0c\u63a5\u89e6\u8fd9\u4e2a\u547d\u4ee4\uff0c\u5199\u7684\u4e00\u4e2a online judge \u7528\u6765\u8dd1\u7f16\u8bd1\u8fc7\u7684\u4ee3\u7801\u7684\u65f6\u5019\u7528\u8fc7\u2026\u2026<br \/>\u6211\u5c31\u8fd9\u51e0\u4e2a\u573a\u666f\u2026\u2026<\/p>\n<p>\u5176\u4ed6\uff0c\u597d\u50cf\u5728 ssh server \u4e0a\u4e5f\u53ef\u4ee5\u7528\uff0c\u8ba9 ssh \u4e0a\u6765\u7684\u7528\u6237\u5904\u4e8e\u4e00\u4e2a chroot \u4e0b\u2026\u2026                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777515\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Tink <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u88c5 arch \u7684\u65f6\u5019\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777516\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wizardoz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a\u8bf4\u7684\u5f88\u5bf9\uff0cchroot \u5f88\u4e45\u5f88\u4e45\u4ee5\u524d\u5c31\u6709\u4e86\uff0cdocker \u662f\u65b0\u5174\u4e8b\u7269\u3002docker \u5b9e\u73b0\u4e86\u5f88\u591a chroot \u505a\u4e0d\u5230\u7684\u4e8b\u60c5\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777517\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : guochao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             chroot \u53ea\u662f\u5207\u6839\uff0c\u8ddf virtualenv \u4ec0\u4e48\u7684\u4e0d\u5927\u4e00\u6837\uff0cdocker \u4e5f\u4e0d\u5927\u4e00\u6837\u3002<\/p>\n<p>\u5148\u8bf4 use case\u3002\u6211\u4e60\u60ef\u7684\u573a\u666f\uff1a<br \/> &#8211; chroot \u53ea\u5728\u4ece Linux \u91cc\u9762\u88c5 Linux \u65f6\u4f7f\u7528\u3002\u9700\u8981\u5148\u5c55\u5f00\u6587\u4ef6\u7cfb\u7edf\u3001\u6302\u8f7d sys procfs devtmpfs efivars \u7b49\u7b49\u7b49\u6587\u4ef6\u7cfb\u7edf\uff0c\u5f88\u9ebb\u70e6\u7684\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u6211\u88c5 Arch \u7528\u7684 arch-chroot \u5c31\u662f\u4e00\u4e2a chroot \u7684 wrapper<br \/> &#8211; docker \u53ea\u662f\u6253\u5305\u7ba1\u7406\u5e94\u7528\u3002\u5982\u679c\u9047\u5230\u4e00\u8fde\u4e32\u7684\u5171\u4eab\u5e93\u4e0d\u4e00\u81f4\u6211\u53ef\u80fd\u4e5f\u4f1a\u7528 docker\uff0c\u6216\u8005\u7528\u7c7b\u4f3c\u4e8e conda \u7684\u5904\u7406\u65b9\u6cd5\u3002<br \/> &#8211; conda\u3001virtualenv\u3001\u6211\u81ea\u5df1\u5199\u7684\u4e00\u4e9b\u7b80\u5355\u7684 helper \u4e3b\u8981\u662f\u5904\u7406\u4e2a\u522b\u7a0b\u5e8f\u9700\u8981\u5728\u4e0d\u540c\u7684\u4e8c\u8fdb\u5236 \/\u5171\u4eab\u5e93\u73af\u5883\u4e0b\u7684\u9700\u6c42\uff0c\u4e00\u822c\u662f\u811a\u672c\u4e00\u7c7b\u7a0b\u5e8f\u7684\u89e3\u91ca\u5668\u7248\u672c\u7684\u95ee\u9898\u6216\u8005\u811a\u672c\u7684\u5e93\u7684\u76ee\u5f55\uff0c\u6216\u8005\u662f\u5171\u4eab\u5e93\u9700\u8981 X Server \u4ee5\u53ca\u4e0d\u4e00\u6837\u7684\u7248\u672c\uff08 preload \uff09<\/p>\n<p>virtualenv \u548c conda \u4e4b\u7c7b\u7684\u5de5\u5177\u4e3b\u8981\u662f\u4fee\u6539\u73af\u5883\u53d8\u91cf\u6765\u4fee\u6539 shell \u548c\u5404\u79cd\u5de5\u5177\u6267\u884c\u3001\u52a0\u8f7d\u5404\u79cd\u7a0b\u5e8f\u7684\u884c\u4e3a\uff0c\u6bd4\u5982\u8bf4 PATH PYTHONPATH PERL5LIB LD_PRELOAD \u8fd9\u4e9b\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u5728\u4e00\u4e2a\u7ec8\u7aef\u91cc\u9762\u6267\u884c\u53e6\u4e00\u5957\u7a0b\u5e8f\u3002\u81ea\u5df1\u5c31\u53ef\u4ee5\u5199\u4e00\u4e9b\u5de5\u5177\u6765\u505a\u7c7b\u4f3c\u7684\u4e8b\u60c5<\/p>\n<p>chroot \u5b9e\u9645\u4e0a\u662f\u8c03\u7528\u4e86\u4e00\u4e2a chroot \u7684\u51fd\u6570\uff08 http:\/\/man7.org\/linux\/man-pages\/man2\/chroot.2.html \uff09\uff0c\u8ba9\u5b50\u8fdb\u7a0b\u53ef\u4ee5\u628a\u8fd9\u4e2a\u76ee\u5f55\u8ba4\u4f5c\u6839\u76ee\u5f55\u3002\u5e76\u6ca1\u6709\u9694\u79bb\u592a\u591a\u8d44\u6e90\uff0c\u4f60\u5b9e\u9645\u4e0a\u8fd8\u662f\u5728\u540c\u4e00\u4e2a\u547d\u540d\u7a7a\u95f4\u91cc\u9762\u7528\u4e86\u540c\u6837\u7684\u8d44\u6e90\u3002\u800c\u4e14 chroot \u9700\u8981\u4f60\u63d0\u524d\u51c6\u5907\u597d\u4e00\u5957\u7c7b\u4f3c\u4e8e\u5bb9\u5668\u955c\u50cf\u7684\u6587\u4ef6\u7cfb\u7edf\uff0c\u5f88\u591a\u60c5\u51b5\u4e0b\u4f60\u8fd8\u9700\u8981\u628a host \u7684\u76ee\u5f55\u6302\u8f7d\u8fdb\u6765\u624d\u80fd\u8ba9\u7a0b\u5e8f\u6b63\u5e38\u8fd0\u884c\u3002\u5f88\u9ebb\u70e6\u7684\u3002<br \/>\u6b64\u5916 chroot \u4ee5\u540e\u5982\u679c\u4e0d\u5207\u6362\u4e3a\u666e\u901a\u7528\u6237\uff0c\u662f\u53ef\u4ee5\u9003\u9038\u51fa\u6839\u76ee\u5f55\u7684\u3002<\/p>\n<p>docker \u5219\u662f\u5229\u7528\u4e86 namespace \u548c cgroup \u6765\u63a7\u5236\u548c\u9694\u79bb\u4e00\u4e2a\u8fdb\u7a0b\u6811\uff0c\u800c\u4e14\u7528\u4e86\u5927\u91cf\u6280\u5de7\u6765\u963b\u65ad\u8fdb\u7a0b\u9003\u9038\u7684\u8fc7\u7a0b\uff0c\u800c\u4e14\u8fd9\u51e0\u5e74\u4e5f\u51fa\u4e86\u975e\u5e38\u591a\u7684\u57fa\u4e8e kvm \u7684 runc\uff0c\u76f8\u5f53\u4e8e\u8f7b\u91cf\u7ea7\u865a\u62df\u673a\uff0c\u5fae\u8f6f\u6253\u7b97\u505a\u7684 wsl2 \u5e94\u8be5\u662f\u5dee\u4e0d\u591a\u7684\u4e1c\u897f\uff0c\u6bd4\u5982\u8bf4 kata container\uff0c\u9003\u9038\u7684\u96be\u5ea6\u975e\u5e38\u5927\u3002\u800c\u4e14\u53ef\u4ee5\u5229\u7528\u73b0\u6709\u7684 image\u3002\u4e3b\u8981\u662f\u4e3a\u4e86\u7f16\u6392\u670d\u52a1\u51fa\u73b0\u7684\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777518\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : devcat <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b89\u88c5 arch \u7684\u65f6\u5019\uff0c\u672c\u8d28\u5c31\u662f\u628a\u542f\u52a8\u76d8\u91cc\u7684\u4e1c\u897f\u5148\u88c5\u5230\u786c\u76d8\uff0c\u7136\u540e chroot \u8fdb\u53bb\u914d\u7f6e\u786c\u76d8\u91cc\u7684\u7cfb\u7edf<br \/>\u8fd8\u6709\u5c31\u662f\u5fd8\u8bb0 root \u5bc6\u7801\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u901a\u8fc7 chroot \u8fd8\u641e\u4e8b\u60c5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777519\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : realpg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             chroot \u53ea\u662f work folder \u52a0\u4e0a\u7981\u6b62\u5411\u4e0a<br \/>\u540e\u7eed\u7684 docker ve \u4ec0\u4e48\u7684\u66f4\u9ad8\u7ea7                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777520\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : updateing <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u53ef\u4ee5\u5728\u8def\u7531\u5668\u3001\u624b\u673a\u8fd9\u7c7b \u81ea\u5e26\u7cfb\u7edf\u4e0d\u662f\u5f88\u901a\u7528 \/\u5b8c\u5584\u7684\u8bbe\u5907\u4e0a \u5728\u4e0d\u4e2d\u65ad\u8bbe\u5907\u4e1a\u52a1\u7684\u524d\u63d0\u4e0b \u8dd1\u4e00\u4e2a\u5e38\u89c1 Linux \u53d1\u884c\u7248\u7684\u8fd0\u884c\u73af\u5883 [doge]                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"777521\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : akyle <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u901a\u8fc7\u542f\u52a8\u76d8\u6302\u8f7d\u539f\u6709\u7cfb\u7edf\uff0c\u4fee\u590d\u7cfb\u7edf\u5f15\u5bfc\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>chroot \u5927\u5bb6\u4e00\u822c\u5728\u4ec0\u4e48\u573a\u666f\u7528&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/100304"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=100304"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/100304\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=100304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=100304"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=100304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}