* [pve-devel] [PATCH manager/nvidia-vgpu-helper v2 0/5] reduce setup steps for nvidia vgpu drivers
@ 2025-01-21 10:04 Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 1/4] create a debian package to make the installation of Nvidia vGPU drivers more convenient Hannes Duerr
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Hannes Duerr @ 2025-01-21 10:04 UTC (permalink / raw)
To: pve-devel
Changes in v2:
* patches contain all changes to build new repository
* make pve-manager depend on this package instead of the other way around
* install the script to /usr/bin/
* rename the script to pve-nvidia-vgpu-helper because it is only
relevant for PVE(the repository should therefore also be renamed
when created)
The aim of the repository is to reduce the necessary installation
steps for the Nvidia VGPU drivers [0]. The package installs a script
which can be used to check and install necessary dependencies and a
systemd template service which can be used to configure the SR-IOV per
pci-id
Part of the changes would later be the adjustment of the wiki page
[0] https://pve.proxmox.com/wiki/NVIDIA_vGPU_on_Proxmox_VE
pve-nvidia-vgpu-helper:
Hannes Duerr (4):
create a debian package to make the installation of Nvidia vGPU
drivers more convenient
debian/control: add dependency for helper script
add pve-nvidia-vgpu-helper and Makefile to make dependency installtion
more convenient
debian: add and install nvidia-vgpu systemd template unit file
pve-manager:
Hannes Duerr (1):
debian/control: add pve-nvidia-vgpu-helper as dependency
debian/control | 1 +
1 file changed, 1 insertion(+)
Summary over all repositories:
1 files changed, 1 insertions(+), 0 deletions(-)
--
Generated by git-murpp 0.8.0
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 1/4] create a debian package to make the installation of Nvidia vGPU drivers more convenient
2025-01-21 10:04 [pve-devel] [PATCH manager/nvidia-vgpu-helper v2 0/5] reduce setup steps for nvidia vgpu drivers Hannes Duerr
@ 2025-01-21 10:04 ` Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 2/4] debian/control: add dependency for helper script Hannes Duerr
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: Hannes Duerr @ 2025-01-21 10:04 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---
debian/changelog | 5 +++++
debian/control | 15 +++++++++++++++
debian/copyright | 14 ++++++++++++++
debian/rules | 8 ++++++++
debian/source/format | 1 +
5 files changed, 43 insertions(+)
create mode 100644 debian/changelog
create mode 100644 debian/control
create mode 100644 debian/copyright
create mode 100755 debian/rules
create mode 100644 debian/source/format
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..de5e10a
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+pve-nvidia-vgpu-helper (8.3.3) UNRELEASED; urgency=medium
+
+ * Initial release.
+
+ -- Proxmox Support Team <support@proxmox.com> Mon, 20 Jan 2025 17:02:52 +0100
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..334bf25
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,15 @@
+Source: pve-nvidia-vgpu-helper
+Section: admin
+Priority: optional
+Maintainer: Proxmox Support Team <support@proxmox.com>
+Build-Depends: debhelper-compat (= 13), lintian,
+Standards-Version: 4.6.2
+Homepage: https://www.proxmox.com
+
+Package: pve-nvidia-vgpu-helper
+Architecture: all
+Depends: ${misc:Depends},
+Description: Proxmox Nvidia vGPU helper script and systemd service
+ This package provides a script, that helps with installing all required
+ packages for the Nvidia vGPU driver, and also a systemd template service which
+ configures the option SRI-OV per pci-id
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..046356b
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,14 @@
+Copyright (C) 2016 - 2024 Proxmox Server Solutions GmbH <support@proxmox.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..218df65
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+%:
+ dh $@
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 2/4] debian/control: add dependency for helper script
2025-01-21 10:04 [pve-devel] [PATCH manager/nvidia-vgpu-helper v2 0/5] reduce setup steps for nvidia vgpu drivers Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 1/4] create a debian package to make the installation of Nvidia vGPU drivers more convenient Hannes Duerr
@ 2025-01-21 10:04 ` Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient Hannes Duerr
` (2 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: Hannes Duerr @ 2025-01-21 10:04 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---
debian/control | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/debian/control b/debian/control
index 334bf25..4492b60 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,8 @@ Homepage: https://www.proxmox.com
Package: pve-nvidia-vgpu-helper
Architecture: all
-Depends: ${misc:Depends},
+Depends: libapt-pkg-perl,
+ ${misc:Depends},
Description: Proxmox Nvidia vGPU helper script and systemd service
This package provides a script, that helps with installing all required
packages for the Nvidia vGPU driver, and also a systemd template service which
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient
2025-01-21 10:04 [pve-devel] [PATCH manager/nvidia-vgpu-helper v2 0/5] reduce setup steps for nvidia vgpu drivers Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 1/4] create a debian package to make the installation of Nvidia vGPU drivers more convenient Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 2/4] debian/control: add dependency for helper script Hannes Duerr
@ 2025-01-21 10:04 ` Hannes Duerr
2025-01-21 10:47 ` Dominik Csapak
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 4/4] debian: add and install nvidia-vgpu systemd template unit file Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-manager v2 1/1] debian/control: add pve-nvidia-vgpu-helper as dependency Hannes Duerr
4 siblings, 1 reply; 15+ messages in thread
From: Hannes Duerr @ 2025-01-21 10:04 UTC (permalink / raw)
To: pve-devel
we add the pve-nvidia-vgpu-helper script to make the installation of the
required nvidia vgpu driver dependencies more convenient.
We also add a Makefile to assist in building the debian package and
installing the script
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---
Makefile | 54 ++++++++++++++++++++++++++++++++++
pve-nvidia-vgpu-helper | 66 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 120 insertions(+)
create mode 100644 Makefile
create mode 100755 pve-nvidia-vgpu-helper
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c6e461d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,54 @@
+include /usr/share/dpkg/default.mk
+
+PACKAGE=pve-nvidia-vgpu-helper
+
+BINDIR=/usr/bin/
+DESTDIR=
+
+GITVERSION:=$(shell git rev-parse HEAD)
+
+BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION)
+DSC=$(PACKAGE)_$(DEB_VERSION).dsc
+
+DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
+
+all:
+deb: $(DEB)
+
+$(BUILDDIR): debian
+ rm -rf $@ $@.tmp
+ rsync -a * $@.tmp/
+ echo "git clone git://git.proxmox.com/git/pve-nvidia-vgpu-helper.git\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE
+ mv $@.tmp $@
+
+$(DEB): $(BUILDDIR)
+ cd $(BUILDDIR); dpkg-buildpackage -b -uc -us
+ lintian $(DEB)
+
+dsc: $(DSC)
+ $(MAKE) clean
+ $(MAKE) $(DSC)
+ lintian $(DSC)
+
+$(DSC): $(BUILDDIR)
+ cd $(BUILDDIR); dpkg-buildpackage -S -uc -us
+
+sbuild: $(DSC)
+ sbuild $(DSC)
+
+.PHONY: install
+install: pve-nvidia-vgpu-helper
+ install -d $(DESTDIR)$(BINDIR)
+ install -m 0755 pve-nvidia-vgpu-helper $(DESTDIR)$(BINDIR)
+
+.PHONY: upload
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
+upload: $(DEB)
+ tar cf - $(DEB)|ssh repoman@repo.proxmox.com -- upload --product pve --dist $(UPLOAD_DIST)
+
+.PHONY: distclean
+distclean: clean
+
+.PHONY: clean
+clean:
+ rm -rf *~ $(PACKAGE)-[0-9]*/ $(PACKAGE)*.tar.* *.deb *.dsc *.changes *.build *.buildinfo
diff --git a/pve-nvidia-vgpu-helper b/pve-nvidia-vgpu-helper
new file mode 100755
index 0000000..fc0856e
--- /dev/null
+++ b/pve-nvidia-vgpu-helper
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use PVE::Tools qw(run_command);
+use AptPkg::Cache;
+
+my @apt_install = qw(apt-get --no-install-recommends -o Dpkg:Options::=--force-confnew install --);
+my @dependencies = qw(dkms libc6-dev);
+my @missing_packages;
+
+die "Please execute the script with root privileges\n" if $>;
+
+my $apt_cache = AptPkg::Cache->new();
+die "unable to initialize AptPkg::Cache\n" if !$apt_cache;
+
+sub package_is_installed {
+ my ($package) = @_;
+ my $p = $apt_cache->{$package};
+ if (!defined($p->{CurrentState}) || $p->{CurrentState} ne "Installed") {
+ push(@missing_packages, $package);
+ }
+}
+
+foreach my $dependency (@dependencies) {
+ package_is_installed($dependency);
+}
+
+
+my $running_kernel;
+run_command( ['/usr/bin/uname', '-r' ],
+ outfunc => sub { $running_kernel = shift } );
+
+my $default_major_minor_version;
+run_command(['/usr/bin/dpkg-query', '-f', '${Depends}', '-W', 'proxmox-default-kernel'],
+ outfunc => sub { $default_major_minor_version = shift } );
+
+my $default_full_version;
+run_command(['/usr/bin/dpkg-query', '-f', '${Version}', '-W', $default_major_minor_version],
+ outfunc => sub { $default_full_version = shift } );
+
+if ($running_kernel =~ /$default_full_version-pve/) {
+ print "You are running the proxmox default kernel `proxmox-kernel-$running_kernel`\n";
+ package_is_installed("proxmox-default-headers");
+} elsif ($running_kernel =~ /pve/) {
+ print "You are running the non default proxmox kernel `proxmox-kernel-$running_kernel`\n";
+ package_is_installed("proxmox-headers-$running_kernel");
+} else {
+ die "You are not using a proxmox-kernel, please make sure that the appropriate header package is installed.\n";
+}
+
+if (!@missing_packages){
+ print "All required packages are installed, you can continue with the Nvidia vGPU driver installation.\n";
+ exit;
+} else {
+ print "The following packages are missing:\n" . join("\n", @missing_packages) ."\n";
+ print "Would you like to install them now (y/n)?\n";
+}
+
+my $answer = <STDIN>;
+if (defined($answer) && $answer =~ m/^\s*y(?:es)?\s*$/i) {
+ if (system(@apt_install, @missing_packages) != 0) {
+ die "apt failed during the installation: ($?)\n";
+ }
+}
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 4/4] debian: add and install nvidia-vgpu systemd template unit file
2025-01-21 10:04 [pve-devel] [PATCH manager/nvidia-vgpu-helper v2 0/5] reduce setup steps for nvidia vgpu drivers Hannes Duerr
` (2 preceding siblings ...)
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient Hannes Duerr
@ 2025-01-21 10:04 ` Hannes Duerr
2025-01-21 10:36 ` Dominik Csapak
2025-01-21 10:04 ` [pve-devel] [PATCH pve-manager v2 1/1] debian/control: add pve-nvidia-vgpu-helper as dependency Hannes Duerr
4 siblings, 1 reply; 15+ messages in thread
From: Hannes Duerr @ 2025-01-21 10:04 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---
debian/nvidia-vgpud@.service | 12 ++++++++++++
debian/rules | 3 +++
2 files changed, 15 insertions(+)
create mode 100644 debian/nvidia-vgpud@.service
diff --git a/debian/nvidia-vgpud@.service b/debian/nvidia-vgpud@.service
new file mode 100644
index 0000000..b3c1220
--- /dev/null
+++ b/debian/nvidia-vgpud@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Enable NVIDIA SR-IOV for PCI ID %i
+After=network.target nvidia-vgpud.service nvidia-vgpu-mgr.service
+Before=pve-guests.service
+
+[Service]
+Type=oneshot
+ExecStartPre=/bin/sleep 5
+ExecStart=/usr/lib/nvidia/sriov-manage -e %i
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
index 218df65..fe9a05d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,3 +6,6 @@
%:
dh $@
+
+override_dh_installsystemd:
+ dh_installsystemd --no-start --no-enable --name nvidia-vgpud@ nvidia-vgpud@.service
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [pve-devel] [PATCH pve-manager v2 1/1] debian/control: add pve-nvidia-vgpu-helper as dependency
2025-01-21 10:04 [pve-devel] [PATCH manager/nvidia-vgpu-helper v2 0/5] reduce setup steps for nvidia vgpu drivers Hannes Duerr
` (3 preceding siblings ...)
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 4/4] debian: add and install nvidia-vgpu systemd template unit file Hannes Duerr
@ 2025-01-21 10:04 ` Hannes Duerr
4 siblings, 0 replies; 15+ messages in thread
From: Hannes Duerr @ 2025-01-21 10:04 UTC (permalink / raw)
To: pve-devel
the package ships a script that helps to set up Nvidia vgpu drivers.
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---
debian/control | 1 +
1 file changed, 1 insertion(+)
diff --git a/debian/control b/debian/control
index 6c94df09..ab02fd76 100644
--- a/debian/control
+++ b/debian/control
@@ -89,6 +89,7 @@ Depends: apt (>= 1.5~),
pve-firewall,
pve-ha-manager,
pve-i18n (>= 3.2.0~),
+ pve-nvidia-vgpu-helper,
pve-xtermjs (>= 4.7.0-1),
qemu-server (>= 8.2.7),
rsync,
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 4/4] debian: add and install nvidia-vgpu systemd template unit file
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 4/4] debian: add and install nvidia-vgpu systemd template unit file Hannes Duerr
@ 2025-01-21 10:36 ` Dominik Csapak
2025-01-21 11:58 ` Hannes Dürr
2025-01-22 13:14 ` Thomas Lamprecht
0 siblings, 2 replies; 15+ messages in thread
From: Dominik Csapak @ 2025-01-21 10:36 UTC (permalink / raw)
To: Proxmox VE development discussion, Hannes Duerr
mhmm not sure if it's so good to reuse the exiting name of the nvidia service
for this. also not sure how systemd likes it if there is a service 'foo.service'
and a template 'foo@.service' (though my guess would be that it's not that big of an issue)
i'd like to seee a distinct name for this (maybe even with pve prefix) like:
pve-nvidia-sriov@.service
Then it's clear where it comes from and what it's for (vgpud is an nvidia daemon
that does not really has anything to do with what this does)
Or do you have any objections to that?
also, would it make sense to add a
---
ConditionPathExists=/usr/lib/nvidia/sriov-manage
---
too?
otherwise users that enable it accidentally or too early run into an ugly error
(though that can be desired too)
On 1/21/25 11:04, Hannes Duerr wrote:
> Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
> ---
> debian/nvidia-vgpud@.service | 12 ++++++++++++
> debian/rules | 3 +++
> 2 files changed, 15 insertions(+)
> create mode 100644 debian/nvidia-vgpud@.service
>
> diff --git a/debian/nvidia-vgpud@.service b/debian/nvidia-vgpud@.service
> new file mode 100644
> index 0000000..b3c1220
> --- /dev/null
> +++ b/debian/nvidia-vgpud@.service
> @@ -0,0 +1,12 @@
> +[Unit]
> +Description=Enable NVIDIA SR-IOV for PCI ID %i
> +After=network.target nvidia-vgpud.service nvidia-vgpu-mgr.service
> +Before=pve-guests.service
> +
> +[Service]
> +Type=oneshot
> +ExecStartPre=/bin/sleep 5
> +ExecStart=/usr/lib/nvidia/sriov-manage -e %i
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/debian/rules b/debian/rules
> index 218df65..fe9a05d 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -6,3 +6,6 @@
>
> %:
> dh $@
> +
> +override_dh_installsystemd:
> + dh_installsystemd --no-start --no-enable --name nvidia-vgpud@ nvidia-vgpud@.service
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient Hannes Duerr
@ 2025-01-21 10:47 ` Dominik Csapak
2025-01-21 15:36 ` Thomas Lamprecht
0 siblings, 1 reply; 15+ messages in thread
From: Dominik Csapak @ 2025-01-21 10:47 UTC (permalink / raw)
To: Proxmox VE development discussion, Hannes Duerr; +Cc: Thomas Lamprecht
looked (&tested) mostly the script itself, not at the Makefile
Looks mostly OK to me, the only thing i noticed is that we only look at the current running kernel,
maybe we should also check if the opt in kernel is installed?
e.g. my test was:
install pve + this package
run 'pve-nvidia-vgpu-helper' => installs default headers
install proxmox-kernel-6.11
run 'pve-nvidia-vgpu-helper' again => says "all required packages are installed' but for dkms i
think it wouldn't work (and not loading the module after a reboot)
It's probably not a bad idea to install the packages for all installed kernel versions? (@Thomas ?)
Not super sure about how exactly DKMS works, but i think it tries to compile for all installed
kernel versions no?
On 1/21/25 11:04, Hannes Duerr wrote:
> we add the pve-nvidia-vgpu-helper script to make the installation of the
> required nvidia vgpu driver dependencies more convenient.
> We also add a Makefile to assist in building the debian package and
> installing the script
>
> Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
> ---
> Makefile | 54 ++++++++++++++++++++++++++++++++++
> pve-nvidia-vgpu-helper | 66 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 120 insertions(+)
> create mode 100644 Makefile
> create mode 100755 pve-nvidia-vgpu-helper
>
> diff --git a/Makefile b/Makefile
> new file mode 100644
> index 0000000..c6e461d
> --- /dev/null
> +++ b/Makefile
> @@ -0,0 +1,54 @@
> +include /usr/share/dpkg/default.mk
> +
> +PACKAGE=pve-nvidia-vgpu-helper
> +
> +BINDIR=/usr/bin/
> +DESTDIR=
> +
> +GITVERSION:=$(shell git rev-parse HEAD)
> +
> +BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION)
> +DSC=$(PACKAGE)_$(DEB_VERSION).dsc
> +
> +DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
> +
> +all:
> +deb: $(DEB)
> +
> +$(BUILDDIR): debian
> + rm -rf $@ $@.tmp
> + rsync -a * $@.tmp/
> + echo "git clone git://git.proxmox.com/git/pve-nvidia-vgpu-helper.git\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE
> + mv $@.tmp $@
> +
> +$(DEB): $(BUILDDIR)
> + cd $(BUILDDIR); dpkg-buildpackage -b -uc -us
> + lintian $(DEB)
> +
> +dsc: $(DSC)
> + $(MAKE) clean
> + $(MAKE) $(DSC)
> + lintian $(DSC)
> +
> +$(DSC): $(BUILDDIR)
> + cd $(BUILDDIR); dpkg-buildpackage -S -uc -us
> +
> +sbuild: $(DSC)
> + sbuild $(DSC)
> +
> +.PHONY: install
> +install: pve-nvidia-vgpu-helper
> + install -d $(DESTDIR)$(BINDIR)
> + install -m 0755 pve-nvidia-vgpu-helper $(DESTDIR)$(BINDIR)
> +
> +.PHONY: upload
> +upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
> +upload: $(DEB)
> + tar cf - $(DEB)|ssh repoman@repo.proxmox.com -- upload --product pve --dist $(UPLOAD_DIST)
> +
> +.PHONY: distclean
> +distclean: clean
> +
> +.PHONY: clean
> +clean:
> + rm -rf *~ $(PACKAGE)-[0-9]*/ $(PACKAGE)*.tar.* *.deb *.dsc *.changes *.build *.buildinfo
> diff --git a/pve-nvidia-vgpu-helper b/pve-nvidia-vgpu-helper
> new file mode 100755
> index 0000000..fc0856e
> --- /dev/null
> +++ b/pve-nvidia-vgpu-helper
> @@ -0,0 +1,66 @@
> +#!/usr/bin/perl
> +
> +use strict;
> +use warnings;
> +
> +use PVE::Tools qw(run_command);
> +use AptPkg::Cache;
> +
> +my @apt_install = qw(apt-get --no-install-recommends -o Dpkg:Options::=--force-confnew install --);
> +my @dependencies = qw(dkms libc6-dev);
> +my @missing_packages;
> +
> +die "Please execute the script with root privileges\n" if $>;
> +
> +my $apt_cache = AptPkg::Cache->new();
> +die "unable to initialize AptPkg::Cache\n" if !$apt_cache;
> +
> +sub package_is_installed {
> + my ($package) = @_;
> + my $p = $apt_cache->{$package};
> + if (!defined($p->{CurrentState}) || $p->{CurrentState} ne "Installed") {
> + push(@missing_packages, $package);
> + }
> +}
> +
> +foreach my $dependency (@dependencies) {
> + package_is_installed($dependency);
> +}
> +
> +
> +my $running_kernel;
> +run_command( ['/usr/bin/uname', '-r' ],
> + outfunc => sub { $running_kernel = shift } );
> +
> +my $default_major_minor_version;
> +run_command(['/usr/bin/dpkg-query', '-f', '${Depends}', '-W', 'proxmox-default-kernel'],
> + outfunc => sub { $default_major_minor_version = shift } );
> +
> +my $default_full_version;
> +run_command(['/usr/bin/dpkg-query', '-f', '${Version}', '-W', $default_major_minor_version],
> + outfunc => sub { $default_full_version = shift } );
> +
> +if ($running_kernel =~ /$default_full_version-pve/) {
> + print "You are running the proxmox default kernel `proxmox-kernel-$running_kernel`\n";
> + package_is_installed("proxmox-default-headers");
> +} elsif ($running_kernel =~ /pve/) {
> + print "You are running the non default proxmox kernel `proxmox-kernel-$running_kernel`\n";
> + package_is_installed("proxmox-headers-$running_kernel");
> +} else {
> + die "You are not using a proxmox-kernel, please make sure that the appropriate header package is installed.\n";
> +}
> +
> +if (!@missing_packages){
> + print "All required packages are installed, you can continue with the Nvidia vGPU driver installation.\n";
> + exit;
> +} else {
> + print "The following packages are missing:\n" . join("\n", @missing_packages) ."\n";
> + print "Would you like to install them now (y/n)?\n";
> +}
> +
> +my $answer = <STDIN>;
> +if (defined($answer) && $answer =~ m/^\s*y(?:es)?\s*$/i) {
> + if (system(@apt_install, @missing_packages) != 0) {
> + die "apt failed during the installation: ($?)\n";
> + }
> +}
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 4/4] debian: add and install nvidia-vgpu systemd template unit file
2025-01-21 10:36 ` Dominik Csapak
@ 2025-01-21 11:58 ` Hannes Dürr
2025-01-22 13:14 ` Thomas Lamprecht
1 sibling, 0 replies; 15+ messages in thread
From: Hannes Dürr @ 2025-01-21 11:58 UTC (permalink / raw)
To: Dominik Csapak, Proxmox VE development discussion
On 1/21/25 11:36, Dominik Csapak wrote:
> mhmm not sure if it's so good to reuse the exiting name of the nvidia
> service
> for this. also not sure how systemd likes it if there is a service
> 'foo.service'
> and a template 'foo@.service' (though my guess would be that it's not
> that big of an issue)
>
> i'd like to seee a distinct name for this (maybe even with pve prefix)
> like:
>
> pve-nvidia-sriov@.service
>
good point, will change that
> Then it's clear where it comes from and what it's for (vgpud is an
> nvidia daemon
> that does not really has anything to do with what this does)
> Or do you have any objections to that?
>
> also, would it make sense to add a
>
> ---
> ConditionPathExists=/usr/lib/nvidia/sriov-manage
> ---
>
> too?
>
also good point, will add this as well
> otherwise users that enable it accidentally or too early run into an
> ugly error
> (though that can be desired too)
>
> On 1/21/25 11:04, Hannes Duerr wrote:
>> Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
>> ---
>> debian/nvidia-vgpud@.service | 12 ++++++++++++
>> debian/rules | 3 +++
>> 2 files changed, 15 insertions(+)
>> create mode 100644 debian/nvidia-vgpud@.service
>>
>> diff --git a/debian/nvidia-vgpud@.service b/debian/nvidia-vgpud@.service
>> new file mode 100644
>> index 0000000..b3c1220
>> --- /dev/null
>> +++ b/debian/nvidia-vgpud@.service
>> @@ -0,0 +1,12 @@
>> +[Unit]
>> +Description=Enable NVIDIA SR-IOV for PCI ID %i
>> +After=network.target nvidia-vgpud.service nvidia-vgpu-mgr.service
>> +Before=pve-guests.service
>> +
>> +[Service]
>> +Type=oneshot
>> +ExecStartPre=/bin/sleep 5
>> +ExecStart=/usr/lib/nvidia/sriov-manage -e %i
>> +
>> +[Install]
>> +WantedBy=multi-user.target
>> diff --git a/debian/rules b/debian/rules
>> index 218df65..fe9a05d 100755
>> --- a/debian/rules
>> +++ b/debian/rules
>> @@ -6,3 +6,6 @@
>> %:
>> dh $@
>> +
>> +override_dh_installsystemd:
>> + dh_installsystemd --no-start --no-enable --name nvidia-vgpud@
>> nvidia-vgpud@.service
>
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient
2025-01-21 10:47 ` Dominik Csapak
@ 2025-01-21 15:36 ` Thomas Lamprecht
2025-01-21 16:12 ` Hannes Dürr
0 siblings, 1 reply; 15+ messages in thread
From: Thomas Lamprecht @ 2025-01-21 15:36 UTC (permalink / raw)
To: Dominik Csapak, Proxmox VE development discussion, Hannes Duerr
Am 21.01.25 um 11:47 schrieb Dominik Csapak:
> It's probably not a bad idea to install the packages for all installed kernel versions? (@Thomas ?)
Yeah, would be definitively a nice UX enhancement.
> Not super sure about how exactly DKMS works, but i think it tries to compile for all installed
> kernel versions no?
While I currently do not know the full semantics of DKMS, I also think
that it will build for all kernels that are installed, so that users can
boot these newer/other kernels and directly use the out-of-tree module
managed by DKMS.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient
2025-01-21 15:36 ` Thomas Lamprecht
@ 2025-01-21 16:12 ` Hannes Dürr
2025-01-22 15:23 ` Hannes Dürr
0 siblings, 1 reply; 15+ messages in thread
From: Hannes Dürr @ 2025-01-21 16:12 UTC (permalink / raw)
To: Thomas Lamprecht, Dominik Csapak, Proxmox VE development discussion
On 1/21/25 16:36, Thomas Lamprecht wrote:
> Am 21.01.25 um 11:47 schrieb Dominik Csapak:
>> It's probably not a bad idea to install the packages for all installed kernel versions? (@Thomas ?)
> Yeah, would be definitively a nice UX enhancement.
sounds good to me, will do.
>> Not super sure about how exactly DKMS works, but i think it tries to compile for all installed
>> kernel versions no?
> While I currently do not know the full semantics of DKMS, I also think
> that it will build for all kernels that are installed, so that users can
> boot these newer/other kernels and directly use the out-of-tree module
> managed by DKMS.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 4/4] debian: add and install nvidia-vgpu systemd template unit file
2025-01-21 10:36 ` Dominik Csapak
2025-01-21 11:58 ` Hannes Dürr
@ 2025-01-22 13:14 ` Thomas Lamprecht
1 sibling, 0 replies; 15+ messages in thread
From: Thomas Lamprecht @ 2025-01-22 13:14 UTC (permalink / raw)
To: Proxmox VE development discussion, Dominik Csapak, Hannes Duerr
Am 21.01.25 um 11:36 schrieb Dominik Csapak:
> On 1/21/25 11:04, Hannes Duerr wrote:
>> diff --git a/debian/nvidia-vgpud@.service b/debian/nvidia-vgpud@.service
>> new file mode 100644
>> index 0000000..b3c1220
>> --- /dev/null
>> +++ b/debian/nvidia-vgpud@.service
>
> mhmm not sure if it's so good to reuse the exiting name of the nvidia service
> for this. also not sure how systemd likes it if there is a service 'foo.service'
> and a template 'foo@.service' (though my guess would be that it's not that big of an issue)
>
> i'd like to seee a distinct name for this (maybe even with pve prefix) like:
>
> pve-nvidia-sriov@.service
>
> Then it's clear where it comes from and what it's for (vgpud is an nvidia daemon
> that does not really has anything to do with what this does)
> Or do you have any objections to that?
>
> also, would it make sense to add a
>
> ---
> ConditionPathExists=/usr/lib/nvidia/sriov-manage
> ---
>
> too?
>
> otherwise users that enable it accidentally or too early run into an ugly error
> (though that can be desired too)
An option might be to replace the ExecStartPre "sleep 5" with an actual pre-start
command provided by the helper that ensures that everything is setup correctly
and prints telling errors otherwise. That can then also handle any sleep that is
required, maybe in a more time-efficient way – like loop and check for the required
condition with shorter sleeps in-between, the wiki also mentions that this might
need to be adapted depending on the setup/HW.
Anyway, it would be good to get an actual commit message, it can be short but
could describe what this does and why a sleep is required in the first place,
also mentioning that this was taken over from the wiki [0] could be nice to
know.
https://pve.proxmox.com/mediawiki/index.php?title=NVIDIA_vGPU_on_Proxmox_VE&oldid=12125#Enabling_SR-IOV
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient
2025-01-21 16:12 ` Hannes Dürr
@ 2025-01-22 15:23 ` Hannes Dürr
2025-01-22 16:04 ` Thomas Lamprecht
0 siblings, 1 reply; 15+ messages in thread
From: Hannes Dürr @ 2025-01-22 15:23 UTC (permalink / raw)
To: pve-devel
On 1/21/25 17:12, Hannes Dürr wrote:
>
> On 1/21/25 16:36, Thomas Lamprecht wrote:
>> Am 21.01.25 um 11:47 schrieb Dominik Csapak:
>>> It's probably not a bad idea to install the packages for all
>>> installed kernel versions? (@Thomas ?)
>> Yeah, would be definitively a nice UX enhancement.
> sounds good to me, will do.
I have another suggestion and in my opinion the UX would be even better
if you also had the opt-in to only install the headers only for the
currently running kernel.
> pve-nvidia-vgpu-helper --only-running-kernel
There are quite a few users who have many, sometimes old, kernels on
their server but don't actually want headers for all of them installed.
What do you think?
>>> Not super sure about how exactly DKMS works, but i think it tries to
>>> compile for all installed
>>> kernel versions no?
>> While I currently do not know the full semantics of DKMS, I also think
>> that it will build for all kernels that are installed, so that users can
>> boot these newer/other kernels and directly use the out-of-tree module
>> managed by DKMS.
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient
2025-01-22 15:23 ` Hannes Dürr
@ 2025-01-22 16:04 ` Thomas Lamprecht
2025-01-23 12:38 ` Hannes Dürr
0 siblings, 1 reply; 15+ messages in thread
From: Thomas Lamprecht @ 2025-01-22 16:04 UTC (permalink / raw)
To: Proxmox VE development discussion, Hannes Dürr
Am 22.01.25 um 16:23 schrieb Hannes Dürr:
>
> On 1/21/25 17:12, Hannes Dürr wrote:
>>
>> On 1/21/25 16:36, Thomas Lamprecht wrote:
>>> Am 21.01.25 um 11:47 schrieb Dominik Csapak:
>>>> It's probably not a bad idea to install the packages for all
>>>> installed kernel versions? (@Thomas ?)
>>> Yeah, would be definitively a nice UX enhancement.
>> sounds good to me, will do.
>
> I have another suggestion and in my opinion the UX would be even better
> if you also had the opt-in to only install the headers only for the
> currently running kernel.
>
> > pve-nvidia-vgpu-helper --only-running-kernel
>
> There are quite a few users who have many, sometimes old, kernels on
> their server but don't actually want headers for all of them installed.
> What do you think?
FWIW: running and newer kernels could be a good heuristic to cover
most use cases.
But: did you test how DKMS handles copes with (older/other) kernels
without any headers available?
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient
2025-01-22 16:04 ` Thomas Lamprecht
@ 2025-01-23 12:38 ` Hannes Dürr
0 siblings, 0 replies; 15+ messages in thread
From: Hannes Dürr @ 2025-01-23 12:38 UTC (permalink / raw)
To: Thomas Lamprecht, Proxmox VE development discussion
On 1/22/25 17:04, Thomas Lamprecht wrote:
> Am 22.01.25 um 16:23 schrieb Hannes Dürr:
>> On 1/21/25 17:12, Hannes Dürr wrote:
>>> On 1/21/25 16:36, Thomas Lamprecht wrote:
>>>> Am 21.01.25 um 11:47 schrieb Dominik Csapak:
>>>>> It's probably not a bad idea to install the packages for all
>>>>> installed kernel versions? (@Thomas ?)
>>>> Yeah, would be definitively a nice UX enhancement.
>>> sounds good to me, will do.
>> I have another suggestion and in my opinion the UX would be even better
>> if you also had the opt-in to only install the headers only for the
>> currently running kernel.
>>
>> > pve-nvidia-vgpu-helper --only-running-kernel
>>
>> There are quite a few users who have many, sometimes old, kernels on
>> their server but don't actually want headers for all of them installed.
>> What do you think?
> FWIW: running and newer kernels could be a good heuristic to cover
> most use cases.
>
> But: did you test how DKMS handles copes with (older/other) kernels
> without any headers available?
If you use the script NVIDIA-Linux-x86_64-525.105.14-vgpu-kvm.run to
install the kernel module, you will be asked whether it should also be
initialised directly with dkms. With this option there are no problems
if the headers are only available for the currently running kernel.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-01-23 12:38 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-21 10:04 [pve-devel] [PATCH manager/nvidia-vgpu-helper v2 0/5] reduce setup steps for nvidia vgpu drivers Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 1/4] create a debian package to make the installation of Nvidia vGPU drivers more convenient Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 2/4] debian/control: add dependency for helper script Hannes Duerr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 3/4] add pve-nvidia-vgpu-helper and Makefile to make dependency installtion more convenient Hannes Duerr
2025-01-21 10:47 ` Dominik Csapak
2025-01-21 15:36 ` Thomas Lamprecht
2025-01-21 16:12 ` Hannes Dürr
2025-01-22 15:23 ` Hannes Dürr
2025-01-22 16:04 ` Thomas Lamprecht
2025-01-23 12:38 ` Hannes Dürr
2025-01-21 10:04 ` [pve-devel] [PATCH pve-nvidia-vgpu-helper v2 4/4] debian: add and install nvidia-vgpu systemd template unit file Hannes Duerr
2025-01-21 10:36 ` Dominik Csapak
2025-01-21 11:58 ` Hannes Dürr
2025-01-22 13:14 ` Thomas Lamprecht
2025-01-21 10:04 ` [pve-devel] [PATCH pve-manager v2 1/1] debian/control: add pve-nvidia-vgpu-helper as dependency Hannes Duerr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal