LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   mtpfs Only Mounts as Root (http://www.linuxquestions.org/questions/slackware-14/mtpfs-only-mounts-as-root-4175431754/)

s3phir0th115 10-11-2012 05:40 PM

mtpfs Only Mounts as Root
 
Hello fellow slackers.

Problem:
I'm having some issues with mtpfs in Slackware 14.0 using my Nexus 7.

For reference, I installed mtpfs by using the slackbuild available at http://slackbuilds.org/repository/14...timedia/mtpfs/

I have followed the directions and have my user in the audio group, as the package description says is required. The command executes fine, but when I try to cd to the mountpoint, I get, "sh: cd: nexus7: Not a directory". This will only go away when I umount it as root. Mounting the same directory as root will work properly.

Things I've tried so far:
Per alienBOB's suggestion, I added udev rules for it in /etc/udev/rules.d/99-fuse.rules, with a line as follows:
Quote:

KERNEL=="fuse", NAME="%k", MODE="0775",OWNER="root",GROUP="fuse"
Then after making a fuse group and adding my user to it, I rebooted. Problem persists.

oliver_ on ##slackware suggested to try "ls -l $(which fusermount)" and see what that produces, so I'll paste that too:
Quote:

-rwsr-xr-x 1 root root 28528 Jan 30 2011 /bin/fusermount
And lastly, it was suggested to run "strace mtpfs nexus7 >& savetheerrors" and see what that spit out into the savetheerrors file. That produces:

Quote:

execve("/usr/bin/mtpfs", ["mtpfs", "nexus7"], [/* 51 vars */]) = 0
brk(0) = 0xd35000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f96937eb000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=236056, ...}) = 0
mmap(NULL, 236056, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f96937b1000
close(3) = 0
open("/lib64/libfuse.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200{\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=221656, ...}) = 0
mmap(NULL, 2316984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9693394000
mprotect(0x7f96933b8000, 2097152, PROT_NONE) = 0
mmap(0x7f96935b8000, 73728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x24000) = 0x7f96935b8000
close(3) = 0
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=18996, ...}) = 0
mmap(NULL, 2109704, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9693190000
mprotect(0x7f9693193000, 2093056, PROT_NONE) = 0
mmap(0x7f9693392000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f9693392000
close(3) = 0
open("/usr/lib64/libgthread-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\5\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=4808, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f96937b0000
mmap(NULL, 2100160, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9692f8f000
mprotect(0x7f9692f90000, 2093056, PROT_NONE) = 0
mmap(0x7f969318f000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x7f969318f000
close(3) = 0
open("/lib64/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\"\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=42620, ...}) = 0
mmap(NULL, 2128984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9692d87000
mprotect(0x7f9692d8e000, 2093056, PROT_NONE) = 0
mmap(0x7f9692f8d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f9692f8d000
close(3) = 0
open("/usr/lib64/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\223\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1169792, ...}) = 0
mmap(NULL, 3267224, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9692a69000
mprotect(0x7f9692b85000, 2097152, PROT_NONE) = 0
mmap(0x7f9692d85000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11c000) = 0x7f9692d85000
close(3) = 0
open("/usr/lib64/libmad.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\33\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=126688, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f96937af000
mmap(NULL, 2221704, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f969284a000
mprotect(0x7f9692868000, 2097152, PROT_NONE) = 0
mmap(0x7f9692a68000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e000) = 0x7f9692a68000
close(3) = 0
open("/usr/lib64/libid3tag.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 l\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=102544, ...}) = 0
mmap(NULL, 2197832, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9692631000
mprotect(0x7f9692648000, 2093056, PROT_NONE) = 0
mmap(0x7f9692847000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f9692847000
close(3) = 0
open("/lib64/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200 \0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=85200, ...}) = 0
mmap(NULL, 2180400, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f969241c000
mprotect(0x7f9692430000, 2097152, PROT_NONE) = 0
mmap(0x7f9692630000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x7f9692630000
close(3) = 0
open("/usr/lib64/libmtp.so.9", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\374\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=324528, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f96937ae000
mmap(NULL, 2419832, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f96921cd000
mprotect(0x7f9692213000, 2093056, PROT_NONE) = 0
mmap(0x7f9692412000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x45000) = 0x7f9692412000
close(3) = 0
open("/usr/lib64/libusb-1.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360*\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=60752, ...}) = 0
mmap(NULL, 2156184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9691fbe000
mprotect(0x7f9691fcc000, 2097152, PROT_NONE) = 0
mmap(0x7f96921cc000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe000) = 0x7f96921cc000
close(3) = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000l\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=130859, ...}) = 0
mmap(NULL, 2208776, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9691da2000
mprotect(0x7f9691db9000, 2093056, PROT_NONE) = 0
mmap(0x7f9691fb8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f9691fb8000
mmap(0x7f9691fba000, 13320, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9691fba000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\33\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2061170, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f96937ad000
mmap(NULL, 3929272, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f96919e2000
mprotect(0x7f9691b97000, 2097152, PROT_NONE) = 0
mmap(0x7f9691d97000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b5000) = 0x7f9691d97000
mmap(0x7f9691d9d000, 17592, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9691d9d000
close(3) = 0
open("/lib64/libgcrypt.so.11", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0~\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=510936, ...}) = 0
mmap(NULL, 2607456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9691765000
mprotect(0x7f96917de000, 2097152, PROT_NONE) = 0
mmap(0x7f96919de000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x79000) = 0x7f96919de000
close(3) = 0
open("/lib64/libgpg-error.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\10\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=13880, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f96937ac000
mmap(NULL, 2109232, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9691562000
mprotect(0x7f9691565000, 2093056, PROT_NONE) = 0
mmap(0x7f9691764000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f9691764000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f96937ab000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f96937a9000
arch_prctl(ARCH_SET_FS, 0x7f96937a9740) = 0
mprotect(0x7f9691d97000, 16384, PROT_READ) = 0
mprotect(0x7f9691fb8000, 4096, PROT_READ) = 0
mprotect(0x7f9692f8d000, 4096, PROT_READ) = 0
mprotect(0x7f9693392000, 4096, PROT_READ) = 0
mprotect(0x7f96937ec000, 4096, PROT_READ) = 0
munmap(0x7f96937b1000, 236056) = 0
set_tid_address(0x7f96937a9a10) = 2626
set_robust_list(0x7f96937a9a20, 0x18) = 0
rt_sigaction(SIGRTMIN, {0x7f9691da8790, [], SA_RESTORER|SA_SIGINFO, 0x7f9691db14e0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f9691da8810, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9691db14e0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
brk(0) = 0xd35000
brk(0xd56000) = 0xd56000
umask(0) = 022
getcwd("/home/s3phir0th115/Desktop", 4096) = 27
lstat("/home/s3phir0th115/Desktop/nexus7", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/dev/null", O_RDWR) = 3
close(3) = 0
stat("/home/s3phir0th115/Desktop/nexus7", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/home/s3phir0th115/Desktop/nexus7", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
getdents(3, /* 2 entries */, 32768) = 48
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
open("/dev/fuse", O_RDWR) = 3
getgid() = 1000
getuid() = 1000
mount("mtpfs", "/home/s3phir0th115/Desktop/nexus7", "fuse.mtpfs", MS_NOSUID|MS_NODEV, "fd=3,rootmode=40000,user_id=1000"...) = -1 EPERM (Operation not permitted)
close(3) = 0
socketpair(PF_FILE, SOCK_STREAM, 0, [3, 4]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f96937a9a10) = 2627
close(3) = 0
recvmsg(4, {msg_name(0)=NULL, msg_iov(1)=[{"\0", 1}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {3}}, msg_flags=0}, 0) = 1
close(4) = 0
wait4(2627, NULL, 0, NULL) = 2627
--- SIGCHLD (Child exited) @ 0 (0) ---
getuid() = 1000
brk(0xd8d000) = 0xd8d000
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f96937a9a10) = 2631
exit_group(0) = ?
So it's looking like a permissions problem, but I have no idea where to start with that, any help would be appreciated.

piratesmack 10-11-2012 06:09 PM

Try this:

Create the file /etc/udev/rules.d/51-android.rules with:
Code:

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
And reboot

If you have problems with MTP, I recommend the program QtAdb.
It uses ADB to push/pull files which I found to be far more reliable than MTP on my Nexus 7.

It does require your Nexus 7 to be rooted with busybox installed though (there is a busybox installer in the Google Play store)

s3phir0th115 10-11-2012 07:02 PM

Thanks piratesmack. That got it mounting properly and it's able to read/write. Problem is now that it won't umount without root rights. This isn't much of a problem normally, but it'll leave a ghost of the files if you just unplug it.

Kudos on the adb solution, I didn't know such a thing existed, but it's a tempting option as my Nexus 7 is indeed rooted and has Cyanogenmod. (The reason I installed mtpfs in the first place was to copy the M2 release rom that came out today over.)

Edit:
Whoops, my fault on that. umount works, but the appropriate option in this case (since I'm not root) would be fusermount -u, which works in my case.

This would solve my problem. Thanks again.

s3phir0th115 10-12-2012 05:10 PM

Hmm, though, another question comes to mind on this subject.

The change suggested here seems to be device specific. I'm curious if there is something that'd work for all mtp devices? It's not critical, but it'd be good to know. Of course, it might just be problematic on android devices, but that doesn't seem likely.

piratesmack 10-12-2012 06:59 PM

I'm not sure if there's something that will work for all mtp devices

You can add additional lines to the 51-android.rules file for other Android devices, this page has the USB vendor IDs:
http://developer.android.com/tools/device.html

18d1 is used for all Nexus devices I believe.


All times are GMT -5. The time now is 05:37 AM.