Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatpak downloads every nvidia driver from flathub at every update #42

Open
ghost opened this issue Jul 28, 2020 · 34 comments · May be fixed by #234
Open

Flatpak downloads every nvidia driver from flathub at every update #42

ghost opened this issue Jul 28, 2020 · 34 comments · May be fixed by #234
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ghost
Copy link

ghost commented Jul 28, 2020

Issue moved from here: flatpak/flatpak#3750

Linux distribution and version

Ubuntu 20.04

Flatpak version

1.6.3

Description of the problem

Every time a new nvidia driver gets released I need to update the flatpaks and this already slow process(with SSD and very fast internet) becomes slower because it redownloads every driver again. This happened three times so far. Now it downloaded every driver from 430.xy to 450.xy.

Steps to reproduce

Run flatpak update when there is a new nvidia driver available.

@TingPing
Copy link
Member

TingPing commented Jul 28, 2020

So currently the build.sh script simply builds every version every time.

What we need is for it to somehow detect if only a new version was added and only export those.

Maybe @barthalion has a clever idea for this. Just a thought:

The script could get a list of nvidia packages in flathub already and compare that to our list of versions. It could also possibly check a git diff of the current commit to see if only data files were changed and nothing else.

@404NetworkError
Copy link
Collaborator

404NetworkError commented Jul 28, 2020

I've thought about this before. A potential problem I see is what would happen if URLs for older releases change or get removed. (It hasn't happened yet but could in the future.) Rebuilding releases on each commit guarantees that the older releases still exist and work on the latest version of Flatpak. There are definitely better ways to combat this problem, though.

@TingPing
Copy link
Member

TingPing commented Jul 28, 2020

There are potentially fancy things would could do like maybe indicate partial or full builds from the commit messages...

Getting into a bit of work but I think update churn is bad enough that its worth it.

@TiZ-HugLife
Copy link
Contributor

Do you remove your old drivers from your flatpak installation when you upgrade to a new driver series? I don't think flatpak uninstall --unused is smart enough to remove those, so you have to look for your unused nvidia versions and remove them manually, but at the very least, restricting the update churn to the driver series you're actually using should help a lot.

@Flashwalker
Copy link

Flashwalker commented Sep 23, 2022

Still have this ussie in 1.14.0 on Ubuntu 22.04.
It literally downloads nvidia driver on every install. Even the same as installed too.
I removed old unused versions of driver, but hte last one is fully downloaded on every install.

$ flatpak list
 nvidia-470-141-03    org.freedesktop.Platform.GL.nvidia-470-141-03    1.4    system

$ sudo flatpak install flathub one.ablaze.floorp
...
 1. org.freedesktop.Platform.GL.nvidia-470-141-03    1.4       u    flathub    < 273,8 MB
 2. one.ablaze.floorp                                stable    i    flathub    < 134,3 MB

Installation 2/2… ████████████████████ 100%  13,7 МБ/s  00:00

 1. [✓] org.freedesktop.Platform.GL.nvidia-470-141-03    1.4    u    flathub    273,0 MB / 273,8 MB
 2. [✓] one.ablaze.floorp    stable    i    flathub    136,9 MB / 134,3 MB

$ flatpak list
 nvidia-470-141-03    org.freedesktop.Platform.GL.nvidia-470-141-03    1.4    system

@guihkx
Copy link
Collaborator

guihkx commented Sep 23, 2022

Someone can correct me if I'm wrong, but you can probably prevent a re-install by simply 'masking' the drivers, e.g.

flatpak mask org.freedesktop.Platform.GL.nvidia-470-141-03
flatpak mask org.freedesktop.Platform.GL32.nvidia-470-141-03

You check your masked apps/runtimes with:

flatpak mask

@TiZ-HugLife
Copy link
Contributor

I think this will be a good workaround because it will prevent the redundant updates that come from the sane nvidia driver being rebuilt for no reason just because another drier got added. However this could become problematic in the future should an actual change happen to the Flathub package that needs to be downloaded for an already-installed driver. Nvidia updates from Flathub are definitely very "cry wolf" until this bug gets fixed for real.

It's been over two years since this issue was opened.

It's the build.sh script that builds every version? How does it get called? What sort of state and/or data persists between builds?

@barthalion
Copy link
Member

It's the build.sh script that builds every version?

Yes.

How does it get called?

See arguments assignments at https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/blob/master/build.sh#L5

What sort of state and/or data persists between builds?

None. You can query available refs with flatpak CLI in build.sh.

@Flashwalker
Copy link

flatpak mask org.freedesktop.Platform.GL.nvidia-470-141-03 org.freedesktop.Platform.GL32.nvidia-470-141-03

It seems to help

@biji
Copy link

biji commented Oct 9, 2022

Probably same downloaded driver can be cached?

@Flashwalker
Copy link

Flashwalker commented Dec 1, 2022

Is there any way to prevent the nvidia driver from updating at all, as long as a fresh version is not required as dep?

something like hold?

@TingPing
Copy link
Member

TingPing commented Dec 1, 2022

@Flashwalker flatpak mask $PACKAGE_NAME

EDIT: Well this was already covered above...

@joezhouchenye
Copy link

Why on earth would flatpak install Nvidia drivers? Using Ubuntu 22.04, two software stores? FIne. Now, this? I even cannot update Nvidia drivers from the system app software and update anymore and all is greyed. Consider uninstalling fatpak.

@TingPing
Copy link
Member

TingPing commented Dec 5, 2022

@joezhouchenye It doesn't have to. Ubuntu could package the drivers for flatpak.

No idea what else you are ranting about. You can run flatpak update to update flatpaks.

@youainti
Copy link

youainti commented Feb 9, 2023

Having read through this and found it helpful, I just wanted to summarize the step I took to fix it.

flatpak uninstall --unused
flatpak list --runtime

Look for the nvidia version in use. I got something along the lines of:

Name                                              Application ID                                            Version              Branch                  Installation
Freedesktop Platform                              org.freedesktop.Platform                                  22.08.7              22.08                   system
Mesa                                              org.freedesktop.Platform.GL.default                       21.3.9               21.08                   system
Mesa                                              org.freedesktop.Platform.GL.default                       22.3.4               22.08                   system
Mesa (Extra)                                      org.freedesktop.Platform.GL.default                       22.3.4               22.08-extra             system
nvidia-470-161-03                                 org.freedesktop.Platform.GL.nvidia-470-161-03                                  1.4                     system
ffmpeg-full                                       org.freedesktop.Platform.ffmpeg-full                                           21.08                   system
openh264                                          org.freedesktop.Platform.openh264                         2.1.0                2.0                     system
openh264                                          org.freedesktop.Platform.openh264                         2.1.0                2.2.0                   system
Freedesktop SDK                                   org.freedesktop.Sdk                                       21.08.12             21.08                   system
GNOME Application Platform version 41             org.gnome.Platform                                                             41                      system

you are going to use this line:

nvidia-470-161-03                                 org.freedesktop.Platform.GL.nvidia-470-161-03                                  1.4                     system

You then mask the appropriate packages

flatpak mask  org.freedesktop.Platform.GL.nvidia-470-161-03

now run your updates

flatpak update package.name.goes.here

Is there a place I could put this in the documentation?

@biji
Copy link

biji commented Feb 10, 2023

It seems repeated download happen only after updating kernel

@evdcush
Copy link

evdcush commented Jan 15, 2024

Same problem.
flatpak mask hack worked.

@guihkx guihkx linked a pull request Feb 5, 2024 that will close this issue
@poltpolt
Copy link

Same problem. flatpak mask hack worked.

how did you do it?
i did
➜ ~ flatpak mask -u org.freedesktop.Platform.nvidia
➜ ~ flatpak mask org.freedesktop.Platform.nvidia
with no luck - still get them listed for update

@guihkx
Copy link
Collaborator

guihkx commented Feb 15, 2024

@poltpolt That's not a valid package name, it's missing the driver version on it.

Here's an example if you're using version 535.154.05 of the driver:

flatpak mask org.freedesktop.Platform.GL.nvidia-535-154-05
flatpak mask org.freedesktop.Platform.GL32.nvidia-535-154-05

To avoid having to figure out the driver version manually, you can use something like this to mask the current driver version:

flatpak mask "org.freedesktop.Platform.GL.nvidia-$(cat /sys/module/nvidia/version | tr '.' '-')"
flatpak mask "org.freedesktop.Platform.GL32.nvidia-$(cat /sys/module/nvidia/version | tr '.' '-')"

@poltpolt
Copy link

so it is not a mask but in fact an exclusion for particular package... for me a mask is something that covers more then one particular identifier but a bit broader

@guihkx
Copy link
Collaborator

guihkx commented Feb 15, 2024

Well, you could technically do something like flatpak mask "org.freedesktop.Platform.GL.nvidia-*", but if e.g. you upgrade your host drivers to a newer version, you'll have to install the Flatpak package for this new version manually, because flatpak update won't install it automatically for you anymore.

@Flashwalker
Copy link

Flashwalker commented Feb 15, 2024

I wrote a bash script you want to run after you upgrade your host system nvidia driver:

cat ~/bin/fupdate-nvidia-driver.sh

#!/bin/bash

oldver="$(flatpak list | grep -oP 'org.freedesktop.Platform.GL.nvidia-(\d|-)+')"; oldver="${oldver#*-}"; oldver2="${oldver%-*}"; oldver2="${oldver2//-/}"
newver="$(cat /sys/module/nvidia/version 2>/dev/null | tr '.' '-')"

function echover {
    echo "flatpak nvidia driver:  ${oldver}"
    echo "host nvidia driver:     ${newver}"
}
function update {
    echover
    echo 'Updating...'
    sudo flatpak install org.freedesktop.Platform.GL.nvidia-"${newver}" &&
    sudo flatpak mask org.freedesktop.Platform.GL{,32}.nvidia-"${newver}"
    sudo flatpak mask --remove org.freedesktop.Platform.GL{,32}.nvidia-"${oldver}"
    sudo flatpak remove org.freedesktop.Platform.GL{,32}.nvidia-"${oldver}"
    exit
}
# If host driver version older than flatpak one
if [[ ${newver//-/} -gt ${oldver//-/} ]]; then
    update
elif [[ "$(echo -n ${newver//-/} | wc -c)" -eq "$(echo -n ${oldver2} | wc -c)" ]] && [[ ${newver//-/} -gt ${oldver2} ]]; then
    update
# If both tha same
elif [[ ${newver//-/} -eq ${oldver//-/} ]]; then
    echover
    echo 'same. do nothing.'
    exit
else
    echover
    exit
fi

@rambo919
Copy link

rambo919 commented Feb 24, 2024

fupdate-nvidia-driver.sh

This is helpful but results in "unary operator expected" errors in lines 12 and 21. Easily fixed by double brackets instead of single one's.

However it then ends in "error: No current masked pattern matching org.freedesktop.Platform.GL.nvidia-" which I assume is part of the removal part of the previous runtime.

@Flashwalker
Copy link

This is helpful but results in "unary operator expected" errors in lines 12 and 21. Easily fixed by double brackets instead of single one's.

Thnx, fixed

However it then ends in "error: No current masked pattern matching org.freedesktop.Platform.GL.nvidia-" which I assume is part of the removal part of the previous runtime.

Perhaps regexp for oldver is not working for you. Try running it and see if it works:

flatpak list | sed -rn 's/org.freedesktop.Platform.GL.nvidia-([-[:digit:]]+)[[:space:]]+.*$/\1/p' | sed -rn 's/^.*[[:space:]]+([-[:digit:]]+)/\1/p'

output should be like: 545-29-06

@rambo919
Copy link

sigh.... the morons did it again and released a hotfix version willy nilly and now no flatpaks will run anymore and once again I probably have to wait a month for someone to fix it.

Output is nvidia-550-54-14 which is the most current flatpak version..... driver version is nvidia-550-54-15. However runtimes also also installed are nvidia-525-125-06, nvidia-525-147-05 and nvidia-545-23-08. For some reason DDM refuses to uninstall 525 so technically I have multiple drivers installed which in itself confuses the system.... I also cannot manually downgrade or uninstall 525 because of dependency problems which is a separate issue.

@Flashwalker
Copy link

@rambo919
I just ran fremove org.freedesktop.Platform.GL.nvidia-OLD_VERSION and it was successfully removed. I just ignored the dependency prompt and forced the removal.

@rambo919
Copy link

@rambo919 I just ran fremove org.freedesktop.Platform.GL.nvidia-OLD_VERSION and it was successfully removed. I just ignored the dependency prompt and forced the removal.

No I mean on system level 525 is still installed as well as the latest one the corresponding flatpaks. I blame nvidia for simply not caring about anyone other than AI farmers at this point. Unlike in windows you cannot downgrade the driver if you need to if you use the nvidia repo, you are forced to upgrade unless you remember to force freeze the version.

It took me far too long to realize what their moron ceo meant by "buying more and more often is buying cheaper".... he obviously considers the common consumer an irritation at this point.

But back to the point, people have commented that if they force remove old driver flatpak runtimes.... they just automatically reinstall next time.

@TingPing
Copy link
Member

flatpak only auto installs the version that matches your host.

The next major release of flatpak will also auto-remove versions that dont match.

@Flashwalker
Copy link

Flashwalker commented Mar 20, 2024

@rambo919 I just ran fremove org.freedesktop.Platform.GL.nvidia-OLD_VERSION and it was successfully removed. I just ignored the dependency prompt and forced the removal.

No I mean on system level 525 is still installed as well as the latest one the corresponding flatpaks. I blame nvidia for simply not caring about anyone other than AI farmers at this point. Unlike in windows you cannot downgrade the driver if you need to if you use the nvidia repo, you are forced to upgrade unless you remember to force freeze the version.

It took me far too long to realize what their moron ceo meant by "buying more and more often is buying cheaper".... he obviously considers the common consumer an irritation at this point.

But back to the point, people have commented that if they force remove old driver flatpak runtimes.... they just automatically reinstall next time.

You can run this
to install e.g. all nvidia 550

sudo apt-get install nvidia-compute-utils-550 nvidia-dkms-550 nvidia-kernel-common-550 nvidia-driver-550 nvidia-utils-550 xserver-xorg-video-nvidia-550 libnvidia-gl-550 libnvidia-compute-550 libnvidia-decode-550 libnvidia-encode-550 libnvidia-extra-550 libnvidia-cfg1-550 libnvidia-fbc1-550 libnvidia-common-550 libnvidia-gl-550:i386 libnvidia-compute-550:i386 libnvidia-decode-550:i386 libnvidia-encode-550:i386 libnvidia-fbc1-550:i386 libnvidia-compute-550 nvidia-compute-utils-550 nvidia-dkms-550 nvidia-kernel-common-550 nvidia-firmware-550-*

and remove all nvidia 525

sudo apt-get purge nvidia-compute-utils-525 nvidia-dkms-525 nvidia-kernel-common-525 nvidia-driver-525 nvidia-utils-525 xserver-xorg-video-nvidia-525 libnvidia-gl-525 libnvidia-compute-525 libnvidia-decode-525 libnvidia-encode-525 libnvidia-extra-525 libnvidia-cfg1-525 libnvidia-fbc1-525 libnvidia-common-525 libnvidia-gl-525:i386 libnvidia-compute-525:i386 libnvidia-decode-525:i386 libnvidia-encode-525:i386 libnvidia-fbc1-525:i386 libnvidia-compute-525 nvidia-compute-utils-525 nvidia-dkms-525 nvidia-kernel-common-525 nvidia-firmware-525-*

@rambo919
Copy link

I tried something like that when i tried to force downgrade had to do a timeshift because I lost the ability to boot.... those specific packages don't actually show up for me in apt anyway.... something to do with how MX Linux tweaks Debian probably or just a Debian problem I dunno.

Though oddly now that I checked a few all of the old driver flatpaks complain that heroic launcher and only heroic launcher needs them..... using Warehouse uninstalled that, then the old driver flatpaks..... now it does not redownload them. I still have the problem of the mystery dual driver setup system side but it seems like the main problem flatpak wise might have been heroic blocking things.

At least this time the flatpak driver hotfix issue was solved quicker this time and it updated to the right one today.... which bodes well for the future.

@TingPing
Copy link
Member

only heroic launcher needs them

This package using the 32bit drivers (note GL32) but it shouldn't be a dependency like that I'd think.

@evdcush
Copy link

evdcush commented Jul 12, 2024

Same problem. flatpak mask hack worked.

how did you do it? i did ➜ ~ flatpak mask -u org.freedesktop.Platform.nvidia ➜ ~ flatpak mask org.freedesktop.Platform.nvidia with no luck - still get them listed for update

@poltpolt
As this bug resurfaced itself recently, I reran the flatpak mask hack to prevent the updates again.
This is the exact command I use:

flatpak mask "org.freedesktop.Platform.GL.nvidia*"

I don't know how safe it is, but I don't care too much; everything works.

@FlameSoulis
Copy link

This is very much still a thing. Seriously, why is this the ONLY package that takes a million years to download?

For the record, the other packages usually download at about 30MB/s. This is the ONLY one that is unusually slow, and sometimes goes as slow as bytes/s.
image

@guihkx
Copy link
Collaborator

guihkx commented Dec 14, 2024

@FlameSoulis Flatpak downloads the driver straight from NVIDIA servers, while most apps are downloaded from Flathub servers. That's why you're seeing that difference in download speeds.

Though I personally never had slow speeds while downloading from NVIDIA servers either, so YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.