Mounting Nexus 4 via MTP in Fedora 17
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 15 of 15
  1. #1
    Join Date
    Dec 2009
    Location
    N/A
    Posts
    14

    Mounting Nexus 4 via MTP in Fedora 17

    Shiny new toy! I wrote a quick howto blog post for getting something working until a better solution comes along.

    Link to blog edited out as per sub-forum rules --- DBelton

    ======================
    ...

    First, install libmtp and simple-mtpfs. There are other projects like mtpfs (seems unmaintained) and go-mtpfs (uses some oddball compiler) so I stuck with simple-mtpfs because it’s already in the Fedora repos and seems to work.

    Code:
    $ sudo yum -y install fuse fuse-libs libmtp simple-mtpfs
    NOTE: you probably already have fuse/fuse-libs and gvfs-fuse installed. Googling around I see there’s work on a MTP interface to GVFS but it’s not ready yet.

    Next, write some quick udev rules to see your Nexus 4 — as of this writing (libmtp-1.1.5-1.fc17) they’re not in the stock /usr/lib/udev/rules.d/69-libmtp.rules file. I’m sure this will get updated, so we’ll put them in our own file and not edit the stock one. Create /etc/udev/rules.d/99-nexus4.rules with:

    Code:
    ACTION!="add", GOTO="nexus4_rules_end"
    ENV{MAJOR}!="?*", GOTO="nexus4_rules_end"
    SUBSYSTEM=="usb", GOTO="nexus4_usb_rules"
    GOTO="nexus4_rules_end"
    
    LABEL="nexus4_usb_rules"
    
    # LGE Nexus 4/10 MTP
    ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee1", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
    
    # LGE Nexus 4/10 MTP+ADB
    ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
    
    LABEL="nexus4_rules_end"
    Last, make your life a bit easier and add two aliases to mount/unmount your device. Make a directory (I used ~/Misc/Nexus4) and add something like the below to your ~/.bashrc file:

    Code:
    alias n4mount="simple-mtpfs ~/Misc/Nexus4"
    alias n4umount="fusermount -u ~/Misc/Nexus4"
    At this point you can either reboot (admit it, you needed to apply that new kernel update anyways) or reload your udev rules and log out/log in:

    Code:
    $ sudo udevadm control --reload-rules
    You’re ready to rock & roll – I seem to be having a spurious problem where the first time I run the mounting alias it “doesn’t work” but the second time I run it it works fine, so “n4mount;n4umount;n4mount” and then my device shows up. Your mileage may vary here – when you plug in your Nexus 4 there should be a new device symlink being created that something like:

    Code:
    $ ls -l /dev/libmtp*
    lrwxrwxrwx   1 root root   15 Dec  8 08:41 libmtp-2-1.1 -> bus/usb/002/007
    If you’re not seeing that after plugging in your device, something’s not right – go back and check your rules and such again. Using the above I’ve been able to copy over all my backups, MP3s, etc. to the device seemingly without any errors or causing any device harm.
    Last edited by troyengel; 26th January 2013 at 03:17 PM. Reason: add MTP+ADB

  2. #2
    Join Date
    Aug 2009
    Posts
    8,486

    Re: Mounting Nexus 4 via MTP in Fedora 17

    As per the sub-forum rules, there are no links to blogs allowed in guides posted in here.

    Since your post pretty much has all of the information contained in the blog post, I simply removed the link in your post above. Please look over your post above and make sure that it does indeed contain everything needed, though.

    This is a nice guide, and thanks for posting it here. There have been several people interested in using a nexus with their Fedora machine.

  3. #3
    Join Date
    Dec 2009
    Location
    N/A
    Posts
    14

    Re: Mounting Nexus 4 via MTP in Fedora 17

    ahh, gotcha - I visit all of a few times a year and maybe post some Howto and nobody has brought this up before, didn't know about the link rule. Yes, I on purpose replicated the content here to protect against disappearing links. I get a bunch of referrals from this forum for my "Installing Fonts" (2010) and "Disable Pulseaudio" (2009) Howtos in this forum...

  4. #4
    Join Date
    Aug 2009
    Posts
    8,486

    Re: Mounting Nexus 4 via MTP in Fedora 17

    I was looking around on your blog and it has some pretty useful information on it.

    It is just in this sub-forum (Guides & Soultions) that has the no link to blogs rule in it, and one of the main reasons is the one you stated above. If you have been copying all of the information over anyway, that's probably why it's never been noticed or anyone said anything about it.

    Anyone interested in checking out the blog, the link is in his signature

  5. #5
    Join Date
    Feb 2008
    Location
    Sydney Australia
    Age
    63
    Posts
    2,589

    Re: Mounting Nexus 4 via MTP in Fedora 17

    Thanks for this guide. I used it to access my HTC One X which since the update to Jelly bean is using MTP.

    Only extra step apart from using the correct Vendor and Product ids (0bb4 & 0dfb) was that I found the device had to be unlocked for it to mount correctly. It still shows the device as unknown but I can access the data.

  6. #6
    Join Date
    Jan 2010
    Posts
    7,364

    Re: Mounting Nexus 4 via MTP in Fedora 17

    My own experience, with the Galaxy SIII has been a bit easier. Just installed simple-mtpfs and was then able to mount it with simple-mtpfs /mnt

    Note that I was doing it for short periods, mostly to transfer a few pdfs from work (I converted them to epub and used the Nook app), and some silly sound bites for ring tones.

    I have not found the unlocked locked thing to be consistent--that is, sometimes it doesn't work when locked, other times it has.

    I didn't have to make udev rules. I've also found, on ArchLinx, that jmtpfs also works quite well.

  7. #7
    Join Date
    Dec 2009
    Location
    N/A
    Posts
    14

    Re: Mounting Nexus 4 via MTP in Fedora 17

    The Samsung Galaxy models have their vendor/product IDs listed in /lib/udev/rules.d/69-libmtp.rules with the shipping version if libmtp, which is why you're having a smoother time. I'd hazard a guess that they are the same for S2/S3 so have been around for awhile? Eventually a new version of libmtp will ship that has an updated udev ruleset for the N4, HTC One series, etc.

  8. #8
    Join Date
    Jan 2010
    Posts
    7,364

    Re: Mounting Nexus 4 via MTP in Fedora 17

    Interesting--thank you for the explanation, which I suspect will help others in the future.

  9. #9
    Join Date
    Apr 2005
    Posts
    15

    Re: Mounting Nexus 4 via MTP in Fedora 17

    I was able to mount a Nexus 10 through the usb connector. Just plug it and say
    simple-mtpfs mountpoint
    You need to install simple-mtpfs from the rpm of that name, and mountpoint
    should be an empty directory. At the end, as usual, say
    fusermount -u mountpoint.

    I got an error message, but I ignored it. This works as it should. I can then copy files into the Download directory, and access them with the Astro file manager app.

    This might be useful for other Android devices, so I am commenting here, even though this is about Nexus 4, not 10.

  10. #10
    Join Date
    Feb 2008
    Location
    Sydney Australia
    Age
    63
    Posts
    2,589

    Re: Mounting Nexus 4 via MTP in Fedora 17

    The HTC One X has been added to the latest version according to http://sourceforge.net/p/libmtp/bugs/663/ I guess others have too and we'll see it as an update a some stage.

  11. #11
    Join Date
    Nov 2008
    Location
    Finland
    Posts
    162

    Re: Mounting Nexus 4 via MTP in Fedora 17

    I have a Sony Xperia Tipo running CyanogenMod 10 (Android 4.1.2). simple-mtpfs does mount the device, but I can't get any data to move. Any and all disk operations just hang for a long while and then do nothing. I have

    kernel-3.7.2-204.fc18.x86_64
    simple-mtpfs-0.1-4.fc18.x86_64

    at the Fedora end of the cable.

  12. #12
    Join Date
    Jan 2010
    Posts
    7,364

    Re: Mounting Nexus 4 via MTP in Fedora 17

    One thing that I'm finding pretty consistently is that the phone should be unlocked at time of connection. Other than that, no real help, I'm afraid. You might try the jmptfs, but of course, it might turn out to be a complete waste of your time.

  13. #13
    Join Date
    Nov 2008
    Location
    Finland
    Posts
    162

    Re: Mounting Nexus 4 via MTP in Fedora 17

    I needed to put some MP3s on my phone and ended up trying all kinds of things. I don't have a home wireless network up, temporarily also don't have access to my Dropbox, Google Drive was taking indefinitely to sync anything, etc. etc. Eventually I zipped the files and pushed them onto the phone over Bluetooth. Took forever for 55 MB, but they got there. Then it turns out that clicking on the zip file in my file manager on Android doesn't do anything. No unzip, apparently. CyanogenMod comes with a terminal emulator installed by default. Turns out command-line unzip is there and worked on my zip archive as advertised. I was actually a bit pleased with myself.
    Last edited by Mikko; 24th January 2013 at 02:08 AM.

  14. #14
    Join Date
    Dec 2009
    Location
    N/A
    Posts
    14

    Re: Mounting Nexus 4 via MTP in Fedora 17

    Small update - I updated the original post to add MTP+ADB idProduct and list the comments as 4/10 compatible. I was browsing the libmtp source and see that on 2012-12-26 they added these into the source, so in theory the next packaged release will obsolete the need for adding custom udev rules.

    I still get janky problems trying to rsync data off sometimes - like this morning I get:

    Code:
    $ bkpn4.sh 
    sending incremental file list
    ...
    TunnyBrowser/cache/speeddial_covers/
    file has vanished: "/home/tengel/Misc/Nexus4/TunnyBrowser/cache/speeddial_covers/00cdf31b.cache"
    file has vanished: "/home/tengel/Misc/Nexus4/TunnyBrowser/cache/speeddial_covers/30d27251.cache"
    file has vanished: "/home/tengel/Misc/Nexus4/TunnyBrowser/cache/speeddial_covers/68a98b16.cache"
    file has vanished: "/home/tengel/Misc/Nexus4/TunnyBrowser/cache/speeddial_covers/8d080e2e.cache"
    file has vanished: "/home/tengel/Misc/Nexus4/TunnyBrowser/cache/speeddial_covers/a12f52c5.cache"
    ...
    rsync warning: some files vanished before they could be transferred (code 24) at main.c(1052) [sender=3.0.9]
    It's seemingly random where I get these "file has vanished" errors - sometimes on pictures, sometimes on cache files. If I remount the device a few times or reboot it they might start working. One time these errors led to *something* going wrong on the device and a picture disappeared from my DCIM/Camera folder - *poof* gone. I use FolderSync and my free 50GB box.net to try and keep backups because of these results.

    I do not yet trust mtpfs in Linux, I think it's very unstable - I seriously lament the loss of USB Mass Storage, it's a real kick in the pants to have to deal with this crappy MTP support.

  15. #15
    Join Date
    Nov 2008
    Location
    Finland
    Posts
    162

    Re: Mounting Nexus 4 via MTP in Fedora 17

    gnomad2 appears to work with my CM10 (Android 4.1.2) phone well enough. It has a graphical UI for transferring files. I can't actually tell if it mounts the phone in some way that can be accessed from the command line.

Similar Threads

  1. Automount Nexus 7 in Nautilus
    By Creak in forum Using Fedora
    Replies: 2
    Last Post: 22nd November 2012, 07:01 PM
  2. Can't mount Nexus
    By BocasThunder in forum Using Fedora
    Replies: 2
    Last Post: 28th October 2012, 03:15 PM
  3. Nexus Personal mini guide
    By nickeh in forum Guides & Solutions (Not For Questions)
    Replies: 13
    Last Post: 17th June 2011, 01:22 AM
  4. Hauppauge Nexus
    By recnelis in forum Hardware & Laptops
    Replies: 0
    Last Post: 2nd October 2004, 12:26 PM
  5. DVD-S Nexus don't work on fedora core 2
    By petitlion in forum Hardware & Laptops
    Replies: 0
    Last Post: 30th June 2004, 03:55 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •