{"id":295,"date":"2018-08-24T14:17:19","date_gmt":"2018-08-24T06:17:19","guid":{"rendered":"http:\/\/www.inhhh.com\/blog\/?p=295"},"modified":"2018-08-24T14:32:02","modified_gmt":"2018-08-24T06:32:02","slug":"sub-process-usrbindpkg-returned-an-error-code-1%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/www.inhhh.com\/blog\/?p=295","title":{"rendered":"Sub-process \/usr\/bin\/dpkg returned an error code (1)\u7684\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\u4e4b\u524d\u662f\u9879\u76ee\u4e2d\u7528\u7684Docker\u5bb9\u5668\uff0c\u540e\u6765\u524d\u5929\u7a81\u7136docker\u8d77\u670d\u52a1\uff0c\u8d77\u4e0d\u6765\u4e86\uff0c\u62a5\u9519\u8bef\u5982\u4e0b\uff1a<\/p>\n<p><span style=\"font-size: medium;\">FATA[0000] Cannot connect to the Docker daemon. Is \u2018docker -d\u2019 running on this host?<\/span><\/p>\n<p>\u7136\u540e\uff0c\u6211\u548c\u6211\u7684\u5c0f\u4f19\u4f34\u5c31\u5f00\u59cb\u4e86\u4f5c\u6b7b\uff08\u6211\u4eec\u5bf9docker\u4e0d\u600e\u4e48\u4e86\u89e3\uff0c\u4ec5\u9650\u77e5\u9053\u662f\u4e2a\u5bb9\u56682333\uff09\uff0c\u7136\u540e\u6211\u4eec\u6253\u7b97\u5378\u8f7d\u4e86docker\u7136\u540e\u91cd\u65b0\u88c5docker\uff0c\u7136\u540e\u6211\u4eec\u5c31\u5378\u8f7d\u4e86docker\uff0c\u81f3\u4e8e\u5378\u8f7d\u7684\u5e72\u51c0\u4e0d\u5e72\u51c0\uff0c\u4e5f\u4e0d\u6e05\u695a\u4e86\uff0c\u4e4b\u540e\u5c31\u5b89\u88c5docker.io \u4f46\u662f\u603b\u662f\u62a5\u9519\uff1a<\/p>\n<p><span style=\"color: red; font-size: medium;\">Sub-process \/usr\/bin\/dpkg returned an error code (1)\u7684\u89e3\u51b3\u65b9\u6cd5<\/span><br \/>\n\u7136\u540e\u7ede\u5c3d\u8111\u6c41\uff0c\u5404\u79cd\u767e\u5ea6\uff0c\u53d1\u73b0\u57fa\u672c\u90fd\u662f\u8bf4\u6709\u4e24\u79cd\u65b9\u6848\uff1a<\/p>\n<ul>\n<li>\u65b9\u6848\u2460<\/li>\n<\/ul>\n<pre class=\"prettyprint\"><code class=\"language-php hljs has-numbering\">\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\r\ncd \/<span class=\"hljs-keyword\">var<\/span>\/lib\/dpkg\/info\r\nsudo rm -f  foomatic-filters <span class=\"hljs-comment\">#\u5373\u5220\u6389\u4e0a\u9762\u63d0\u793a\u5230\u7684\u90a3\u4e9b\u51fa\u9519\u7684\u8f6f\u4ef6\u5305<\/span>\r\nsudo apt-get update -f\r\nsudo apt-get -f install\r\nsudo apt-get upgrade\r\nsudo apt-get install foomatic-filters  <span class=\"hljs-comment\">#\u5373\u53c8\u91cd\u65b0\u5b89\u88c5\u56de\u539f\u6765\u51fa\u9519\u7684\u8f6f\u4ef6\u5305<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<\/ul>\n<ul>\n<li>\u65b9\u6848\u2461<\/li>\n<\/ul>\n<pre class=\"prettyprint\"><code class=\"language-php hljs has-numbering\">cd \/<span class=\"hljs-keyword\">var<\/span>\/lib\/dpkg\r\nsudo mv info info.bak <span class=\"hljs-comment\">#\u5373\u5907\u4efd\u4e00\u4e2ainfo<\/span>\r\nsudo mkdir info <span class=\"hljs-comment\">#\u65b0\u5efa\u4e00\u4e2a\u65b0\u7684info\u76ee\u5f55<\/span>\r\n\u7136\u540e\u91c7\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u88c5\u90a3\u4e9b\u51fa\u9519\u7684\u8f6f\u4ef6\u5305\r\nsudo apt-get \u2013reinstall install \u8f6f\u4ef6\u5305\u540d\r\n\u5f00\u59cb\u6211\u662f\u60f3\u5728\u4e00\u6761\u547d\u4ee4\u4e2d\u540c\u65f6\u5b89\u88c5\u51e0\u4e2a\u8f6f\u4ef6\u5305\uff0c\u7ed3\u679c\u8fd8\u662f\u51fa\u73b0E: Sub-process \/usr\/bin\/dpkg returned an error code (<span class=\"hljs-number\">1<\/span>) \u3002\u4e8e\u662f\u628a\u65b0\u7684info\u5220\u6389\uff0c\u4e00\u4e2a\u4e2a\u5730\u6765\u5b89\u88c5\uff0c\u6bcf\u88c5\u597d\u4e00\u4e2a\u8f6f\u4ef6\u5305\uff0c\u5c31\u628ainfo\u5220\u6389\uff0c\u518d\u65b0\u5efa\u4e00\u4e2a\uff0c\u8fd9\u6837\u5c31\u6ca1\u6709\u63d0\u793aE: Sub-process \/usr\/bin\/dpkg returned an error code (<span class=\"hljs-number\">1<\/span>) \u4e86\u3002\r\n\u6700\u540e\u7528\u539f\u6765\u7684info.bak \u66ff\u6362\u65b0\u7684info\r\nsudo -rf info\r\nsudo mv info.bak info\r\n\u4e4b\u540e\u8f93\u5165 sudo apt-get update \u548c sudo apt-get upgrade \u4ee5\u53casudo apt-get autoremove \u90fd\u4e0d\u518d\u6709E: Sub-process \/usr\/bin\/dpkg returned an error code (<span class=\"hljs-number\">1<\/span>)\u4e86<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<\/ul>\n<blockquote><p>\u8fd9\u4e9b\u90fd\u8fd8\u662f\u62a5\u9519\uff0c\u54ea\u6015\u5b89\u88c5\u4e0a\u4e86\uff0c\u5c31\u662f\u8fd8\u8981\u62a5\u9519\u8bef\uff1a<\/p>\n<p><span style=\"color: #993434; font-size: large;\">Client and server don\u2019t have same version (client API version: 1.20, server API version: 1.19)\u00a0<\/span><br \/>\n\u90a3\u6211\u4eec\u6700\u540e\u53c8\u627e\u4e86\u4e2a\u5f3a\u529b\u5c0f\u4f19\u4f34\uff0c\u4ed6\u7ed9\u6211\u4eec\u628a\u5378\u8f7d\u5e72\u51c0\u4e86\u4e4b\u540e\uff08 \/usr\/bin\/docker\u4e0b\u9762\u7684docker.io.<em>*<\/em>\u00a0\u5728\u5378\u8f7ddocker.io \u7684\u65f6\u5019\u4e0d\u4f1a\u81ea\u52a8\u6e05\u9664\uff0c\u9700\u8981\u5355\u72ec\u5220\u9664\uff09\uff0c\u6700\u540e\u6211\u4eec\u5b89\u88c5\u7684\u5b98\u7f51\u6700\u65b0\u7248\uff01<\/p><\/blockquote>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\"><span class=\"hljs-comment\">\/\/\u6700\u7ec8\u89e3\u51b3\u95ee\u9898O(\u2229_\u2229)O\u54c8\u54c8~<\/span>\r\n$ sudo apt<span class=\"hljs-attribute\">-get<\/span> install apt<span class=\"hljs-attribute\">-transport<\/span><span class=\"hljs-attribute\">-https<\/span> \r\n$ sudo apt<span class=\"hljs-attribute\">-key<\/span> adv <span class=\"hljs-subst\">--<\/span>keyserver hkp:<span class=\"hljs-comment\">\/\/keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 <\/span>\r\n$ sudo bash <span class=\"hljs-attribute\">-c<\/span> <span class=\"hljs-string\">\"echo deb https:\/\/get.docker.io\/ubuntu docker main &gt; \/etc\/apt\/sources.list.d\/docker.list\"<\/span> \r\n$ sudo apt<span class=\"hljs-attribute\">-get<\/span> update \r\n$ sudo apt<span class=\"hljs-attribute\">-get<\/span> install lxc<span class=\"hljs-attribute\">-docker<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<\/ul>\n<blockquote><p>\u603b\u7ed3\uff1a\u611f\u89c9\u5c31\u662f\u5378\u8f7d\u8f6f\u4ef6\u7684\u65f6\u5019\u5378\u8f7d\u7684\u4e0d\u5e72\u51c0\uff0c\u5bfc\u81f4\u5b89\u88c5\u7684\u65f6\u5019\u53d1\u73b0\u6709docker\u6b8b\u7559\uff0c\u5b89\u88c5\u4e0d\u4e86\uff0c\u6d89\u53ca\u7248\u672c\u95ee\u9898\u7684\u60c5\u51b5\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\uff0c\u8bd5\u8bd5\uff01\uff01\uff01<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u662f\u9879\u76ee\u4e2d\u7528\u7684Docker\u5bb9\u5668\uff0c\u540e\u6765\u524d\u5929\u7a81\u7136docker\u8d77\u670d\u52a1\uff0c\u8d77\u4e0d\u6765\u4e86\uff0c\u62a5\u9519\u8bef\u5982\u4e0b\uff1a FATA[0000]<\/p>\n<div class=\"more-link\">\n\t\t\t\t <a href=\"http:\/\/www.inhhh.com\/blog\/?p=295\" class=\"link-btn theme-btn\"><span>Read More <\/span> <i class=\"fa fa-caret-right\"><\/i><\/a>\n\t\t\t<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-295","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=295"}],"version-history":[{"count":1,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":296,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/295\/revisions\/296"}],"wp:attachment":[{"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}