Bug 337685 - SFTP: Filesystem expose doesn't work
Summary: SFTP: Filesystem expose doesn't work
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: android-application (show other bugs)
Version: 0.7.2
Platform: Android Android 4.x
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
: 347695 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-07-22 08:40 UTC by Sergey Morozov
Modified: 2017-05-06 12:34 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch to make KDE Connect ignore rmnet-related network interfaces on Android devices (2.02 KB, patch)
2017-04-27 15:33 UTC, Nicholas Killewald
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Morozov 2014-07-22 08:40:20 UTC
Instead of using wlan0 IP address of the device, rmnet0 IP address is used in the sshfs parameters. Of course, this ip address is inaccesible from the PC.
Comment 1 Rafael Gomes (Gomex) 2014-09-01 18:39:55 UTC
can you please tell us the steps to reproduce that error?
Comment 2 Sergey Morozov 2014-09-01 19:12:40 UTC
firmware: cyanogenmod 11 nightlies (may be this is important)
device: HTC One X (endeavoru)

Steps to reproduce:
1. Install kdeconnect to the android phone
2. Install kdeconnect to the linux desktop with kde
3. Pair phone with desktop
4. Try to browse a phone filesystem from PC

More info:
netinfo from abd shell:
$ netcfg
lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00
dummy0   DOWN                                   0.0.0.0/0   0x00000082 e6:6d:8c:e5:9c:8f
sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
gannet0  DOWN                                   0.0.0.0/0   0x00001082 d6:cf:7c:d7:a0:a7
rmnet0   DOWN                            100.125.53.245/0   0x00001082 7a:5c:25:9c:0d:6d
rmnet1   DOWN                                   0.0.0.0/0   0x00001002 a2:62:32:fe:02:3d
rmnet2   DOWN                                   0.0.0.0/0   0x00001002 ce:32:d8:8c:3b:58
wlan0    UP                                192.168.0.20/24  0x00001043 1c:b0:94:80:6a:03  <-- this is my wi-fi network
p2p0     UP                                     0.0.0.0/0   0x00001003 1e:b0:94:80:ea:03


output of ps aux on the desktop when i trying to browse phone fs:
$ ps aux | grep sshfs
sergey    8851  0.0  0.0  16264  1080 ?        S    23:10   0:00 sshfs kdeconnect@100.125.53.245:/storage/sdcard0 /home/sergey/.kde4/share/apps/kdeconnect/4487b0b381e064 -p 1739 -d -f -o IdentityFile=/home/sergey/.kde4/share/apps/kdeconnect/key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
Comment 3 Albert Vaca Cintora 2014-09-04 18:19:05 UTC
Can you send us the otuput of the kdeconnectd executable?
Comment 4 Sergey Morozov 2014-09-04 19:13:17 UTC
$ /usr/lib64/kde4/libexec/kdeconnectd --nofork
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QDBusObjectPath)
Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QDBusObjectPath)
fusermount: entry for /home/sergey/.kde4/share/apps/kdeconnect/4487b0b381e064 not found in /etc/mtab
fusermount: entry for /home/sergey/.kde4/share/apps/kdeconnect/4487b0b381e064 not found in /etc/mtab
Comment 5 Christoph Feck 2014-09-13 23:33:50 UTC
Does comment #4 provide the requested information? Please set the bug status.
Comment 6 Albert Vaca Cintora 2014-10-20 22:17:48 UTC
This might happen with a corrupt config file (moving your home folder, changing distros, or using a config version created by old versions of kdeconnect may have caused this). Can you try removing your .kde4/share/config/kdeconnectrc file?
Comment 7 Sergey Morozov 2014-10-22 17:34:36 UTC
I removed the configuration file, but the problem remained.
Comment 8 Aleix Pol 2015-11-12 01:34:46 UTC
*** Bug 347695 has been marked as a duplicate of this bug. ***
Comment 9 Grishin 2016-01-13 12:44:29 UTC
Сергей, пишу по-русски, потому что с английским у меня непорядок. 
Была аналогичная проблема: kdeconnect почему-то прекратил показывать файловую систему. 
Телефон Galaxy note 3 SM-n900, 
linux mint 17.3 KDE
KDEconnect был установлен из Playstore
После некоторых матюканий я сделал следующее:
- удаление KDEconnect и shfs из ЭВМ с помощью Synaptic; 
- удаление всех папок и файлов настройки Kdeconnect из домашнего каталога; 
- удаление KDEconnect из Android; 
- установка KDEconnect из F-Droid (не знаю, почему именно оттуда, но мне показалось, что так будет лучше); 
- перезагрузка ЭВМ и Galaxy note 3; 
- соединение KDEconnect между устройствами.
После этого я попытался открыть файловую систему Андроид, как обычно. Получилось. 
Причина ошибки мне осталась неясна. 
Если тебе нетрудно - переведи вышеизложенное нашим иностранным друзьям. Может, это будет полезно. 
Всех благ.
Comment 10 Grishin 2016-01-13 12:56:45 UTC
Ещё одно замечание. 
При попытке открыть файловую систему Андроид с помощью Krusader, последний высвечивает ошибку: 
"Папка /var/tmp/myprofilename/krun/3080_0_ не существует". 
Я посмотрел через файловый менеджер и нашёл файл 3080_0_ по указанному адресу. Почему-то программа его не видит. 
Таким образом, посмотреть файловую систему с помощью Krusader удаётся лишь посредством следующих действий: 
- запустить в Krusader менеджер монтирования; 
- выбрать по имени kdeconnect; 
После этого в окне Krusader появляется файловая система Андроид. 
В Dolphin такой проблемы нет - сразу высвечивает папки All files и Camera что-то там.
Comment 11 Sergey Morozov 2016-01-14 18:33:26 UTC
I will try to translate a previous two messages.

First message:

There was a similar problem: kdeconnect somehow stopped showing filesystem.
Phone: Galaxy note 3 SM-n900
linux mint 17.3 KDE
KDEconnect has been installed from Playstore
After some filthy words, I did the following:
- remove KDEconnect and shfs on PC via Synaptic; 
- remove all files and folders with KDEconnect settings from home directory;
- remove KDEconnect on Android;
- install KDEconnect from F-Droid (I do not know why it is there, but it seemed to me that it would be better)
- reboot PC and Galaxy note 3; 
Then I tried to open the Android file system, as usual. And it happened.
Reason of the error remained isn't clear to me.
Comment 12 Sergey Morozov 2016-01-14 18:49:40 UTC
Second message:

When I try to open the Android file system using Krusader, it displays an error:
"Folder /var/tmp/myprofilename/krun/3080_0_ does not exist".
I look via file manager and found a file 3080_0_ at this path. For some reason the program does not see it.
Thus, to see the file system using Krusader succeed only through the following actions:
- start mount manager in Krusader;
- select kdeconnect by name;
After that Android file system appers in the Krusader window.
Dolphin doesn't have this problem - he just displays folders All files and Camera.

I apologize for a poor translation, I badly know English.
Comment 13 Sergey Morozov 2016-01-14 18:54:26 UTC
From myself I want to add that after bought new phone, the problem left.
Comment 14 Grishin 2016-01-14 19:40:49 UTC
(In reply to Sergey Morozov from comment #13)
> From myself I want to add that after bought new phone, the problem left.

Радикальное решение.. ) 
Спасибо за перевод, Сергей. 
Наверное, англоговорящим гражданам, а также тем, кто, подобно мне, не будучи программистом (а будучи простым государственным юристом), читает техническую документацию по Линукс на английском языке, всё написано очень доступно.
Comment 15 Stanislav N 2016-03-13 21:21:45 UTC
The same problem.
/usr/libexec/gdm-x-session[2331]: fusermount: entry for /home/wizard/.config/kdeconnect/5290a060de937612/kdeconnect_sftp/5290a060de937612 not found in /etc/mtab
Comment 16 uwe.helms 2016-05-01 11:29:41 UTC
The same problem, when open Nexus 5 (Android 6.01, not rooted) in Dolphin, there are Folders for all Files and Photos, unfortunately, unable to open. An error occured:  
"Die Datei oder der Ordner /home/user/.config/kdeconnect/4b61c525375d1811/kdeconnect_sftp/4b61c525375d1811/storage/emulated/0/DCIM/Camera existiert nicht." 
That says "The file or folder ... did not exist". 
Open the path ~/.config/kdeconnect/  the mentiond folders are there.
Comment 17 Colin 2017-01-14 05:44:27 UTC
I don't know if this is the same error or not. KDE Connect used to work for me to browse files on my Android 6.0 security patch 10/5/16 "R1 HD Blu" (bought from Amazon). Now, it doesn't respond when I click to browse from the systray, and gives the following error when I try to browse from Dolphin:

Internal Error. Please send a full bug report at http://bugs.kde.org. No such method 'mountAndWait' in interface 'org.kde.kdeconnect.device.sftp' at object path '/modules/kdeconnect/devices/7a8d2fffdd56459/sftp' (signature '')

I am able to control the mouse pointer on my computer using KDE Connect on my phone, but even if I control the mouse pointer to open Dolphin and browse "Blu" it still gives this error.
Comment 18 remeson 2017-03-22 18:40:21 UTC
The same problem, kdeconnect 1.0.1, Android 6.0
Comment 19 Nicholas Killewald 2017-04-25 16:46:00 UTC
I'm getting the same issue with the KDE Connect app 1.6.1 and Android 7.1.2 (using a Pixel).  It looks like what's happening is that Android is reporting the wrong IP address to the KDE side of things (in my case, the "v4-rmnet_data6" interface, which seems reasonably like "rmnet0" that Sergey noted in the initial description).

Looking over the source of the Android app, I can see exactly where it happens: getLocalIpAddress() in SimpleSftpServer.java is going through all the available network interfaces until it finds the first non-local IPv4 address, or the last IPv6 address if it never finds an IPv4.  On my phone, at least, v4-rmnet_data6 shows up in the list before a "real" address, so when SftpPlugin.java gets the message to start browsing (in onPackageReceived()), it sends out that IP address, meaning the KDE side tries to connect to it to no avail.

This appears to be device-specific; on my Nexus 9 (Android 7.1.1), I don't get any rmnet-related interfaces or IP addresses, and the filesystem browser works perfectly there.  It's only on my Pixel that I get this problem.

That said, I'm not sure how you could definitively tell what the "real" interface is on the Android device to get the proper IP address, unless the KDE side instead defaults to using whatever address it just used to send the message to start browsing.
Comment 20 Nicholas Killewald 2017-04-27 15:33:32 UTC
Created attachment 105225 [details]
Patch to make KDE Connect ignore rmnet-related network interfaces on Android devices

After further research, it looks like anything rmnet-related is safe to ignore, as that has to do with cellular communication and/or USB tethering.  Since that seems to be causing Sergey's original problem (and my problem, and presumably others'), I made this quick patch that should take care of it.

I hope I formatted the patch correctly.
Comment 21 Albert Vaca Cintora 2017-05-06 12:30:19 UTC
Git commit c5022358de3a5c3f6bbde44915ae48702cee719d by Albert Vaca, on behalf of Nicholas Killewald.
Committed on 06/05/2017 at 12:26.
Pushed by albertvaka into branch '1.x'.

Made getLocalIpAddress ignore rmnet-related interfaces.

Any interface with "rmnet" in it is an internal interface that has to do
with the device's cellular connection or USB tethering.  Since those
interfaces might give IPv4 addresses that are unreachable from any other
device, this change makes getLocalIpAddress ignore anything rmnet-related.

M  +11   -0    src/org/kde/kdeconnect/Plugins/SftpPlugin/SimpleSftpServer.java

https://commits.kde.org/kdeconnect-android/c5022358de3a5c3f6bbde44915ae48702cee719d
Comment 22 Albert Vaca Cintora 2017-05-06 12:34:58 UTC
Thanks for your patch Nicholas, I finally found time to test it and made a release with your changes in the beta channel of the Play Store. I hope this fixes the problem :) And thanks again!