我有一个 Ubuntu 14.04 安装,我想升级do-release-upgrade
到 16.04。当我尝试升级时,我收到错误
可用磁盘空间不足
升级已中止。升级需要磁盘“/boot”上总共 76.2 M 的可用空间。请在“/boot”上至少释放 58.8 M 的额外磁盘空间。
apt-get autoremove
并且apt-get clean
没有删除任何文件。从网络搜索来看,这个问题的标准解决方案似乎是由 Alaa Ali 的回答提供的这个 AskUbuntu 问题,即apt-get purge
未使用的内核映像。按照这个建议,我删除了 41 个内核映像。然而,这并没有释放 上的任何空间/boot
。
前 apt-get purge
41 幅图像的输出df -h
为
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 785M 1012K 784M 1% /run
/dev/sda2 47G 28G 17G 62% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 88K 3.9G 1% /run/shm
none 100M 20K 100M 1% /run/user
/dev/sdb1 459G 121G 338G 27% /data
/dev/sda1 114M 89M 17M 85% /boot
/dev/sda4 404G 90G 295G 24% /home
后清除后,输出df -h
为
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 785M 1012K 784M 1% /run
/dev/sda2 47G 28G 17G 62% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 88K 3.9G 1% /run/shm
none 100M 20K 100M 1% /run/user
/dev/sdb1 459G 121G 338G 27% /data
/dev/sda1 114M 89M 17M 85% /boot
/dev/sda4 404G 90G 295G 24% /home
什么都没有改变。当我尝试时,仍然会收到相同的错误do-release-upgrade
。
dpkg -l | grep linux-image
比较清除图像前后的输出,确认内核图像已被删除。
我发现的所有答案都归结为autoremove
、clean
或清除内核映像,但这些都不起作用。我现在该怎么办?
编辑:附加信息
这是清除之前的输出dpkg -l | grep linux-image
:
$ dpkg -l | grep linux-image
rc linux-image-2.6.32-21-generic 2.6.32-21.32 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-23-generic 2.6.32-23.37 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-24-generic 2.6.32-24.43 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-25-generic 2.6.32-25.45 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-26-generic 2.6.32-26.48 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-27-generic 2.6.32-27.49 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-29-generic 2.6.32-29.58 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-30-generic 2.6.32-30.59 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-31-generic 2.6.32-31.61 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-32-generic 2.6.32-32.62 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-34-generic 2.6.32-34.77 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-37-generic 2.6.32-37.81 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-38-generic 2.6.32-38.83 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-39-generic 2.6.32-39.86 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-40-generic 2.6.32-40.87 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-41-generic 2.6.32-41.94 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-2.6.32-44-generic 2.6.32-44.98 amd64 Linux kernel image for version 2.6.32 on x86/x86_64
rc linux-image-3.13.0-107-generic 3.13.0-107.154 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rc linux-image-3.13.0-116-generic 3.13.0-116.163 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rc linux-image-3.13.0-157-generic 3.13.0-157.207 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-3.13.0-164-generic 3.13.0-164.214 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-3.13.0-170-generic 3.13.0-170.220 amd64 Signed kernel image generic
rc linux-image-3.13.0-66-generic 3.13.0-66.108 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rc linux-image-3.2.0-32-generic 3.2.0-32.51 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-33-generic 3.2.0-33.52 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-34-generic 3.2.0-34.53 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-35-generic 3.2.0-35.55 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-36-generic 3.2.0-36.57 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-37-generic 3.2.0-37.58 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-38-generic 3.2.0-38.61 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-39-generic 3.2.0-39.62 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-40-generic 3.2.0-40.64 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-41-generic 3.2.0-41.66 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-45-generic 3.2.0-45.70 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-48-generic 3.2.0-48.74 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-49-generic 3.2.0-49.75 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-53-generic 3.2.0-53.81 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-58-generic 3.2.0-58.88 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-88-generic 3.2.0-88.126 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-89-generic 3.2.0-89.127 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-3.2.0-92-generic 3.2.0-92.131 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc linux-image-extra-3.13.0-107-generic 3.13.0-107.154 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
rc linux-image-extra-3.13.0-116-generic 3.13.0-116.163 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
rc linux-image-extra-3.13.0-157-generic 3.13.0-157.207 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-164-generic 3.13.0-164.214 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
rc linux-image-extra-3.13.0-66-generic 3.13.0-66.108 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.170.181 amd64 Generic Linux kernel image
以下是我用来清除图像的命令:
$ sudo apt-get purge linux-image-2.6.32-{21,23,24,25,26,27,29,30,31,32,34,37,38,39,40,41,44}-generic
$ sudo apt-get purge linux-image-3.2.0-{32,33,34,35,36,37,38,39,40,41,45,48,49,53,58,88,89,92}-generic
$ sudo apt-get purge linux-image-3.13.0-107-generic
$ sudo apt-get purge linux-image-3.13.0-116-generic
$ sudo apt-get purge linux-image-extra-3.13.0-107-generic
$ sudo apt-get purge linux-image-extra-3.13.0-116-generic
$ sudo apt-get purge linux-image-3.13.0-66-generic
$ sudo apt-get purge linux-image-extra-3.13.0-66-generic
dpkg -l | grep linux-image
以下是运行上述清除命令后的输出:
$ dpkg -l | grep linux-image
rc linux-image-3.13.0-157-generic 3.13.0-157.207 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-3.13.0-164-generic 3.13.0-164.214 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-3.13.0-170-generic 3.13.0-170.220 amd64 Signed kernel image generic
rc linux-image-extra-3.13.0-157-generic 3.13.0-157.207 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-164-generic 3.13.0-164.214 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.170.181 amd64 Generic Linux kernel image
以下是 的当前内容/boot
:
$ ls -l /boot
total 81817
-rw-r--r-- 1 root root 1169147 Dec 5 2018 abi-3.13.0-164-generic
-rw-r--r-- 1 root root 166221 Dec 5 2018 config-3.13.0-164-generic
-rw-r--r-- 1 root root 166221 May 9 09:35 config-3.13.0-170-generic
drwxr-xr-x 5 root root 1024 Jul 19 14:43 grub
-rw-r--r-- 1 root root 31803728 Jul 9 13:28 initrd.img-3.13.0-164-generic
-rw-r--r-- 1 root root 31804631 Jul 9 13:28 initrd.img-3.13.0-170-generic
drwx------ 2 root root 12288 Jul 22 2010 lost+found
-rw-r--r-- 1 root root 254 Dec 5 2018 retpoline-3.13.0-164-generic
-rw------- 1 root root 3417774 Dec 5 2018 System.map-3.13.0-164-generic
-rw------- 1 root root 3418683 May 9 09:35 System.map-3.13.0-170-generic
-rw------- 1 root root 5905712 Dec 5 2018 vmlinuz-3.13.0-164-generic
-rw------- 1 root root 5909496 May 14 15:03 vmlinuz-3.13.0-170-generic
这是uname -r
:
$ uname -r
3.13.0-170-generic
编辑:摘要
/boot
通过删除一个内核映像, 我设法获得了 58M 可用空间。do-release-upgrade
需要 77M,所以我仍然需要大约 20M。
剩余的内核映像(我目前正在使用的那个)是 31M。除此之外,其他所有东西总共/boot
约 15.9M。似乎没有办法在do-release-upgrade
不删除当前内核映像的情况下释放足够的空间来运行。有人看到我遗漏了什么吗?
用于统计磁盘空间的数据:
$ sudo du -h -d 1 /boot/
12K /boot/lost+found
6.7M /boot/grub
47M /boot/
$ ls -lh /boot
total 40M
-rw-r--r-- 1 root root 163K May 9 09:35 config-3.13.0-170-generic
drwxr-xr-x 5 root root 1.0K Jul 23 13:41 grub
-rw-r--r-- 1 root root 31M Jul 9 13:28 initrd.img-3.13.0-170-generic
drwx------ 2 root root 12K Jul 22 2010 lost+found
-rw------- 1 root root 3.3M May 9 09:35 System.map-3.13.0-170-generic
-rw------- 1 root root 5.7M May 14 15:03 vmlinuz-3.13.0-170-generic
编辑:分辨率
显然,我没有能力解决这个问题。感谢所有提供信息和建议的人!
答案1
答案2
无需实时系统即可移动/boot
到根分区,如下所示。(每个步骤都应该是不言自明的,但请注意,我重新安装了 GRUB 和内核包,而不仅仅是复制文件。)
警告:不要忘记任何步骤,尤其grub-install
是和update-grub
,否则您的系统无法启动。
firas@ubuntu:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 396M 420K 395M 1% /run
/dev/sda2 9.1G 1.2G 7.5G 14% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 8.0K 5.0M 1% /run/lock
none 2.0G 0 2.0G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda1 464M 38M 398M 9% /boot
firas@ubuntu:~$ ls /boot
config-3.13.0-170-generic initrd.img-3.13.0-170-generic System.map-3.13.0-170-generic
grub lost+found vmlinuz-3.13.0-170-generic
firas@ubuntu:~$ sudo umount /boot
firas@ubuntu:~$ ls /boot
firas@ubuntu:~$ grep boot /etc/fstab
# /boot was on /dev/sda1 during installation
#UUID=9e6d0006-a9c2-4d0d-9b8a-615ffd9f533a /boot ext4 defaults 0 2
firas@ubuntu:~$ apt list --installed | grep grub
WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.
grub-common/trusty-updates,now 2.02~beta2-9ubuntu1.17 amd64 [installed]
grub-gfxpayload-lists/trusty,now 0.6 amd64 [installed,automatic]
grub-pc/trusty-updates,now 2.02~beta2-9ubuntu1.17 amd64 [installed]
grub-pc-bin/trusty-updates,now 2.02~beta2-9ubuntu1.17 amd64 [installed,automatic]
grub2-common/trusty-updates,now 2.02~beta2-9ubuntu1.17 amd64 [installed,automatic]
firas@ubuntu:~$ sudo apt-get install --reinstall grub-common grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 5 reinstalled, 0 to remove and 0 not to upgrade.
Need to get 0 B/3,241 kB of archives.
After this operation, 0 B of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 54436 files and directories currently installed.)
Preparing to unpack .../grub-common_2.02~beta2-9ubuntu1.17_amd64.deb ...
Unpacking grub-common (2.02~beta2-9ubuntu1.17) over (2.02~beta2-9ubuntu1.17) ...
Preparing to unpack .../grub-gfxpayload-lists_0.6_amd64.deb ...
Unpacking grub-gfxpayload-lists (0.6) over (0.6) ...
Preparing to unpack .../grub-pc_2.02~beta2-9ubuntu1.17_amd64.deb ...
Unpacking grub-pc (2.02~beta2-9ubuntu1.17) over (2.02~beta2-9ubuntu1.17) ...
Preparing to unpack .../grub-pc-bin_2.02~beta2-9ubuntu1.17_amd64.deb ...
Unpacking grub-pc-bin (2.02~beta2-9ubuntu1.17) over (2.02~beta2-9ubuntu1.17) ...
Preparing to unpack .../grub2-common_2.02~beta2-9ubuntu1.17_amd64.deb ...
Unpacking grub2-common (2.02~beta2-9ubuntu1.17) over (2.02~beta2-9ubuntu1.17) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Setting up grub-common (2.02~beta2-9ubuntu1.17) ...
Setting up grub2-common (2.02~beta2-9ubuntu1.17) ...
Setting up grub-pc-bin (2.02~beta2-9ubuntu1.17) ...
Setting up grub-gfxpayload-lists (0.6) ...
Setting up grub-pc (2.02~beta2-9ubuntu1.17) ...
firas@ubuntu:~$ sudo grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
firas@ubuntu:~$ apt list --installed | grep linux
WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.
libselinux1/trusty-updates,now 2.2.2-1ubuntu0.1 amd64 [installed]
linux-base/trusty-updates,trusty-security,now 4.5ubuntu1~14.04.1 all [installed,automatic]
linux-firmware/trusty-updates,trusty-security,now 1.127.24 all [installed,automatic]
linux-generic/trusty-updates,trusty-security,now 3.13.0.170.181 amd64 [installed]
linux-headers-3.13.0-170/trusty-updates,trusty-security,now 3.13.0-170.220 all [installed,automatic]
linux-headers-3.13.0-170-generic/trusty-updates,trusty-security,now 3.13.0-170.220 amd64 [installed,automatic]
linux-headers-generic/trusty-updates,trusty-security,now 3.13.0.170.181 amd64 [installed]
linux-image-3.13.0-170-generic/trusty-updates,trusty-security,now 3.13.0-170.220 amd64 [installed,automatic]
linux-image-generic/trusty-updates,trusty-security,now 3.13.0.170.181 amd64 [installed,automatic]
linux-modules-3.13.0-170-generic/trusty-updates,trusty-security,now 3.13.0-170.220 amd64 [installed,automatic]
linux-modules-extra-3.13.0-170-generic/trusty-updates,trusty-security,now 3.13.0-170.220 amd64 [installed,automatic]
util-linux/trusty-updates,now 2.20.1-5.1ubuntu20.9 amd64 [installed]
firas@ubuntu:~$ sudo apt-get install --reinstall linux-image-3.13.0-170-generic linux-modules-3.13.0-170-generic linux-modules-extra-3.13.0-170-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 3 reinstalled, 0 to remove and 0 not to upgrade.
Need to get 0 B/50.5 MB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 54436 files and directories currently installed.)
Preparing to unpack .../linux-image-3.13.0-170-generic_3.13.0-170.220_amd64.deb ...
Unpacking linux-image-3.13.0-170-generic (3.13.0-170.220) over (3.13.0-170.220) ...
Preparing to unpack .../linux-modules-3.13.0-170-generic_3.13.0-170.220_amd64.deb ...
Unpacking linux-modules-3.13.0-170-generic (3.13.0-170.220) over (3.13.0-170.220) ...
Preparing to unpack .../linux-modules-extra-3.13.0-170-generic_3.13.0-170.220_amd64.deb ...
Unpacking linux-modules-extra-3.13.0-170-generic (3.13.0-170.220) over (3.13.0-170.220) ...
Setting up linux-modules-3.13.0-170-generic (3.13.0-170.220) ...
Setting up linux-image-3.13.0-170-generic (3.13.0-170.220) ...
Setting up linux-modules-extra-3.13.0-170-generic (3.13.0-170.220) ...
Processing triggers for linux-image-3.13.0-170-generic (3.13.0-170.220) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-3.13.0-170-generic
firas@ubuntu:~$ sudo update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.13.0-170-generic
Found initrd image: /boot/initrd.img-3.13.0-170-generic
done
firas@ubuntu:~$ sudo reboot
答案3
我曾经遇到过类似的情况,其中有很多内核文件是从以前的升级中继承下来的。
首先,你只需要一个内核就可以让系统工作。卸载所有其他内核,包括附带的头文件和额外文件。
接下来,如果这仍然没有清除足够的空间,您可以从/boot
终端手动删除所有剩余的文件,只留下与正在使用的一个内核相关的文件。
看这个问题