Sunday, February 17, 2008

OLPC: Making fuse work

Since the OLPC is rather limited in terms of memory having a networked filesystem available is rather important. While NFS works, it isn't ideal, since it is not very flexible. Luckily there is an alternative: Fuse, which is a user space filesystem layer that has modules for all shorts of filesystems, such as sshfs or smb. Installing it however doesn't work out of the box, since you need an extra kernel module, so here a little docu on how to install it in a rather fast and painless fashion:

First step is to obtain git (maybe something like git-base would be enough, git is a rather large download):
  • yum -y install git
Then get yourself a copy of the olpc kernel tree:
  • git clone git://dev.laptop.org/olpc-2.6
Next we switch the checkout to the exact version on your machine, for that we look at the output of 'uname -a':

$ uname -a
Linux xo-05-29-94.localdomain 2.6.22-20080131.2.olpc.f150813900a7eec #1 PREEMPT Thu Jan 31 17:07:39 EST 2008 i586 i586 i386 GNU/Linux

At the end of the version number there is a hex code, this is what we use to checkout/reset our kernel tree:
  • git reset f150813900a7eec
Then we copy over the config that was used:
  • cp /boot/config-2.6.22-20080131.2.olpc.f150813900a7eec .config
And run:
  • make oldconfig
  • make xconfig
Via the search function search for 'fuse' and enable the module, once done, save the new config and:
  • make fs/fuse/fuse.ko
This little command ensures that you only compile the module, not the complete kernel. Once done you can run:
  • insmod fs/fuse/fuse.ko
To insert the module. The last step is to install the userspace fuse tools:
  • yum -y install fuse fuse-devel fuse-libs fuse-smb fuse-sshfs
If everything worked as expected you should now be able to use fuse and mount for example a different host via sshfs:
  • sshfs yourname@yourhost:/somedirectory /mnt
PS: You can run the whole git checkout and kernel compile on another host, it doesn't have to be the OLPC XO-1, it worked for me on Ubuntu 7.10. The 'git checkout' and 'git reset' can take a while, kernel module compile itself is very quick. You have to be root most some of this. A 'insmod' will only last till the next reboot, you have it to repeat after it or modify some files under /etc/. You have to be in the group fuse to use fuse as user, so edit /etc/groups.

4 comments:

Brad said...

I've been struggling trying to get this to work. I am running ubuntu-7.10 from a 1gb sd card on the xo (xfce). (about 100mb free) using moocapians's compressed file build

from your instructions with yum i booted from nand flash into sugar to try it in "fedora" but indexing the olpc tree failed.

Is there any other way to go about this? I don't have any experience doing kernel compiles (so you might have to speak in --verbose mode). thanks.

Sebastian E said...

hi, thanks for your guide - this is exactly what I'm looking for. I\ve a few remarks and a question. First, yes, it is sufficient to install git-core, but then you'd also need to:
# yum install make gcc

I'm a bit stuck when doing make oldconfig. It fails because of some missing header files:

bash-3.2# make oldconfig
HOSTCC scripts/basic/fixdep
scripts/basic/fixdep.c:107:23: error: sys/types.h: No such file or directory

do you have any idea what I missed out? thanks in advance.

Grumbel said...

'make oldconfig' might not even be needed, however it shouldn't fail either. I assume that you are missing some more packages, the blogpost assumes that you have all the devel stuff already installed. Try installing all these additional packages:

yum -y install \
git \
glibc-devel \
gcc \
make \
glibc-headers

I also uploaded the fuse.ko module I am currently using:

http://pingus.seul.org/~grumbel/tmp/fuse.ko

Not sure how compatible it is with other kernels, but it works for me on build 691.

Sebastian E said...

thanks very much for answering! it seems to work now. Using your kernel module on a build 656 is okay and I'm using it for now since I really didn't get it quite working. What happened to me was:

after 'yum install glibc-devel glibc-headers' I could 'make oldconfig', but not 'make xconfig' (I haven't got qt3 installed). I tried the same on a gentoo machine, where 'make menuconfig' worked, but instead I just edited the .config and enabled CONFIG_FUSE_FS=m. Then 'make fs/fuse/fuse.ko' suceeds, but '/sbin/insmod fs/fuse/fuse.ko' failes:

bash-3.2# /sbin/insmod fs/fuse/fuse.ko
insmod: error inserting '/usr/src/olpc-2.6/fs/fuse/fuse.ko': -1 Unknown symbol in module.

Am I still missing something? Would be great if I gain some insight by this.

Another thing just for other users: Mounting didn't work at first although I've added user olpc to the fuse group, I had to 'chmod 4755 /usr/bin/fusermount' before getting it working.