gydl icon indicating copy to clipboard operation
gydl copied to clipboard

Gydl fails to detect network in Flatpak sandbox

Open legacychimera247 opened this issue 6 years ago • 34 comments

i've installed the application yesterday and it was working for the first few times...now if i open the app in as $ i get a "no internet connection estabilished", if i oep it via root i get "Traceback (most recent call last): File "/app/bin/gydl", line 179, in prepareDownload self.prepareVideo(DownloadDir) File "/app/bin/gydl", line 136, in prepareVideo + "/%(title)s.%(ext)s" "UUU"") TypeError: Can't convert 'NoneType' object to str implicitly" in terminal...any suggestion?

btw i am using fedora 26 workstation, if needed...

legacychimera247 avatar Sep 15 '17 10:09 legacychimera247

First of all, Gydl is not meant to be run as root, running it as such will result in errors.

I'm not quite sure if I understand your problem correctly, hence I'd like to ask, do you get any problems/errors when running it as a normal user?

JannikHv avatar Sep 15 '17 11:09 JannikHv

i know it's not meant te be run as root...it was just for trying...anyway maybe i wrote my message badly...if i run the app as nomal user i get a "no internet connection has been estabilished" message and i can either return to the menu or close the app...

legacychimera247 avatar Sep 15 '17 11:09 legacychimera247

It's pretty weird since the internet connection test is using GLib which just pings "google.com" from port 0, so usually theres shouldn't be any problems :/

I assume you're having a stable internet connection up and running though. I've just commited a "potential" fix, would you mind re-installing the application from git and try to replicate your problem?

JannikHv avatar Sep 15 '17 12:09 JannikHv

hi there, yes i have an internet connection which is quite stable, and youtube-dl itself is working. Now, i have installed Gydl through flathub and thought youtube-dl was not needed (thought it was included in the flatpak) so i've removed it...from that moment the app stopped working telling me i have no internet connection...tried reinstall youtube-dl (which again is working) but with no luck...tried even removing gydl and the reinstalling youtube-dl first (in case of) and then gydl but it's simply not working (while is working on another computer with no youtube-dl installed)

by the way, mind to fix the push to the flatpak app?

legacychimera247 avatar Sep 15 '17 13:09 legacychimera247

I am probably in a much better position help, since I am the actual flatpak author.

There does indeed seem to be some issues with how Gydl checks for network. I have no issues on my desktop, but on my laptop I do sometimes experience the same issue. The problem is that it is very inconsistent. Sometimes it works and sometimes not. I was planning on bringing it up but it got delayed and forgotten.

Unfortunately I am unqualified to determine the exact cause or solution but I can confirm that this is specific to the flatpak build. I recommend that @JannikHv take a look at the following documentation and determine if there is an issue:

  • http://docs.flatpak.org/en/latest/working-with-the-sandbox.html#portals

Gydl needs to be compatible and make use of these API:s in order to work in the sandbox.

There also seems to be some confusion here regarding external dependencies. Flatpak applications are sandboxed and it is simple impossible for it to break if you uninstall youtube-dl outside the sandbox.

Regarding a fix to the Flatpak version. Flathub does not accept development builds. If you require a development version I could provide one on my own webbserver. Alternatively I could do the initial testing now that you reminded me of the issue.

AsavarTzeth avatar Sep 15 '17 18:09 AsavarTzeth

Well unfortunately my testes were inconclusive.

I had no issues with the stable build from flathub, nor with a local build based on the latest commit. This was tested on my laptop which often had the same issue with the network check.

AsavarTzeth avatar Sep 15 '17 19:09 AsavarTzeth

Yeah, couldn't replicate it either, not on my PC, nor on my Laptop. What we could do is going back to the "primitive" type of checking if the internet connection works, by a system call instead of using GLib. We might want to fall back to it until we found what caused this problem (?).

Edit: Or by sockets actually to avoid using system calls.

JannikHv avatar Sep 15 '17 19:09 JannikHv

I've made some changes which should probably fix the problem you're having. My guess is that GLib may has chosen the wrong network card or something along these lines.

Since I couldn't replicate this problem in any way, it'd be awesome if you checked if it persists after the last commit I've done.

18d4819511c668b2e1225aabb3de5bcab48b1c46

JannikHv avatar Sep 15 '17 19:09 JannikHv

Based on how I understand the Flatpak portal system I very much doubt this would be possible. They quite clearly state that toolkits handle portals for you, otherwise you have to implement the portal manually.

Nevertheless I will try it. Also, again you might want to use a branch for the bug fix attempts. It will be a lot of commits to revert otherwise if we need to change it back.

AsavarTzeth avatar Sep 15 '17 20:09 AsavarTzeth

one thing i can add...yesterday at home i've installed the program via flathub and it was working, then my connection suddenly dropped, and gydl started telling me there is no internet connection...now there's no way to make it work...i even changed my connection to a much stabler one (real 8 mb) but there's no way to make it work...youtube-dl otherwise works perfectly...

maybe it's just nothing but thought about reporting it...

EDIT : it's actually working...dunno why...i will anyway leave that one open till i can test it even at work where i have a much stabler connection...in case it's working i will close this issue...

legacychimera247 avatar Sep 15 '17 20:09 legacychimera247

Maybe it works until your connection state changes? This would obviously explain why it happens more often on my laptop (which only has WiFi).

AsavarTzeth avatar Sep 15 '17 20:09 AsavarTzeth

well i'm on a laptop too...i really can't explain unfortunately...anyway i just noticed that video downloading always tells me the format is not supported whichever format i choose...think i need to have all the codecs installed for this, right?

legacychimera247 avatar Sep 15 '17 20:09 legacychimera247

Codecs are installed with the flatpak and you cannot change that unless you build your own flatpak. You don't have any other installation of Gydl? If you do I recommend you run it from the command line with flatpak run com.github.JannikHv.Gydl//stable to be sure.

AsavarTzeth avatar Sep 15 '17 20:09 AsavarTzeth

already done it...maybe it was the video?anyway i only have the flathub installation and it's always telling me "error (in red) format non supported"

legacychimera247 avatar Sep 15 '17 20:09 legacychimera247

That one I can't explain. Could you share the URL to the video in question? And what options did you set in Gydl?

If you give me this I can check with youtube-dl what is available at the source and also check if ffmpeg is missing some build option.

AsavarTzeth avatar Sep 15 '17 21:09 AsavarTzeth

Do you mean the "format not supported" error when actually downloading something with Gydl (Sorry, little confused). Not every video can be downloaded in the desired format, so it'll show you this error instead.

JannikHv avatar Sep 15 '17 21:09 JannikHv

thanks you two for the prompt answers...i will give you the link as soon as i will be back to my pc...maybe anyway is better to open another issue for this?

legacychimera247 avatar Sep 15 '17 21:09 legacychimera247

Interestingly the latest commit does work with flatpak; shows how little I understand the network monitor portal. I guess it makes sense since Gydl is packaged with the --share=network argument and has full access for the purpose of the download.

I have put a test build of the latest build in my personal repository.

Test Instructions

flatpak remote-add --if-not-exists tzeth --from https://tzeth.com/repo/tzeth.flatpakrepo
flatpak install tzeth com.github.JannikHv.Gydl//master

Make sure the ostree commit is 0f502928689d

# Display builds available at remote
flatpak remote-ls tzeth -d

# Display locally installed
flatpak info com.github.JannikHv.Gydl//master

Output of the second command should include:

ID: com.github.JannikHv.Gydl
Branch: master
Origin: tzeth
Commit: 0f502928689d6341e9ca0c5e46c9605560a512360d3057f78cdd34780a6cbdb3

Run it

flatpak run com.github.JannikHv.Gydl//master

Any testing done at this point should be against the latest commit 18d4819511c668b2e1225aabb3de5bcab48b1c46 and be valid for this issue.

AsavarTzeth avatar Sep 16 '17 08:09 AsavarTzeth

So it was indeed just a Flatpak related issue, huh? I'll "reverse" this commit ASAP making it use GLib again then.

JannikHv avatar Sep 16 '17 09:09 JannikHv

There is no point in being hasty with these things. It is a Flatpak specific issue yes. I would like to think I made that pretty clear in my first comment. Then again I am starting to get the feeling that nobody reads them.

In any case, it needs to work with the Flatpak version as well or I might be forced to patch out the network connectivity check altogether (in the flatpak only/downstream). I recommend actually waiting and seeing if @legacychimera247 could test this as I instructed and report the results.

AsavarTzeth avatar Sep 16 '17 09:09 AsavarTzeth

well thing is the app now working with the version actually on flathub and i really dunno why...i will test with my connection at work and in case it's not working i will test the new one :)

legacychimera247 avatar Sep 17 '17 19:09 legacychimera247

Reopen if necessary, I'll call it done for now.

JannikHv avatar Sep 19 '17 12:09 JannikHv

sorry for being late, anyway i tested it at work and it does not work...think needs to be reopened but i don't know how to do it...

legacychimera247 avatar Sep 19 '17 16:09 legacychimera247

Since @JannikHv closed it he or I would have to reopen it.

AsavarTzeth avatar Sep 19 '17 17:09 AsavarTzeth

so, today software center detected an update, but unfortunately couldn't download it...tried with flatpak update but this is the result

Updating: com.github.JannikHv.Gydl/x86_64/stable from flathub [####################] 1 delta parts, 1 loose fetched; 48 KiB transferred in 0 s Error: Failed to update com.github.JannikHv.Gydl/x86_64/stable: GDBus.Error:org.freedesktop.DBus.Error.Failed: Error deploying: While trying to checkout c1be90f015658c19eab785a31594badb63f01e82bb414a767a061e8e940bf797 into /var/lib/flatpak/app/com.github.JannikHv.Gydl/x86_64/stable/.c1be90f015658c19eab785a31594badb63f01e82bb414a767a061e8e940bf797-ACBU6Y: Couldn't find file object 'f602680263c107d496735103ce6ad164a3f0bed068d6de485195dcc4105b9d86' error: One or more operations failed

at the end i just uninstalled the app and installed it again... anyway now the program is perfectly working...i will check later even at home but i can say the issue is solved :)

legacychimera247 avatar Sep 26 '17 07:09 legacychimera247

Well that isn't really related to this issue or even the application itself. I would report flatpak errors like that on flatpak after having searched if someone else have already reported it or something similar.

And yes, Gnome Software still needs a lot of improvements to its flatpak plugin. From what I heard the 3.26 updates brings a lot of fixes. Since you used the Ubuntu branding for it I am guessing that is what you use, which would mean 17.10 should bring those fixes.

What exact command did you use to update? Did you run it with sudo or as root? I used to do that initially but had all kinds of weird issues. So if you are I would say never run flatpak as root.

AsavarTzeth avatar Sep 26 '17 08:09 AsavarTzeth

i will next time...

dunno why i haven't stated but i am on fedora 26...we will see gnome 3.26 in fedora 27 wich is due to being released on early december...

anyway just run a normal "flatpak update" with no root at all...

legacychimera247 avatar Sep 26 '17 21:09 legacychimera247

by the way the app is correctly working now...

legacychimera247 avatar Sep 26 '17 21:09 legacychimera247

Since there have not been any new releases the problem likely is not fixed. Then again it is possible the issue is external.

If the issue occurs again, feel free to leave the issue open. There is no need to close it and open it each time it seems to work again.

AsavarTzeth avatar Sep 27 '17 06:09 AsavarTzeth

unfortunately the problem isn't fixed yet...no internet connection again...i will reopen it again and leave it opened...

legacychimera247 avatar Sep 28 '17 09:09 legacychimera247

I just installed on Arch via flatpák. It says no internet connection is available.

glaubersm avatar Oct 12 '17 13:10 glaubersm

screenshot from 2017-12-08 15-54-58

deikatsuo avatar Dec 08 '17 08:12 deikatsuo

Same issue here (No internet Connection Available) from Flathub

Commit: c7cfdb578262f2a78f4c84e497f0252a68eb7bebb8ff2986db9ee1d5585ad829 Flatpak: 0.11.3

alex285 avatar Feb 28 '18 08:02 alex285

Just like to report that the issue seems to be resolved. I downloaded it from flathub and I am able to download videos just fine.

Version: 0.1.1

alexpattyn avatar Feb 15 '19 20:02 alexpattyn