-
Notifications
You must be signed in to change notification settings - Fork 1.2k
How to mount network shares on Chromebook (sshfs, cifs, nfs etc)
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.
Therefor on xfce we also install pcmanfm with:
$ sudo apt-get install pcmanfm
Then one problem still exists when you want to browse to your network drives you will have to open some ports of the chromeos firewall. See http://terokarvinen.com/linux/doc/samba-quickstart.html bottom of the page.
So open a crosh shell ctrl-alt-t and type shell.
Note: You need to replace the ip address (10.0.0.1) with the one from your local lan.
Note: On a reboot the iptables are reset to default, so you will need to reapply it when rebooted.
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 / $
-
Install Network File Share for Chrome OS app from the webstore. Source can be found https://github.com/GoogleChrome/chromeos_network_file_share Note: These mounts will only show in the File app in chromeos and not in your chroot. Slow file transfer.
-
Install File System for Windows app from the webstore. Source can be found https://github.com/yoichiro/chromeos-filesystem-cifs.
Note: These mounts will only show in the File app in chromeos and not in your chroot. Slow file transfer. -
Another way to mount smb shares on your chromebook can be found https://github.com/divx118/cifs/blob/master/README.md. This method uses cifs kernel module and doesn't need to have a chroot setup.
Note: These shares will turn up in the chroot. Fast file transfer.
Note: The following is tested on a standard chroot ubuntu precise and trusty.
For autofs to get working we need a module for our kernel. This can be build following the wiki page Build chrome os kernel and kernel modules.
Note: You will need to disable module_locking for loading modules see Enable loading of kernel modules.
We should now have our kernel module autofs4.ko we can copy it anywhere in the chroot. Lets say we make a dir /opt/modules to put our external modules in. In the example we use a chroot named trusty. Adjust the path of autofs4.ko to where it is on your system.
$ sudo enter-chroot -n trusty
$ sudo mkdir -p /opt/modules
$ sudo cp autofs4.ko /opt/modules
We need to install autofs in our chroot and this example will mount sshfs drives so we also need sshfs package.
$ sudo apt-get install autofs sshfs
Configure your autofs to mount the sshfs files by following for example http://www.mccambridge.org/blog/2007/05/totally-seamless-sshfs-under-linux-using-fuse-and-autofs/ which I did.
Now load your autofs module and start the daemon. In this example we will start the daemon in foreground, if everything works you can put the commands in /etc/rc.local to do it for you everytime the chroot starts. Just leave away the extra flags and use only /usr/sbin/automount
to run it in the background.
$ sudo insmod /opt/modules/autofs4.ko
$ sudo /usr/sbin/automount -d -f -v
Your mounted drives should now be working, test them by starting another instance of the chroot. If they are not working see the output of automount
to troubleshoot.
For mounting cifs and nfs we need to build some additional modules.
Mounting cifs modules:
- cifs.ko
- md4.ko
To build enable the following config in chromeos/config/base.config
Note: If asked during make oldconfig
for additional configs, you can leave them at default by pressing enter.
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_CRYPTO_MD4=m
CONFIG_CIFS=m
Mounting nfs modules:
- sunrpc.ko
- grace.ko (may be required with newer kernels e.g 3.18)
- lockd.ko
- nfs.ko
- nfsv2.ko
- nfsv3.ko
Note: You should load the modules in the same order as they are listed above, because of dependencies.
To build enable the following config in chromeos/config/base.config
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=m
Note: For my nfs share (from a synology NAS) I needed to add the mount option nolock (-o nolock
) with nfsv3.ko loaded. nfs.ko needs always to be loaded since nfsv2.ko and nfsv3.ko depends on it.
You also will need to install nfs-common sudo apt-get install nfs-common