Here is the approach I took. It takes care of all but the /dev/sd? problem. I have been meaning to address this as well with some clever client side scripting, but there are some higher priority issues on the table that we have committed resources to first.
Anyhow, I hope this approach helps you, and perhaps some other guys on the list can take it the rest of the way.
Theory
---------
Rather than automount a samba-shared supermount all in one shot, because of the timings involved, our approach is to share a directory of devices on the thin client with the name "DEVICES", so on the server you would automount "//ws00001/DEVICES", rather than each device individually. That saves a lot of headaches, because you automount to an actual directory, rather than a supermount point.
Because Nautilus and other file management systems actually stat all files within a directory, if the sub-directories under your samba share are supermount points, you can get serious hanging as all of the automagic stuff tries to work its magic, so we create a sub-directory within each device subfolder called "disc". (Actually, we should probably spell it with a 'k', but who's counting...) This "disc" directory is the supermount point. This keeps everything clean and fast, and lends itself nicely to client-side scripts for adjusting things.
Because of the scsi emulation, the usb-storage module has to be re-loaded to ensure proper pointing of devices. We have a script that runs on the thin client called "symbiont_media" that reloads the usb-storage module upon USB device inactivity (basically when supermount unmounts all usb devices).
Practice
------------
Attached are 3 files that can be replaced to setup the thin client as described above:
1. inittab -> /opt/ltsp/i386/etc/inittab
2. symbiont_media -> /opt/ltsp/i386/bin/symbiont_media
3. rc.localdev -> /opt/ltsp/i386/etc/rc.localdev
On the server, you should set up automount to mount directories as such:
ws00001 -fstype=smbfs,workgroup=LTSP,fmask=666,dmask=777,guest,username=nobody ://ws00001/DEVICES
Then, you can symlink to the DEVICES directory or to its contents, if you like, so you map the workstation to the user appropriately. Alternatively, you can use pam mounting...
Our users have a "Local Devices" directory that has symlinks named such things as "Floppy", "CDROM", "USB Hard Drive A", "USB Hard Drive B", etc.
Works very well.
TO DO
----------
Enhance the "symbiont_media" script to figure out which scsi device points to which USB device and adjust links, so just have "USB Hard Drive", and it doesn't matter if it is /dev/sda or /dev/sdb.
HTH,
-Gideon
On Mon, 2004-10-04 at 09:01, Dag Sverre Seljebotn wrote:
So I tried localdev with USB drives (camera, to be exact).. and the experience was less than pleasurable. So I was wondering if anybody had any experiences to share? The problems: - Worst was that I couldn't unplug the camera and then have it worked when I plugged it back in.. I had to reload the usb-storage module (ie "modprobe -r usb-storage; modprobe usb-storage"). I did try a quick fix with ssh-ing to the client and do that, but that's less than ideal to put it mildly. I guess this one is the top priority for me. - The /dev/sd?1-scheme with ? counting upwards really irritates me. Yes, I can see the use for it, but for removable USB drives, as opposed to fixed ones, it's not good. How to fix? I'm thinking along the lines of either a) find a kernel patch, or b) somehow listen to USB kernel messages in a daemon and maintain symlinks that is set when plugging in the USB device (this event listening could ideally update a list of available devices on the server). - I have USB ports on all the clients. Like it is now, you just have to try in automount and see if it's the right port (ie, dev/sda1, or was it sdb1...) Setting up static allocation of these means the users will have a hard time finding their way, potentially trying all ports (and before that nautilus is hung). And in my case they don't even really care which client they are on. Ideally, there would be a folder /var/media or just /media which would at any point contain symlinks to the currently attached devices on the whole network (sorted in a folder per client, which could also be dynamic). Yes, it's a high goal, but thinking about it can at least set the course. - Nautilus keeps chrashing now and then, when accessing my automount -> smb -> automount -> usb setup (as documented in localdev.txt). I guess it doesn't handle the lack of response that setup has. Granted, nautilus is not a problem LTSP is concerned with, but it might give a hint that something is wrong (perhaps the chain of filesystems is just too complex to work well, with three or four timeouts sitting there working at once). So, while I appriciate the effort done in the localdev area, I would like to see if it was possible to find a solution more tailored for USB pens. Perhaps using network block devices and keep filesystem logic on the server only? I would appriciate to hear any thoughts on this matter. // Dag Sverre ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _____________________________________________________________________ Ltsp-discuss mailing list. To un-subscribe, or change prefs, goto: https://lists.sourceforge.net/lists/listinfo/ltsp-discuss For additional LTSP help, try #ltsp channel on irc.freenode.net
--
--------------------------------------------------------
Gideon Romm | Product R&D [EMAIL PROTECTED]
Symbio Technologies o:(914) 576-1205
134 North Ave, Suites E&F f:(914) 576-0944
New Rochelle, NY 10801 c:(914) 774-4691
www.symbio-technologies.com
www.thesymbiont.com
|
# # Copyright (c) 2002 by James A. McQuillan (McQuillan Systems, LLC) # # This software is licensed under the Gnu General Public License. # The full text of which can be found at http://www.LTSP.org/license.txt # id:5:initdefault: si::sysinit:/etc/rc.sysinit
1:3:respawn:/bin/startsess tty1 /bin/bash --login s1:5:respawn:/bin/startsess tty1 /etc/screen_session s2:5:respawn:/bin/startsess tty2 /etc/screen_session s3:5:respawn:/bin/startsess tty3 /etc/screen_session s4:5:off:/bin/startsess tty4 /etc/screen_session s5:5:off:/bin/startsess tty5 /etc/screen_session s6:5:off:/bin/startsess tty6 /etc/screen_session s7:5:off:/bin/startsess tty7 /etc/screen_session s8:5:off:/bin/startsess tty8 /etc/screen_session s9:5:off:/bin/startsess tty9 /etc/screen_session sa:5:off:/bin/startsess tty10 /etc/screen_session sb:5:off:/bin/startsess tty11 /etc/screen_session sc:5:off:/bin/startsess tty12 /etc/screen_session # # Start the printers # a:345:respawn:/bin/start_printer 0 b:345:respawn:/bin/start_printer 1 c:345:respawn:/bin/start_printer 2 l:345:respawn:/etc/run_ltspinfod s:0:wait:/bin/sh /etc/rc.shutdown r:6:wait:/bin/sh /etc/rc.reboot SYM:345:respawn:/bin/symbiont_media
#!/bin/sh
#
# local_cd
#
# This script will set up a local cdrom drive for supermount.
#
PATH=/bin:$PATH; export PATH
. /etc/ltsp_functions
SAMBATMP="/tmp/samba"
SAMBACNF="/tmp/smb.conf"
#
# Get the lts.conf entries
#
eval `/bin/getltscfg -a`
FOUND_ONE="N"
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15; do
DEVVAR=LOCAL_DEVICE_${i}
if [ ! -z ${!DEVVAR} ] ; then
#
# As soon as we find at least 1 local device, we need to
# setup the Samba config stuff
#
if [ "${FOUND_ONE}" = "N" ]; then
FOUND_ONE=Y
mkdir ${SAMBATMP}
cat <<-EOF >${SAMBACNF}
[global]
workgroup = ${WORKGROUP:-"LTSP"}
security = SHARE
smb passwd file = /etc/passwd
guest account = nobody
log file = /tmp/samba/%m.log
max log size = 2
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
load printers = No
dns proxy = No
lock directory = /tmp/samba
pid directory = /tmp/samba
private dir = /tmp/samba
[DEVICES]
path = /tmp/samba_share
read only = no
guest ok = Yes
locking = no
EOF
fi
DEVICE=`echo ${!DEVVAR} | sed 's/\(.*\):.*/\1/'`
SHARE=`echo ${!DEVVAR} | sed 's/.*:\(.*\)/\1/'`
BASE_DEVICE=`/usr/bin/basename ${DEVICE}`
START_SAMBA="Y"
if [ -z ${SHARE} ] ; then
SHARE=${BASE_DEVICE}
fi
echo ${DEVICE} ${SHARE} ${BASE_DEVICE}
case "${SHARE}" in
cdrom* ) modprobe ide-cd
modprobe iso9660
RW="ro"
SRW="yes"
FS="iso9660"
;;
floppy* ) modprobe floppy
modprobe vfat
RW="rw"
SRW="no"
FS="vfat"
;;
usbhdd* ) modprobe usb-storage
modprobe vfat
RW="rw"
SRW="no"
FS="vfat"
;;
usbfloppy* ) modprobe floppy
modprobe vfat
RW="rw"
SRW="no"
FS="vfat"
;;
usbcdrom* ) modprobe scsi_mod
modprobe sr_mod
modprobe iso9660
RW="ro"
SRW="yes"
FS="iso9660"
;;
* ) # assume modules are already loaded
RW="rw"
SRW="no"
FS="auto"
;;
esac
mkdir -p /tmp/samba_share/${SHARE}/disc
mount -t supermount \
-o fs=${FS},dev=${DEVICE},--,${RW} none /tmp/samba_share/${SHARE}/disc
fi
done
if [ "${START_SAMBA}" = "Y" ] ; then
smbd -D -s /tmp/smb.conf
fi
#!/bin/bash
# script to handle USB stick un/mounting
# This is one of the stupider hacks, but hey...
. /etc/ltsp_functions
#
# Get the lts.conf entries
#
eval `/bin/getltscfg -a`
while [ 1 ]
do
LAST_MOUNTED=$MOUNTED
MOUNTED=0
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15; do
DEVVAR=LOCAL_DEVICE_${i}
if [ ! -z ${!DEVVAR} ] ; then
DEVICE=`echo ${!DEVVAR} | sed 's/\(.*\):.*/\1/'`
SHARE=`echo ${!DEVVAR} | sed 's/.*:\(.*\)/\1/'`
BASE_DEVICE=`/usr/bin/basename ${DEVICE}`
if [ -z ${SHARE} ] ; then
SHARE=${BASE_DEVICE}
fi
case "${SHARE}" in
usbhdd* )
CHECK_FOR_MOUNT=1
;;
usbfloppy* )
CHECK_FOR_MOUNT=1
;;
usbcdrom* )
CHECK_FOR_MOUNT=1
;;
* ) #
CHECK_FOR_MOUNT=0
;;
esac
if [ "$CHECK_FOR_MOUNT" == "1" ]; then
grep " mounted" /proc/fs/supermount/subfs | grep ${DEVICE} >/dev/null
if [ "$?" == "0" ]; then
# Wait we're mounted!
MOUNTED=1
fi
fi
fi
done
if [ "$MOUNTED" == "0" -a "$LAST_MOUNTED" == "1" ]; then
rmmod usb-storage >/dev/null 2>&1
modprobe usb-storage >/dev/null 2>&1
fi
sleep 5
done
