LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   autofs does not auto-mount cdrom (https://www.linuxquestions.org/questions/linux-general-1/autofs-does-not-auto-mount-cdrom-938348/)

Hammo 04-05-2012 02:53 PM

autofs does not auto-mount cdrom
 
Hi all,

I am using CentOS 6 (kernel 2.6.32-71.el6.x86_64) on a virtual machine and trying to test out some basic automount functions, but autofs doesn't seem to be working even with the basic configuration.

-------------------
[root@RHEL01 ~]# service autofs status
automount (pid 1635) is running...
[root@RHEL01 ~]#

[root@RHEL01 ~]# cat /etc/auto.master | grep -v ^#
/misc /etc/auto.misc
/net -hosts
+auto.master

[root@RHEL01 ~]#
[root@RHEL01 ~]# cat /etc/auto.misc | grep -v ^#

cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom --timeout=5

[root@RHEL01 ~]#


---------------------

I have been trying to search the internet for any possible information, but did not come across anything related.

Also /var/log/messages do not show anything suspicious.

When I try to manuall mount the CD it DOES work:

[root@RHEL01 ~]# mount /dev/cdrom /media
mount: block device /dev/sr0 is write-protected, mounting read-only


I would appreciate if anyone could give me some idea on how to further debug this, or if you encountered it before, what was the solution.

Thanks

T3RM1NVT0R 04-05-2012 04:12 PM

@ Reply
 
Hi Hammo,

How are you trying to access the autofs mount? As I can see from the post the settings are at default. So basically your cd should be accessible via following path:

Code:

cd /misc/cd
and I would suggest you to increase timeout a bit.

Hammo 04-05-2012 08:01 PM

I cd into the /misc/cd directory, yet it is empty:


[root@RHEL01 ~]# cd /misc/
[root@RHEL01 misc]# ll
total 0
[root@RHEL01 misc]# cd /misc/cd
-bash: cd: /misc/cd: No such file or directory
[root@RHEL01 misc]#


I set the timeout manually to --timeout=600 (although I think this is the default value anyways) still no luck :S

T3RM1NVT0R 04-05-2012 08:08 PM

@ Reply
 
Try this:

Restart autofs using the following command:

Code:

service autofs restart
Then try to get into /misc/cd . If you still get the same error then paste the output of the following command:

Code:

tail /var/log/messages
It will be good if you share the files /etc/auto.misc, /etc/auto.master and /etc/auto.net. I just want to make sure that these files are properly configured or not.

Hammo 04-05-2012 08:54 PM

[root@RHEL01 /]# date
Fri Apr 6 03:46:31 EET 2012

[root@RHEL01 /]#
[root@RHEL01 /]#
[root@RHEL01 /]# cat /etc/auto.master | grep -v ^#
/misc /etc/auto.misc --timeout=600
/net -hosts
+auto.master

--------------------------------------------------

[root@RHEL01 /]# cat /etc/auto.misc | grep -v ^#

cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom --timeout=5

--------------------------------------------------


[root@RHEL01 /]# cat /etc/auto.net | grep -v ^#



key="$1"

opts="-fstype=nfs,hard,intr,nodev,nosuid"


for P in /bin /sbin /usr/bin /usr/sbin
do
for M in showmount kshowmount
do
if [ -x $P/$M ]
then
SMNT=$P/$M
break
fi
done
done

[ -x $SMNT ] || exit 1

SHOWMOUNT="$SMNT --no-headers -e $key"

$SHOWMOUNT | LC_ALL=C sort -k 1 | \
awk -v key="$key" -v opts="$opts" -- '
BEGIN { ORS=""; first=1 }
{ if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }
END { if (!first) print "\n"; else exit 1 }
' | sed 's/#/\\#/g'

--------------------------------------------------
[root@RHEL01 /]# service autofs stop
Stopping automount: [ OK ]
[root@RHEL01 /]# service autofs start
Starting automount: [ OK ]
--------------------------------------------------

[root@RHEL01 /]#
[root@RHEL01 /]# date
Fri Apr 6 03:48:56 EET 2012
[root@RHEL01 /]#
[root@RHEL01 /]# tail /var/log/messages
Apr 6 03:36:32 RHEL01 kernel: attempt to access beyond end of device
Apr 6 03:36:32 RHEL01 kernel: loop0: rw=0, want=3623889368, limit=8278597
Apr 6 03:37:44 RHEL01 kernel: attempt to access beyond end of device
Apr 6 03:37:44 RHEL01 kernel: loop0: rw=0, want=3623889368, limit=8278597
Apr 6 03:37:51 RHEL01 kernel: attempt to access beyond end of device
Apr 6 03:37:51 RHEL01 kernel: loop0: rw=0, want=3623889368, limit=8278597
Apr 6 03:41:48 RHEL01 kernel: attempt to access beyond end of device
Apr 6 03:41:48 RHEL01 kernel: loop0: rw=0, want=3623889368, limit=8278597
Apr 6 03:42:18 RHEL01 kernel: attempt to access beyond end of device
Apr 6 03:42:18 RHEL01 kernel: loop0: rw=0, want=3623889368, limit=8278597


--------------------------------------------------
--------------------------------------------------
--------------------------------------------------


Please not that these errors in the var/log/messages are not related to this (I was trying to mount an ISO file which didnt work as well, but this is another topic), you can see this from the timestamp and date command outputs

T3RM1NVT0R 04-05-2012 09:37 PM

@ Reply
 
Remove timeout option from both /etc/auto.master and /etc/auto.misc. You are confusing the system by setting up different timeouts on different files. You should not mention timeout in /etc/auto.misc on the first place.

Things to do:

1. Remove timeout switch.
2. Restart autofs
3. Run cd /misc/cd and if it fails then paste the output of tail /var/log/messages.

You posted the output without trying to get into cd /misc/cd

Hammo 04-05-2012 09:51 PM

I removed the timeout from both files and it is working now :) Thanks!

The 5 sec timeout was recommended in some site so that /dev/cdrom gets unmounte shortly after the physical CD is removed. Still confused though why this should cause a problem.

T3RM1NVT0R 04-05-2012 10:04 PM

@ Reply
 
Glad that it worked.

If you want to mention timeout then just mention it in /etc/auto.master. Do not mention anywhere else and see if that works. If not, then remove it and we can take troubleshooting up from there.

Hammo 04-06-2012 09:28 AM

I tried to change the timeout value in auto.master only to 3 seconds and /dec/cdrom gets unmounted correctly after that timeout.

However when I put the timeout setting in auto.misc it does not work at all, so it seems this option can't be specified in that file.


So I will create a different auto.* file for mounts that I want to set a longer timeout to and specify that timeout in auto.master.

Thanks a lot for your help.

Cheers! :)

mssm06 12-28-2012 04:08 AM

autofs not working
 
Hello,

I'm experiencing the same issue here. I got RHEL 6.2 installed. I've started the autofs service and checking if autofs is working with default settings in /etc/auto.mater and /etc/auto.misc. However, when I go into /misc directory there is nothing, it is empty. I'm testing to check if default mounting of cd works.

Whenever I mount CD/DVD, it gets mount automatically in /media directory. I can unmount and mount it back to any other directory. however, /misc directory doesn't contain cd sub-directory.

Thanks,
mssm


All times are GMT -5. The time now is 01:56 PM.