{"id":312,"date":"2019-09-21T11:59:51","date_gmt":"2019-09-21T03:59:51","guid":{"rendered":"http:\/\/www.mustenaka.cn\/?p=312"},"modified":"2019-09-21T12:01:17","modified_gmt":"2019-09-21T04:01:17","slug":"ubunturemoveaptlock","status":"publish","type":"post","link":"https:\/\/www.mustenaka.cn\/index.php\/2019\/09\/21\/ubunturemoveaptlock\/","title":{"rendered":"Ubuntu\u7cfb\u5217\u7cfb\u7edf\u89e3\u9664\u8f6f\u4ef6\u9501"},"content":{"rendered":"<h3>\u5728Ubuntu\u53ca\u5176\u7cfb\u5217\u7cfb\u7edf\u4e2d<\/h3>\n<p>\u6709\u65f6\u5019\u8fd0\u7528sudo \u00a0apt-get install \u5b89\u88c5\u8f6f\u4ef6\u65f6\uff0c\u4f1a\u51fa\u73b0\u4e00\u4e0b\u7684\u60c5\u51b5<\/p>\n<blockquote><p>E: Could not get lock \/var\/lib\/dpkg\/lock &#8211; open (11: Resource temporarily unavailable)<br \/>\nE: Unable to lock the administration directory (\/var\/lib\/dpkg\/), is another process using it?<\/p><\/blockquote>\n<p>\u5728\u8fd9\u4e2a\u65f6\u5019\uff0c\u4e3b\u8981\u662f\u56e0\u4e3aapt\u8fd8\u5728\u8fd0\u884c\uff0c\u6b64\u65f6\u7684\u89e3\u51b3\u65b9\u6848\u662f<\/p>\n<p><!--more--><\/p>\n<h4>1\u3001\u627e\u5230\u5e76\u4e14\u6740\u6389\u6240\u6709\u7684apt-get \u548capt\u8fdb\u7a0b<\/h4>\n<p>\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u751f\u6210\u6240\u6709\u542b\u6709 apt \u7684\u8fdb\u7a0b\u5217\u8868\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528ps\u548cgrep\u547d\u4ee4\u5e76\u7528\u7ba1\u9053\u7ec4\u5408\u6765\u5f97\u5230\u542b\u6709apt\u6216\u8005apt-get\u7684\u8fdb\u7a0b\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">ps -A | grep apt\r\n\u627e\u51fa\u6240\u6709\u7684 apt \u4ee5\u53ca apt-get \u8fdb\u7a0b\r\n\r\n$ sudo kill -9 \u8fdb\u7a0bID\r\n\u6216\u8005\r\n$ sudo kill -SIGKILL \u8fdb\u7a0bID<\/code><\/pre>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u4e5f\u540c\u6837\u9002\u7528\u4e8edpkg\u7684\u9501\u5b9a\u95ee\u9898<\/p>\n<h4>2\u3001\u5220\u9664\u9501\u5b9a\u6587\u4ef6<\/h4>\n<p>\u9501\u5b9a\u7684\u6587\u4ef6\u4f1a\u963b\u6b62 Linux \u7cfb\u7edf\u4e2d\u67d0\u4e9b\u6587\u4ef6\u6216\u8005\u6570\u636e\u7684\u8bbf\u95ee\uff0c\u8fd9\u4e2a\u6982\u5ff5\u4e5f\u5b58\u5728\u4e8e Windows \u6216\u8005\u5176\u4ed6\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u3002<\/p>\n<p>\u4e00\u65e6\u4f60\u8fd0\u884c\u4e86 apt-get \u6216\u8005 apt \u547d\u4ee4\uff0c\u9501\u5b9a\u6587\u4ef6\u5c06\u4f1a\u521b\u5efa\u4e8e\u00a0\/var\/lib\/apt\/lists\/\u3001\/var\/lib\/dpkg\/\u3001\/var\/cache\/apt\/archives\/\u00a0\u4e2d\u3002<\/p>\n<p>\u8fd9\u6709\u52a9\u4e8e\u8fd0\u884c\u4e2d\u7684 apt-get \u6216\u8005 apt \u8fdb\u7a0b\u80fd\u591f\u907f\u514d\u88ab\u5176\u5b83\u9700\u8981\u4f7f\u7528\u76f8\u540c\u6587\u4ef6\u7684\u7528\u6237\u6216\u8005\u7cfb\u7edf\u8fdb\u7a0b\u6240\u6253\u65ad\u3002\u5f53\u8be5\u8fdb\u7a0b\u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u9501\u5b9a\u6587\u4ef6\u5c06\u4f1a\u5220\u9664\u3002<\/p>\n<p>\u5f53\u4f60\u6ca1\u6709\u770b\u5230 apt-get \u6216\u8005 apt \u8fdb\u7a0b\u7684\u60c5\u51b5\u4e0b\u5728\u4e0a\u9762\u4e24\u4e2a\u4e0d\u540c\u7684\u6587\u4ef6\u5939\u4e2d\u770b\u5230\u4e86\u9501\u5b9a\u6587\u4ef6\uff0c\u8fd9\u662f\u56e0\u4e3a\u8fdb\u7a0b\u7531\u4e8e\u67d0\u4e2a\u539f\u56e0\u88ab\u6740\u6389\u4e86\uff0c\u56e0\u6b64\u4f60\u9700\u8981\u5220\u9664\u9501\u5b9a\u6587\u4ef6\u6765\u907f\u514d\u8be5\u9519\u8bef\u3002<\/p>\n<p>\u9996\u5148\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u79fb\u9664\u00a0\/var\/lib\/dpkg\/\u00a0\u6587\u4ef6\u5939\u4e0b\u7684\u9501\u5b9a\u6587\u4ef6\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">$ sudo rm \/var\/lib\/dpkg\/lock\r\n\u4e4b\u540e\u50cf\u4e0b\u9762\u8fd9\u6837\u5f3a\u5236\u91cd\u65b0\u914d\u7f6e\u8f6f\u4ef6\u5305\uff1a\r\n\r\n$ sudo dpkg --configure -a\r\n\u4e5f\u53ef\u4ee5\u5220\u9664\u00a0\/var\/lib\/apt\/lists\/\u00a0\u4ee5\u53ca\u7f13\u5b58\u6587\u4ef6\u5939\u4e0b\u7684\u9501\u5b9a\u6587\u4ef6\uff1a\r\n\r\n$ sudo rm \/var\/lib\/apt\/lists\/lock\r\n$ sudo rm \/var\/cache\/apt\/archives\/lock\r\n\u63a5\u4e0b\u6765\uff0c\u66f4\u65b0\u4f60\u7684\u8f6f\u4ef6\u5305\u6e90\u5217\u8868\uff1a\r\n\r\n$ sudo apt update\r\n\u6216\u8005\r\n$ sudo apt-get update<\/code><\/pre>\n<p>\u603b\u7ed3\u4e00\u4e0b\uff0c\u5bf9\u4e8e Ubuntu\uff08\u4ee5\u53ca\u5b83\u7684\u884d\u751f\u7248\uff0cELEMENTARY OS\uff09\u7528\u6237\u5728\u4f7f\u7528 apt-get \u6216\u8005 apt \u4e5f\u53eb aptitude \u547d\u4ee4\u65f6\u9047\u5230\u7684\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u7528\u4e24\u79cd\u65b9\u6cd5\u6765\u89e3\u51b3\u4e86\uff0c\u8fd9\u6837\u7684\u65b9\u6cd5\u5305\u62ecdpkg\u547d\u4ee4\u7b49\u5176\u4ed6\u7684\u5b89\u88c5\u547d\u4ee4\u9501\u5b9a\u90fd\u6709\u7528\uff0c\u9501\u5b9a\u6587\u4ef6\u4e0d\u540c\uff0c\u4f46\u601d\u7ef4\u90fd\u662f\u76f8\u540c\u7684\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Ubuntu\u53ca\u5176\u7cfb\u5217\u7cfb\u7edf\u4e2d \u6709\u65f6\u5019\u8fd0\u7528sudo \u00a0apt-get install \u5b89\u88c5\u8f6f\u4ef6\u65f6\uff0c\u4f1a\u51fa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[7],"class_list":["post-312","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux"],"views":1865,"_links":{"self":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/comments?post=312"}],"version-history":[{"count":2,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/312\/revisions"}],"predecessor-version":[{"id":314,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/312\/revisions\/314"}],"wp:attachment":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/categories?post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/tags?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}