LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-05-2003, 05:30 AM   #1
ohcysp
LQ Newbie
 
Registered: Aug 2003
Location: Lund, Sweden
Distribution: slackware 9.0
Posts: 9

Rep: Reputation: 0
automounting cd-rom in slackware 9.0


Hi!

Since this is my first post on this forum, I hope I post it in the correct part of the forum. Searching for similar problems didn't help me to get it working, so I decided to post a new thread.

I just recently went from Mandrake 9.1 to Slackware 9.0, and as I did I realised that the CD's I put in my player doesn't automagically show up when I try to ls /mnt/cdrom (default mountpoint for my /dev/hdc).

Reading a bit about this I learned that one have to mount each time a new CD is placed into the drive, and to change disc one have to umount to unlock it. This is something that for me is a bit annoying. Learning about the program supermount I also noticed that there's a program called automount, which according to most guides is superior to supermount, as Linus has implemented kernel code to support autofs.

Compiling a new kernel (2.4.21, latest stable) and making sure that autofs is supported under filesystems, I started experimenting (which led to an unfortunate oversleep this morning and me being late for work ) yesterday, and I just can't seem to get it working.

I managed to find out how the bootup process under Slackware works, /etc/rc.d in a BSD fashion style, instead of the usual SystemV. Even managed to get some bash-scripts running at bootup.

Though I still can't get the darn automounting working... it could be a simple problem of me just not understanding the syntax.

So, I could really need some help, at a fairly low level of guiding since I'm still somewhat a n00b to Linux.

Best regards, Kristoffer


Below are some excerpts from the relevant files

-- rc.autofs --
#!/bin/bash
/usr/sbin/automount --timeout=10 /mnt file /etc/auto.master

#yeah I know, it's lame, but only for testing purposes

-- fstab --
..
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro,user 0 0

-- auto.master --
/mnt /etc/auto.misc

-- auto.misc --
cdrom -fstype=iso9660,ro :/dev/hdc
 
Old 08-05-2003, 09:11 AM   #2
Corin
Member
 
Registered: Jul 2003
Location: Jette, Brussels Hoofstedelijk Gewest
Distribution: Debian sid, RedHat 9, Suse 8.2
Posts: 446

Rep: Reputation: 31
Hi Kristoffer!

If you have installed the autofs package under slackware, I find it hard to believe that the slackware package does not come ready supplied with an rc.d file ready to fire up autofs at boot time.

However, you will probably need to use your runlevel editor or manually do what needs to be done to ensure that the script is called in run levels 2,3,4,5 and shutdown in 0,1,6.

Personally I prefer to keep my automounts under /auto rather than /misc, but that is up to you.

For autofs, you need a master file specified in the rc.d file,
usually auto.master, which has lines

#*****************************************************************************#
#
# file: /etc/auto.master
#
#*---------------------------------------------------------------------------*#
#
/auto/koala /etc/auto/auto.koala --timeout 60
/auto/local /etc/auto/auto.local --timeout 60
/auto/ocelot /etc/auto/auto.ocelot --timeout 60
/auto/wolverine /etc/auto/auto.wolverine --timeout 60
#
#*****************************************************************************#

and then in each of those files which I keep under /etc/auto
rather than clogging up /etc, we have for example

#*****************************************************************************#
#
# file: /etc/auto/auto.local
#
#*---------------------------------------------------------------------------*#
#
cdrom -fstype=iso9660,nodev,nosuid,ro :/dev/cdrom
#
floppy -fstype=auto,nodev,nosuid,sync :/dev/floppy0
#
#*****************************************************************************#

and for a machine on the LAN

#*****************************************************************************#
#
# file: /etc/auto/auto.wolverine
#
#*---------------------------------------------------------------------------*#
#
apps -fstype=nfs,hard,intr,nodev,nosuid,nonstrict,ro wolverin
e.wsl.COM:/usr/local
#
cdrom -fstype=smbfs,credentials=/etc/samba/smb.autofs,intr,ro ://WOLVE
RINE/CD-ROM
dvd -fstype=smbfs,credentials=/etc/samba/smb.autofs,intr,ro ://WOLVE
RINE/DVD
#
software -fstype=smbfs,credentials=/etc/samba/smb.autofs,intr,ro ://WOLVE
RINE/SOFTWARE
temp -fstype=smbfs,credentials=/etc/samba/smb.autofs,intr,ro ://WOLVE
RINE/TEMP
#
#*****************************************************************************#

So you can even automount another machine's CD-ROM, provided it is accessible through SAMBA share or nfs.

NOW, even if the autofs is all set up and correctly working, and you then do an

$ ls /auto/cdrom

you will not see anything! Shock, horror!

In order to get the automounter to "kick in" and actually automount the device you have to try and access something on the automounted device, the best method being to cd into the directory eg

$ cd /auto/cdrom

(BTW in /auto I have a symlink from /auto/local/cdrom to /auto/cdrom in case anybody is worrying about the discrepancy with the paths shown in the /etc/auto/auto.local file).

And it all works wonderfully. But note that you have to cd out of the automounted directory before you can do the command

$ eject cdrom

And yes, it is all so much more convenient than doing mount and remount all the time.

Last edited by Corin; 08-05-2003 at 09:12 AM.
 
Old 08-05-2003, 12:19 PM   #3
ohcysp
LQ Newbie
 
Registered: Aug 2003
Location: Lund, Sweden
Distribution: slackware 9.0
Posts: 9

Original Poster
Rep: Reputation: 0
Hi Corin and thanks for the reply!

You mention that the slackware package should come with an rc.d file to start autofs att boot time. This gives me a few questions. First of all, how do I determine that the autofs is started? A grep in /etc/rc.d returns

psycho@r3215:/etc/rc.d>grep autofs *
rc.local:if [ -x /etc/rc.d/rc.autofs ]; then
rc.local: . /etc/rc.d/rc.autofs

and this is my own editing, creating the rc.autofs and editing the rc.local file, which is called from rc.M. I guess that this script will be called in all runlevels you mention.

My second question is, the "rc.d file"? I do have a catalog called /etc/rc.d, but it does not contain a file called "rc.d".

/etc/auto.master and /etc/auto.misc do comply with the specifications you gave me and it shouldn't be those that gives me problems, since I guess this (the problem that automounting does not work for me) comes from the init when I boot my computer.
Therefore, it would be nice if you could give me some examples of what you call "rc.d file" and also tell me how I need to edit my runlevels.

The last question to this problem I have regards the fstab. What exactly should I put in it to get automounting working (for now I'm just interested in my CD-drive, if I learn the methodology I will most likely be able to aotomount other locations when I find a need for it)?
Do I need to edit it at all?

Best regards, Kristoffer
 
Old 08-05-2003, 06:20 PM   #4
Corin
Member
 
Registered: Jul 2003
Location: Jette, Brussels Hoofstedelijk Gewest
Distribution: Debian sid, RedHat 9, Suse 8.2
Posts: 446

Rep: Reputation: 31
Quote:
Originally posted by ohcysp
You mention that the slackware package should come with an rc.d file to start autofs att boot time.
Well under the Slackware package scheme, what are the contents
of the slackware package, apart from the autofs daemon. Are
there any shell scripts installs in /etc/rc.d or not? I do not know
since I do not have or have used a slackware system.

Quote:
This gives me a few questions. First of all, how do I determine that the autofs is started?
Do you mean

A) How do I ensure that autofs is started each time I enter a runlevel?

or

B) How do I determine that autofs has started after I enter a runlevel?

Quote:
I guess that this script will be called in all runlevels you mention.
Yes, this will do what is necessary.

Quote:
My second question is, the "rc.d file"?
Sorry I was using "rc.d" as an adjective, ie I meant to indicate a file in the rc.d directory. Otherwise I would have said the file rc.d. It was not accurate and not clear so I offer my apology.

Quote:
Therefore, it would be nice if you could give me some examples of what you call "rc.d file" and also tell me how I need to edit my runlevels.
No need, since what you have done is CORRECT (for Slackware's
BSD style runlevel scheme).

Quote:
What exactly should I put in it to get automounting working
You do not need to put anything in /etc/fstab, and you certainly do
not put the "auto" option on an entry in there.

Even though I automount my CD-ROM I still have the entry

/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0

in my fstab, so that if for some reason I wish or need to do a manual
mount, I still can, but it in no way affects the automount process.

So if you have set up your /etc/auto.master and /etc/{auto/}auto.local file correctly, all should work

You should see something equivalent to this

ps -adef | egrep auto
root 686 1 0 Aug05 ? 00:00:00 /usr/sbin/automount --timeout 60 /auto/koala file /etc/auto/auto.koala
root 704 1 0 Aug05 ? 00:00:00 /usr/sbin/automount --timeout 60 /auto/local file /etc/auto/auto.local
root 728 1 0 Aug05 ? 00:00:00 /usr/sbin/automount --timeout 60 /auto/ocelot file /etc/auto/auto.ocelot
root 752 1 0 Aug05 ? 00:00:00 /usr/sbin/automount --timeout 60 /auto/wolverine file /etc/auto/auto.wolverine
root 776 1 0 Aug05 ? 00:00:00 /usr/sbin/automount --timeout 60 /net/koala/usr file /etc/auto/net.koala.usr
root 798 1 0 Aug05 ? 00:00:00 /usr/sbin/automount --timeout 60 /net/ocelot/usr file /etc/auto/net.ocelot.usr
root 822 1 0 Aug05 ? 00:00:00 /usr/sbin/automount --timeout 60 /net/wolverine/usr file /etc/auto/net.wolverine.usr
miller 8038 1786 0 01:12 pts/1 00:00:00 grep -E auto

And if you cd to the auto directory mount point

$ df -k .

Filesystem 1K-blocks Used Available Use% Mounted on
automount(pid686) 0 0 0 - /auto/koala
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware 2.6.7 no CD-ROM? qtaznromeo7 Linux - Hardware 1 10-21-2004 05:10 AM
automounting options in Slackware 9.1 ZidanaX Slackware 2 03-07-2004 07:36 PM
ATAPI floppy/dvdrom/cdrw automounting, slackware 9.1 Ben2210 Slackware 13 03-02-2004 12:55 AM
Slackware and automounting jfallon Slackware 2 02-09-2004 01:55 PM
can't boot to slackware 8.1 cd rom twinkiekilla Slackware 1 02-26-2003 04:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration