How to modify Samba extension
Topic: How to modify Samba extension
started by: Juanito
Posted by Juanito on Aug. 01 2007,11:43I'd like to start to work with the samba extension to share a printer/scanner/fax with Windows PC's.
Due to resource constraints, I'd rather use the extension in unc format - the trouble is that /etc/smb.conf is ro if I make the conversion dsl2unc.
Apart from making /etc/smb.conf a symlink to another file in /etc, is there a better way to do this?
Posted by roberts on Aug. 01 2007,13:10Why not link to the existing /opt/samba/smb.conf ?
Posted by mikshaw on Aug. 01 2007,13:27And make sure your unc does not mount to /opt/samba, or you'll be scratching your head about that one =o)
Posted by Juanito on Aug. 01 2007,13:34
Posted by ^thehatsrule^ on Aug. 01 2007,13:38If the naming of the /opt/<extension name> is the same as when loading uci's, try renaming your file.
Posted by Juanito on Aug. 01 2007,16:20OK - I see now that /opt/smb.conf, /usr/bin/smbclient and /usr/bin/smbtree exist in DSL without the samba extension being loaded.
From playing around with the commands, I can list the shares on a network hd but it looks like acting as a printer server is going to require the samba extension or perhaps a full version of samba.
Posted by mikshaw on Aug. 01 2007,16:31If renaming the unc doesn't work for some reason (i think it should, but maybe there is /opt/samba in the unc package), try renaming the samba.dsl file first and then run dsl2unc
Posted by ^thehatsrule^ on Aug. 01 2007,17:00
Posted by mikshaw on Aug. 01 2007,22:57I couldn't say. I don't know the exact directory structure of the cloop files, so I thought maybe the "myapp" directory (as in /opt/myapp) might be included in the ISO
Posted by andrewb on Aug. 02 2007,00:04If you load it as a unc at boot time this is loaded before the backup is loaded so if you put /ramdisk/etc/smb.conf in your filetool.lst files it will get loaded over whatever the unc loads up. This works OK with the default boot settings (i.e. unionfs) as etc is a union with /ramdisk/etc & so writable. I use this method, but do get some stragne things happening. If I look in /etc/samba I can't see smb.conf listed, but 'vi smb.conf' does edit the file. If I look in /ramdisk/etc/samba the file is visible using 'ls' or in emelfm. There is another version of the file in /opt/samba/etc/samba which is loaded with the unc, but isn't linked to the one in /etc/samba (i.e. if you edit the one accessible through /etc/samba or /ramdisk/etc/samba it has no effect on the one in /opt/samba/etc/samba - as you would expect since it is ro). For info I've appended the output of listu on my machine with Samba.unc loaded. I'm uncertain how unionfs decides which of the files it decides to use when /etc/samba/smb.conf if accessed, but it always seems to pick up the one I want (i.e. the edited one in /ramdisk/etc) & that is the one that is stored & reloaded by the backup system when selected in filetool.lst.
& the output from mount:
/dev/root on / type ext2 (rw)
/dev/scd0 on /cdrom type iso9660 (ro)
/dev/cloop on /KNOPPIX type iso9660 (ro)
/ramdisk on /ramdisk type tmpfs (rw,size=99068k,size=94284k)
/proc/bus/usb on /proc/bus/usb type usbdevfs (rw,devmode=0666)
unionfs on /KNOPPIX/bin type unionfs (rw,dirs=/ramdisk/bin=rw:/bin=ro)
unionfs on /dev type unionfs (rw,dirs=/ramdisk/dev=rw:/dev=ro)
unionfs on /etc type unionfs (rw,dirs=/ramdisk/etc=rw:/etc=rw)
unionfs on /KNOPPIX/lib type unionfs (rw,dirs=/ramdisk/lib=rw:/lib=ro)
unionfs on /KNOPPIX/sbin type unionfs (rw,dirs=/ramdisk/sbin=rw:/sbin=ro)
unionfs on /KNOPPIX/usr type unionfs (rw,dirs=/ramdisk/usr=rw:/usr=ro)
unionfs on /ramdisk/var type unionfs (rw,dirs=/ramdisk/var=rw)
/dev/scd0 on /mnt/auto/cdrom type iso9660 (ro,nosuid,nodev)
/cdrom/unc/samba.unc on /ramdisk/opt/samba type iso9660 (ro,loop=/dev/cloop1)
Posted by andrewb on Aug. 02 2007,02:02Hmmmmmmmmmmmmmmmmm...............
There is something weird going on with the Unionfs system. Looing at the output I posted above the /ramdisk directories should be the top level ones & therfore show all the files linked in the union under that directory (I'm assuming the directory listing is in order of priority). On first booting DSL & opening emelfm (or just using 'ls' in a console) there are no files visible in e.g. /ramdisk/bin. If a file is opened in /bin using e.g. Beaver & then closed it will appear in the file list under /ramdisk/bin (files referenced by symlinks in /bin don't appear in /ramdisk/bin when they are selected).
I'm assuming that the script for unionfs sets /ramdisk/<dir> as the top priority directory. It appears that files only appear in the /ramdisk/<dir> directory listings when an operation is carried out that may require them to be writable. This is not how I thought unionfs was supposed to work. I thought all the files were visible from the top priority directory, but only physically copied to the medium holding the top priority directory if they were needed to be writable?
Posted by roberts on Aug. 02 2007,02:55
using the listu command shows the search order with the topmost level preceding down.
All files are visible from /etc. You really shouldn't being specifying lower level branches, e.g., /ramdisk/etc as only files that have been written are copied there.
Posted by Juanito on Aug. 02 2007,03:31
I compiled the full version of samba yesterday, but it looks like smbmount is no longer supported and the kernel in DSL appears not to support the replacement mount.cifs...(or maybe I didn't use the correct syntax).
Confusingly, there is so much stuff available via Google on samba that makes it more difficult to figure out than if there were nothing at all
Posted by andrewb on Aug. 02 2007,03:55RobertS,
I agree with what you say, but try this.
Load Samba.unc. Try to edit smb.conf. It doesn't appear in either /etc/samba or ramdisk/etc/samba.
Trying to edit /opt/samba/etc/samba/smb.conf produces a ro file warning & the file can't be altered (surely this is where unionfs should kick in & make a copy to /ramdisk/etc/samba?).
Using emelfm as root, copy smb.conf from /opt/samba/etc/samba to /etc/samba. The copy goes with no error, but no file appears in /etc/samba. Looking in /ramdisk/etc/samba - the file is now there & can be edited. In a terminal cd to /etc/samba & try 'ls', no files are found. Still in /etc/samba try 'vi smb.conf - the file from /ramdisk/etc/samba is opened in vi !!
Posted by Juanito on Aug. 02 2007,04:35
/etc/samba/smb.conf -> /KNOPPIX/etc/samba/smb.conf -> /opt/samba/smb.conf
I've noticed you cannot overwrite a symlink like /etc/samba/smb.conf - you have to delete it and then copy the replacement file (or it seems that way to me at least).
Posted by roberts on Aug. 02 2007,04:36The weirdness that you are seeing is like mikshaw pointed out. The original /etc/smb.conf was linked to /opt/samba/smb.conf which samba.unc mounted on /opt/samba -- ouch!
Additionally, in order for me to support both legacy and unionfs not all directories participate, i.e., /opt is by default writable and therefore not part of unionfs.
Without testing, I would suggest to rename samba.unc to something else to avoid this.
There are limitations with unionfs and mounting over directories that contain linked files appears to be one.
Unfortunately, newer versions of unionfs do not support 2.4. Not that would necessarliy solve this issue. However, that does not diminish current unionfs usefulness, especailly for lower memory systems.
Since legacy required many links to be created in /opt and unionfs, as I have implemented it, also want to mount in /opt; I will check if these /opt mountpoints exist as links or directories, and if so, not allow this situation to occur. This should then avoid this problem. I will implement in 3.4.1 as well as 4.0
[EDIT] On second thought this test should be in the declobber script and not have pay a penalty to test everytime any unc is loaded.
Posted by roberts on Aug. 02 2007,15:42Just to add more to this topic.
Boot DSL legacy, then mount anything (floppy, pendrive, etc) at /opt/samba.
The fact that you can mount over non-empty directories is what is happening here. To expect unionfs to known that everything that became hidden should be copied up is extremely debatable.
Posted by Juanito on Aug. 02 2007,17:24I decided to try and compile samba-3 to /opt/samba-3 to get around the various issues that this thread brought up - also I would like my ancient dsl desktop to act as a print server for windows machines and I am not sure the samba extension can do this.
As said earlier, probably the best thing to do would be to rename the samba.dsl extension to something else and then use dsl2unc.
In the meantime, I'll compile samba-3 to use /etc/samba-3/smb.conf in an attempt to avoid all of this...
Some early success - I managed to compile cifs.o for dsl and can mount a windows share using mount.cifs
Posted by mikshaw on Aug. 03 2007,00:23
Posted by andrewb on Aug. 03 2007,01:08RobertS:
Thanks for clearing that up. I suspected it was all just down to a limitation of the unionfs system.
If you load samba.unc at boot time & then edit smb.conf in /etc/samba using vi (the file is invisible but it edits ok - you need to be root - i.e. use 'sudo vi smb.conf'). Now add this file (etc/samba/smb.conf) to your filetool.lst so that it gets backed up. All will now work automatically on boot as Samba will be loaded first & then the restore script will put the edited smb.conf back where you want it (it still isn't visible under etc/samba, but is editable with vi - it is visible under ramdisk/etc/samba & can be edited there ok as root [run emelfm as root & edit from there]). You can run smbd & nmbd in bootlocal.sh to get the server started. I have used this for file-sharing with M$ clients & it works well.
Posted by jpeters on Dec. 29 2007,06:14
Some reference to this mess should be written to the samba.unc info file; nothing like loading the unc and finding two unwrittable smb.conf files in three places with the fourth one you can actually edit hidden (I'd still love to have an explanation as to why it doesn't show up with a find or ls command).
...talk about crazy making.,...followed by the hplip-cups disaster; suicide may preclude printing.
Posted by Juanito on Dec. 29 2007,14:28
- do you mean there's a problem with the hplip extension or a problem with hplip & cups in general?
Posted by jpeters on Dec. 30 2007,00:22
I haven't really got past samba problems. I've got two Dell latitude clones with basically all the same software on them, and identical smb.conf files. My XP computer sees one of them, no problem, but not the other. I've about exhausted every possible variable with the same result (changing it's place on the network, etc., etc.)
Also, loading samba.unc overwrites the edited /etc/samba/smb.conf files, and I haven't found a way to turn samba off and back on without rebooting. (there's no "smb restart", and it basically loads with the wrong smb.conf file.
If I get samba working, I'll try the drivers via networking. I had printing working, as I recall, only with a parallel port connection due to some problem recognizing the USB port.
Wouldn't it be nice to just plug your network printer into a router and have it immediately recognized? (just joking..
Posted by john.martzouco on Dec. 30 2007,03:22
killall -TERM smbd
killall -TERM nmbd
Posted by jpeters on Dec. 30 2007,05:37
Looks drastic! Anyway, I got a "no process terminated" error.
Timely post, however. I found the latter two commands on p. 307 of the Damn Small Linux book a few hours ago, which enabled XP to see my computer (after I entered a search IP). I'm still working on trying to get it to accept a password, however. Maybe the smbpasswd file is corrupted.
Edit: the killall command works, although still no luck getting XP to accept the password. Very weird... with the other laptop it had no problem taking a password (and didn't need the nmbd, smbd commands). I'm getting a long list of errors using the /opt/bin/samba/usr/bin/smbpasswd command before it states that the usr name has been created. I think I've wasted enough time shooting in the dark on this....
Posted by jpeters on Dec. 30 2007,08:45Okay, got it all working. The problem was that the smbpasswd file got corrupted. A new one gets created automatically if the old file is deleted or missing (e.g., smbpasswd -a name).
Thanks to John Martzouco for the kill code. I wonder why there's no 'init.d/smb restart' code with the extention.
note: I don't know how others are handling this, but I'm overwriting the /etc/samba/smb.conf file with a wrapper when loading the unc.
edit: also the /usr/bin/smbpasswd.
EDIT: Samba networked HP deskjet worked flawlessly. The gimp drivers did the trick, although I'll experiment with Juanito's extentions a bit see if there's anything specific to the HPdeskjet940C. (note: the HP stp/pcl-895 gimp drivers already work very well).
EDIT2...damn...how did I miss juanito's sambi.uci extension, with all the documentation!!!!!!
Posted by Juanito on Dec. 31 2007,10:47
- I was just about to mention that, however, it is a bunch larger than the original samba extension and the icon is strange
Posted by jpeters on Dec. 31 2007,22:36
Thanks for the tip....the only code I found for smbd was "smbd -D" to start. "smbd start" also seems to work. The code I found for stopping was "killproc smbd", but the 'killproc' command isn't recognized on my setup.