由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - 【求助】udev无法自动mount任何USB盘
相关主题
再问个关于nas的问题问一个简单的问题
一个恼人的mount问题有几个分区不知道怎么挂载的。。。
scsi drive problem when resuming from suspend请问一个HDMI连电视的问题
江湖救急,udev不能自动mount外置U盘我来示范一下自动mount硬盘和读写权限
fstab里面users和uid,gid不能一起用吗?不能umount /mnt了怎么回事阿?
一个关于sort的奇怪问题glibc和kernel的兼容性问题
怎么自动mount一个USB设备?SuSE Enterprise 10: Kernel Update问题
[已解决]请问如何在auto mount NTFS partition?哪位真有时间自己写程序贡献社区,重写个systemd吧
相关话题的讨论汇总
话题: udev话题: usb话题: mount话题: dev话题: kernel
进入Linux版参与讨论
1 (共1页)
m********r
发帖数: 334
1
不是PC,每次插入USB盘udevd自动运行,但是在/etc/udev/rules.d/10-udev.rules从
来不执行,必须手动mount,有什么办法可以调试udev为什么没有执行rules文件?
或者,有什么其他办法自动mount任何牌子的USB盘?
基本上每次设备名都是sda1。
v*****r
发帖数: 1119
2
What's the OS and version?
检查一下 /etc/fstab file, 有可能 nodev, nosuid options 被加到 root
filesystem / entry。 If yes, remove them to give it a try.
m********r
发帖数: 334
3
好像不是
#
# /etc/fstab: static file system information.
#
# file system mount type options dump pass
#/dev/root / ext2 rw,noauto 0 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
usbfs /proc/bus/usb usbfs defaults 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0

【在 v*****r 的大作中提到】
: What's the OS and version?
: 检查一下 /etc/fstab file, 有可能 nodev, nosuid options 被加到 root
: filesystem / entry。 If yes, remove them to give it a try.

m********r
发帖数: 334
4
试了一下,在fstab里加上
/dev/sda1 /mount/usb vfat defaults 0 0
启动的时候报错
mount: Mounting /dev/sda1 on /mount/usb failed: No such device or address
而usb盘的检测是在后面,所以当然找不到设备了,这个顺序可以改吗?

【在 m********r 的大作中提到】
: 好像不是
: #
: # /etc/fstab: static file system information.
: #
: # file system mount type options dump pass
: #/dev/root / ext2 rw,noauto 0 1
: proc /proc proc defaults 0 0
: devpts /dev/pts devpts gid=5,mode=620 0 0
: sysfs /sys sysfs defaults 0 0
: usbfs /proc/bus/usb usbfs defaults 0 0

b***d
发帖数: 186
5
default 去掉,换成 rw,noauto,启动时不会报错。不过并不会解决自动mount的问题

【在 m********r 的大作中提到】
: 试了一下,在fstab里加上
: /dev/sda1 /mount/usb vfat defaults 0 0
: 启动的时候报错
: mount: Mounting /dev/sda1 on /mount/usb failed: No such device or address
: 而usb盘的检测是在后面,所以当然找不到设备了,这个顺序可以改吗?

v*****r
发帖数: 1119
6
感觉还是你的 udev 设置有问题

【在 b***d 的大作中提到】
: default 去掉,换成 rw,noauto,启动时不会报错。不过并不会解决自动mount的问题
v*****r
发帖数: 1119
7
This workaround should work:
1. Add the following line to /etc/fstab
/dev/sda1 /mount/usb vfat noauto,defaults 0 0
2. Then add this line in /etc/rc.d/rc.local
mount /dev/sda1 /mount/usb
But still I don't think it is recommended to hard code each usb device for
automount. The best solution would be to figure out what is wrong with the
UDEV setting.
m********r
发帖数: 334
8
谢谢回复,这种办法可以mount,但不是我希望的方式,我也不知道为什么udev不执行
规则文件,udev.conf很简单,如下
# udev.conf
# The main config file for udev
#
# This file can be used to override some of udev's default values
# for where it looks for files, and where it places device nodes.
# udev_root - where in the filesystem to place the device nodes
udev_root="/dev"
# udev_db - The name and location of the udev database.
udev_db="/dev/.udevdb"
# udev_rules - The name and location of the udev rules file
udev_rules="/etc/udev/rules.d"
# udev_

【在 v*****r 的大作中提到】
: This workaround should work:
: 1. Add the following line to /etc/fstab
: /dev/sda1 /mount/usb vfat noauto,defaults 0 0
: 2. Then add this line in /etc/rc.d/rc.local
: mount /dev/sda1 /mount/usb
: But still I don't think it is recommended to hard code each usb device for
: automount. The best solution would be to figure out what is wrong with the
: UDEV setting.

a*******e
发帖数: 3021
9
你为啥要自己写udev得规则啊?
使用默认的不行吗?
u盘这种系统应该自动给配好了阿

【在 m********r 的大作中提到】
: 谢谢回复,这种办法可以mount,但不是我希望的方式,我也不知道为什么udev不执行
: 规则文件,udev.conf很简单,如下
: # udev.conf
: # The main config file for udev
: #
: # This file can be used to override some of udev's default values
: # for where it looks for files, and where it places device nodes.
: # udev_root - where in the filesystem to place the device nodes
: udev_root="/dev"
: # udev_db - The name and location of the udev database.

m********r
发帖数: 334
10
唉,这不是PC系统,没有HAL,没有桌面

【在 a*******e 的大作中提到】
: 你为啥要自己写udev得规则啊?
: 使用默认的不行吗?
: u盘这种系统应该自动给配好了阿

相关主题
一个关于sort的奇怪问题问一个简单的问题
怎么自动mount一个USB设备?有几个分区不知道怎么挂载的。。。
[已解决]请问如何在auto mount NTFS partition?请问一个HDMI连电视的问题
进入Linux版参与讨论
a*******e
发帖数: 3021
11
o,可怜

【在 m********r 的大作中提到】
: 唉,这不是PC系统,没有HAL,没有桌面
v*****r
发帖数: 1119
12
我觉的有可能 udev rule match keys 不对
# udevinfo -a -p $(udevinfo -q path -n /dev/sda)
Based on output,try first:
KERNEL=="sda", RUN+="/root/usbmount.sh"
then add one key:
KERNEL=="sda", SUBSYSTEM=="...", RUN+="/root/usbmount.sh"
Keep trying by add a couple of more key(one at a time) ....
m********r
发帖数: 334
13
有很多发现,先说几个相关的。有两个Key发现不工作,ACTION和RUN,比如
KERNEL=="sd*[0-9]", NAME="my_usbdrive"
插入后在/dev下有my_usbdrive,但是如果写成
ACTION="add",KERNEL=="sd*[0-9]", NAME="my_usbdrive"
什么都没有。
KERNEL=="sd*[0-9]",SYMLINK="mitbbs" 没问题,但是
KERNEL=="sd*[0-9]",RUN+="/usr/bin/my_script" 不执行
如果是
KERNEL=="sd*[0-9]",PROGRAM="/usr/bin/my_script" 可以执行my_script,但是
my_script变成僵尸,而且在my_script里任何命令带参数都不执行,比如
umount -l /mnt/usb
现在搞不清楚这是不是bug

【在 v*****r 的大作中提到】
: 我觉的有可能 udev rule match keys 不对
: # udevinfo -a -p $(udevinfo -q path -n /dev/sda)
: Based on output,try first:
: KERNEL=="sda", RUN+="/root/usbmount.sh"
: then add one key:
: KERNEL=="sda", SUBSYSTEM=="...", RUN+="/root/usbmount.sh"
: Keep trying by add a couple of more key(one at a time) ....

v*****r
发帖数: 1119
14
I am not sure some issues are bugs or not.
One possible cause of your script not triggered to run is due to the keys
you specified in the rule are not unique enough to identify your thumbdrive.
That is why sometimes we have to run "udevinfo" command to find out all
unique attributes assigned to the device and try different combination of
keys.
m********r
发帖数: 334
15
问题解决了!!
我的BSP的udev版本太低,056,竟然没有支持RUN和ACTION,升级就好了。
Freescale的开源产品真烂,现在很同情前一阵子痛恨开源的那个同学,闭源产品起码
有保障,不会搞这种无厘头的事情。

thumbdrive.

【在 v*****r 的大作中提到】
: I am not sure some issues are bugs or not.
: One possible cause of your script not triggered to run is due to the keys
: you specified in the rule are not unique enough to identify your thumbdrive.
: That is why sometimes we have to run "udevinfo" command to find out all
: unique attributes assigned to the device and try different combination of
: keys.

v*****r
发帖数: 1119
16
Cong!
1 (共1页)
进入Linux版参与讨论
相关主题
哪位真有时间自己写程序贡献社区,重写个systemd吧fstab里面users和uid,gid不能一起用吗?
grub的问题??一个关于sort的奇怪问题
swap疑问怎么自动mount一个USB设备?
哇,这个牛逼。。。[已解决]请问如何在auto mount NTFS partition?
再问个关于nas的问题问一个简单的问题
一个恼人的mount问题有几个分区不知道怎么挂载的。。。
scsi drive problem when resuming from suspend请问一个HDMI连电视的问题
江湖救急,udev不能自动mount外置U盘我来示范一下自动mount硬盘和读写权限
相关话题的讨论汇总
话题: udev话题: usb话题: mount话题: dev话题: kernel