dnschneid / crouton

Chromium OS Universal Chroot Environment
https://goo.gl/fd3zc?si=1
BSD 3-Clause "New" or "Revised" License
8.57k stars 1.24k forks source link

Samba not working #120

Closed leomilano closed 11 years ago

leomilano commented 11 years ago

Hi

I have been trying to access local samba shares that are definitively accessible to other local Ubuntu machines. I run KDE/Kubuntu in all of them, and they show up just fine in Dolphin. In crouton, I installed everything that seemed to make sense (samba, smbclient, winbind). No charm. Any thoughts, anybody?

Cheers Leo

dnschneid commented 11 years ago

You probably have to run smbd manually via the init.d script, and you'll likely want to add that to your rc.local. See #15, #82, #115, and possibly some others.

leomilano commented 11 years ago

I had actually tried starting smbd, just by running 'service smbd start' with no luck. I now tried as suggested in #15:

santi@localhost:~$ sudo /etc/init.d/smbd start Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service smbd start initctl: Unknown job: smbd

Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the start(8) utility, e.g. start smbd

And for the record,

santi@localhost:~$ sudo service smbd status status: Unknown job: smbd

I'll keep looking around - thanks!

leomilano commented 11 years ago

Mmm ... it seems like any of the services I see in /etc/init.d will give the same error!

santi@localhost:~$ sudo service ssh status status: Unknown job: ssh santi@localhost:~$ sudo service winbind status status: Unknown job: winbind

Now, upstart is installed, I wonder what's wrong! Many thanks !

dnschneid commented 11 years ago

Yes, looks like an upstart daemon. Please read those bugs again; the service command controls Chromium OS, so you need to look at the /etc/init/smbd.conf or whatever and figure out what commands it runs to launch smbd, then run those yourself (probably in rc.local).

dnschneid commented 11 years ago

This is causing a lot of people grief. I'll probably make something along the lines of this to properly parse and start/stop upstart jobs on command.

divx118 commented 10 years ago

There is also a way to mount smb shares in chromeos see https://github.com/divx118/cifs/blob/master/README.md currently the modules in this git only work for 3.8.11 x86_64 kernel. However this should also work for arm devices or other kernels. Just built the modules with the right config and kernel. The smb shares will then be available in chromeos and in the chroot.

AdrielSanchez commented 10 years ago

sanba dosent work on crouton idk?

MeneerJansen commented 8 years ago

Wat a minute. Are y'all seriously trying to say that Samba does not work on Crouton????!!! No wonder I've been strugling for days on end.

divx118 commented 8 years ago

@MeneerJansen You can browse smb shares in a chroot see the first chapter https://github.com/dnschneid/crouton/wiki/How-to-mount-network-shares-on-Chromebook-(sshfs,-cifs,-nfs-etc)#browsing-smb-shares-in-a-chroot

DennisLfromGA commented 8 years ago

You Can Now Access Samba Shares on a Chromebook (on the Chrome OS side)

divx118 commented 8 years ago

@DennisLfromGA Yep that is correct, but it doesn't work well with my synology NAS.

DennisLfromGA commented 8 years ago

@divx118,

Thanx for the info., I don't have anything to test it with anymore (no windoze - yay!) so I haven't tried it.

-DennisL

MeneerJansen commented 8 years ago

Thank you all for the links. I'll look into it.

MeneerJansen commented 8 years ago

The ChromeOS addon for SMB shares looks nice and easy.

Is there any way to share a folder via SMB on my Chroot or from ChromeOS? So that Windows users can access my files?

MeneerJansen commented 8 years ago

From the Crouton Wiki:

Note: This should work on a standard chroot with no additional smb packages installed. Mounting smb shares in a chroot is easy. It can be done with browsing with for example filemanager "pcmanfm". On LXDE this is the default filemanager on xfce we have thunar. Thunar gave me an error: Failed to open "/ on ". Still have to do research on what the problem is. Unity/gnome/kde needs to be tested.

This cannot be true. Tried it: wouldn't know what is so special about pcmanfm and it does not connect to the Windows network.

Furthermore: on my ChromeOS the afore mentioned File System for Windows from the Chrome Store indeed allows me to connect to and browse the Samba shares on my Linux machine, but I cannot get it to connect to a Windows share. And if I could: the share would not show up in my beloved chroot anyway. I can connect to the SMB share on my Win 10 machine from my other Linux computer though.

So I tried another method from the wiki. That mounted a Samba share to ChromeOS in the 'Downloads' folder. ChromeOS cannot "see" this mount (as said on that site) but neither can my chroot. I can only browse the share from the command line in ChromeOS. And when I try to edit a text file in vi from there the shell crashes. Maybe I have to update ChromeOS, but I'm afraid that breaks other things.

Might try to use the experimental SSH support from Microsoft to try to let Window speak SSH. See: https://winscp.net/eng/docs/guide_windows_openssh_server

Has any of you succeeded to actually read and write to a Windows share in ChromeOS or chroot?

divx118 commented 8 years ago

@MeneerJansen For the first method, did you open the ports as mentioned in the wiki after of course replacing the sample router ip address with yours.

crosh> shell
chronos@localhost / $ sudo iptables -I INPUT 1 -p udp --source 10.0.0.1/255.255.255.0 --dport 1025:65535 -j ACCEPT
chronos@localhost / $ 

For the second, although I don't use windows shares I also have problems with my synology NAS connecting with the app. Indeed normal linux smb shares work for me too.

For the third, You can't use smb shares in the Downloads folder, you will have to use a folder on an external SD-card or USB-stick. In the Downloads folder they won't show up. This is also mentioned in the "Note" below the screenshot.

MeneerJansen commented 8 years ago

@divx118 Thanks for your help. About the IP tables: opening the ports via the method you posted gives no errors in ChromeOS or in my croot but saving it does:

$ sudo iptables-save > /etc/sysconfig/iptables
iptables-save > /etc/sysconfig/iptables  No such file or directory

About mounting smb shares so thy show up in ChromeOS AND the chroot (link), I did as they say in that Wiki:

If you don't want to mount on top of an external media device, but still want to be the share visible in the chroot. You can do the following by creating a mountpoint in ~/Downloads and execute the following commands in a crosh shell.

$ sudo mount --bind ~/Downloads ~/Downloads $ sudo mount --make-shared ~/Downloads

Didn't help either. Gonna try to mount to removable SD crd now... I'll be back.

P.S. Is there anybody who actually can access SMB shares on a Windows 10 machine from ChromeOS or Crouton? Please let me know.

MeneerJansen commented 8 years ago

@divx118 Only just a minute ago I noticed that you are actually the author of the Wiki I am following. Mounting my working Linux Samba share does not work anymore, while it sorta did yesterday. Could you help me out? I think I messed up w/ the command:

sudo mount --bind ~/Downloads ~/Downloads/sambamounts

I've been using Linux for quite some time now but I don't understand what that does exactly. From the man page I understand that is rebinds an old dir to a new one. But I don't know what my "olddir" is anymore.

Anyway after sudo mountcifs start I get the following error:

mount: wrong fs type, bad option, bad superblock on /192.168.0.100/administr,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
Mount failed for /192.168.0.100/administr on /home/chronos/user/Downloads/sambamounts 

(same error if I change it to mount somewhere on an SD card, i.e. /media/removable/Jansen_32GB/Chromebook/)

This is driving me completely crazy, ha ha.

divx118 commented 8 years ago

@MeneerJansen Just opening the ports in a crosh shell should be enough. You can't save them, because the chromeos rootfs is by default readonly. So you need to open them after each reboot. This method worked for me on a HP chromebook 14.
The method of making a bind mount of Downloads I never tried. I always used an external media. For the error it could be that the cifs modules are a bit outdated. Can you give me the output of uname -a So I build some new modules.

MeneerJansen commented 8 years ago

I might just be using the old kernel you used to build said module:

$ uname -a

Linux localhost 3.8.11 #1 SMP Tue Jul 7 19:37:06 PDT 2015 x86_64 Intel(R) Celeron(R) 2955U @ 1.40GHz GenuineIntel GNU/Linux

I'm using a Toshiba Cromebook 11 (CB30-102).

divx118 commented 8 years ago

@MeneerJansen Yes correct, modules are now updated. https://github.com/divx118/cifs/commit/6c61c2160289379a528c32ff22390db4eed716df Just redo the steps below in a crosh shell to get the updated modules.

$ cd /usr/local 
$ sudo wget "https://raw.github.com/divx118/cifs/master/mountcifs.tar.gz" 
$ sudo tar xvf mountcifs.tar.gz 

Modules are untested. If you have problems, take a look at dmesg and post the output when running the mountcifs script.

Edit: I will try them later tonight.

divx118 commented 8 years ago

Just tested, they work for me with no problems. I have also the 3.8.11 kernel.

MeneerJansen commented 8 years ago

@divx118 So it works on your end, that means that I'm doing soething wrong. Probably some configuration error by me. This is the error:

$ sudo mountcifs start
Module cifs loaded
Module md4 loaded
mount: wrong fs type, bad option, bad superblock on //192.168.0.100/administr,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
Mount failed for //192.168.0.100/administr on /media/removable/Michel_32GB/Chromebook/home/michel/sambamounts/ 

Dmesg, about a thousand times this::

[ 1724.461421] wlan0: cancelling probereq poll due to a received beacon
[ 1727.438500] wlan0: detected beacon loss from AP - sending probe request
[ 1727.532874] wlan0: cancelling probereq poll due to a received beacon
[ 1729.434258] wlan0: detected beacon loss from AP - sending probe request
[ 1729.478380] wlan0: cancelling probereq poll due to a received beacon
[ 1733.437510] wlan0: detected beacon loss from AP - sending probe request
[ 1733.471346] wlan0: cancelling probereq poll due to a received beacon
[ 1735.433252] wlan0: detected beacon loss from AP - sending probe request
[ 1735.519162] wlan0: cancelling probereq poll due to a received beacon
[ 1738.436753] wlan0: detected beacon loss from AP - sending probe request
[ 1738.488317] wlan0: cancelling probereq poll due to a received beacon
[ 1740.432423] wlan0: detected beacon loss from AP - sending probe request
[ 1740.536058] wlan0: cancelling probereq poll due to a received beacon
[ 1742.428127] wlan0: detected beacon loss from AP - sending probe request
[ 1742.481314] wlan0: cancelling probereq poll due to a received beacon
[ 1745.435604] wlan0: detected beacon loss from AP - sending probe request
[ 1745.450563] wlan0: cancelling probereq poll due to a received beacon
[ 1747.427266] wlan0: detected beacon loss from AP - sending probe request
[ 1747.498158] wlan0: cancelling probereq poll due to a received beacon
[ 1749.426883] wlan0: detected beacon loss from AP - sending probe request
[ 1749.443584] wlan0: cancelling probereq poll due to a received beacon
[ 1751.426629] wlan0: detected beacon loss from AP - sending probe request
[ 1751.494654] wlan0: cancelling probereq poll due to a received beacon
[ 1753.430215] wlan0: detected beacon loss from AP - sending probe request
[ 1753.444827] wlan0: cancelling probereq poll due to a received beacon
[ 1755.429882] wlan0: detected beacon loss from AP - sending probe request
[ 1755.485310] wlan0: cancelling probereq poll due to a received beacon
[ 1758.429368] wlan0: detected beacon loss from AP - sending probe request
[ 1758.453587] wlan0: cancelling probereq poll due to a received beacon
[ 1760.429076] wlan0: detected beacon loss from AP - sending probe request
[ 1760.501313] wlan0: cancelling probereq poll due to a received beacon

And:

[ 1611.208855] Chromium OS LSM: init_module locking-ignored module="/usr/local/modules/x86_64_3.8.11/cifs.ko" pid=1034 cmdline="/sbin/insmod /usr/local/modules/x86_64_3.8.11/cifs.ko"
[ 1611.228314] Chromium OS LSM: init_module locking-ignored module="/usr/local/modules/x86_64_3.8.11/md4.ko" pid=1041 cmdline="/sbin/insmod /usr/local/modules/x86_64_3.8.11/md4.ko"
[ 1611.270581] CIFS: Unknown mount option "0"

[edit] My fstab on ChromeOS /usr/local/etc/fstab:

 device name   mount point     fs-type      options                                             dump-freq pass-num
//192.168.0.100/administr     /media/removable/Michel_32GB/Chromebook/home/michel/sambamounts/          username=XXXXXX,password=YYYYYY,rw,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
#//10.0.0.13/1000GbXBMC /media/removable/UNTITLED/timara1 smbfs username=username,password=password,rw,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
divx118 commented 8 years ago

I think you messed up the etc/fstab looking at CIFS: Unknown mount option "0"

MeneerJansen commented 8 years ago

@divx118 You're right! Added "cifs" to /usr/local/etc/fstab and I can browse the Samba share on the command line shell of ChromeOS. The directory structure of said share shows up in the "Files" app of ChromeOS. I cannot readany files though. And I cannot go into a directory of my share.

In the filemanager of my chroot it takes a long time for the directory listing to show up. I can "go into" a subdirectory of my share on my chroot, but its all terribly slow. Adding a word of text in a test.txt file still hangs at this moment, but it finish successfully in about 15 minutes or so.

Anyway, it works!

Thanks very much for your help! Will try a Win 10 SMB share now. :)

MeneerJansen commented 8 years ago

Update: ha ha. Every crosh I opens hangs now. The file explorer and the text editor in my chroot has the be "xkill-ed". Gonna reboot now. @divx118 By the way, I do not have to open a port in ChromeOS every time I reboot to use your method, or do I?

divx118 commented 8 years ago

@MeneerJansen No no ports need to be opened. I think you are exceeding the depth of the directory structure. Try mounting it directly in a folder in the root of your SDcard/USBdisk. I also have problems if my path depth goes beyond 8.

MeneerJansen commented 8 years ago

@divx118 Mounted it to a dir on the root of the SD card. Still very slow...

MeneerJansen commented 8 years ago

When I try to mount the Windows 10 share I get:

mount: mount //192.168.0.110/Michel on /media/removable/Michel_32GB/sambamounts failed: Connection refused

Might be because of an SMB3 issue. Win 10 uses the SMB version 3.1.1 protocol, new versions of Samba support that (SMB is the protocol from Microsoft, Samba is the software/protocol in *NIX to access it).

Giving up for now. I can connect just fine w/ Linux shares. To connect from Crouton to Windows I think I'll just run ye' ol' insecure FTP server from Win 10.

Thanks everybody for the help! :-)