Keybow 2040 mounting read only with solution

OK I managed to get my keybow into a state, I think I unplugged it without using umount and it had the dirty bit set so every time I plugged it in it would mount read only. To top that off it also had the code.py file corrupted and the volume label was not set in the boot sector. So quite a mess!

I’m running Ubuntu so the following probably applies to most linux machines

The keybow has two modes the RPI-RP2 mode where I believe it listens to the incoming data and does something with it. The following will not work in that mode; my keybow was in that state and I copied the circuit python image to it and it restarts.

cp adafruit-circuitpython-pimoroni_keybow2040-en_GB-8.0.5.uf2 /media/fsmith/RPI-RP2/

Now it should be in the CIRCUITPI mode;

fred@freds-pc:~$ mount | grep CIRCUITPY

/dev/sdb1 on /media/fred/CIRCUITPY type vfat (ro,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

this will tell you which device in my case /dev/sdb1

fred@freds-pc:~$ sudo fsck.fat /dev/sdb1

fsck.fat 4.2 (2021-01-31)

/CODE.PY

Contains a free cluster (3). Assuming EOF.

/CODE.PY

File size is 1697 bytes, cluster chain length is 0 bytes.

Truncating file to 0 bytes.

There is no label in boot sector, but there is volume label ‘CIRCUITPY’ stored in root directory

  1. Copy volume label from root directory to boot sector

  2. Remove volume label from root directory

[12?q]? 1

Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.

  1. Remove dirty bit

  2. No action

[12?q]? 1

*** Filesystem was changed ***

The changes have not yet been written, you can still choose to leave the

filesystem unmodified:

  1. Write changes

  2. Leave filesystem unchanged

[12?q]? 1

/dev/sdb1: 46 files, 226/2008 clusters

NOTE: Read this carefully yours may be different and you might not want to do it. Be careful……

So what happened:

  1. fsck automatically fixed the broken file

  2. I told it to write the volume label to the boot sector

  3. I told it to remove the dirty bit

  4. I told it write the changes to the file system and it did.

After this I assumed anything on the keybow was likely to be scrambled so I put it into RPI-RP2 mode and reloaded everything.

It worked. I hope you have the same outcome.