我正在尝试删除旧内核版本以便进行升级。我使用的方法如下。
sudo apt-get purge linux-image-x.y.z-server
每次运行它时都会出现以下错误:
<(Reading database ... 516009 files and directories currently installed.)
Unpacking linux-image-3.0.0-32-server (from .../linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb (--unpack):
failed in write on buffer copy for backend dpkg-deb during `./boot/System.map-3.0.0-32-server': No space left on device
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.0.0-32-server /boot/vmlinuz-3.0.0-32-server
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-32-server /boot/vmlinuz-3.0.0-32-server
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
好的,我得到的是,它告诉我空间不足,我知道这一点。我还会不时收到一条消息,要求运行下面的程序来解决我的错误,此时我再次收到现在空间不足的消息。
sudo apt-get install -f
我尝试的所有方法都给出现在空间错误。令人沮丧.....感谢大家的帮助。
这是请求的输出,抱歉
/dev/mapper/wikisrvr-root
48G 6.4G 40G 14% /
udev 996M 4.0K 996M 1% /dev
tmpfs 402M 952K 401M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1005M 188K 1004M 1% /run/shm
/dev/sda1 228M 227M 0 100% /boot
这是我尝试按照发布的链接清除时遇到的错误。顺便说一句,这是我尝试关注的 orgions 帖子。
build@wikisrvr:~$ sudo apt-get purge linux-image-3.0.0-12-server
[sudo] password for build:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
linux-image-server : Depends: linux-image-3.0.0-32-server but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
sudo apt-get -f install 的结果
build@wikisrvr:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.0.0-26-generic linux-headers-3.0.0-20-server
linux-headers-3.0.0-24-server linux-headers-3.0.0-19-server ubufox
linux-headers-3.0.0-12 linux-headers-3.0.0-20 linux-headers-3.0.0-21
linux-headers-3.0.0-16 linux-headers-3.0.0-22 linux-headers-3.0.0-17
linux-headers-3.0.0-24 linux-headers-3.0.0-19 linux-headers-3.0.0-30
linux-headers-3.0.0-25 linux-headers-3.0.0-26 linux-headers-3.0.0-21-generic
linux-headers-3.0.0-16-generic linux-headers-3.0.0-12-server
linux-headers-3.0.0-24-generic linux-headers-3.0.0-19-generic
linux-headers-3.0.0-21-server linux-headers-3.0.0-30-server
linux-headers-3.0.0-25-server linux-headers-3.0.0-22-generic
linux-headers-3.0.0-17-generic linux-headers-3.0.0-22-server
linux-headers-3.0.0-17-server linux-headers-3.0.0-30-generic
linux-headers-3.0.0-25-generic linux-headers-3.0.0-26-server
linux-headers-3.0.0-20-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
linux-image-3.0.0-32-server
Suggested packages:
fdutils linux-doc-3.0.0 linux-source-3.0.0 linux-tools
The following NEW packages will be installed:
linux-image-3.0.0-32-server
0 upgraded, 1 newly installed, 0 to remove and 127 not upgraded.
12 not fully installed or removed.
Need to get 0 B/37.3 MB of archives.
After this operation, 150 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 516009 files and directories currently installed.)
Unpacking linux-image-3.0.0-32-server (from .../linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb (--unpack):
failed in write on buffer copy for backend dpkg-deb during `./boot/System.map-3.0.0-32-server': No space left on device
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.0.0-32-server /boot/vmlinuz-3.0.0-32-server
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-32-server /boot/vmlinuz-3.0.0-32-server
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sugo apt-get autoremove 的结果
build@wikisrvr:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
linux-image-server : Depends: linux-image-3.0.0-32-server but it is not installed
E: Unmet dependencies. Try using -f.
sudo apt-get autoremove -f 的结果
build@wikisrvr:~$ sudo apt-get autoremove -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
linux-image-3.0.0-32-server
Suggested packages:
fdutils linux-doc-3.0.0 linux-source-3.0.0 linux-tools
The following packages will be REMOVED:
linux-headers-3.0.0-12 linux-headers-3.0.0-12-server linux-headers-3.0.0-16
linux-headers-3.0.0-16-generic linux-headers-3.0.0-17
linux-headers-3.0.0-17-generic linux-headers-3.0.0-17-server
linux-headers-3.0.0-19 linux-headers-3.0.0-19-generic
linux-headers-3.0.0-19-server linux-headers-3.0.0-20
linux-headers-3.0.0-20-generic linux-headers-3.0.0-20-server
linux-headers-3.0.0-21 linux-headers-3.0.0-21-generic
linux-headers-3.0.0-21-server linux-headers-3.0.0-22
linux-headers-3.0.0-22-generic linux-headers-3.0.0-22-server
linux-headers-3.0.0-24 linux-headers-3.0.0-24-generic
linux-headers-3.0.0-24-server linux-headers-3.0.0-25
linux-headers-3.0.0-25-generic linux-headers-3.0.0-25-server
linux-headers-3.0.0-26 linux-headers-3.0.0-26-generic
linux-headers-3.0.0-26-server linux-headers-3.0.0-30
linux-headers-3.0.0-30-generic linux-headers-3.0.0-30-server ubufox
The following NEW packages will be installed:
linux-image-3.0.0-32-server
0 upgraded, 1 newly installed, 32 to remove and 127 not upgraded.
12 not fully installed or removed.
Need to get 0 B/37.3 MB of archives.
After this operation, 1,029 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 516009 files and directories currently installed.)
Unpacking linux-image-3.0.0-32-server (from .../linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb (--unpack):
failed in write on buffer copy for backend dpkg-deb during `./boot/System.map-3.0.0-32-server': No space left on device
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.0.0-32-server /boot/vmlinuz-3.0.0-32-server
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-32-server /boot/vmlinuz-3.0.0-32-server
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
为了防止将来出现“boot/ 中没有空间”错误,安装 ubuntu-tweak并使用其清理程序频繁清理缓存的程序、旧内核、不需要的程序等等。
安装后,转到“janitor”,选中左侧边栏中的“系统”复选框,然后按底部的“清理”。查看下图。
答案2
此命令来源:
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -E "(image|headers)" | xargs sudo apt-get -y purge
我运行的这个命令释放了 723 MB 的磁盘空间。这将检查您正在使用的当前内核版本并删除其余的版本。