[SOLVED] Android phone (5.0) doesn't get recognized by "jmtpfs"

Issues related to applications and software problems
dolly
Posts: 16
Joined: 2018/01/01 09:32:25

[SOLVED] Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by dolly » 2018/02/18 14:07:06

Hello,
I'm on a 32 bit CentOS 6 machine. I'm having trouble getting my Android Zenfone 2 recognized by the OS when I connect it with the USB cable. I have installed "jmtpfs" package because I read it is good at supporting Android devices (tablets or phones) but every time I connect the phone and try to access the "Internal Storage", even with root privileges, the OS says "Permission denied".
  • Why so?
  • Can anyone help me set the OS to automatically recognize the phone as soon as I connect it, please?
I've created a mount point in /media/phone and set its properties in the /etc/fstab file below. Here are the errors I get:
  • Code: Select all

    [dolly@centos media]$ pwd
    /media
    [dolly@centos media]$ sudo jmtpfs phone 
    [sudo] password for dolly: 
    Device 0 (VID=0b05 and PID=5f02) is a Asus Zenfone 2 ZE550ML (MTP).
    Android device detected, assigning default bug flags
    fuse: bad mount point `phone': Input/output error
    [dolly@centos media]$ cd phone 
    bash: cd: phone: Permission denied
    [dolly@centos media]$
  • Code: Select all

    [dolly@centos media]$ sudo fusermount phone 
    [sudo] password for dolly: 
    fusermount: old style mounting not supported
    [dolly@centos media]$ 
  • Code: Select all

    [dolly@centos media]$ ls -hltr
    ls: cannot access phone: Permission denied
    total 2.0K
    d?????????? ? ?     ?       ?            ? phone
    dr-x------. 2 dolly dolly 164 Jun 30  2015 cdrom_install
    [dolly@centos media]$ 
The /etc/fstab file:

Code: Select all

#
# /etc/fstab
# Created by anaconda on Fri Oct 27 00:03:17 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_hpdv6000-lv_root /                       ext4    defaults        1 1
UUID=8b4c9d1b-6bcb-4bfc-b48f-146a415fb8f3 /boot                   ext4    defaults        1 2
/dev/mapper/vg_hpdv6000-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sda1 	        /mnt/win ntfs-3g rw,umask=0000,defaults	0 0
jmtpfs                  /media/phone fuse nodev,allow_other,rw,allow_other,user,noauto,noatime,uid=1000,gid=1000 0 0
Any help is truly appreciated.
Last edited by dolly on 2018/02/22 13:38:51, edited 1 time in total.

scottro
Forum Moderator
Posts: 2394
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by scottro » 2018/02/18 18:09:30

I use simple-mtpfs which works quite well for me. I plug in the phone, then type sudo simple-mtpfs -l and it usually sees the phone. Sometimes, on the phone there will be a notification asking if I want to allow it, I don't remember that with Android 5, this is version 7.0 I tap OK on the phone screen, then I can just type sudo simple-mtpfs /mnt (for example) and can then access the phone's contents in the /mnt directory. As its name suggests, it's simple. :)

This is on CentOS-7.x, I don't remember how well it worked on 6.x
New users should check the FAQ and Read Me First pages

User avatar
TrevorH
Forum Moderator
Posts: 24104
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by TrevorH » 2018/02/18 20:46:49

First, you don't want to put this in fstab. What happens if you boot without the phone installed and it's in fstab? It'll drop to emergency mode and refuse to boot. Second, you need to make sure the device file in /dev/usb is owned by your user/group so you probably need a udev rules file for this. Mine for a Sony E6653 phone looks like:

Code: Select all

$ cat /etc/udev/rules.d/91-sony-phone.rules
SUBSYSTEM=="usb", ENV{ID_MODEL}=="E6653", GROUP="trevor"
Now, when you plug the phone in, its /dev file will be owned by your user and you don't need sudo any more.

Also, by the looks of the error message, I suspect your user doesn't own /media/phone - hence the bad mount point.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

dolly
Posts: 16
Joined: 2018/01/01 09:32:25

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by dolly » 2018/02/18 22:41:42

scottro wrote:I use simple-mtpfs [...]
I can just type sudo simple-mtpfs /mnt (for example) and can then access the phone's contents in the /mnt directory. [...] This is on CentOS-7.x, I don't remember how well it worked on 6.x
I'll give it a try. I don't need to write any entry into the /etc/fstab file, right?
TrevorH wrote:First, you don't want to put this in fstab. What happens if you boot without the phone installed and it's in fstab?
Well, that's why there's a "noauto" (as in "don't load it automatically at bootstrap") in the last line of the /etc/fstab file:

Code: Select all

jmtpfs      /media/phone fuse nodev,allow_other,rw,allow_other,user,noauto,noatime,uid=1000,gid=1000 0 0
TrevorH wrote:Second, you need to make sure the device file in /dev/usb is owned by your user/group so you probably need a udev rules file for this.
How do you set such a rule? This is the list of files in /etc/udev/rules.d/:

Code: Select all

 [dolly@centos /]$ ls -lh /etc/udev/rules.d/
total 56K
-rw-r--r--. 1 root root 1.7K Nov 12  2010 60-fprint-autosuspend.rules
-rw-r--r--. 1 root root 4.1K Nov 11  2010 60-openct.rules
-rw-r--r--. 1 root root 1.1K Nov 11  2010 60-pcmcia.rules
-rw-r--r--. 1 root root  316 Jan 26 08:42 60-raw.rules
-rw-r--r--. 1 root root   56 Feb 29  2012 65-crystalhd.rules
-rw-r--r--. 1 root root  998 Dec  9 00:19 70-persistent-cd.rules
-rw-r--r--. 1 root root  590 Oct 27 00:11 70-persistent-net.rules
-rwxr-xr-x. 1 root root  294 Jan  9 00:32 79-udev-epson.rules
-rw-r--r--. 1 root root  320 Nov 22  2016 90-alsa.rules
-rw-r--r--. 1 root root   83 Oct 15  2014 90-hal.rules
-rw-r--r--. 1 root root 2.5K Sep 12 23:56 97-bluetooth-serial.rules
-rw-r--r--. 1 root root  348 Nov 15 15:49 98-kexec.rules
-rw-r--r--. 1 root root   54 May 11  2016 99-fuse.rules
[dolly@centos /]$ cat /etc/udev/rules.d/99-fuse.rules 
KERNEL=="fuse", MODE="0666",OWNER="root",GROUP="root"
[dolly@centos /]$
TrevorH wrote:by the looks of the error message, I suspect your user doesn't own /media/phone - hence the bad mount point
That's another peculiar fact about this whole matter. Look at the permissions before and after the jmtpfs /media/phone command.
Before plugging in my phone

Code: Select all

[dolly@centos /]$ ls -lhtr /media/
total 4.0K
drwxr-xr-x. 2 dolly dolly 4.0K Feb  9 22:15 phone
[dolly@centos /]$ 
After connecting phone to PC and giving the command

Code: Select all

[dolly@centos media]$ ll
ls: cannot access phone: Permission denied
total 2
dr-x------. 2 dolly dolly 164 Jun 30  2015 cdrom_install
d?????????? ? ?     ?       ?            ? phone
[dolly@centos media]$ 
Last edited by dolly on 2018/02/18 22:53:45, edited 1 time in total.

User avatar
TrevorH
Forum Moderator
Posts: 24104
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by TrevorH » 2018/02/18 22:53:12

How do you set such a rule?
By creating a .rules file in that directory and setting your rule in it.

As for permissions, that looks normal. When you list it before the mount, you see the permissions of the directory itself on your root filesystem. Once you mount a filesystem on it, then it'll show what permissions are on the new filesystem. Obviously something isn't working properly for you, possibly that's permissions on the /dev/ file or maybe your device doesn't work properly with the libmtp that is shipped by CentOS.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

dolly
Posts: 16
Joined: 2018/01/01 09:32:25

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by dolly » 2018/02/18 23:28:01

Given that

Code: Select all

[dolly@centos media]$ lsusb | grep ASUS
Bus 001 Device 007: ID 0b05:5f02 ASUSTek Computer, Inc.
I created the following rule:

Code: Select all

[dolly@centos media]$ cat /etc/udev/rules.d/91-android.rules 
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="5f02", MODE=="0666", GROUP="dolly"
Is that it? I'm still getting the "bad mount point", "Input/output error" msgs:

Code: Select all

[dolly@centos media]$ sudo jmtpfs phone 
Device 0 (VID=0b05 and PID=5f02) is a Asus Zenfone 2 ZE550ML (MTP).
Android device detected, assigning default bug flags
fuse: bad mount point `phone': Input/output error
[dolly@centos media]$
Do I erase that last line from the /etc/fstab file? And maybe reboot?

User avatar
TrevorH
Forum Moderator
Posts: 24104
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by TrevorH » 2018/02/19 07:15:07

Try using somewhere other than /media to mount this. Run mkdir /mnt/phone and then try and mount it there instead.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

dolly
Posts: 16
Joined: 2018/01/01 09:32:25

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by dolly » 2018/02/19 09:42:58

A few updates:
  1. Tried [dolly@centos /]$ sudo yum search simple-mtpfs but output was:

    Code: Select all

    <output omitted>
    Warning: No matches found for: simple-mtpfs
    No Matches found
    [dolly@centos /]$

    This pkg may be not available for CentOS 6.
  2. Removed last line from the /etc/fstab file (the one about jmtpfs), ran sudo mount -a, even rebooted but that line still appears in the output of mount command.
  3. Prior to /media/phone, I had tried /mnt/android but was getting this very same problem -- "Permission denied!", "Input/output error", "?" in place of directory's user and group ownerships. This is my alternative mount point. It was working fine but after a couple of days this problem started again.
  4. Below is the output of cmd "mount" while phone is connected via usb cable.

    Code: Select all

    [dolly@centos /]$ mount 
    /dev/mapper/vg_hpdv6000-lv_root on / type ext4 (rw)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
    /dev/sda3 on /boot type ext4 (rw)
    /dev/sda1 on /mnt/win type fuseblk (rw,allow_other,default_permissions,blksize=4096)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    /dev/sr1 on /media/cdrom_install type udf (ro,nosuid,nodev,uhelper=udisks,uid=501,gid=502,iocharset=utf8,umask=0077)
    jmtpfs on /media/phone type fuse.jmtpfs (rw,nosuid,nodev)
    [dolly@centos /]$ 
    Notice the 2nd-to-last line (/dev/sr1...)? It appears whenever I connect the phone to the PC. The last line is the one that shouldn't be there.

User avatar
TrevorH
Forum Moderator
Posts: 24104
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by TrevorH » 2018/02/19 10:51:29

/media is a special directory and you probably cannot use it. Use /mnt instead.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

dolly
Posts: 16
Joined: 2018/01/01 09:32:25

Re: Android phone (5.0) doesn't get recognized by "jmtpfs"

Post by dolly » 2018/02/19 22:12:48

Same problem.

Code: Select all

[dolly@centos mnt]$ pwd
/mnt
[dolly@centos mnt]$ ll
ls: cannot access phone: Permission denied
total 32
drwxr-xr-x. 2 root root  4096 Oct 27 00:03 boot
d?????????? ? ?    ?        ?            ? phone
drwxrwxrwx. 1 root root 28672 Feb  4 19:10 win
[dolly@centos mnt]$ sudo jmtpfs phone 
[sudo] password for dolly: 
Device 0 (VID=0b05 and PID=5f02) is a Asus Zenfone 2 ZE550ML (MTP).
Android device detected, assigning default bug flags
fuse: bad mount point `phone': Input/output error
[dolly@centos mnt]$ 
This is my /etc/fstab file.

Code: Select all

#
# /etc/fstab
# Created by anaconda on Fri Oct 27 00:03:17 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_hpdv6000-lv_root /                       ext4    defaults        1 1
UUID=8b4c9d1b-6bcb-4bfc-b48f-146a415fb8f3 /boot                   ext4    defaults        1 2
/dev/mapper/vg_hpdv6000-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sda1               /mnt/win        ntfs-3g         rw,umask=0000,defaults  0 0
As you can see, no jmtpfs, right? Then why is mount like this? (Pay attention to the last two lines, please.)

Code: Select all

[dolly@centos mnt]$ mount
/dev/mapper/vg_hpdv6000-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda3 on /boot type ext4 (rw)
/dev/sda1 on /mnt/win type fuseblk (rw,allow_other,default_permissions,blksize=4096)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
jmtpfs on /mnt/phone type fuse.jmtpfs (rw,nosuid,nodev)
/dev/sr1 on /media/cdrom_install type udf (ro,nosuid,nodev,uhelper=udisks,uid=501,gid=502,iocharset=utf8,umask=0077)
[dolly@centos mnt]$
It used to work just like in Win7. I could "cd" into the phone's SD card and see "Internal storage" under which all other directories were listed. Sigh!

Post Reply