Skip to main content
NPal.2
Associate III
August 16, 2021
Solved

Is there possibility we can auto mount a usb when connected to usb host ? Any leads will be appreciated since tricks for x86 based systems might not work to fullest for custom embedded ARM env due to missing packages.

  • August 16, 2021
  • 2 replies
  • 1446 views

..

This topic has been closed for replies.
Best answer by Jean-Marc B

Hi @VRoma.2​ ,

the package usbmount doesn't exist in OpenSTLinux distribution. However, could you make a try with the package udev-extraconf please? This package exists in 2.0.

root@stm32mp1:~# apt-get install udev-extraconf

I did a test with OpenSTLinux 3.1 and my USB key is auto-mounted under /run/media/sda1. This is the output I got :

root@stm32mp1:~# [ 400.824653] usb 2-1.4: new high-speed USB device number 6 using ehci-platform
[ 401.011458] usb-storage 2-1.4:1.0: USB Mass Storage device detected
[ 401.022701] scsi host0: usb-storage 2-1.4:1.0
[ 402.205025] scsi 0:0:0:0: Direct-Access Kingston DataTraveler 3.0 PMAP PQ: 0 ANSI: 6
[ 402.220259] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 403.318695] sd 0:0:0:0: [sda] 30310400 512-byte logical blocks: (15.5 GB/14.5 GiB)
[ 403.327412] sd 0:0:0:0: [sda] Write Protect is off
[ 403.333210] sd 0:0:0:0: [sda] No Caching mode page found
[ 403.337185] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 403.490008] sda: sda1
[ 403.499969] sd 0:0:0:0: [sda] Attached SCSI removable disk
root@stm32mp1:~# cd /run/media/sda1/
root@stm32mp1:/run/media/sda1# ls
2016-01-09-10-PARIS-Ci JM ST ebooks
2016-01-09-10-PARIS-final JM_Work System Volume Information photos
Generiques_TV Papiers deces_claude

When unplugging the usb key, the key is un-mounted:

root@stm32mp1:/run/media/sda1# cd
root@stm32mp1:~# umount /run/media/sda1
root@stm32mp1:~# [ 706.654509] usb 2-1.4: USB disconnect, device number 6
root@stm32mp1:~# ls /run/media/
root@stm32mp1:~#

Best regards,

--JM

2 replies

OlivierK
Technical Moderator
August 16, 2021

Hi NPal.2 (Community Member) 

Have you tried already: sudo apt-get install usbmount

Regards,

Olivier

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
NPal.2
NPal.2Author
Associate III
August 18, 2021

Thanks @OlivierK​ . Will try that.

VRoma.2
Associate II
January 8, 2022

Is there no usbmount package under 2.0 dunfell InRelease?

I cannot install it, due to not found error...

Jean-Marc B
Jean-Marc BBest answer
ST Employee
January 10, 2022

Hi @VRoma.2​ ,

the package usbmount doesn't exist in OpenSTLinux distribution. However, could you make a try with the package udev-extraconf please? This package exists in 2.0.

root@stm32mp1:~# apt-get install udev-extraconf

I did a test with OpenSTLinux 3.1 and my USB key is auto-mounted under /run/media/sda1. This is the output I got :

root@stm32mp1:~# [ 400.824653] usb 2-1.4: new high-speed USB device number 6 using ehci-platform
[ 401.011458] usb-storage 2-1.4:1.0: USB Mass Storage device detected
[ 401.022701] scsi host0: usb-storage 2-1.4:1.0
[ 402.205025] scsi 0:0:0:0: Direct-Access Kingston DataTraveler 3.0 PMAP PQ: 0 ANSI: 6
[ 402.220259] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 403.318695] sd 0:0:0:0: [sda] 30310400 512-byte logical blocks: (15.5 GB/14.5 GiB)
[ 403.327412] sd 0:0:0:0: [sda] Write Protect is off
[ 403.333210] sd 0:0:0:0: [sda] No Caching mode page found
[ 403.337185] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 403.490008] sda: sda1
[ 403.499969] sd 0:0:0:0: [sda] Attached SCSI removable disk
root@stm32mp1:~# cd /run/media/sda1/
root@stm32mp1:/run/media/sda1# ls
2016-01-09-10-PARIS-Ci JM ST ebooks
2016-01-09-10-PARIS-final JM_Work System Volume Information photos
Generiques_TV Papiers deces_claude

When unplugging the usb key, the key is un-mounted:

root@stm32mp1:/run/media/sda1# cd
root@stm32mp1:~# umount /run/media/sda1
root@stm32mp1:~# [ 706.654509] usb 2-1.4: USB disconnect, device number 6
root@stm32mp1:~# ls /run/media/
root@stm32mp1:~#

Best regards,

--JM

VRoma.2
Associate II
January 10, 2022

Hi @Jean-Marc B (ST Employee)

Thank you very much, it worked!