My balena image doesn't support ntfs or exfat for USB. Which one should I use? :)

Hello,
I started running into issues mounting a USB drive when running my app after some time of non-use (was working for a long time):

FROM balenalib/%%BALENA_MACHINE_NAME%%-node:16

(this was :latest, locked it down for now due to another unrelated error, could be a contributor)

After some troubleshooting of my exfat AND ntfs drives not being recognized, e.g.:

server  mount: /mnt/MYDRIVE: unknown filesystem type 'exfat'.
...
server  mount: /mnt/MYDRIVE: unknown filesystem type 'ntfs'.

I read here that I should check that the file system is supported. Perhaps these were removed from the node image at some point, or :16 doesn’t have the support that :latest has?:

Output:

cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   ramfs
nodev   bdev
nodev   proc
nodev   cpuset
nodev   cgroup
nodev   cgroup2
nodev   tmpfs
nodev   devtmpfs
nodev   configfs
nodev   debugfs
nodev   tracefs
nodev   securityfs
nodev   sockfs
nodev   bpf
nodev   pipefs
nodev   rpc_pipefs
nodev   devpts
        ext3
        ext2
        ext4
        squashfs
        vfat
        msdos
nodev   nfs
nodev   nfs4
nodev   autofs
nodev   overlay
        f2fs
nodev   mqueue

I can post a lot more code if it helps (followed this sometime back though and it was great), yet I think I have it narrowed down above. Do you have a recommendation of which image I should use that supports node and will support ntfs for mounting of USB drives?

Thanks for taking a look!

Chris

1 Like

I figured it out. :slight_smile: I just needed to add a package or two.

It eventually grabs this image (I corrected the tag to 16.13.0): balenalib/raspberrypi4-64-debian-node:16.13.0. To support both:

RUN install_packages util-linux fuse ntfs-3g exfat-fuse exfat-utils

There’s a chance this could be overkill. For example, util-linux us used for unrelated reasons. I may still have an extra something in there.

1 Like

Hi @owntheweb, glad you found a solution and thank you for sharing it :blush: do let us know if you have any other questions.

I’m only interested in exFAT (not NTFS), so instead of creating a new post, I think it’s better to continue this one.

My Dockerfile.template contains the following;

FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3.11.2-bookworm-build
# ...
RUN install_packages exfat-fuse exfat-utils
# ...

But when I build, I get an error. So, I added the apt-get update (not sure if it’s needed with install_packages) but still got the same error:

[vnc-app]  Step 6/15 : RUN apt-get update -q -y
[vnc-app]  Using cache
[vnc-app]   ---> 7955214e0f02
[vnc-app]  Step 7/15 : RUN install_packages exfat-fuse exfat-utils
[vnc-app]   ---> Running in 0d3b07ff6e07
[vnc-app]  Reading package lists...
[vnc-app]  Building dependency tree...
[vnc-app]  Reading state information...
[vnc-app]  Package exfat-utils is not available, but is referred to by another package.
[vnc-app]  This may mean that the package is missing, has been obsoleted, or
[vnc-app]  is only available from another source
[vnc-app]  E: Package 'exfat-utils' has no installation candidate

If I substitute exfat-utils with exfatprogs (based on this) which say that “exfat-utils has been replaced by exfatprogs”, my build succeeds but I still cannot mount my USB stick exFAT:

root@b59fb16:/usr/src/app# cat /proc/filesystems 
nodev   sysfs
nodev   tmpfs
nodev   bdev
nodev   proc
nodev   cgroup
nodev   cgroup2
nodev   cpuset
nodev   devtmpfs
nodev   configfs
nodev   debugfs
nodev   tracefs
nodev   sockfs
nodev   bpf
nodev   pipefs
nodev   ramfs
nodev   hugetlbfs
nodev   rpc_pipefs
nodev   devpts
        ext3
        ext2
        ext4
        vfat
        msdos
nodev   nfs
nodev   nfs4
nodev   autofs
nodev   overlay
nodev   mqueue
root@b59fb16:/usr/src/app# cat /proc/filesystems  | grep fat
        vfat
root@b59fb16:/usr/src/app# mkdir mnt
root@b59fb16:/usr/src/app# mount /dev/sda1 mnt
mount: /usr/src/app/mnt: unknown filesystem type 'exfat'.
       dmesg(1) may have more information after failed mount system call.
root@b59fb16:/usr/src/app# uname -a
Linux b59fb16 5.4.142 #1 SMP PREEMPT Tue May 3 20:55:29 UTC 2022 aarch64 GNU/Linux
root@b59fb16:/usr/src/app# 

and by following dmesg:

[   10.779144] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[   10.830204] scsi host1: usb-storage 1-1.2:1.0
[   10.831856] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   10.831862] [drm] No driver support for vblank timestamp query.
[   10.831924] imx-drm soc@0:bus@32c00000:display-subsystem: bound imx-lcdif-crtc.0 (ops lcdif_crtc_ops)
[   10.832633] imx_sec_dsim_drv 32e10000.mipi_dsi: version number is 0x1060200
[   10.833225] imx_sec_dsim_drv 32e10000.mipi_dsi: Failed to attach bridge: 32e10000.mipi_dsi
[   10.848464] imx_sec_dsim_drv 32e10000.mipi_dsi: failed to bind sec dsim bridge: -517
[   11.614154] scsi 0:0:0:0: Direct-Access     SanDisk  SanDisk 3.2 Gen1 DL17 PQ: 0 ANSI: 6
[   11.628009] sd 0:0:0:0: [sda] 977829888 512-byte logical blocks: (501 GB/466 GiB)
[   11.628631] sd 0:0:0:0: [sda] Write Protect is off
[   11.628639] sd 0:0:0:0: [sda] Mode Sense: 45 00 00 00
[   11.630906] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   11.812769]  sda: sda1
[   11.816639] sd 0:0:0:0: [sda] Attached SCSI removable disk
[   11.817762] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   11.817768] [drm] No driver support for vblank timestamp query.
[   11.817826] imx-drm soc@0:bus@32c00000:display-subsystem: bound imx-lcdif-crtc.0 (ops lcdif_crtc_ops)
[   11.818507] imx_sec_dsim_drv 32e10000.mipi_dsi: version number is 0x1060200
[   11.819093] imx_sec_dsim_drv 32e10000.mipi_dsi: Failed to attach bridge: 32e10000.mipi_dsi
[   11.837897] scsi 1:0:0:0: Direct-Access      USB      SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
[   11.838993] sd 1:0:0:0: [sdb] 120164352 512-byte logical blocks: (61.5 GB/57.3 GiB)
[   11.840147] sd 1:0:0:0: [sdb] Write Protect is off
[   11.840156] sd 1:0:0:0: [sdb] Mode Sense: 43 00 00 00
[   11.840921] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   11.849283] imx_sec_dsim_drv 32e10000.mipi_dsi: failed to bind sec dsim bridge: -517
[   11.866531]  sdb: sdb1
[   11.869893] sd 1:0:0:0: [sdb] Attached SCSI removable disk
[   11.881312] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   11.881318] [drm] No driver support for vblank timestamp query.

Any ideas?

I also tried this in my Dockerfile.template:

RUN apt-get update -q -y
RUN add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"

RUN install_packages exfat-fuse exfat-utils

The build gave me:

[vnc-app]  Step 6/16 : RUN apt-get update -q -y
[vnc-app]  Using cache
[vnc-app]   ---> 7955214e0f02
[vnc-app]  Step 7/16 : RUN add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
[vnc-app]   ---> Running in f22ae55cd099
[vnc-app]  /bin/sh: 1: lsb_release: not found
[vnc-app]
[vnc-app]  /bin/sh: 1: add-apt-repository: not found
[vnc-app]
[vnc-app]  Removing intermediate container f22ae55cd099
[vnc-app]  The command '/bin/sh -c add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"' returned a non-zero code: 127
[Info]     Uploading images
[Success]  Successfully uploaded images
[Error]    Some services failed to build:
[Error]      Service: vnc-app
[Error]        Error: The command '/bin/sh -c add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"' returned a non-zero code: 127
[Info]     Built on 0602a6e
[Error]    Not deploying release.
Remote build failed