Hmmm... I take it back...
After a phone restart, I seem to be having some issues with this... it's not showing on the network anymore... and I can't even connect via \\192.168.0.2
it seems like if the device goes to sleep, the SMB disappears... even though WiFi is still running??
HardCorePawn said:Looking at the PATH in betterterm... it was showing that /system/xbin was at the end (after /system/bin)... However, it would appear that the "standard" rm lives in /system/bin... DOH!
so I juggled the PATH to put /system/xbin before /system/bin and presto! the script seems to run without errors... YAY!
Ok... so I've done some more testing (and hacking of scripts) and have achieved the following:
1. The DHCP script is now successively being executed when the WiFi is toggled ON, and it is starting up smbd
HardCorePawn said:2. The DHCP script is NOT being executed when the WiFi is toggled OFF, so the smbd process is not being stopped
HardCorePawn said:3. Occassionally, the nmbd is being killed immediately after the process is started, which is why I am sometimes unable to connect to \\ANDROID\ but can connect to \\192.168.1.2\
Not sure where to go next... I'm guessing for some reason my Samsung Galaxy S is not releasing the DHCP lease when the WiFi is shut off... so the dhcp hooks are not used and the process is not killed properly...
I/dhcpcd ( 4557): dhcpcd 4.0.1 starting
I/dhcpcd ( 4557): executing `/system/etc/dhcpcd/dhcpcd-run-hooks', reason PREINIT
I/dhcpcd ( 4557): executed run_script
I/dhcpcd ( 4557): executing `/system/etc/dhcpcd/dhcpcd-run-hooks', reason BOUND
I/dhcpcd ( 4557): executed run_script
I/dhcpcd ( 4557): executing `/system/etc/dhcpcd/dhcpcd-run-hooks', reason STOP
I/dhcpcd ( 4557): executed run_script
So it looks like the dhcpcd-run-hooks is being executed when the WiFi is toggle off. Unfortunately, looking at my /data/local/log... I can only see the output for the PREINIT and BOUND... so while dhcpcd-run-hooks is being executed, for some reason it is not executing the hook script on the STOP
...
It is like the process is being paused or something???
md5sum /system/bin/sh /system/bin/dhcprootshell /system/xbin/sh
md5sum /system/bin/sh /system/bin/dhcprootshell /system/xbin/sh
0467311b1712ed9a9a5b173bdd2a0e40 /system/bin/sh
0467311b1712ed9a9a5b173bdd2a0e40 /system/bin/dhcprootshell
831e7f23e12678e4a77e4d1258bcb2b1 /system/xbin/sh
#
I hit it on a previous ROM but havent seen it since going to VR12 - shell command hangs waiting for phone user to confirm root access - but it was a while ago so i dont remember the exact circumstances. Thought it was worth mentioning tho.HardCorePawn said:No... I never got a notification about superuser rights... should I? and if so, when?
I'm pretty sure all of the below is only relevant to Samsung Galaxy S - GT-I9000, ymmv
Ok... so after trying absolutely everything I could think of to get the DHCP auto start/stop working... I gave up...
But, I think I have it at a stage that I can live with (for now )
I reflashed the JM2 firmware... and rooted it with the "standard" update.zip for Galaxy I9000...
adb shell
su (click OK on superuser permission pop-up)
echo $PATH
/sbin:/system/sbin:/system/bin:/system/xbin (noted that /system/sbin doesn't actually exist)
mkdir /system/sbin
busybox --install -s /system/sbin
(this next bit is necessary, or when you try to su on subsequent connections it says "su:must be suid to work properly")
cd /system/sbin
rm su
ln -s /system/xbin/su su
EDIT:
(this bit is optional, but is required if you'd like your 'reboot' command to work properly!
cd /system/sbin
rm reboot
then we can install samba:
sh /sdcard/sambaAndroid.sh
everything seems to install OK... (I chose not to install the DHCP hooks and not to start samba)
Instead, I have installed Gscript Lite from the Android Market... it allows you to run shellscripts from the UI (and you can even create homescreen shortcuts)... so I created a "SMB-start":
/data/local/samba/bin/samba-rc start
and a "SMB-stop":
/data/local/samba/bin/samba-rc stop
and put shortcuts to the scripts on the homescreen... I can now start/stop samba at will with a single click
It also seems to now be consistently allowing connection via \\ANDROID\ as the nmdb process isn't being randomly killed immediately after startup anymore
I think I can live with this arrangement until this is all wrapped up in a 'proper' app/service...
One last FYI, the install script leaves the "sambaAndroidtmpfile" in /sdcard... you'll probably want to chuck a "rm" command in there somewhere to tidy that up
mount -o remount,rw /system
cp <this shell vers> /system/bin/dhcprootshell
chown 0:1014 /system/bin/dhcprootshell
chmod 4550 /system/bin/dhcprootshell
ln -s /data/local/samba/bin/dhcp-samba-script /etc/dhcpcd/dhcpcd-hooks/96-samba-startstop
Before I forget, I must say "THANKS!" to all involved for providing the SMB stuff in the first place... it is infinitely more useful that all the other "file browser"/connection utils I've found... much faster[1]... and most importantly... it's FREE!
[1] I have been getting transfers to the phone of >800KB/second (transferring some large PDFs ie. 26meg, 12meg, 16meg etc.) but I do notice it pauses right at the end for a few seconds... some sort of read buffer in action I think...
It sucks at transferring lots of small files... just like every other method I've tried... which makes transferring over all these googleMap tiles I downloaded for use with BrutGoogleMaps a bit of a nuisance... woohoo 14KB/second...
You've been busy. Nice workaround I'll include it in the next release README, and get the install script to point to it if it detects a GT-I9000 (can u tell me if 'getprop ro.build.product' reports that as that exact string, or something else?).
When you get a spare moment, I've attached a zip'd /system/bin/sh from my ROM (HTC VR12) - can you test if it works ok as a normal shell on your phone+ROM, and if so try the DHCPshell start/stop with this version:
...
And bounce the wifi service.
9436 0 1412 S /data/local/samba/bin/nmbd -D
9438 0 3192 S /data/local/samba/bin/smbd -D
9503 2000 716 S /system/bin/sh -
9504 0 716 S sh -
9505 0 1088 R ps
Always happy to help... I like to give back as much as I can... I think it helps keep my Karma in balance
I'll have a muck around... I should also note, that I think part of getting the phone to show in my network using NETBIOS name thing, was actually turning off that stupid Windows7 "homegroup" thing... and actually joining a workgroup... I noted in the debug or one of the config files that this samba service is setup for MSHOME, so I joined my PC to that oneYeah I see the same with small files. Try testing other values for SO_SNDBUF & SO_RCVBUF in /data/local/samba/lib/smb.conf. Those values in sambaAndroid-0.4a were what seemed optimal on my HTC Hero back on the samba2 build running on Android 1.5 (and will vary between chipsets/phone-models), have since re-tested and now that I'm on a 2.1 ROM with samba3 i get better large file xfer speeds using buffer sizes of 16384.
- jc
Ok... installed that shell... turned WiFi on... and it started up the service OK... I also noted that in /data/local/log, is was actually outputting the "reason" now too... so I think your samba-rc and my sh are not exactly liking each other...
The $reason variable is defined by dhcpcd to contain the cause of the DHCP state change (STOP, BOUND etc) so the scripts know what action to take when they are called...you've just used $reason... and I note in the actual dhcpcd scripts they use ${reason}
I tried turning off WiFi... but unfortunately, the samba service is still running
...
for some reason, that dhcpcd-run-hooks just refuses to kill the samba service...
One day workgroup name will be configurable. Also Samba periodically announces its self to broadcast (255.255.255.255) so it should show up eventually in your Windows network browser (firewall may be blocking the broadcast traffic).I'll have a muck around... I should also note, that I think part of getting the phone to show in my network using NETBIOS name thing, was actually turning off that stupid Windows7 "homegroup" thing... and actually joining a workgroup... I noted in the debug or one of the config files that this samba service is setup for MSHOME, so I joined my PC to that one
Appreciate your help!
When you start the wifi interface again, are the old smbd+nmbd processes replaced with new ones?.
As root (with the default shell PATH) can you run /data/local/samba/bin/killsamba and see if that kills the processes?
If we can get auto stop/start working (or at least make sure auto-start is killing the previous daemons before running new) then along with your Gscript method for manual stop+start via the phone UI, all bases are covered until the proper Android package+UI is done.
- jc
When I go to "media/Nexus" and see permissions of existing files it seems like this: user 1000 and group 1015. So I can not delete or modify files on sdcard .
I read smb.conf and found "force user=root". And I do not understand why I have not access to files. Can you help me to solve this problem?
delete readonly = yes
If you're keen you can try editing /data/data/com.funkyfresh.samba/files/samba-rc to add the chmod line to the start section after line 17:
...
7 SPIDFILE=$PRE/var/locks/smbd.pid
8 NPIDFILE=$PRE/var/locks/nmbd.pid
9
10 case "$1" in
11 start)
12 $0 stop
13 $0 cleanup
14 $0 rmlogs
15 $PRE/nmbd -D
16 $PRE/smbd -D
17 sleep 1
18 [B]chmod 644 $NPIDFILE $SPIDFILE[/B] # add this line chmod ...
19 echo ok
20 ;;
21 stop)
...