Can not change permissions of files/directories in a chrooted filesystem

filespermissionssquashfs

I am using Ubuntu 12.04 LTS 64 bits to chroot into a just extracted to my harddrive (with unsquashfs) Squash File System from a Kali Linux v1.0.5 32 bits pendrive for customizations:

luis@Fujur:$ sudo chroot /media/Datos/Temporal/squashfs/modificando
root@Fujur:/# ls
0    boot  etc   initrd.img  media  opt   root  sbin     srv  tmp  var
bin  dev   home  lib         mnt    proc  run   selinux  sys  usr  vmlinuz

I have been able to modify files (/etc/rc.local, add users with adduser and some other minor changes to the extracted filesystem), but the created new users have this problem:

root@Fujur:/# ls /home -la
total 8
drwxrwx--- 1 root plugdev    0 mar 24 22:45 .
drwxrwx--- 1 root plugdev 4096 sep  5  2013 ..
drwxrwx--- 1 root plugdev 4096 mar 24 00:29 luis
drwxrwx--- 1 root plugdev    0 mar 24 22:45 potato

as you can see, the owner is "root", and the group is "plugdev", when both should be the same name of the user account (luis/potato in this example).
Knowing why this happen should be fine, but I think I could solve it if I could change file/directory permissions, but I can not neither:

root@Fujur:/tmp# cd /home/
root@Fujur:/home# ls -la
total 8
drwxrwx--- 1 root plugdev    0 mar 24 22:45 .
drwxrwx--- 1 root plugdev 4096 sep  5  2013 ..
drwxrwx--- 1 root plugdev 4096 mar 24 00:29 luis
drwxrwx--- 1 root plugdev    0 mar 24 22:45 potato
root@Fujur:/home# chown potato potato
root@Fujur:/home# ls -la
total 8
drwxrwx--- 1 root plugdev    0 mar 24 22:45 .
drwxrwx--- 1 root plugdev 4096 sep  5  2013 ..
drwxrwx--- 1 root plugdev 4096 mar 24 00:29 luis
drwxrwx--- 1 root plugdev    0 mar 24 22:45 potato

and even on /temp there is no chance:

root@Fujur:/# cd /tmp
root@Fujur:/tmp# ls -la
total 4
drwxrwx--- 1 root plugdev    0 mar 24 22:52 .
drwxrwx--- 1 root plugdev 4096 sep  5  2013 ..
root@Fujur:/tmp# mkdir test
root@Fujur:/tmp# ls -la
total 4
drwxrwx--- 1 root plugdev    0 mar 24 22:57 .
drwxrwx--- 1 root plugdev 4096 sep  5  2013 ..
drwxrwx--- 1 root plugdev    0 mar 24 22:57 test
root@Fujur:/tmp# chmod a+x test
root@Fujur:/tmp# ls -la
total 4
drwxrwx--- 1 root plugdev    0 mar 24 22:57 .
drwxrwx--- 1 root plugdev 4096 sep  5  2013 ..
drwxrwx--- 1 root plugdev    0 mar 24 22:57 test
root@Fujur:/tmp# chmod a-x test
root@Fujur:/tmp# ls -la
total 4
drwxrwx--- 1 root plugdev    0 mar 24 22:57 .
drwxrwx--- 1 root plugdev 4096 sep  5  2013 ..
drwxrwx--- 1 root plugdev    0 mar 24 22:57 test

It is such a strange thing: I can make directories and files, even editing files, but not changing permissions.
Maybe I have not chrooted correctly? When I *chroot` into a partition to restore GRUB I do:

$ sudo mount --bind /dev /mnt/dev

prior to chroot, but I think this is not the case.
I believe I could be misusing the chroot command. Any ideas, please?

ADDED: this is the result of mount.
Outside (before) chroot:

root@Fujur:/# mount
/dev/sda6 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sda7 on /media/Datos type fuseblk (rw)
gvfs-fuse-daemon on /var/lib/lightdm/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=lightdm)

Inside (after) chroot:

root@Fujur:/# mount
warning: failed to read mtab

EDIT: Just tested and I have the same problem outside chroot, this is: without chrooting. I can not change file/directories permissions. Still there are no errors, but the changes are not made.

Best Answer

The line

/dev/sda7 on /media/Datos type fuseblk (rw)

from mount's output tells you that /media/Datos is an NTFS partition (type fuseblk).

NTFS cannot store ownership and permissions in the same way Linux/Unix filesystems like ext{2..4} can. That's why you can set ownership/permissions but they do not persist.

You'll need to switch to a "proper" filesystem (e.g. ext4) for that.

Related Question