How to pass environment variables to torizon

Hi @ujsugi ,

Step7(-v /media:/media:rslave) seems to work. If bind-mounting with rslave, permissions is hold at unplugging and plugging USB.

Great, it’s good to know that this part is working as it should.

It never change to 777 even after executing “sudo chmod 777 UJDISK”. It is always 755 (owner is root). I tried something like editing /etc/fstab to add /dev/sda1 but it was in vain.
But it is sure that the permissions on you PC is 777. I like to know what is the difference b/w you and I.
There should be something trick or magic hidden?
PS: Actually FAT32 has permission, doesn’t it? Is this a thing hidden…?

From what I found apparently FAT32 doesn’t support Linux-like permissions, they’re determined by how the drive is mounted: This should explain why you couldn’t change permissions with chmod. See these links for more info:

With a FAT32 USB drive I was able to reproduce your results: When mounted, the USB drive had permissions set to 755, with root being the owner. All my previous tests were done with an ext4 formatted USB stick.

I eventually managed to mount the FAT32 USB drive with 755 permission but with user torizon as the owner of the mount point, allowing read and write access. To do this I added the following line in /etc/fstab:

UUID=<usb-uuid> /var/rootdirs/media/UJDISK vfat users,noauto,uid=1000,gid=1000,umask=0022 0 0

Replace <usb-uuid> with the UUID of your USB drive. You can find it by plugging it and then running sudo blkid. After that reboot your device; you should be able to access the contents of the USB stick with read and write permissions, inside and outside of a container:

torizon@colibri-imx8x:/media$ ls -l
total 8
drwxr-xr-x 2 torizon torizon 4096 Jan  1  1970 FAT32_USB

Hope this works for you.

Best regards,
Lucas Akira