赞
踩
如果是双系统则选择ubuntu高级选项
然后选择 Advanced options for Ubuntu,回车:
再选择一个 (recovery mode) 即可:
最后根据自己的需求来进行选择:
resume: 退出 recovery 模式,然后正常启动;
clean: 尝试清理垃圾文件,腾出更多的空间;
dpkg: 修复损坏的包;
fsck: 检查所有文件系统;
grub: 更新 grub 的启动载入器;
network: 启动网络;
root: 进入命令行模式; (如果没有网络,则要先选择 network)
system-summary: 系统概览,查看电脑的基本信息;
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p5 181M 141M 27M 85% /boot
/dev/nvme0n1p8 71G 26G 41G 39% /home
/dev/nvme0n1p1 96M 48M 49M 50% /boot/efi
tmpfs 1.6G 16K 1.6G 1% /run/user/121
tmpfs 1.6G 44K 1.6G 1% /run/user/1000
发现/boot确实占用率很高。
lenmom@M1701:~$ uname -a
Linux M1701 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64
lenmom@M1701:~$ dpkg --get-selections |grep linux
binutils-x86-64-linux-gnu install
console-setup-linux install
libselinux1:amd64 install
linux-base install
linux-firmware install
linux-generic install
linux-headers-4.15.0-39 install
linux-headers-4.15.0-39-generic install
linux-headers-4.15.0-43 install
linux-headers-4.15.0-43-generic install
linux-headers-generic install
linux-image-4.15.0-29-generic deinstall
linux-image-4.15.0-39-generic install
linux-image-4.15.0-43-generic install
linux-image-generic install
linux-libc-dev:amd64 install
linux-modules-4.15.0-29-generic deinstall
linux-modules-4.15.0-39-generic install
linux-modules-4.15.0-43-generic install
linux-modules-extra-4.15.0-29-generic deinstall
linux-modules-extra-4.15.0-39-generic install
linux-modules-extra-4.15.0-43-generic install
linux-signed-generic install
linux-sound-base install
pptp-linux install
syslinux install
syslinux-common install
syslinux-legacy install
util-linux install
能看到已经安装的版本,其中带image的一般就是旧版本,其中
a)deinstall 代表是已经删除的旧版本
b) install 是还没有删除的旧版本内核
通过uname -a可以查看到当前正在使用的内核版本,把不是当前版本的处于install状态的image-xxx-generic文件卸载掉,对于本例中linux-modules-extra-4.15.0-39-generic是多余的内核文件,正在使用的是linux-modules-extra-4.15.0-43-generic,开始卸载。
卸载命令为sudo apt-get remove linux-modules-xxx-generic,其中xxx为要卸载的内核版本号
lenmom@M1701:~$ sudo apt-get remove linux-modules-4.15.0-39-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-4.15.0-39-generic linux-modules-4.15.0-39-generic
0 upgraded, 0 newly installed, 2 to remove and 105 not upgraded.
1 not fully installed or removed.
After this operation, 74.6 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 187447 files and directories currently installed.)
Removing linux-image-4.15.0-39-generic (4.15.0-39.42) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.15.0-43-generic
I: /initrd.img.old is now a symlink to boot/initrd.img-4.15.0-43-generic
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-39-generic
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-43-generic
Found initrd image: /boot/initrd.img-4.15.0-43-generic
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
Removing linux-modules-4.15.0-39-generic (4.15.0-39.42) ...
Setting up initramfs-tools (0.130ubuntu3.5) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.5) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-43-generic
W: APT had planned for dpkg to do more than it reported back (6 vs 10).
Affected packages: initramfs-tools:amd64
u can execute the following command to ensure all useless files are deleted:
sudo dpkg -P linux-modules-4.15.0-46-generic -- the kernel name depend to your concret condition
lenmom@M1701:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p5 181M 75M 94M 45% /boot
/dev/nvme0n1p8 71G 26G 41G 39% /home
/dev/nvme0n1p1 96M 48M 49M 50% /boot/efi
tmpfs 1.6G 16K 1.6G 1% /run/user/121
tmpfs 1.6G 44K 1.6G 1% /run/user/1000
从软件源(也就是服务器)下载最新的软件包列表文件,更新本地软件包缓存信息(包含软件名,版本,校验值,依赖关系等)。
第一步,apt-get remove xxx ;就是卸载xxx
或者 apt-get remove --purge xxx ;卸载xxx并清除配置。
这两条命令对于依赖则是不管的。因为别的软件可能和此软件有相同的依赖,当然对依赖不能管了。
第二步,apt-get autoremove ;就是来对付那些不再被“依赖”的包, 自动检测并删除他们(任何时候都可以执行此条命令)。
autoremove: is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed.
[注释]: 这条命令不带任何参数。另外还有一条命令apt-get autoremove xxx ; 即加上软件名称。经测试这条命令和apt-get remove xxx相比,会多
出很多卸载内容,apt-get autoremove xxx 可能是 第一步和第二步 命令的综合写法,但不确定。慎用,可能会导致其他软件不可用!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。