Armadilloフォーラム

autofsによるUSBメモリ・SDカード自動マウントができない件について(ご相談)

shimomura2025

2025年9月12日 10時28分

いつもお世話になっております。下村と申します。

現在、Armadilloフォーラム(https://armadillo.atmark-techno.com/howto/autofs)を参考に、
ABOSDE上でAtmark Container Projectを用いてautofsによるUSBメモリ・SDカードの自動マウント機能を実装しております。

しかしながら、コンテナ作成後、ABOS側から下記パスにアクセスしても、
automount配下にusbやsd等のディレクトリが作成されず、
USBメモリやSDカードの自動マウントができない状況です。

/run/mnt/
└── automount

autofsコンテナのログは以下の通りです。

open_fopen_r:211: failed to open file: No such file or directory
Starting automounter version 5.1.9, master map auto.master
using kernel protocol version 5.05
reading files master auto.master
mounted indirect on /mnt/automount with timeout 1, freq 1 seconds
ghosting enabled

USBメモリやSDカードの抜き差し、コンテナの再起動等も試みましたが、状況は変わりませんでした。

この場合に考えられる原因や、確認すべきポイント等がございましたらご教授いただけますと幸いです。

お忙しいところ恐れ入りますが、何卒よろしくお願いいたします。

コメント

at_shota.shimoyama

2025年9月12日 10時34分

アットマークテクノの下山です。

autofsコンテナ側でつまずいている可能性があるので、autofsコンテナの中に入って/mntの中にusbやsdなどのディレクトリがあるかどうか、
またABOS側で

podman logs autofs

と実行してautofsのログを出力し、それを教えていただけますでしょうか

よろしくお願いします

>autofsコンテナ側でつまずいている可能性があるので、autofsコンテナの中に入って/mntの中にusbやsdなどのディレクトリがあるかどうか、
autofsコンテナ側で/mntの中にusbやsdなどのディレクトリも存在してないです

/ # ls /mnt/automount/
/ # 

>autofsのログを出力し、それを教えていただけますでしょうか
ログはこのようになってます。

/home/atmark # podman logs alpine
open_fopen_r:211: failed to open file: No such file or directory
Starting automounter version 5.1.9, master map auto.master
using kernel protocol version 5.05
reading files master auto.master
mounted indirect on /mnt/automount with timeout 1, freq 1 seconds
ghosting enabled

よろしくお願いいたします。

at_shota.shimoyama

2025年9月12日 11時56分

>> autofsコンテナ側でつまずいている可能性があるので、autofsコンテナの中に入って/mntの中にusbやsdなどのディレクトリがあるかどうか、
すみません、間違えました。ls /mnt/automount/でsdやusbディレクトリは確認できるでしょうか?
ちなみに、sdやusbディレクトリなどはSDカードやUSBの有無に関係なく表示されるはずです

もし見つからない場合、autofs側の設定に問題があるかもしれません
ABOS側で次のコマンドの結果を教えてください

cat /etc/atmark/containers/autofs.conf
cat /var/app/rollback/volumes/autofs/auto.master
cat /var/app/rollback/volumes/autofs/auto.mnt
cat /var/app/rollback/volumes/autofs/autofs.conf

> ログはこのようになってます。
ログはこちらでも同じ出力が確認できたので問題はなさそうです

> すみません、間違えました。ls /mnt/automount/でsdやusbディレクトリは確認できるでしょうか?
> ちなみに、sdやusbディレクトリなどはSDカードやUSBの有無に関係なく表示されるはずです
確認できておりません

> もし見つからない場合、autofs側の設定に問題があるかもしれません
各種設定は以下のようになっております。

/home/atmark # cat /var/app/rollback/volumes/autofs/auto.master

/mnt/automount /etc/autofs/auto.mnt

/home/atmark # cat /var/app/rollback/volumes/autofs/auto.mnt

usb -nosuid,nodev,ro,fstype=auto :/dev/sda1
sd -nosuid,nodev,ro,fstype=auto :/dev/mmcblk1p1
# fat の場合(FAT32まで)は以下のようにユーザーも設定可能です
# usb_fat -nosuid,nodev,ro,uid=1000,gid=1000,fstype=vfat :/dev/sda1

/home/atmark # cat /var/app/rollback/volumes/autofs/autofs.conf

# 変更が必要な場合は man page を参照してください:
# https://manpages.debian.org/bookworm/autofs/autofs.conf.5.en.html
[autofs]
# デフォルトより早めにアンマウントします
timeout = 1
# マウントに失敗してから再試行可能になるまでの時間を早めに設定
negative_timeout = 1

/home/atmark # cat /etc/atmark/containers/autofs.confに関してはコンテナのイメージ名が違うため、(alpine)になっているためalpine.conf に設定がありました。
コード
cat: can't open '/etc/atmark/containers/autofs.conf': No such file or directory
/home/atmark # cd /etc/atmark/containers/alpine.conf

set_image localhost/alpine:latest
 
# コンフィグディレクトリ
add_volumes /var/app/rollback/volumes/autofs:/etc/autofs:ro
# 共有ディレクトリ
add_volumes /run/mnt:/mnt:shared
# マウントするために必要な権限
add_args --cap-add SYS_ADMIN
# sd と mmc は usb メモリ等のため
# misc は /dev/autofs のアクセス権限のため
add_hotplugs sd mmc misc
# pid が見えないとリクエストを受信できないため
add_args --pid=host
# サービス実行コマンド
set_command automount -f -v

よろしくお願いいたします。

at_shota.shimoyama

2025年9月12日 14時11分

たしかにABOSDEから行うとalpine.confという名前になりますね

autofs関連の設定には問題ないように見えるので、原因の切り分けのために

vi /etc/atmark/containers/alpine.conf

で、add_volumes /run/mnt:/mnt:sharedの行を消してみてもらえますでしょうか?
その後、podman_start -aで全てのコンテナを再起動した後、alpineコンテナの中に入ってls /mnt/automountでsdやusbディレクトリが見えるかどうか確認してください。
ABOS側やアプリケーションコンテナ側からは見えなくなってしまいますが、原因を切り分けやすくなると思います。

よろしくお願いします

> その後、podman_start -aで全てのコンテナを再起動した後、alpineコンテナの中に入ってls /mnt/automountでsdやusbディレクトリが見えるかどうか確認してください。
alpine.confを変更してみたんですが、やはりusbやsdのディレクトリは見えませんでした。

少し気になるのがautofsコンテナのログを確認した時に、時々以下のようなログ表示がされます。コンテナ起動時に毎回表示されるわけではありません。

open_fopen_r:211: failed to open file: No such file or directory
Starting automounter version 5.1.9, master map auto.master
using kernel protocol version 5.05
reading files master auto.master
mounted indirect on /mnt/automount with timeout 1, freq 1 seconds
ghosting enabled
attempting to mount entry /mnt/automount/MAILPATH
lookup(program): lookup for MAILPATH failed
failed to mount /mnt/automount/MAILPATH
attempting to mount entry /mnt/automount/MAILPATH
lookup(program): lookup for MAILPATH failed
failed to mount /mnt/automount/MAILPATH

よろしくお願いいたします。

at_shota.shimoyama

2025年9月12日 14時52分

こちらでは再現できないですね…
そのエラーが表示される原因やsdやusbディレクトリが見つからない原因も全く見当が付かないですが、バージョンの依存性や他のアプリケーションコンテナの存在などが関与しているかもしれません
以下のコマンドの結果を教えていただけますでしょうか

armadillo:~# cat /etc/atmark-release
armadillo:~# ls /etc/atmark/containers

よろしくお願いします

> こちらでは再現できないですね…
> そのエラーが表示される原因やsdやusbディレクトリが見つからない原因も全く見当が付かないですが、バージョンの依存性や他のアプリケーションコンテナの存在などが関与しているかもしれません
> 以下のコマンドの結果を教えていただけますでしょうか
このようになっております。何か影響をありそうな部分についてご教授いただければ幸いです。
>

/home/atmark # cat /etc/atmark-release
3.20.3-at.5
/home/atmark # ls /etc/atmark/containers
README                        at-debian-image.conf.example
alpine.conf                   {メインアプリケーションのコンテナ名}.conf
alpine.conf.example
> 

alpine.conf.example

set_image docker.io/alpine
 
# replace with a more useful command
set_command sleep infinity
/etc/atmark/containers # at-debian-image.conf.example
sh: at-debian-image.conf.example: not found
/etc/atmark/containers # cat at-debian-image.conf.example
set_image localhost/at-debian-image:latest
 
# for VPU and NPU
add_volumes /opt/firmware:/opt/firmware:ro
add_devices /dev/dri /dev/galcore
 
# for video decoding and camera
add_hotplugs video4linux
add_devices /dev/mxc_hantro /dev/mxc_hantro_vc8000e /dev/ion
 
# for weston
add_hotplugs input
add_devices /dev/tty7
add_args --cap-add=SYS_TTY_CONFIG
 
# for weston with external clients
add_volumes /tmp/xdg_home:/run/xdg_home
add_args --env=XDG_RUNTIME_DIR=/run/xdg_home

at-debian-image.conf.example

set_image localhost/at-debian-image:latest
 
# for VPU and NPU
add_volumes /opt/firmware:/opt/firmware:ro
add_devices /dev/dri /dev/galcore
 
# for video decoding and camera
add_hotplugs video4linux
add_devices /dev/mxc_hantro /dev/mxc_hantro_vc8000e /dev/ion
 
# for weston
add_hotplugs input
add_devices /dev/tty7
add_args --cap-add=SYS_TTY_CONFIG
 
# for weston with external clients
add_volumes /tmp/xdg_home:/run/xdg_home
add_args --env=XDG_RUNTIME_DIR=/run/xdg_home
 
# replace with a more useful command
set_command at-weston-launch

{メインアプリケーションのコンテナ名}.conf

set_image localhost/{メインアプリケーションのコンテナ名}:latest
 
# for VPU and NPU
add_volumes /opt/firmware:/opt/firmware:ro
add_devices /dev/dri /dev/galcore
 
# for video decoding
add_devices /dev/mxc_hantro /dev/mxc_hantro_vc8000e /dev/ion
 
# for video
add_hotplugs video4linux
 
# for audio
add_devices /dev/snd
 
# for weston
add_volumes /run/udev:/run/udev:ro
add_hotplugs input
add_devices /dev/tty7
add_args --cap-add=SYS_TTY_CONFIG
 
# for mounting USB drives
add_volumes /run/mnt:/mnt:shared,ro
 
# set timezone
add_args -e TZ=Asia/Tokyo
 
# for network access
add_args --network=host
 
# mount app sources and data:
# - relative paths are in /var/app/rollback/volumes and can be
# rolled back on failed upgrades, suitable for application sources
# and assets.
# - /var/app/volumes is not copied on updates and more suitable
# for volatile data such as logs and databases.
# - "/vol_app:ro" means to make "/vol_app" read-only.
# If this is inconvenient, please remove ":ro".
add_volumes /var/app/rollback/volumes/{メインアプリケーションのコンテナ名}:/vol_app
add_volumes /var/app/volumes/{メインアプリケーションのコンテナ名}:/vol_data
 
# Add environment variables set by Atmark Techno.
add_armadillo_env
 
# Allow LED to be written. This is application specific
# and should be changed depending on your needs.
add_volumes /sys:/sys
 
# udev rules for touchscreen
add_pre_command touch /var/app/volumes/{メインアプリケーションのコンテナ名}/touchscreen.rules
add_pre_command cp /var/app/volumes/{メインアプリケーションのコンテナ名}/touchscreen.rules /etc/udev/rules.d/
add_pre_command udevadm control --reload
add_pre_command udevadm trigger --subsystem-match=input
 
# set AUTH environment variable for ABOSDE API
add_args --env=AUTH="Authorization:Bearer …"
 
# launch app
# /vol_app/build/main is launched
# see container/resources_c/bin/c_launch
set_command {メインアプリケーション}

お世話になっております。

autofsの自動マウント設定でusbやsdディレクトリができない件、
原因は設定ファイルの改行コードがLFじゃなくCRLFになっていたことでした。

改行コードをLFに直したら、無事にディレクトリも作成されて動作するようになりました。

ご心配・お手数をおかけしてすみませんでした。
今後は気をつけますので、引き続きよろしくお願いします

at_shota.shimoyama

2025年9月12日 15時58分

> autofsの自動マウント設定でusbやsdディレクトリができない件、
> 原因は設定ファイルの改行コードがLFじゃなくCRLFになっていたことでした。

そういうことでしたか
無事解決したようでなによりです

また何かございましたら遠慮なくお聞きください