马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
一直使用VPS,今天心血来潮,想升级一下VPS上的ubuntu和kernel版本,但在升级过程中,碰到一个环境:VPS的boot分区太小,剩余空间不足,造成kernel upgrade时失败了。
The upgrade has aborted. The upgrade needs a total of 207 M free
space on disk '/boot'. Please free at least an additional 69.2 M of
disk space on '/boot'. You can remove old kernels using 'sudo apt
autoremove' and you could also set COMPRESS=xz in
/etc/initramfs-tools/initramfs.conf to reduce the size of your
initramfs.
按照上面提示,尝试把压缩选项从lz4改成了xz,但空间仍旧不够。仔细检查了下boot分区内的文件,发现以前老旧的kernel image占用了很大空间,遂尝试了下面的下令进行了删除,删除之后就可以正常升级kernel了。
- root@valuable-idea-1:~# <strong>uname -</strong><strong>a</strong>
- Linux valuable-idea-1.localdomain <strong>5.15.0-138-generic</strong> #148-Ubuntu SMP Fri Mar 14 19:05:48 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
复制代码- root@valuable-idea-1:~# <strong>apt remove linux-image-5</strong><strong>.</strong>
- linux-image-5.15.0-138-generic linux-image-5.4.0-214-generic
- root@valuable-idea-1:~# <strong>apt remove linux-image-5.4.0-214-</strong><strong>generic</strong>
- Reading package lists... Done
- Building dependency tree... Done
- Reading state information... Done
- The following packages were automatically installed and are no longer required:
- accountsservice alsa-topology-conf alsa-ucm-conf at bsdmainutils crda cryptsetup-run
- dconf-gsettings-backend dconf-service gcc-10-base glib-networking glib-networking-common
- glib-networking-services gsettings-desktop-schemas language-selector-common libaccountsservice0
- libasn1-8-heimdal libasound2 libasound2-data libboost-program-options1.71.0 libcanberra0 libcbor0.6
- libdconf1 libdns-export1109 libevent-2.1-7 libffi7 libfl2 libfuse2 libgssapi3-heimdal libhavege1
- libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhogweed5 libhx509-5-heimdal libicu66
- libjson-c4 libkrb5-26-heimdal libldap-2.4-2 libltdl7 libmpdec2 libnettle7 libntfs-3g883 libogg0
- libperl5.30 libproxy1v5 libpython3.8 libpython3.8-minimal libpython3.8-stdlib libreadline5
- libroken18-heimdal libsoup2.4-1 libsoup2.4-common libtdb1 liburcu6 libvorbis0a libvorbisfile3 libwebp6
- libwind0-heimdal ltrace lz4 ncal perl-modules-5.30 popularity-contest python3-entrypoints python3-future
- python3-mock python3-pbr python3-requests-unixsocket python3-simplejson python3.8 python3.8-minimal
- session-migration sound-theme-freedesktop
- Use 'apt autoremove' to remove them.
- The following packages will be REMOVED:
- linux-image-5.4.0-214-generic linux-modules-extra-5.4.0-214-generic
- 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
- After this operation, 215 MB disk space will be freed.
- Do you want to continue? [Y/n] Y
- (Reading database ... 116717 files and directories currently installed.)
- Removing linux-modules-extra-5.4.0-214-generic (5.4.0-214.234) ...
- Removing linux-image-5.4.0-214-generic (5.4.0-214.234) ...
- I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.15.0-138-generic
- I: /boot/initrd.img.old is now a symlink to initrd.img-5.15.0-138-generic
- /etc/kernel/postrm.d/initramfs-tools:
- update-initramfs: Deleting /boot/initrd.img-5.4.0-214-generic
- /etc/kernel/postrm.d/zz-update-grub:
- Sourcing file `/etc/default/grub'
- Sourcing file `/etc/default/grub.d/init-select.cfg'
- Generating grub configuration file ...
- Found linux image: /boot/vmlinuz-5.15.0-138-generic
- Found initrd image: /boot/initrd.img-5.15.0-138-generic
- Warning: os-prober will not be executed to detect other bootable partitions.
- Systems on them will not be added to the GRUB boot configuration.
- Check GRUB_DISABLE_OS_PROBER documentation entry.
- done
复制代码
- 更新下GRUB设置,之前apt remove时已经更新过,这步其实可以省略
- root@valuable-idea-1:~# <strong>update-</strong><strong>grub</strong>
- Sourcing file `/etc/default/grub'
- Sourcing file `/etc/default/grub.d/init-select.cfg'
- Generating grub configuration file ...
- Found linux image: /boot/vmlinuz-5.15.0-138-generic
- Found initrd image: /boot/initrd.img-5.15.0-138-generic
- Warning: os-prober will not be executed to detect other bootable partitions.
- Systems on them will not be added to the GRUB boot configuration.
- Check GRUB_DISABLE_OS_PROBER documentation entry.
- done
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |