PINE64
MTP Services Mobian - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+---- Forum: Debian on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=139)
+---- Thread: MTP Services Mobian (/showthread.php?tid=12633)

Pages: 1 2


MTP Services Mobian - exhoplex - 12-27-2020

I broke MTP, does anyone know what service I need to fix on the phone or check?

Thanks in advance, I will continue to google, as I am not an expert on MTP server services for Debian.

I found lots on how to connect a phone to debian but not much on how to actually serve up MTP.

Regards,

I found this , I think I am getting close

umtp-responder

getting warmer

viveris/uMTP-Responder: Lightweight USB Media Transfer Protocol (MTP) responder daemon for GNU/Linux (github.com)


RE: MTP Services Mobian - exhoplex - 12-27-2020

Interesting umtprd is running and configured but something as amiss, still looking

hmm must be in kernal space configuration not user space? ConfigFS... I will roll back to old version see how I broke it


RE: MTP Services Mobian - scholbert - 01-06-2021

Hi exhoplex,

maybe a little hint could be useful here...
Instead of fiddling around with system setup, you may try to start from 1215 Mobian Image and do apt update/upgrade.
Next make sure that your phone is not connected to any network (simply set airplane mode in the settings).

You then may connect to your host PC (i used WIN10 Notebook) and MTP should work all fine!

Regards,
scholbert


RE: MTP Services Mobian - calinb - 01-22-2021

(12-27-2020, 10:29 PM)exhoplex Wrote: Interesting umtprd is running and configured but something as amiss, still looking

hmm must be in kernal space configuration not user space? ConfigFS... I will roll back to old version see how I broke it

You may not have been the person who broke umtp, echoplex! Perhaps you've discovered that the Mobian team de-featured it, which given the alpha security level of the system (pretty much warranting maintaining physical security of the PinePhone hardware at all times), I find to be very irritating:

https://gitlab.com/mobian1/issues/-/issues/232

I would like to figure out how to re-enable it too, but I have no experience with systemd. All of my experience was over a decade ago using SysV init and udev. It appears that Mobian starts umpt-responder.service with systemd. General reference here:

https://www.howtogeek.com/687970/how-to-run-a-linux-program-at-startup-with-systemd/

However, before  I realized umtp had been de-featured, I had removed umtp-responder with apt autoremove so I had to apt install it. Now
Code:
sudo systemctl list-unit-files --type=service
reports that umtp-responder.service STATE and VENDOR_PRESET are enabled so I don't know where it was disable and why it is not working.

Have you made any progress?


(01-06-2021, 07:37 AM)scholbert Wrote: Hi exhoplex,

maybe a little hint could be useful here...
Instead of fiddling around with system setup, you may try to start from 1215 Mobian Image and do apt update/upgrade.
Next make sure that your phone is not connected to any network (simply set airplane mode in the settings).

You then may connect to your host PC (i used WIN10 Notebook) and MTP should work all fine!

Regards,
scholbert

Airplane mode doesn't help on my current and up to date Mobian system (run from eMMC). However, MTP on the older Mobian on Megi's multiboot (SD card) still works! I'm trying to use it to determine what must be rolled back in my new Mobian system to gain MTP functionality again.

Maybe I'll ditch Mobian and start working on getting Gentoo working for me. It's been years (over a decade) since I ran Gentoo, but I loved it. Gentoo makes every user responsible for their own Linux system (and enables them to educate themselves and configure it however they choose). Of course the problem is bringing Gentoo up on the PinePhone is probably a herculean development effort (despite the Gentoo PinePhone work that's in progress). Nonetheless, it's probably easier than trying to re-spin other distros to function as desired!

This might also be a clue, though I don't see how disabling umtp-responder must also disable USB networking. From the https://gitlab.com/mobian1/issues/-/issues/232 thread:

Arnaud Ferraris @a-wai ·  1 day ago
Owner
 


Quote:This should be re-added.
Yes, that's the whole point of this issue, but with a more secure implementation (including user authorization dialog).
The security mechanisms of umtp-responder are too weak atm, and there's currently no way to disable umtp-responder whithout also disabling USB networking, which is by far more important IMHO (and doesn't have a workaround like scp vs. MTP).


RE: MTP Services Mobian - calinb - 01-23-2021

The umtp security vulnerability poses no additional security vulnerability or risk for me so I've fallen back to mobian-pinephone-phosh-20201215 until I can get mtp on my newer Mobian system working.

On my up to date and mtp disabled current Mobian system, I tried the following (and probably some others stuff I'm forgetting here):

I reinstalled umtp-responder (after executing apt autoremove Sad)

The 5.9 and 5.10 kernel configs both include CONFIG_USB_FUNCTIONFS as a module.

I loaded usb_f_fs with modprobe and I also loaded libcomposite but /dev/ffs-mtp is not being created.

"systemctl list-unit-files --type=service" reports that umtp-responder.service STATE and VENDOR_PRESET are both enabled.

No mtp yet. Perhaps I'm still missing a kernel module or some service.


RE: MTP Services Mobian - scholbert - 04-13-2021

Hi,

there'd been no news for a while how to get back MTP-Service on the PinePhone.
As i use the phone mainly as a media player, i simply need a real easy way to transfer some files (mainly with Win10 Laptops).
So i had a look at the source repos and decided to turn the wheel back.
Reference:
https://salsa.debian.org/Mobian-team/mobian-tweaks/-/commit/26c7281617c790c204c32a2bf58b22e03aacb86c

Here's how you re-activate umtp-responder (make sure you are root or use sudo while performing these steps):

- reinstall umtp-responder package:
  sudo apt-get install umtp-responder

- stop the specific services to do the changes:
  sudo systemctl stop umtp-responder.service
  sudo systemctl disable umtp-responder.service
  sudo systemctl stop mobian-usb-gadget.service
  sudo systemctl disable mobian-usb-gadget.service

- create a folder "umtp-responder.service.d" in /lib/sytemd/system:
  sudo mkdir /lib/sytemd/system/umtp-responder.service.d

- copy override.conf to /lib/sytemd/system/umtp-responder.service.d

- copy mobian.conf to /etc/umtprd

- replace mobian-usb-gadget in /usr/sbin

- replace mobian-usb-gadget.service in /lib/systemd/system

- replace umtp-responder.service in /lib/systemd/system

- enable and start the specific services:
  sudo systemctl enable mobian-usb-gadget.service
  sudo systemctl start mobian-usb-gadget.service
  sudo systemctl enable umtp-responder.service
  sudo systemctl start umtp-responder.service

Please see the tar.gz archiv for the directory structure as well... you may even extract the folder over your root...
but it is better to do it manually and try to understand the parts involved.

I made a slight change to the mobian.conf file as i use a sdcard for the media and do not need to access the home folder.
Because the sdcard is vfat there is no issue with the files permission.
As said before...
Try to understand what's involved, tweak it yourself and think about the security flaws mentioned in the mobian issue tracker.
It's your decision and i'm not responsible if the secret agent plans got stolen...
I like it a little more comfortable  Big Grin

EDIT: Just for completeness... it has been tested on up to date mobian system (emmc) while still on 5.10 linux kernel.
Make sure to keep some backup copies of the files replaced, to revert back...
Right now this should be treated as a temporary hack, because we could not simply put it back into the packages already distributed (e.g. mobian-tweaks, umtp-responder).

Cheers,
scholbert


RE: MTP Services Mobian - MtnSk8 - 04-17-2021

I think mtp responder hack was removed because there is a much better way, the standard way Wink .
With the same user experience (ie. full file manager access to PP's emmc and uSD)
(also I'm thinking of this blog post: https://blog.brixit.nl/do-you-really-want-linux-phones/ ) Big Grin 

Yoda says - do it this way you will.

1. Connect via USB-C and SSH. --ref: https://wiki.mobian-project.org/doku.php?id=howto:networking

2. Using SSH with a key instead of password. --ref: https://wiki.mobian-project.org/doku.php?id=howto:security

3. Passwordless SSH Login. --ref: https://linuxize.com/post/how-to-setup-passwordless-ssh-login

4. Create Alias for SSH Hosts. --ref: https://www.howtogeek.com/75007/stupid-geek-tricks-use-your-ssh-config-file-to-create-aliases-for-hosts

5. Add a Bookmark to your favorite file manager for " sftp://mobian  " or whatever alias you created in step 4.

Notice that ~99% of the steps above are to configure your client ie. Desktop/Laptop. All the phone needs is openssh-server (you may need to install it btw).
Additionally you can go through the above steps to set up the phone as a client too and access your Desktop/Laptop storage from the phone's file manager.
You can (and I do) basically set up both devices as both client and server on both USB-C and WiFi networks and it's very nice indeed. 

Cheers!


RE: MTP Services Mobian - calinb - 04-18-2021

(04-17-2021, 11:27 PM)MtnSk8 Wrote: I think mtp responder hack was removed because there is a much better way, the standard way Wink .
<snip>
In terms of speed, convenience, reliability and the benefit of minimal terminal typing, Yoda's ("standard way") isn't even close to MTP between the PinePhone and another computer. Sure--SSH / sftp can work, as can the less reliable samba, but they are all a pain compared to just plugging-in a USB cable and immediately using a graphical file manager (like Nemo on my PinePhone and Thunar on my MX-Linux laptop). Having to do anything on a terminal on the PinePhone is a pain--even a simple "ifconfig" or "ping"!

nmbd isn't reliable (and it's slow to detect) so connections are slow and iffy without discovering the other machine's IP address (which isn't always the same over USB, in my experience) and then manually typing in an IP instead of the unrecognized hostname,...etc. makes it even more slow. dnsmasq is a pain to setup as is samba, even at the best of times.

It's not even close. Once I get MTP running again, I'll race ya'! Ha--I would probably win even rebooting to Jumpdrive.

In any case, the beauty of Linux used to be that users get to decide what's best for themselves. It's so "Microsoft" for a dev to think they know so much better than the users that devs now often feel compelled to put up roadblocks to keep users from using their machines as they wish.


RE: MTP Services Mobian - MtnSk8 - 04-18-2021

(04-18-2021, 01:15 AM)calinb Wrote: It's so "Microsoft" for a dev to think they know so much better than the users that devs now often feel compelled to put up roadblocks to keep users from using their machines as they wish.

"A Brief History of MTP

Standardized in 2000, PTP was originally developed to transfer images from a digital still camera to a PC. PTP is limited to transferring images and is an insufficient solution for media rich portable devices like phones and portable media players. Users required a method to transfer different file formats like media files, people contacts or video, which were not supported by PTP. Microsoft therefore introduced the MTP to address the shortcomings in PTP."

https://www.2brightsparks.com/resources/articles/media-transfer-protocol.html


---------


""MTP is part of the "Windows Media" framework and thus closely related to Windows Media Player.""

https://en.wikipedia.org/wiki/Media_Transfer_Protocol


RE: MTP Services Mobian - calinb - 04-18-2021

(04-18-2021, 09:36 AM)MtnSk8 Wrote: "A Brief History of MTP

Standardized in 2000, PTP was originally developed to transfer images from a digital still camera to a PC. PTP is limited to transferring images and is an insufficient solution for media rich portable devices like phones and portable media players. Users required a method to transfer different file formats like media files, people contacts or video, which were not supported by PTP. Microsoft therefore introduced the MTP to address the shortcomings in PTP."

https://www.2brightsparks.com/resources/articles/media-transfer-protocol.html


---------


""MTP is part of the "Windows Media" framework and thus closely related to Windows Media Player.""

https://en.wikipedia.org/wiki/Media_Transfer_Protocol

Thanks for the MTP history, MtnSk8.

I'm not saying Microsoft hasn't developed useful stuff. I've simply observed that, ever since Microsoft was founded, it has imposed a lot of annoyances on its users over the years. Geez--with every new release of Windows, website howtos pop-up all over the place explaining how to defeat many of the new annoyances.


(04-18-2021, 09:36 AM)MtnSk8 Wrote: PTP is limited to transferring images and is an insufficient solution for media rich portable devices like phones and portable media players.

Yup--that's mostly how I use my PinePhone so now I know that, historically, Microsoft developed MTP precisely for devices like the PinePhone! To date, the PinePhone is mostly an excellent portable media player and also a partially capable phone.

So Microsoft developed MTP, but some Linux OS devs decided that it's an insufficient solution for the devices MS targeted and its use should be "canceled" (at least for all but the most experienced and determined users who have plenty of time to spend on re-enabling it).

I just realized that what many long-term Linux OS reviewers, like Dedoimedo, and I have been criticizing about the overall direction of Linux development for the last several years was actually a leading edge form of "cancel culture"!