# samba get root inode failed Cannot allocate memory

## doublehp

Server: Android mobile device, in which I have installed LinuxInstaller: we end up with a chrooted Debian installed via Debootstrap. In the end, we have, vertically:

- Linux kernel

- Android OS

- chroot

- Debian

- samba

Server conf:

```

root@DHP-ARMEL:~# cat /etc/samba/smb.conf  | grep -v -e "^;" -e "^#" | uniq

[global]

   workgroup = WORKGROUP

   server string = %h server

   dns proxy = no

   log file = /var/log/samba/log.%m

   max log size = 1000

   syslog = 0

   panic action = /usr/share/samba/panic-action %d

   encrypt passwords = true

   passdb backend = tdbsam

   obey pam restrictions = yes

   unix password sync = yes

   passwd program = /usr/bin/passwd %u

   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

   pam password change = yes

[tmp1]

   comment = Temporary file space

   path = /tmp

   read only = no

   public = yes

[tmp2]

   comment = Temporary file space SDC

   path = /mnt/sdcard/

   read only = no

   public = yes

root@DHP-ARMEL:~#

```

Client conf: Gentoo: /etc/fstab:

```

//server/tmp1      /mnt/s1      cifs    rw,noauto,username=user,password=pass       0 0

//server/tmp2   /mnt/s2   cifs    rw,noauto,username=user,password=pass       0 0

```

syslog on client:

```

Sep  4 14:08:10 uranus kernel: CIFS VFS: Send error in QFSAttributeInfo = -13

Sep  4 14:08:10 uranus kernel: CIFS VFS: Send error in QFSUnixInfo = -13

Sep  4 14:08:10 uranus kernel: CIFS VFS: cifs_read_super: get root inode failed

```

CLI on client:

```

uranus ~ # mount /mnt/s2

mount error(12): Cannot allocate memory

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

uranus ~ #

```

Server logs does not say anything relevant. Just auth success, no error anywhere.

Mounting /mnt/s1 works fine.

/mnt/s1 on client points (indirectly) to /tmp on server. This folder is a legacy folder in the chroot, and a normal folder in Android.

/mnt/s2 points to /mnt/sdcard on server. This is the non working stuff, and here is what this folder REALLY is: /mnt/sdcard is, by essence, a normal folder for Debian (inside the chroot). But the content of /mnt/sdcard@Debian is not managed by Debian. Coming backwards ... /mnt/sdcard@Debian is /mnt/chroot/mnt/sdcard@Android ... which, in Android, is a bind mount from /mnt/sdcard@Android. Which in Android is a mount of a block device.

Re-doing the walk from device to samba:

mount in Android:

```

/dev/block/vold/179:65 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=101

5,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=r

emount-ro)
```

then, we bind it to the proper location, in android:

```

/dev/block/vold/179:65 on /mnt/chroot/mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)

```

This mount is done using mount -o bind /src /dst

This folder becomes /mnt/sdcard in Debian, and we can list is nicely. Ls gives expected content ... same as /mnt/chroot/mnt/sdcard in android.

Export of /mnt/sdcard in Android works fine via Samba (using an Android samba server).

Export of /tmp in Debian works fine using Debian Samba (after killing Android Samba of course).

Export of /mnt/sdcard in Debian gives the upper error.

I am not surprised that Samba can not this folder as easily as /tmp : the content comes from a bind, after a block mount. I can understand Samba get's mad in front of this. The error message is completely irrelevant. Client as way enough memory to mount anything: AMD64 with 4G RAM, way enough local storage to store 375 times the Android server ... just keep in mind the fact there is an error, and forget about error message. It's just the kind or issue the software is not designed to deal with, and will prompt out any random stupid and useless message.

The questino is: how do I fix this error ? how to mount this folder ?

Android can not be avoided. Chroot can not be avoided. Debian can not be avoided. Use of Samba in Android shall be stopped; I tried it ... for a try, but it's not reliable, not flexible, and has many bugs (and Samba team does not seem sensible to the bugs I have found, and are unlikely to fix them: server shuts down in various cases where I want to keep it up). Bind-mount can not be avoided.

----------

## alex260978

Hi,

you can try to install SMBFS package. Here a brief guide : http://www.debian-administration.org/articles/165

----------

