【本文任务描述】:在VM虚拟机安装了ubuntu18.04,插叙df的时候发现很多/dev/loop的占用都是100%,但实际上并没有用到。因此找方法将这些设备删除掉。
【第一步】
直接尝试删除指令
apt autoremove --purge snapd
或者需要管理员权限来执行
sudo apt autoremove --purge snapd
如果报错如下所示,则进入第二步
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
【第二步】
尝试如下方案:
lsof /var/lib/dpkg/lock-frontend sudo rm /var/lib/dpkg/lock-frontend
然后重新配置
sudo dpkg --configure -a
如果成功,可以再次执行第一步,如果报错如下
dpkg: error: dpkg status database is locked by another process
则继续进行如下 *** 作:
lsof /var/lib/dpkg/lock lsof /var/lib/apt/lists/lock lsof /var/cache/apt/archives/lock
在执行过程中有可能会有以下信息提示
$ lsof /var/lib/apt/lists/lock lsof: status error on /var/lib/apt/lists/lock: No such file or directory lsof 4.89 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man usage: [-?abhKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-E] [+|-e s] [+|-f[gG]] [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s] [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names] Use the ``-h'' option to get more help information.
不用管这些信息,继续执行
sudo rm /var/lib/apt/lists/lock sudo rm /var/cache/apt/archives/lock sudo rm /var/lib/dpkg/lock
也有可能出现如下信息提示
$ sudo rm /var/lib/apt/lists/lock rm: cannot remove '/var/lib/apt/lists/lock': No such file or directory
也不用管这些,直接执行配置指令
sudo dpkg --configure -a
如无报错,即可回到【第一步】继续执行。正确的效果如下,键入y即可继续执行,之后可能会走进度耽误几分钟。
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: gnome-software gnome-software-common Suggested packages: apt-config-icons-hidpi gnome-software-plugin-flatpak gnome-software-plugin-limba Recommended packages: gnome-software-plugin-snap The following packages will be REMOVED: gnome-software-plugin-snap* linux-hwe-5.4-headers-5.4.0-42* linux-hwe-5.4-headers-5.4.0-47* linux-hwe-5.4-headers-5.4.0-48* snapd* The following packages will be upgraded: gnome-software gnome-software-common 2 upgraded, 0 newly installed, 5 to remove and 312 not upgraded. Need to get 2,966 kB of archives. After this operation, 316 MB disk space will be freed. Do you want to continue? [Y/n] y
展示效果如下图
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)