4

I run sudo apt update and sudo apt upgrade every month on my pi.
A couple weeks back this occurred during the upgrade part.

> pi@ngpi:/var/log $ sudo apt upgrade Reading package lists... Done
> Building dependency tree        Reading state information... Done You
> might want to run 'apt --fix-broken install' to correct these. The
> following packages have unmet dependencies:  libraspberrypi0 :
> Depends: raspberrypi-bootloader (= 1.20200902-1) but 1.20200819-1 is
> installed E: Unmet dependencies. Try 'apt --fix-broken install' with
> no packages (or specify a solution).

I did a bunch of debug and it appears the /boot file system is read only even though mount reports is as rw. How do I fix this?

I tried sudo apt --fix-broken install and get this error

   pi@ngpi:/var/log $ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  raspberrypi-bootloader
The following packages will be upgraded:
  raspberrypi-bootloader
1 upgraded, 0 newly installed, 0 to remove and 37 not upgraded.
17 not fully installed or removed.
Need to get 0 B/4,543 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 153773 files and directories currently installed.)
Preparing to unpack .../raspberrypi-bootloader_1.20200902-1_armhf.deb ...
Adding 'diversion of /boot/start.elf to /usr/share/rpikernelhack/start.elf by rpikernelhack'
dpkg-divert: error: error checking '/boot/start.elf': Read-only file system
dpkg: error processing archive /var/cache/apt/archives/raspberrypi-bootloader_1.20200902-1_armhf.deb (--unpack):
 new raspberrypi-bootloader package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/raspberrypi-bootloader_1.20200902-1_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've tried a fix-install for raspberrypi-bootloader ad libraspberrypi0 to no avail.

More info: Linux ngpi 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux Model : Raspberry Pi 3 Model B Rev 1.2 Debian ver: 10.4

Thoughts?

Based on more research, I tried this: sudo apt install libraspberrypi0 raspberrypi-bootloader Results:

pi@ngpi:/var/log $ sudo apt install libraspberrypi0 raspberrypi-bootloader
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libraspberrypi0 is already the newest version (1.20200902-1).
The following packages will be upgraded:
  raspberrypi-bootloader
1 upgraded, 0 newly installed, 0 to remove and 37 not upgraded.
17 not fully installed or removed.
Need to get 0 B/4,543 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 153773 files and directories currently installed.)
Preparing to unpack .../raspberrypi-bootloader_1.20200902-1_armhf.deb ...
Adding 'diversion of /boot/start.elf to /usr/share/rpikernelhack/start.elf by rpikernelhack'
dpkg-divert: error: error checking '/boot/start.elf': Read-only file system
dpkg: error processing archive /var/cache/apt/archives/raspberrypi-bootloader_1.20200902-1_armhf.deb (--unpack):
 new raspberrypi-bootloader package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/raspberrypi-bootloader_1.20200902-1_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Here is the pertinent part. Why would the boot file system be read-only?

Preparing to unpack .../raspberrypi-bootloader_1.20200902-1_armhf.deb ...
Adding 'diversion of /boot/start.elf to /usr/share/rpikernelhack/start.elf by rpikernelhack'
dpkg-divert: error: error checking '/boot/start.elf': Read-only file system

I ran sudo mount -o remount, rw /and see this in /var/log/messages Oct 22 22:03:37 ngpi kernel: [1762400.628213] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

and this running mount: /dev/mmcblk0p2 on / type ext4 (rw,noatime)

but re-running sudo apt install libraspberrypi0 raspberrypi-bootloader gives the same read-only file system error. A restart did not fix anything.

1
  • Added OS & model info
    – uSlackr
    Commented Oct 23, 2020 at 1:33

2 Answers 2

10

I had the same issue and the fix was just to:

mount -o remount, rw /boot

then update/upgrade works.

4

Turns out the /boot file system was set to read-only in /etc/fstab. Changing that to rw did the trick. Of course, I have no idea how it wound up this way.

proc                    /proc           proc    defaults          0       0
PARTUUID=9975ff21-01  /boot             vfat    defaults,ro          0       2
PARTUUID=9975ff21-02  /                 ext4    defaults,noatime  0       1
//hda/music             /music          cifs    credentials=/etc/samba/hda.cred,uid=1000,gid=1000,vers=1.0 0 0
//hda/docs              /docs           cifs    credentials=/etc/samba/hda.cred,uid=1000,gid=1000,vers=1.0 0 0
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
3
  • Please mark the answer as the accepted one with a click on the tick on its left side. That prevents your Question from being shown as an unsolved Post to the community and saves them/us a lot of work.
    – Ingo
    Commented Oct 31, 2020 at 17:43
  • Are you sure you didn't change it to ro yourself? I'm at loss imagining who else might have done such a change. Commented Mar 3, 2021 at 17:48
  • I didn't change it
    – uSlackr
    Commented Mar 4, 2021 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.