3

I haven't run apt upgrade on my Pi 3 in a while and did it today. It resulted in an error message with my /boot partition being filled to 100%. Any subsequent apt commands are resulting in errors because the /boot partition is full (apt-get autoremove is a common suggestion, but that won't work).

I've seen on other sites suggestions to check what kernels are installed using a variant of sudo dpkg --list 'linux-image*', but when I run this I get no results (it appears no kernels are installed anymore).

Here is the output from ls -la for my /boot partition:

pi@raspberry ~ % ls -la /boot
total 41056
drwxr-xr-x  4 root root     2560 Sep 15 23:10 .
drwxr-xr-x 25 root root     4096 Jun 10  2017 ..
-rwxr-xr-x  1 root root    15660 Sep 15 23:05 bcm2708-rpi-0-w.dtb
-rwxr-xr-x  1 root root    15197 Sep 15 23:05 bcm2708-rpi-b.dtb
-rwxr-xr-x  1 root root    15456 Sep 15 23:05 bcm2708-rpi-b-plus.dtb
-rwxr-xr-x  1 root root    14916 Sep 15 23:05 bcm2708-rpi-cm.dtb
-rwxr-xr-x  1 root root    16523 Sep 15 23:05 bcm2709-rpi-2-b.dtb
-rwxr-xr-x  1 root root    17624 Sep 15 23:05 bcm2710-rpi-3-b.dtb
-rwxr-xr-x  1 root root    16380 Sep 15 23:05 bcm2710-rpi-cm3.dtb
-rwxr-xr-x  1 root root    50248 Sep 15 23:05 bootcode.bin
-rwxr-xr-x  1 root root      187 Dec 31  1979 cmdline.txt
-rwxr-xr-x  1 root root     1662 May 31  2017 config.txt
-rwxr-xr-x  1 root root    18693 Sep 15 23:05 COPYING.linux
-rwxr-xr-x  1 root root       41 May 31  2017 .firmware_revision
-rwxr-xr-x  1 root root     2583 Sep 15 23:04 fixup_cd.dat
-rwxr-xr-x  1 root root     6674 Sep 15 23:04 fixup.dat
-rwxr-xr-x  1 root root     9813 Sep 15 23:05 fixup_db.dat
-rwxr-xr-x  1 root root     9813 Sep 15 23:05 fixup_x.dat
-rwxr-xr-x  1 root root 10201980 May 31  2017 initrd.img-4.9.30-v7+
-rwxr-xr-x  1 root root 10174464 Sep 15 23:10 initrd.img-4.9.30-v7+.dpkg-bak
-rwxr-xr-x  1 root root      145 Apr 10  2017 issue.txt
-rwxr-xr-x  1 root root  4579248 Sep 15 23:05 kernel7.img
-rwxr-xr-x  1 root root  4379032 Sep 15 23:05 kernel.img
-rwxr-xr-x  1 root root     1494 Sep 15 23:05 LICENCE.broadcom
-rwxr-xr-x  1 root root    18974 Apr 10  2017 LICENSE.oracle
drwxr-xr-x  2 root root    10240 Sep 15 23:05 overlays
-rwxr-xr-x  1 root root   659492 Sep 15 23:04 start_cd.elf
-rwxr-xr-x  1 root root  4993604 Sep 15 23:04 start_db.elf
-rwxr-xr-x  1 root root  2855556 Sep 15 23:04 start.elf
-rwxr-xr-x  1 root root  3939492 Sep 15 23:04 start_x.elf
drwxr-xr-x  2 root root      512 May 30  2017 System Volume Information

output of df -h

pi@raspberry ~ % df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  4.0G   24G  15% /
devtmpfs        458M     0  458M   0% /dev
tmpfs           462M     0  462M   0% /dev/shm
tmpfs           462M  6.6M  456M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           462M     0  462M   0% /sys/fs/cgroup
/dev/mmcblk0p1   41M   41M  3.5K 100% /boot
/dev/sda1       116G  854M  114G   1% /usr/local/src
/dev/sda1       116G  854M  114G   1% /home
tmpfs            93M  4.0K   93M   1% /run/user/1000

Output of sudo apt-get autoremove:

pi@raspberry ~ % sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.120+deb8u3) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.120+deb8u3) ...
ln: failed to create hard link ‘/boot/initrd.img-4.9.30-v7+.dpkg-bak’ => ‘/boot/initrd.img-4.9.30-v7+’: Operation not permitted
cp: error writing ‘/boot/initrd.img-4.9.30-v7+.dpkg-bak’: No space left on device
cp: failed to extend ‘/boot/initrd.img-4.9.30-v7+.dpkg-bak’: No space left on device
dpkg: error processing package initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

Output of dpkg --list 'linux-image*':

pi@raspberry ~ % dpkg --list 'linux-image*'                        
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                           Version                      Architecture                 Description
+++-==============================================-============================-============================-=================================================================================================
un  linux-image                                    <none>                       <none>                       (no description available)

What do I need to do to get this fixed and have apt upgrade succeed?

2 Answers2

1

The main problem is that on your installation a Ramdisk is generated. These initrd.img occupy 20 MB from 30 MB of the space of the boot partition:

-rwxr-xr-x  1 root root 10201980 May 31  2017 initrd.img-4.9.30-v7+
-rwxr-xr-x  1 root root 10174464 Sep 15 23:10 initrd.img-4.9.30-v7+.dpkg-bak0

This will of course make your problems. But Raspbian does not support Init Ramdisks. To load it you must have an entry in /boot/config.txt like this:

initramfs initrd.img-4.9.30-v7+ followkernel

To use a Ramdisk with Raspbian you may have a look at How can I use an init ramdisk (initramfs) on boot up Raspberry Pi?.

So if you do not have an entry in your config.txt as shown above then generating the initrd.img-4.9.30-v7+ is wasting of space. Then just delete the two image files and deinstall initramfs-tools. Then you should be able to upgrade your operating system.

Ingo
  • 42,961
  • 20
  • 87
  • 207
0

I finally folded and moved the largest files in /boot (*.img and *.elf) to a temporary directory. The install for initramfs-tools (which was the one that was failing) then succeeded. I moved those files back to /boot and all is ok...at least for now. /boot is showing 76% utilization though, so I am suspecting this issue will crop up again unless I go through the hassle of enlarging the /boot partition.

pi@raspberry ~/boot_backup % df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  4.1G   24G  15% /
devtmpfs        458M     0  458M   0% /dev
tmpfs           462M     0  462M   0% /dev/shm
tmpfs           462M  6.6M  456M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           462M     0  462M   0% /sys/fs/cgroup
/dev/mmcblk0p1   41M   31M  9.8M  76% /boot
/dev/sda1       116G  879M  114G   1% /usr/local/src
/dev/sda1       116G  879M  114G   1% /home
tmpfs            93M  4.0K   93M   1% /run/user/1000

I edited this thinking this fixed my problem, but it just fried my entire Raspbian installation. Luckily I have a Pi 4 I was planning to upgrade to, I guess I'll just be making the upgrade sooner than expected.