Open mspatil32 opened 1 year ago
You don't have permissions to access /
of your phone.
Press Ctrl+L
and append to the address /storage/emulated/0
to access Android Internal storage. It should be the default.
Hi @f-fouad ,
Thanks for your reply.
Please tell me where should I add the address "/storage/emulated/0".
This issue came up after the "kdeconnect" app got updated yesterday in android. As a work around, I installed the older version of the app (from Jan 2023), and it is working fine.
I'm seeing the same problem after upgrading kdeconnect on my phone.
@mspatil32 When you're on the Nautlius page giving you the error, pressing Ctrl+L opens the address bar at the top. Append "/storage..." to the address.
@seanms Oh okay, understood now. Does this help? Is the entire phone's filesystem accessible by this method? Previously, the Downloads folders in the internal storage was not accessible.
Yes, this appears to work around the problem. I'm able to read and write the phone's file system.
Hi @seanms Thanks a lot. Will try it. Currently, I installed the older version of the app (Jan 2023), and it doesn't give this problem, and I can access some of the folders in the phone (not the main internal storage and the Downloads folder).
I'm seeing the same with recent versions and appending /storage/emulated/0
helps indeed.
@andyholmes would it be possible to optionally add this path via settings automatically?
No, it's the responsibility of the remote device to report the correct path. This doesn't relate to any settings in GSConnect.
I see. So the KDEConnect client is publishing the remote paths to GSConnect then and currently it is reporting sftp://192.123.123.132:61454/
instead of sftp://192.123.123.132:61454/storage/emulated/0
and hence it is an upstream issue where the KDEConnect client should publish the first valid path instead of the root path.
Do I understand this correctly @andyholmes?
Does anyone know whether there is an upstream ticket for this then?
Correct, the remote device must communicate the path. I haven't seen such a bug report yet, nope :/
Hi Will there be an update to kde connect app to solve this issue?
You will have to open an upstream bug at https://bugs.kde.org
Sure. Thanks @andyholmes .
Not sure whether it's related but I asked over here. :man_shrugging:
@andyholmes would it be possible just to add a configurable default path in the settings until the issue is fixed in upstream? :pleading_face:
No, because it's not a setting. It would be like adding a setting for payload transfer ports, when those should clearly be set internally by the device.
This setting is exposed on the device with the SSH server, because that device has access and control over the server. The remote device can't choose what the correct path is, it can only be told what it is.
Hi Here are the results of some experiments I have done :
First Configuration :
Second configuration :
Third configuration :
Log extract (slightly modified):
GSConnect: 53 (user) GJS: 16405 Session: x11 OS: Ubuntu 20.04.6 LTS
...
mai 29 18:37:46 org.gnome.Shell.Extensions.GSConnect[24701]: [/service/plugins/sftp.js:_listDirectories/iter</<:160]: SM-A528B: Access denied _listDirectories/iter</<@/home/xxxx/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sftp.js:160:38
So if KDE Connect works it is likely another issue?
@ajpy5215 Thanks for the logs!
The function appears to be a part of a refactoring in #831 which addressed #478. So in fact GSConnect generally ignores the path sent by the Android device and tries to list the directories itself.
This could be fixed by either reverting that patch, or possibly falling back to the advertised paths if the listing fails. Patches for either would be okay by me.
So /storage/emulated/0
is the main storage. How is the path to the external storage then? It seems that /storage/emulated/1
doesn't work.
I my case I get access to the external Sdcard by appending "storage/635F-151F" to "sftp://192.168.1.24:1739/". Unfortunately the value "635F-151F" is specific to my Android/sdcard combination and will be different in other setups so cannot use that value on your side. I obtained the required value while experimenting with Kubuntu/KDEConnect. I’m not aware of other methods to get that value. Note : appending " sdcard" gives the same result as appending "storage/emulated/0".
I see, thank you!
Same issue here with ubuntu 23.04. Is there a way to work around this issue? I've tried to bookmark the sftp url on the working /sdcard sub-path but obviously the address and port combination keeps changing, so it won't work for very long. Any other way to create an alias( or something) automatically or from a scripts? (I don't know gvfs very much, whether it has some cmd line tool to list mount points or not, besides the nautilus interface). My problem is that I will likely forget to add /sdcard as the good path (and the emulated thing even more).
Same issue here with ubuntu 23.04. Is there a way to work around this issue? I've tried to bookmark the sftp url on the working /sdcard sub-path but obviously the address and port combination keeps changing, so it won't work for very long.
I quote myself, I think I've found a simple work-around to share:
the mount point is available here: /run/user/1000/gsconnect/by-name/<device name>/sdcard
device name is "Mi 9T Pro" in my case, so I bookmarked that path under Nautilus as "Mi 9T Pro sdcard".
The path /run/user/1000/gsconnect/by-name/Mi 9T Pro/sdcard seems to be constant and working even when the sftp:// url switches port number.
hi @andyholmes , I have been messing with source code for a few days. I have an idea for the workaround.
When mounting storage I tried to create a bookmark with the device name which contains soft links representing internal storage and SD card. It seems like resolving network locations takes time leading me to experience a significant speed drop. I dropped this idea.
i saw some Stackoverflow code(can't find the link rn). What it did was, give the location of the nautilus uri of all instances every time it changed. i plan to use that program to monitor D-bus signal and monitor if I open some dummy folders representing the phone's internal storage and sd card. I have the high-level image of how i wil do it.
at the end, it is just a workaround. if such pr i can be accepted, i will try to integrate it into the code. Otherwise, i will write all logic in Python and run a service as I'm comfortable in it as compared to JavaScript.
I'm not sure I understand your proposed solution? Nautilus really doesn't know anything about the remote storage, that either has to be sent by kdeconnect-android or queried with GVfs.
with gvfs we can only mount the location provided by whatever is servering sftp. shortcut are out of option as i mentioned above.
i still cant really find the Stackoverflow link but i have the code
dbus-monitor "
type='signal',
interface='org.freedesktop.DBus.Properties',
path='/org/freedesktop/FileManager1',
member='PropertiesChanged'" | awk -F '"' '
$2 ~ "^/org/gnome/Nautilus/window/[[:digit:]]+$" {
window = $2
sub(".*/", "", window)
tab = 0
next
}
window && /string / {
print window"."++tab": "$2
next
}
tab {window = 0}'
this will monitor d bus signal PropertiesChanged for file manager and dive output like this i planned on creating a dummy directory like "device name" inside this "Internal Storage" and "sd card" and whenever i open these, just launch a new instance of nautilus with mapped uri.
Ah, yeah that seems out-of-scope for GSConnect. It might make sense as a Nautilus plugin though.
Probably kdeconnect-android should just serve the path to the SD Card if this is an issue though.
i was checking data shared by kde-connect and it turns out it servers paths for internal storage and sd card.
issue lies in with gvfs we can only mount the location provided by whatever is servering sftp.
kde plasma implements sompthing like kdeconnect:///device-name
with internal storage and sd card. And these just redirects to to mapped uri like /storage/emulated/0
and /stoarge/emulated/sdcardvalue
.
i dont really know anything about custom uri. but i got a workaround(lol)
@andyholmes please confirm that such PR will not be accepted
I would not accept a PR that tries to address issues in GVfs or Nautilus.
The function appears to be a part of a refactoring in #831 which addressed #478. So in fact GSConnect generally ignores the path sent by the Android device and tries to list the directories itself.
This could be fixed by either reverting that patch, or possibly falling back to the advertised paths if the listing fails. Patches for either would be okay by me.
I would accept a PR that did either of these two things.
If anyone in future is interested in a workaround check this repo. It also handles SD card. i tested in multiple live environment like manjaro, garuda Linux, Pop OS.
Facing same issue on PopOS with gnome 42.9, fixed by appending the path
https://github.com/GSConnect/gnome-shell-extension-gsconnect/issues/1203#issuecomment-1886359637
I've read the KDE Connection Android app code, and I noticed that KDE Connection sends multiple paths, but GSConnect only mounts the root directory; Here:
I would not accept a PR that tries to address issues in GVfs or Nautilus.
The function appears to be a part of a refactoring in #831 which addressed #478. So in fact GSConnect generally ignores the path sent by the Android device and tries to list the directories itself. This could be fixed by either reverting that patch, or possibly falling back to the advertised paths if the listing fails. Patches for either would be okay by me.
I would accept a PR that did either of these two things.
After investigating exactly what gsconnect-mount-manager does, I found the easiest way to fix the mount path for Nautilus without installing anything.
Steps:
Ctrl+L
and copy the path, e.g. sftp://192.168.1.238:1761/
gedit ~/.config/gtk-3.0/bookmarks
sftp://192.168.1.238:1761/storage/emulated/0 MyPhone
, save and exit.MyPhone
bookmark in Nautilus should appear, which should open the phone folder without error on click.This bookmark will only work if the phone has been mounted with GSConnect. To work independently without GSC mount, you need to make a ~/.ssh/config
file, where you should specify the ssh connection parameters (In progress...).
After investigating exactly what gsconnect-mount-manager does
u could have tagged me. gsconnect-mount-manager is a lil thing I wrote when I knew nothing about linux interfaces.
Add a line like sftp://192.168.1.238:1761/storage/emulated/0 MyPhone, save and exit.
what if IP address changes? for me when i change classroom in university. this case is handled in gsconnect-mount-manager
if there are any question regarding the working of gsconnect-mount-manager
just ask me or if you want me to explain everything i can do that too
- Add a line like
sftp://192.168.1.238:1761/storage/emulated/0 MyPhone
, save and exit.
The port is dynamic, and it's changing at each connection.
This bookmark will only work if the phone has been mounted with GSConnect. To work independently without GSC mount, you need to make a
~/.ssh/config
file, where you should specify the ssh connection parameters (In progress...).
I'm interested in knowing how to connect without GSC.
I'm interested in knowing how to connect without GSC.
how I did it before gsconnect-mount-manager
using sshfs with the termux app on Android. I had some python code running in termux and laptop to handle dynamic ip
if there are any question regarding the working of
gsconnect-mount-manager
just ask me or if you want me to explain everything i can do that too
Spent two evenings debugging and now I can say that your mount implementation completely brakes Mount
in GSConnect )) After reinstalling gsconnect and deleting service file, GSConnect gives this error:
$ systemctl status --user dbus-:1.2-org.gnome.Shell.Extensions.GSConnect@0.service
....
Apr 05 21:14:11 arch gjs[1285]: JS ERROR: Pixel 4: Gio.IOErrorEnum: Connection failed
_promisify/proto[asyncFunc]/</<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:453:45
@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/daemon.js:720:17
### Promise created here: ###
_handleMount@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sftp.js:231:24
async*handlePacket@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sftp.js:124:26
handlePacket@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js:441:25
_readLoop@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js:365:22
async*setChannel@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js:346:18
_onChannel@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/manager.js:229:20
channel@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/core.js:436:19
_onIdentity@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/backends/lan.js:390:18
async*_onIncomingIdentity@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/
Any suggestions? May be I need to restore some dconf settings?
Your mount implementation
Mounting is handled by GSConnect.
What I tried to do was handle the paths.
I will briefly explain what my implementation is doing:
/
is not accessible in Android (unless your device is rooted, I guess) and we need to access /storage/emulated/0
to access the storage.
It turns out it serves paths for internal storage and SD card. The issue lies with GVFS; we can only mount the location provided by whatever is serving SFTP.
~/.gsconnectMounts/
. In the example, it's realme 8
.
Internal shared Storage
and SD card
.
~/.gsconnectMounts
, info about that device IP and port and path is read from dconf, the correct path is built, and a new Nautilus window is opened.
- The install script edits your GSConnect file to add two extra lines of code in sftp.js, both wrapped in try and catch. THAT IS IT, nothing else is edited in your GSConnect installation.
- If something were to go wrong in my implementation, I don't see it causing any issues with the working of GSConnect.
My main focus was not to interfere with gsconnect working.
Spent two evenings debugging
systemctl --user stop gsconnect-mount-manager.service
systemctl --user disable gsconnect-mount-manager.service
reinstall the gsconnect to remove those edit two extra lines of code in sftp.js, both wrapped in try and catch.
if this does not fix your issue it's most probably not due to my implementation. I may be completely wrong, so if you can point me to a potential issue I would appreciate it.
I may be completely wrong, so if you can point me to a potential issue I would appreciate it.
Found simple solution: rm $HOME/.config/dconf/user
Now mounting work as expected but again with wrong path in Nautilus.
Reverting to making proper bookmark, we could use two ways:
dconf
to get dynamic IP and portps aux
after GSConnect mounting and adding bookmark:
mf="storage/emulated/0 MyPhone";
ps aux|awk -v r="$mf" '/ sftp/{printf("%s://%s:%s/%s\n",$31,$30,$28,r)}'| head -1 >> .config/gtk-3.0/bookmarks
Add some lines to handle the bookmark update, make a keybinding, et voila!
Next step: using ~/.ssh/config.
In my home network, the phone has a dns name <phonename>.lan
, for example pixel-4.lan
. Another situation, the phone does not have a dns name, but the router often gives the IP for the phone the same if that phone appears frequently on the wi-fi network. Get the IP or dns of the phone anyway, then:
sftp://pixel-4.lan/storage/emulated/0 Pixel
in .config/gtk-3.0/bookmarks
~/.ssh/config
:
Host pixel-4.lan
Port 1739
User kdeconnect
IdentityFile ~/.config/gsconnect/private.pem
IdentitiesOnly yes
IdentityAgent none
PubkeyAcceptedKeyTypes ssh-rsa
HostKeyAlgorithms +ssh-rsa
ForwardX11 no
ForwardAgent no
PermitLocalCommand no
ClearAllForwardings yes
Protocol 2
NoHostAuthenticationForLocalhost yes
ControlMaster auto
ControlPath=/run/user/1000/gvfsd-sftp/%C
Nautilus will open the phone folder on click. GSConnect should be loaded in the background, of course.
Won't help much but :
⋅ sftp://IP:portA/storage/emulated/0 → seems to be the first user created on Android ; ⋅ sftp://IP:portB/storage/emulated/10 → …the second user.
Because yes, there can be many users on one phone - or many « sessions » for different purposes.
Won't help much but :
⋅ sftp://IP:portA/storage/emulated/0 → seems to be the first user created on Android ; ⋅ sftp://IP:portB/storage/emulated/10 → …the second user.
i don't think anybody is using multiple user is android
Well I do that's how I know...
:-D -- Envoyé depuis Motorola g84 via le courrieleur libre K-9 Mail ( prochainement Thunderbird ).
Le 3 mai 2024 11:06:12 GMT+02:00, fjueic @.***> a écrit :
Won't help much but :
⋅ sftp://IP:portA/storage/emulated/0 → seems to be the first user created on Android ; ⋅ sftp://IP:portB/storage/emulated/10 → …the second user.
i don't think anybody is using multiple user is android
-- Reply to this email directly or view it on GitHub: https://github.com/GSConnect/gnome-shell-extension-gsconnect/issues/1610#issuecomment-2092604355 You are receiving this because you commented.
Message ID: @.***>
There is a workaround for this. When gsconnect mounts the sftp it adds a new folder in the /run/user/1000/gvfs
with host ip
and port
as a folder name.
I wrote the below bash script to automatically find the host ip
and port
from the folder name and then open Nautilus with the correct path.
#!/bin/bash
# A script to open GSconnect sftp folder with correct path
# Define the path to the GVFS folder
gvfs_path="/run/user/1000/gvfs"
# Find the folder that matches the pattern "sftp:host=*,port=*"
folder=$(find "$gvfs_path" -type d -name "sftp:host=*,port=*" | head -n 1)
if [ -z "$folder" ]; then
echo "No matching folder found."
exit 1
fi
# Extract host and port from the folder name
regex="sftp:host=([^,]*),port=([0-9]*)"
if [[ $folder =~ $regex ]]; then
host=${BASH_REMATCH[1]}
port=${BASH_REMATCH[2]}
else
echo "Failed to extract host and port from folder name."
exit 1
fi
# Construct the sftp URL
sftp_url="sftp://$host:$port/storage/emulated/0"
echo "Opening $sftp_url in Nautilus..."
# Open the sftp URL in Nautilus
nautilus "$sftp_url" &
This script works with Nautilus but can be easily modified to work with other file managers.
Describe the bug
Hi,
I think the app in phone got updated recently, and I'm getting the below error when trying to access the mounted drive in linux.
Please provide solutions.
Steps to reproduce
No response
Expected behavior
No response
GSConnect version
55
Installed from
GNOME Extensions website
GNOME Shell version
No response
Linux distribution/release
No response
Paired device(s)
No response
KDE Connect app version
No response
Plugin(s)
No response
Support log
No response
Screenshots
No response
Notes
No response