How can I install an automounter into puppy?

Booting, installing, newbie
Message
Author
plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

How can I install an automounter into puppy?

#1 Post by plockery »

I would very much like to use puppy 2.01 on some student terminals to log in via rdesktop to a windows terminal server.

But the students need access to their usb sticks from the terminal server window.

This means I need samba server operating and an automounter that is able to mount and unmount different usb sticks when inserted by various students.

Thanks to MU I have now installed the samba dotpup and when mounted the usb files can be seen over the windows network.

What I desparately need now is to install something like autofs/automount (have used this before on other full distros) or supermount (have not used this) on puppy.

Is that at all possible? If so how?

I have limited skills with linux and no programming skills.

Is there a way to do this fairly simply or could I learn how to do it?

mylon2202
Posts: 3
Joined: Fri 21 Jul 2006, 16:31

#2 Post by mylon2202 »

I am currently looking for a way to do this also.

I have tried installing autofs but that didn't work, also tried a C program that was supposed to mount then unmount the cd when you press the button on the cdrom, it mounted fine but does not allow you to unmount...

I don't believe you need samba to use usb sticks, I have mine redirecting through rdesktop using the switch -r disk:usb=/dev/sda1 or whatever usb your plug into use that appropriate /dev/

If anyone has some info on how to get some automounting in linux to work that would be great.. I would need cdrom and usb also.

Thanks

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

If I'm correct, the client PCs are running Puppy & the students need to plug the USBs into the client PC that they're at?

Why don't the students just use Puppy's MUT (Media Utility Tool) to mount the USBs?
It's easy to understand, simple to use & works most all the time.
Besides if you heard the horror stories about using automount & supermount you might reconsider.

mylon2202
Posts: 3
Joined: Fri 21 Jul 2006, 16:31

#4 Post by mylon2202 »

Try pitching that to an IT manager, if you've ever worked in a bigger corporation you find out there are a lot of people that are not IT savy, and this would be a big learning curve for them. I can image students have the same problems.

Ohh well trying out windows fundamentals and will pitch both my builds of Puppy and Fundamentals to the boss and see what takes..

plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

#5 Post by plockery »

Thanks for the tip mylon2202 about -r option with the usb in rdesktop.

However I tried that option (-r disk:usb=/dev/sda1 [where my usb stick is located]) but it does not work.

Windows explorer shows a network usb entry called usb under my computer but when I click it no files show up, just empty.

Any ideas why?

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#6 Post by sunburnt »

I was working on a bash script daemon, with a delayed loop that checks for USB drives, & if finds one, it mounts it.
This code WORKS, it attempts to mounts USB drives every 5 seconds:

#!/bin/sh
USBmod=`lsmod | grep "usb-storage"`

if [ -z "$USBmod" ];then # if not loaded, load USB drive module
modprobe usb-storage
fi

# make 4 USB mount point dirs.

mkdir -p /mnt/sda1 # USB #1, Part.#1
mkdir -p /mnt/sda2 # USB #1, Part.#2
mkdir -p /mnt/sdb1 # USB #2, Part.#1
mkdir -p /mnt/sdb2 # USB #2, Part.#2

while :
do
sleep 5
for USBmnt in sda1 sda2 sdb1 sdb2
do
mount /dev/$USBmnt /mnt/$USBmnt # attempt to mount USB

if [ $? -eq 0 ];then # if mount good, InfoBox
Xdialog --title " USB Drive daemon" \
--infobox "
USB Flash Drive found...

It's mounted at: /mnt/$USBmnt

" 0 0 5000 &

rox /mnt/$USBmnt # show USB drive in ROX
fi
done
done

===========
I can't find a way to tell when the USB drive's been removed to unmount it.
Perhaps someone can come up with a way to do that!

plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

#7 Post by plockery »

Mylon2202 - Some further questions re usb redirection in rdesktop.

1. Are you logging in to a windows server?

2. I always thought linux could not talk to windows without samba because of the different file systems. My usb drive is formatted in FAT. Should windows be able to see this from the linux terminal anyway?

User avatar
fluxit
Posts: 326
Joined: Sat 24 Jun 2006, 04:14
Location: Ketchikan, AK USA

#8 Post by fluxit »

sunburnt,
I can't find a way to tell when the USB drive's been removed to unmount it.
Perhaps someone can come up with a way to do that!
A combination of dmesg, dmesg -c, and grep could tell you that(I'm not sure if it's a good idea or not,) but what is the point? If the drive has already been removed, it's too late to unmount it. :shock:

--Lee

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#9 Post by sunburnt »

fluxit; I've checked that, I pulled the USB drive while mounted, & no errors!
Strangely "ls -a /mnt/sda1" still displayed the dir. listing, so I couldn't use it to test for the USB.
Then I "umount /mnt/sda1" & it unmounted without errors & "ls -a /mnt/sda1" gave the empty dir. display ". ..".
Typeing "mount" shows the USB still mounted after unplugging it, after unmounting "mount" doesn't show it.

I'm not grasping what your saying about: dmesg, dmesg -c, and grep
I know how to use grep, but I'm not sure how dmesg fits in.
Could you work up a code scrap I could test out?

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#10 Post by BarryK »

Guys, there's a Window maker docapp that may do what you want.
I downloaded it awhile ago, don't recall where from.
The tarball is devmon-1.5.tar.gz
There's something else similar for Cds, called cdmon.

Attached tarball is the source.
Attachments
devmon-1.5.tar.gz
(47.79 KiB) Downloaded 397 times

User avatar
fluxit
Posts: 326
Joined: Sat 24 Jun 2006, 04:14
Location: Ketchikan, AK USA

#11 Post by fluxit »

Barry,

devmon requires famhttp://oss.sgi.com/projects/fam/download.html it looks good though. I don't have my Puppy 2 dev environment up yet(devmon also needs a 2.6 kernel.)

sunburnt,

If you are still interested, here is that dmesg info. I don't know enough bash to help with code(I can understand it.)
Attachments
puppy2usb-dmesg.txt.gz
(647 Bytes) Downloaded 435 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#12 Post by sunburnt »

Thanks fluxit & Barry, I'd like the USB removal detection to be as simple as the rest of my code (if it's possable).
It also needs to work in ALL Puppy versions (preferably), you'd think it'd be EASY to detect a known USB device.
If I can figure out how to do it useing std. Linux & Bash commands, it'll pretty much work anywhere.

fluxit; I tried: "dmesg -c" & got alot of info like your .txt file, but I couldn't make it work again!
After being run once, it won't give any more console output after that!
Starting a new xterm didn't help, so I'm not sure if it'll be useable.
It'll have to be run over & over, same as the repeted mount commands in my daemon code.

I'll just have to keep looking through what's available, but... I'll find a way!

User avatar
fluxit
Posts: 326
Joined: Sat 24 Jun 2006, 04:14
Location: Ketchikan, AK USA

#13 Post by fluxit »

Sorry, I should have explained. The "-c" means clear. My idea was that you would parse the output and then have a new set of "device messages" the next time you run it. I generated the content of that text file like so:
dmesg -c
(plug in thumbdrive)
dmesg -c #+copy&paste
(unplug thumbdrive)
dmesg -c #+c&p again

If your code was smart enough, you wouldn't need the "-c" switch at all. I just though it might be easier that way, of course "-c" would also eliminate dmesg's usefulness for other purposes as your daemon would be eating its contents continuously. :oops:

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#14 Post by sunburnt »

fluxit; I took a closer look at dmesg, & it detects the USB & I can grep for the line:
USB Mass Storage device found at 25

Unfortunately it doesn't tell me which device it is (/dev/sda1, /dev/sdb1, etc.).
If someone can tell me how to convert "25" into a device designation ..................... HELP!
This method seemed fast compared to my solution below.


Messing around I found out that the command: "probepart" DOES detect USB drives!
So between testing for the drive & testing if the drive was mounted, I was able to make it work!

The TEST file: "usb-auto_test" auto. mounts my USB drive when plugged in, & unmounts it when it's removed.
When it finds a USB drive it pops up an InfoBox saying so, & tells the mount point.
I also set it up to run ROX with the USB drive shown, I can shut this off if needed.
It takes maybe 5 seconds (more or less) to detect the USB & mount it, PC speed matters I'm sure.
Last edited by sunburnt on Wed 02 Aug 2006, 06:05, edited 5 times in total.

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#15 Post by Dougal »

Sunburnt: (I'm not sure if the system doesn't do this automatically frequently enough, but, if not...) Wouldn't you need a "sync" to be run regularly to prevent data loss from what was supposed to be saved to the USB device?

Usually a "sync" is run before unmounting, so you need to be sure one was run shortly enough before the USB device was pulled out...
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#16 Post by sunburnt »

Dougal; Your probably right (of course), syncing shouldn't be done too much though.
Yeah, this is one of the many incongruities of the way Linux does things.
It'd be nice if a "Neo Linux" were made & they could fix all of them & toss the legacy stuff.
Say... isn't that what the MAC OS is?

I'm reworking it so hopefully it won't access the USB constantly, I'll look at putting a sync in the loop.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#17 Post by sunburnt »

Look above for the NEW version of "usb-auto", check out the improvements.

NOTE: If you look at the code, I forgot to remove the trash code at the bottom, doesn't hurt.

User avatar
fluxit
Posts: 326
Joined: Sat 24 Jun 2006, 04:14
Location: Ketchikan, AK USA

#18 Post by fluxit »

sunburnt,

Your usb-auto does work with one of my flash drives(I only tried one.) It mounts the single vfat partition as umsdos however, providing short names only.
A reboot is required to regain the ability to see long names. Even closing usb-auto, loading MUT(which sees the partition as vfat,) then mounting with MUT will not show longnames.

--Lee

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#19 Post by sunburnt »

fluxit; I left the drive type designation off of the mount command "-t (type)" hopeing it'd mount the correct one.
Apparently Linux defaults to msdos if not told other wise, I seem to recall something about this.

Anyway... I'll add parsing for the partition type to it, & I'll check to make sure it's functional.
I need to get at making it at least recognize & mount more than 1 partition, & more USBs.
Up to 4 drives with up to 4 partitions on each of them is my hope.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#20 Post by sunburnt »

New version: usb-auto_test-3

I added drive partition type parsing to insure it's mounted as the proper type.
I tested by copying a file with a 12 character name to the USB & from it, worked good.

ALSO, I added searching & mounting of up to 4 partitions on the USB drive.
But currently it still only does 1 USB drive at a time (sda1-4), I hope to get up to 4 USBs working.

All 3 of my USB drives are full of stuff & they're all only 1 partition...
I though about dumping one, or useing PartitionMagic to change it, nah... too much work.
I've been intending on getting another 1 or 2 of them, as they're so useful.

So the 4 partition parsing is untested & probably needs work.
To test it; run it from xterm, see what errors there are, & if it works.
Could someone try this out with a USB drive that has more than 1 partition?
Last edited by sunburnt on Sun 06 Aug 2006, 05:41, edited 1 time in total.

Post Reply