LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-30-2016, 03:36 PM   #1
eco_bach
Member
 
Registered: Dec 2016
Posts: 242

Rep: Reputation: Disabled
simple-mtpfs - unable to delete files [permissions issue]


Hi,
Using simple-mtpfs to treat my Android(MTP device) as a mass storage device.

I can successfully mount my camera folder, list files, mount and unmount the camera folder.

However what I cannot do is delete any existing files.

Mounting the camera as mass storage device is done simply by calling

Code:
simple-mtpfs ~/camera
where camera is a previously created folder needed as a mount point.

I then try and delete any existing photos using

Code:
sudo rm -rf ~/camera/DCIM/Camera/*
which returns a
Quote:
:Permission denied
for each .jpg in the Camera folder.

So then I try and change ownership by issuing

Code:
sudo chmod -R 755 ~/camera/DCIM/Camera
which ALSO returns a
Quote:
Permission denied
error

What gives? How can I delete files successfully?
 
Old 12-30-2016, 04:24 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Although a fuse filesystem does "treat" your Android device like a mass storage device it is only a bridge and simple-mftpfs still uses libmtp as an interface. If gphoto2 or mtp-tools does not work then as you have posted in your other thread that it could be some protocol incompatibility. Gnome and KDE have their own mtp virtual file systems and I think you have already tried those with similar results.

It could be that libmtp does not like your Android device.

https://wiki.archlinux.org/index.php/MTP

I might write to the gphoto developers.
http://www.gphoto.org/proj/libgphoto2/support.php

Have you tried Android file transfer yet?

Last edited by michaelk; 12-30-2016 at 04:59 PM.
 
Old 12-30-2016, 05:08 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by eco_bach View Post
Hi,
Using simple-mtpfs to treat my Android(MTP device) as a mass storage device.

I can successfully mount my camera folder, list files, mount and unmount the camera folder.

However what I cannot do is delete any existing files.

Mounting the camera as mass storage device is done simply by calling

Code:
simple-mtpfs ~/camera
where camera is a previously created folder needed as a mount point.

I then try and delete any existing photos using

Code:
sudo rm -rf ~/camera/DCIM/Camera/*
which returns a for each .jpg in the Camera folder.

So then I try and change ownership by issuing

Code:
sudo chmod -R 755 ~/camera/DCIM/Camera
which ALSO returns a error

What gives? How can I delete files successfully?
does not your Linux System automount your phone whenever you plug it in?

mine does, and I am able to copy,move files onto it, and copy,move,delete files off of my phone whenever it is pluged in via my file manager.

I am just curious as to why you are having to mount it manually to work on your photos?
 
Old 12-30-2016, 06:56 PM   #4
eco_bach
Member
 
Registered: Dec 2016
Posts: 242

Original Poster
Rep: Reputation: Disabled
Hi
Yes, of course my phone and cameras automount as MTP devices whenever conncted via USB.
When you say you are 'able to copy,move files onto it, and copy,move,delete files off ', I assume you mean manually, not scripted in the terminal?

I need an automated solution via shell scripting. The problem with MTP mounted devices as I have noted elsewhere, is that the mount point is constantly changing making it near impossible to use standard cd, rm etc commands to navigate to your photos.

So I've tried both gphoto2 and mtp-tools which both use libmtp AFAIK to access MTP-PTP devices.
With these MTP solutions I am able to list, copy files, but not to delete them.

So now I am resorting to simple-mtpfs, which seems the most robust solution. However still need a way to delete files via scripting.

Isn't it possibly a simple-mtpfs configuration issue?

What would be the proper syntax to enable permission checking by kernel?

https://www.mankier.com/1/simple-mtpfs#Options

FUSE Options

Quote:
-o default_permissions enable permission checking by kernel

Last edited by eco_bach; 12-30-2016 at 07:17 PM.
 
Old 12-30-2016, 07:23 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by eco_bach View Post
Hi
Yes, of course my phone and cameras automount as MTP devices whenever conncted via USB.
When you say you are 'able to copy,move files onto it, and copy,move,delete files off ', I assume you mean manually, not scripted in the terminal?

I need an automated solution via shell scripting. The problem with MTP mounted devices as I have noted elsewhere, is that the mount point is constantly changing making it near impossible to use standard cd, rm etc commands to navigate to your photos.

So I've tried both gphoto2 and mtp-tools which both use libmtp AFAIK to access MTP-PTP devices.
With these MTP solutions I am able to list, copy files, but not to delete them.

So now I am resorting to simple-mtpfs, which seems the most robust solution. However still need a way to delete files via scripting.
post your script you are using in code block so I can see exactly what you are doing.
let me install some of this 'crap' and see what I can figure out for you.
 
1 members found this post helpful.
Old 12-30-2016, 07:34 PM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
What?
Code:
userx@voider~:>> simple-mtpfs ~/mpts
userx@voider~:>> cd mpts
userx@voider~/mpts:>> ls
'Internal storage'  'SD card'

userx@voider~/mpts:>> cd 'SD card'
userx@voider~/mpts/SD card:>> ls
Android  LOST.DIR  movies  mpon

userx@voider~/mpts/SD card:>> cd movies

userx@voider~/mpts/SD card/movies:>> ls
Goldrush.mp4  paranoid-2000-jessica-alba.mp4

userx@voider~/mpts/SD card/movies:>> rm Goldrush.mp4
userx@voider~/mpts/SD card/movies:>> ls
paranoid-2000-jessica-alba.mp4
I had no problem deleting a file using simple-mtpfs in my terminal. My first time I've ever done this.

Please post your entire script so I can take a look at it for you and anyone else that might catch something within it.

Last edited by BW-userx; 12-30-2016 at 07:45 PM.
 
1 members found this post helpful.
Old 12-30-2016, 07:39 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
It is automounting via the desktop using gvfs if I remember from your other thread. Just out of curiosity can you delete files from your file browser?

As stated above simple-mtpfs also uses libmtp which is why you can not delete files using it either. android-file-transfer is not dependent upon libmtp so it might fair better. I have not used it so do not know how well it works.

In the ArchWiki link I posted there is information on how to use gvfs-mount to detect mtp devices. Have you tried using that to find your device. May not be the best long term solution due to updates or switching desktops could change how it works.

BW-userx, what is the make/model of your camera and is it on the list of known working devices?

Last edited by michaelk; 12-30-2016 at 07:41 PM.
 
Old 12-30-2016, 07:42 PM   #8
eco_bach
Member
 
Registered: Dec 2016
Posts: 242

Original Poster
Rep: Reputation: Disabled
Thumbs up

I have 90% of a solution but will do further testing

Looking at the various FUSE options I see that there is allow_root
I also discovered that FUSE options are set when you mount the device
ie

Code:
$ simple-mtpfs ~/camera -o allow_root
However, i at first got an error with the above and first had to edit my /etc/fuse.conf and uncomment 'user_allow_other'

So then

Code:
$ simple-mtpfs ~/camera -o allow_root
$ ##chmod not necessary, we are already accessing camera as root 
$ sudo rm -rf ~/camera/DCIM/Camera/*(no permissions error yeah!)
To confirm unmounted, remounted and checked mounted Camera directory. All photos gone!

Code:
$ fusermount -u ~/camera
$ simple-mtpfs ~/camera -o allow_root
This seems to work, the last remaining hurdle is that original photos on the actual camera are NOT deleted even though they seem to be when I remount the camera.
Back to square one. I assume this must be because FUSE works with a copy of the actual camera directories.

Last edited by eco_bach; 12-30-2016 at 08:48 PM.
 
Old 12-30-2016, 07:43 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Perfect.
 
Old 12-30-2016, 08:01 PM   #10
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by michaelk View Post
BW-userx, what is the make/model of your camera and is it on the list of known working devices?
I have no idea about that known working devices,I do not have a camera, he too said he was using a phone as well as a camera. I've never mounted my phone manually ever. That was the first time ever and it would have been the same mythology but he got it working. Finally.

needing root user type as I stated prior or in another post of his on this situation. gooo root!

something for the back burner:
if you ever get a device is busy and it will not unmount using fusermount -u
Code:
sudo umount -l /path/to/unmount

Last edited by BW-userx; 12-30-2016 at 08:09 PM.
 
Old 12-30-2016, 09:37 PM   #11
eco_bach
Member
 
Registered: Dec 2016
Posts: 242

Original Poster
Rep: Reputation: Disabled
Testing against Nexxus 5.
My target device is Samsung Gear 360

Don't think either device are fully supported by any of my attempted solutions, mtps, gphoto2 or simple-mtpfs


If it helps others

Am having better luck with jmtpfs in regards to deleting files!

Still have an unmounting error to resolve
Quote:
fusermount: entry for /home/ubuntu-mate/camera1 not found in /etc/mtab
see this article
http://research.jacquette.com/jmtpfs...ces-and-linux/

When mounting with jmtpfs vs simple-mtpfs there is an extra directory present"Internal storage" which seems to reflect what actually exists on my device

$<home>/<mount point>/Internal storage/DCIM/Camera

ie

Last edited by eco_bach; 01-01-2017 at 01:31 PM.
 
  


Reply

Tags
delete, mtp, permission denied



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Unable to delete files. Having weird ownership and permissions mithun119 Linux - Server 10 12-23-2016 02:08 AM
[SOLVED] how to use mtpfs to transfer files to my android fone nitecrawler Slackware 23 10-04-2015 07:14 AM
unable to delete mtpfs mountpoint alexbib Linux - General 6 04-07-2014 10:43 AM
unable to install mtpfs but it is saying mad is missing schneidz Linux - Software 2 11-04-2008 10:59 PM
don't have permissions on files I want to delete drawde83 Ubuntu 2 07-13-2007 12:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration