Add file to resin-boot partition in Jetson Nano emmc image

Hi,

We would like to preload a NetworkManager file to the host OS img before flashing it.
The device uses a Jetson nano production (emmc) module.
Mounting the img file using standard ways fails in both macos and linux (ubuntu 18.04).

Is there any way to get the boot partition mounted prior to flashing?

Regards,
Robin

Hi Robin,

When you download the balena image for your Jetson, extract it from the .zip and try to loop mount it you may be having an issue with the multiple partitions. The HostOS image has 5. On Linux, you can try using losetup, as in:

sudo losetup -Pf disk.img
sudo mkdir /mnt/loop0p1
sudo mount /dev/loop0p1 /mnt/loop0p1

losetup will likely expose each partition as a separate /dev/loop0p<number>. You’re looking for the first partition, which is resin-boot. In the root of that mount you’ll find a folder called (resin-boot)/system-connections. Save your NetworkManager config file in that folder, umount your temporary directory and flash that edited image.

Let us know how you make out.

John

Hi John,

Thank you for the reply.
I can get the partitions exposed, but I seem to be unable to then actually mount a partition : mount: /mnt/resin-boot: wrong fs type, bad option, bad superblock on /dev/loop13p1, missing codepage or helper program, or other error.
This is on Ubuntu bionic.

robin@ubuntu:~$ ls -hal /dev/loop*
brw-rw---- 1 root disk  7,   0 Sep 18 05:00 /dev/loop0
brw-rw---- 1 root disk  7,   1 Sep 18 05:00 /dev/loop1
brw-rw---- 1 root disk  7,  10 Sep 18 05:00 /dev/loop10
brw-rw---- 1 root disk  7,  11 Sep 18 05:00 /dev/loop11
brw-rw---- 1 root disk  7,  12 Sep 18 05:00 /dev/loop12
brw-rw---- 1 root disk  7,  13 Sep 18 05:01 /dev/loop13
brw-rw---- 1 root disk  7,  14 Sep 18 05:00 /dev/loop14
brw-rw---- 1 root disk  7,  15 Sep 18 05:00 /dev/loop15
brw-rw---- 1 root disk  7,  16 Sep 18 05:00 /dev/loop16
brw-rw---- 1 root disk  7,  17 Sep 18 05:00 /dev/loop17
brw-rw---- 1 root disk  7,  18 Sep 18 05:00 /dev/loop18
brw-rw---- 1 root disk  7,   2 Sep 18 05:00 /dev/loop2
brw-rw---- 1 root disk  7,   3 Sep 18 05:00 /dev/loop3
brw-rw---- 1 root disk  7,   4 Sep 18 05:00 /dev/loop4
brw-rw---- 1 root disk  7,   5 Sep 18 05:00 /dev/loop5
brw-rw---- 1 root disk  7,   6 Sep 18 05:00 /dev/loop6
brw-rw---- 1 root disk  7,   7 Sep 18 05:00 /dev/loop7
brw-rw---- 1 root disk  7,   8 Sep 18 05:00 /dev/loop8
brw-rw---- 1 root disk  7,   9 Sep 18 05:00 /dev/loop9
crw-rw---- 1 root disk 10, 237 Sep 18 05:00 /dev/loop-control
robin@ubuntu:~$ sudo losetup -Pf ~/Downloads/balena-cloud-jn30b-nano-2.56.0+rev1-dev-v11.14.0.img
robin@ubuntu:~$ ls -hal /dev/loop*
brw-rw---- 1 root disk   7,   0 Sep 18 05:00 /dev/loop0
brw-rw---- 1 root disk   7,   1 Sep 18 05:00 /dev/loop1
brw-rw---- 1 root disk   7,  10 Sep 18 05:00 /dev/loop10
brw-rw---- 1 root disk   7,  11 Sep 18 05:00 /dev/loop11
brw-rw---- 1 root disk   7,  12 Sep 18 05:00 /dev/loop12
brw-rw---- 1 root disk   7,  13 Sep 18 05:02 /dev/loop13
brw-rw---- 1 root disk 259,   0 Sep 18 05:02 /dev/loop13p1
brw-rw---- 1 root disk 259,   9 Sep 18 05:02 /dev/loop13p10
brw-rw---- 1 root disk 259,  10 Sep 18 05:02 /dev/loop13p11
brw-rw---- 1 root disk 259,  11 Sep 18 05:02 /dev/loop13p12
brw-rw---- 1 root disk 259,  12 Sep 18 05:02 /dev/loop13p13
brw-rw---- 1 root disk 259,  13 Sep 18 05:02 /dev/loop13p14
brw-rw---- 1 root disk 259,  14 Sep 18 05:02 /dev/loop13p15
brw-rw---- 1 root disk 259,  15 Sep 18 05:02 /dev/loop13p16
brw-rw---- 1 root disk 259,   1 Sep 18 05:02 /dev/loop13p2
brw-rw---- 1 root disk 259,   2 Sep 18 05:02 /dev/loop13p3
brw-rw---- 1 root disk 259,   3 Sep 18 05:02 /dev/loop13p4
brw-rw---- 1 root disk 259,   4 Sep 18 05:02 /dev/loop13p5
brw-rw---- 1 root disk 259,   5 Sep 18 05:02 /dev/loop13p6
brw-rw---- 1 root disk 259,   6 Sep 18 05:02 /dev/loop13p7
brw-rw---- 1 root disk 259,   7 Sep 18 05:02 /dev/loop13p8
brw-rw---- 1 root disk 259,   8 Sep 18 05:02 /dev/loop13p9
brw-rw---- 1 root disk   7,  14 Sep 18 05:00 /dev/loop14
brw-rw---- 1 root disk   7,  15 Sep 18 05:00 /dev/loop15
brw-rw---- 1 root disk   7,  16 Sep 18 05:00 /dev/loop16
brw-rw---- 1 root disk   7,  17 Sep 18 05:00 /dev/loop17
brw-rw---- 1 root disk   7,  18 Sep 18 05:00 /dev/loop18
brw-rw---- 1 root disk   7,   2 Sep 18 05:00 /dev/loop2
brw-rw---- 1 root disk   7,   3 Sep 18 05:00 /dev/loop3
brw-rw---- 1 root disk   7,   4 Sep 18 05:00 /dev/loop4
brw-rw---- 1 root disk   7,   5 Sep 18 05:00 /dev/loop5
brw-rw---- 1 root disk   7,   6 Sep 18 05:00 /dev/loop6
brw-rw---- 1 root disk   7,   7 Sep 18 05:00 /dev/loop7
brw-rw---- 1 root disk   7,   8 Sep 18 05:00 /dev/loop8
brw-rw---- 1 root disk   7,   9 Sep 18 05:00 /dev/loop9
crw-rw---- 1 root disk  10, 237 Sep 18 05:00 /dev/loop-control
robin@ubuntu:~$ cd /mnt
robin@ubuntu:/mnt$ sudo mkdir resin-boot  
robin@ubuntu:/mnt$ sudo mount /dev/loop13p1 /mnt/resin-boot/
mount: /mnt/resin-boot: wrong fs type, bad option, bad superblock on /dev/loop13p1, missing codepage or helper program, or other error.
robin@ubuntu:/mnt$ sudo mount /dev/loop13p2 /mnt/resin-boot/
mount: /mnt/resin-boot: wrong fs type, bad option, bad superblock on /dev/loop13p2, missing codepage or helper program, or other error.
robin@ubuntu:/mnt$ sudo mount /dev/loop13p3 /mnt/resin-boot/
mount: /mnt/resin-boot: wrong fs type, bad option, bad superblock on /dev/loop13p3, missing codepage or helper program, or other error.
robin@ubuntu:/mnt$ sudo mount /dev/loop13p3 /mnt/resin-boot/
mount: /mnt/resin-boot: wrong fs type, bad option, bad superblock on /dev/loop13p3, missing codepage or helper program, or other error.
robin@ubuntu:/mnt$ sudo mount /dev/loop13p4 /mnt/resin-boot/
mount: /mnt/resin-boot: wrong fs type, bad option, bad superblock on /dev/loop13p4, missing codepage or helper program, or other error.

Explicitly specifying vfat as fstype does not seem to help either:

robin@ubuntu:/mnt/loop$ sudo mount -t vfat /dev/loop13p1 /mnt/resin-boot/
mount: /mnt/resin-boot: wrong fs type, bad option, bad superblock on /dev/loop13p1, missing codepage or helper program, or other error.

That may be the wrong partition (you should be able to confirm by trying to mount it as ext4). For eMMC-based devices you need the resin-flash partition, which I’m not sure off the top of my head which one it is. Let me know if you need me to ask the team.

Seems like partition 12 was the one we need!

Perfect, glad you sorted it.