apt-get installs 报错 ,提示如下:

Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)

glp@ubuntu:~$ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

解决:

glp@ubuntu:~$ su
Password:
root@ubuntu:/home/glp# rm -rf /var/lib/dpkg/lock
root@ubuntu:/home/glp# rm -rf /var/cache/apt/archives/lock

root@ubuntu:/home/glp# apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [50.0 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [39.7 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [32.1 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [37.0 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [288 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [184 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [139 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [164 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [2,516 B]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,324 B]
Fetched 1,247 kB in 5s (209 kB/s)
Reading package lists... Done

root@ubuntu:/home/glp# apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [50.0 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [39.7 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [32.1 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [37.0 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [288 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [184 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [139 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [164 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [2,516 B]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,324 B]
Fetched 1,247 kB in 5s (209 kB/s)
Reading package lists... Done

root@ubuntu:/home/glp# dpkg --configure -a

root@ubuntu:/home/glp# apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:libpango1.0-0 libpangox-1.0-0 ubuntu-core-launcher
Use 'apt autoremove' to remove them.
The following additional packages will be installed:vim-runtime
Suggested packages:ctags vim-doc vim-scripts vim-gnome-py2 | vim-gtk-py2 | vim-gtk3-py2| vim-athena-py2 | vim-nox-py2
The following NEW packages will be installed:vim vim-runtime
0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded.
Need to get 6,199 kB of archives.
After this operation, 30.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.2 [5,164 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim amd64 2:7.4.1689-3ubuntu1.2 [1,036 kB]
Fetched 6,199 kB in 31s (194 kB/s)
Selecting previously unselected package vim-runtime.
(Reading database ... 205227 files and directories currently installed.)
Preparing to unpack .../vim-runtime_2%3a7.4.1689-3ubuntu1.2_all.deb ...
Adding 'diversion of /usr/share/vim/vim74/doc/help.txt to /usr/share/vim/vim74/doc/help.txt.vim-tiny by vim-runtime'
Adding 'diversion of /usr/share/vim/vim74/doc/tags to /usr/share/vim/vim74/doc/tags.vim-tiny by vim-runtime'
Unpacking vim-runtime (2:7.4.1689-3ubuntu1.2) ...
Selecting previously unselected package vim.
Preparing to unpack .../vim_2%3a7.4.1689-3ubuntu1.2_amd64.deb ...
Unpacking vim (2:7.4.1689-3ubuntu1.2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up vim-runtime (2:7.4.1689-3ubuntu1.2) ...
Setting up vim (2:7.4.1689-3ubuntu1.2) ...
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode

apt-get installs 报错 Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)相关推荐

  1. 【错误记录】Android 可执行权限报错 ( Cannot run program “/data/user/0/cn.e/ffmpeg“: error=13,Permission denied )

    文章目录 一.报错信息 二.解决方案 一.报错信息 在应用中执行二进制可执行程序 , 将二进制文件拷贝到了 data/user/0/cn.example/files/ 目录下 , 2021-11-11 ...

  2. Conda——报错解决:CondaError: Cannot write to /.condarc Caused by PermissionError(13, ‘Permission denied‘)

    报错详情 解决方法 sudo chown -R pc /home/pc/.condarc sudo chown -R pc /home/pc/anaconda3 # pc ,替换你的用户名 # /ho ...

  3. ubuntu apt报错无法获得锁/var/lib/dpkg/lock 和无法锁定管理目录

    使用命令 sudo rm /var/cache/apt/archives/lock sudo rm /var/lib/dpkg/lock 使用完上述命令之后,需要关闭当前终端重新打开 参考链接 [Ub ...

  4. apt-get could not get lock /var/lib/dpkg/lock报错

    用apt-get命令安装一些软件包时,报这个错 could not get lock /var/lib/dpkg/lock 出现这个问题的原因可能是有另外一个程序正在运行,导致资源被锁不可用.而导致资 ...

  5. ubundu pip时报错:Could not get lock /var/lib/dpkg/lock

    在ubundu安装git时报错: E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily ...

  6. apt Could not get lock /var/lib/dpkg/lock 解决方案

    apt Could not get lock /var/lib/dpkg/lock 解决方案 删除锁定文件 sudo rm /var/lib/dpkg/lock

  7. Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)

    Ubuntu使用教程:E: 无法获得锁 /var/lib/apt/lists/lock - open (11 资源临时不可用) 查看一下是否有使用apt-get的程序,终端输入:ps -aux,找到使 ...

  8. sudo rm /var/cache/apt/archives/lock sudo rm /var/lib/dpkg/lock

    原因:历史软件(包)更新(安装)未完成就退出了系统 解决办法:杀死该进程 sudo rm /var/cache/apt/archives/lock sudo rm /var/lib/dpkg/lock ...

  9. Docker物理机重启后,docker报错 error creating overlay mount to /var/lib/docker/overlay2

    昨晚公司运维说机房要停电,然后今天上午来公司发现,之前docker起的容器启动不起来了,报错 Error response from daemon: Cannot restart container ...

  10. mysql启动报错mysqld_safe MySQL from pid file /var/run/MariaDB/marabi.pid ended

    用mysqld_safe 启动mysql遇到这个错误 这个问题的原因是mysql没有权限创建/var/run/mariadb/mariadb.pid这个文件,所以才造成的报错 正确方法是创建/var/ ...

最新文章

  1. OpenCV中利用cvConvertScale()将图像的数据类型由u8转化为64f...
  2. window.open 不显示地址栏_谷歌浏览器Chrome显示「由贵单位管理」怎么解决?非阿里...
  3. 【Linux】一步一步学Linux——indent命令(262)
  4. 设某链表中最常用的操作是在链表的尾部_Redis系列(二)底层数据结构之双端链表...
  5. 12c分页查询特性FETCH FIRST ROWS,OFFSET ROWS FETCH NEXT ROW LIMIT Clause子句
  6. 前端学习(2823):sitemap配置
  7. python——面向对象相关
  8. python如何把二进制转文本_在python3中如何把文本转换为二进制
  9. linux 2.6线程创建源码分析
  10. hdoj1043 Eight(逆向BFS+打表+康拓展开)
  11. 第一财经周刊:MySpace入乡 终于随俗
  12. XRD结果如何做定量相分析
  13. TDDL分布式数据库
  14. 常用十大免费建站程序介绍
  15. Oracle SQL 基础要点
  16. 实时可视化大数据项目05 -- UI界面
  17. 计算机毕业设计Java互联网校园家教兼职平台(源码+系统+mysql数据库+lw文档)
  18. Oracle查询表名注释及表字段注释
  19. Web前端开发培训之41个JavaScript实用技巧
  20. 【SpringBoot】35、SpringBoot整合Redis监听Key过期事件

热门文章

  1. mysql 插件相关命令
  2. 树莓派内网穿透方法大全
  3. 如何破解加密相册密码四大方法
  4. Delphi 读取注册表REG_MULTI_SZ类型,注意事项
  5. TransModeler交通仿真软件的最新特点
  6. 倒写的乘法口诀表用c语言表示,乘法口诀表,C语言实现
  7. LUP分解的C++实现
  8. BUUCTF WEB DROPBOX
  9. 通过H5(浏览器/WebView/其他)唤起本地app
  10. android sit0 ip6tnl0,android netcfg iwlist 的使用