Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions ubuntu22.04/nvidia-driver
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@ DRIVER_ARCH=${TARGETARCH/amd64/x86_64} && DRIVER_ARCH=${DRIVER_ARCH/arm64/aarch6

echo "DRIVER_ARCH is $DRIVER_ARCH"

# Run apt-get -qq quietly, on failure print actual error to stdout and exit.
_apt_quiet() {
local err_file
err_file=$(mktemp)
trap "rm -f \"$err_file\"" RETURN
if ! apt-get -qq "$@" 2>"$err_file"; then
echo "ERROR: apt-get failed (exit $?): $*"
echo "apt-get stderr:"
cat "$err_file"
return 1
fi
return 0
}

_enable_fips_if_required() {
if [[ -n "${UBUNTU_PRO_TOKEN}" && ${KERNEL_VERSION} =~ "fips" ]]; then
echo "Ubuntu Pro token and FIPS kernel detected"
apt-get -qq install --no-install-recommends ubuntu-advantage-tools > /dev/null
_apt_quiet install --no-install-recommends ubuntu-advantage-tools
echo "Attaching Ubuntu Pro token..."
pro attach --no-auto-enable "${UBUNTU_PRO_TOKEN}"
echo "Enabling FIPS apt repo access..."
Expand All @@ -39,7 +53,7 @@ _enable_fips_if_required() {
_update_package_cache() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
echo "Updating the package cache..."
if ! apt-get -qq update; then
if ! _apt_quiet update; then
echo "ERROR: Failed to update package cache. "\
"Ensure that the cluster can access the proper networks."
exit 1
Expand Down Expand Up @@ -89,11 +103,11 @@ _install_prerequisites() (
mkdir -p /lib/modules/${KERNEL_VERSION}/proc

echo "Installing Linux kernel headers..."
apt-get -qq install --no-install-recommends linux-headers-${KERNEL_VERSION} > /dev/null
_apt_quiet install --no-install-recommends linux-headers-${KERNEL_VERSION}

echo "Installing Linux kernel module files..."
apt-get -qq download linux-image-${KERNEL_VERSION} && dpkg -x linux-image*.deb .
{ apt-get -qq download linux-modules-${KERNEL_VERSION} && dpkg -x linux-modules*.deb . || true; } 2> /dev/null
_apt_quiet download linux-image-${KERNEL_VERSION} && dpkg -x linux-image*.deb .
{ _apt_quiet download linux-modules-${KERNEL_VERSION} && dpkg -x linux-modules*.deb . || true; }
mv lib/modules/${KERNEL_VERSION}/modules.* /lib/modules/${KERNEL_VERSION}
mv lib/modules/${KERNEL_VERSION}/kernel /lib/modules/${KERNEL_VERSION}
depmod ${KERNEL_VERSION}
Expand All @@ -111,7 +125,7 @@ _install_prerequisites() (
# Cleanup the prerequisites installed above.
_remove_prerequisites() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
apt-get -qq purge linux-headers-${KERNEL_VERSION} > /dev/null
_apt_quiet purge linux-headers-${KERNEL_VERSION}
# TODO remove module files not matching an existing driver package.
fi
}
Expand Down
16 changes: 15 additions & 1 deletion ubuntu22.04/precompiled/nvidia-driver
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,24 @@ nvsdm_install() {
fi
}

# Run apt-get -qq quietly, on failure print actual error to stdout and exit.
_apt_quiet() {
local err_file
err_file=$(mktemp)
trap "rm -f \"$err_file\"" RETURN
if ! apt-get -qq "$@" 2>"$err_file"; then
echo "ERROR: apt-get failed (exit $?): $*"
echo "apt-get stderr:"
cat "$err_file"
return 1
fi
return 0
}

_update_package_cache() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
echo "Updating the package cache..."
if ! apt-get -qq update; then
if ! _apt_quiet update; then
echo "ERROR: Failed to update package cache. "\
"Ensure that the cluster can access the proper networks."
exit 1
Expand Down
28 changes: 21 additions & 7 deletions ubuntu24.04/nvidia-driver
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@ DRIVER_ARCH=${TARGETARCH/amd64/x86_64} && DRIVER_ARCH=${DRIVER_ARCH/arm64/aarch6

echo "DRIVER_ARCH is $DRIVER_ARCH"

# Run apt-get -qq quietly, on failure print actual error to stdout and exit.
_apt_quiet() {
local err_file
err_file=$(mktemp)
trap "rm -f \"$err_file\"" RETURN
if ! apt-get -qq "$@" 2>"$err_file"; then
echo "ERROR: apt-get failed (exit $?): $*"
echo "apt-get stderr:"
cat "$err_file"
return 1
fi
return 0
}

_enable_fips_if_required() {
if [[ -n "${UBUNTU_PRO_TOKEN}" && ${KERNEL_VERSION} =~ "fips" ]]; then
echo "Ubuntu Pro token and FIPS kernel detected"
apt-get -qq install --no-install-recommends ubuntu-advantage-tools > /dev/null
_apt_quiet install --no-install-recommends ubuntu-advantage-tools

# This workaround is needed in Ubuntu 24.04 as OpenSSL attempts to leverage the FIPS provider
# when the underlying kernel is FIPS enabled.
Expand All @@ -39,7 +53,7 @@ _enable_fips_if_required() {
echo "Enabling FIPS apt repo access..."
pro enable --access-only --assume-yes fips-updates
echo "Installing the OpenSSL FIPS modules"
apt-get -qq install --no-install-recommends ubuntu-fips-userspace > /dev/null
_apt_quiet install --no-install-recommends ubuntu-fips-userspace

# With the OpenSSL FIPS module installed, OpenSSL can now work with the default settings,
unset OPENSSL_FORCE_FIPS_MODE
Expand All @@ -49,7 +63,7 @@ _enable_fips_if_required() {
_update_package_cache() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
echo "Updating the package cache..."
if ! apt-get -qq update; then
if ! _apt_quiet update; then
echo "ERROR: Failed to update package cache. "\
"Ensure that the cluster can access the proper networks."
exit 1
Expand Down Expand Up @@ -99,11 +113,11 @@ _install_prerequisites() (
mkdir -p /lib/modules/${KERNEL_VERSION}/proc

echo "Installing Linux kernel headers..."
apt-get -qq install --no-install-recommends linux-headers-${KERNEL_VERSION} > /dev/null
_apt_quiet install --no-install-recommends linux-headers-${KERNEL_VERSION}

echo "Installing Linux kernel module files..."
apt-get -qq download linux-image-${KERNEL_VERSION} && dpkg -x linux-image*.deb .
{ apt-get -qq download linux-modules-${KERNEL_VERSION} && dpkg -x linux-modules*.deb . || true; } 2> /dev/null
_apt_quiet download linux-image-${KERNEL_VERSION} && dpkg -x linux-image*.deb .
{ _apt_quiet download linux-modules-${KERNEL_VERSION} && dpkg -x linux-modules*.deb . || true; }
mv lib/modules/${KERNEL_VERSION}/modules.* /lib/modules/${KERNEL_VERSION}
mv lib/modules/${KERNEL_VERSION}/kernel /lib/modules/${KERNEL_VERSION}
depmod ${KERNEL_VERSION}
Expand All @@ -121,7 +135,7 @@ _install_prerequisites() (
# Cleanup the prerequisites installed above.
_remove_prerequisites() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
apt-get -qq purge linux-headers-${KERNEL_VERSION} > /dev/null
_apt_quiet purge linux-headers-${KERNEL_VERSION}
# TODO remove module files not matching an existing driver package.
fi
}
Expand Down
16 changes: 15 additions & 1 deletion ubuntu24.04/precompiled/nvidia-driver
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,24 @@ nvsdm_install() {
fi
}

# Run apt-get -qq quietly, on failure print actual error to stdout and exit.
_apt_quiet() {
local err_file
err_file=$(mktemp)
trap "rm -f \"$err_file\"" RETURN
if ! apt-get -qq "$@" 2>"$err_file"; then
echo "ERROR: apt-get failed (exit $?): $*"
echo "apt-get stderr:"
cat "$err_file"
return 1
fi
return 0
}

_update_package_cache() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
echo "Updating the package cache..."
if ! apt-get -qq update; then
if ! _apt_quiet update; then
echo "ERROR: Failed to update package cache. "\
"Ensure that the cluster can access the proper networks."
exit 1
Expand Down
26 changes: 20 additions & 6 deletions vgpu-manager/ubuntu22.04/nvidia-driver
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,24 @@ MODPROBE_CONFIG_DIR="/etc/modprobe.d"

export DEBIAN_FRONTEND=noninteractive

# Run apt-get -qq quietly, on failure print actual error to stdout and exit.
_apt_quiet() {
local err_file
err_file=$(mktemp)
trap "rm -f \"$err_file\"" RETURN
if ! apt-get -qq "$@" 2>"$err_file"; then
echo "ERROR: apt-get failed (exit $?): $*"
echo "apt-get stderr:"
cat "$err_file"
return 1
fi
return 0
}

_update_package_cache() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
echo "Updating the package cache..."
apt-get -qq update
_apt_quiet update
fi
}

Expand Down Expand Up @@ -56,13 +70,13 @@ _install_prerequisites() {
mkdir -p /lib/modules/${KERNEL_VERSION}/proc

echo "Installing Linux kernel headers..."
apt-get -qq install --no-install-recommends linux-headers-${KERNEL_VERSION} > /dev/null
_apt_quiet install --no-install-recommends linux-headers-${KERNEL_VERSION}

echo "Installing Linux kernel module files..."
apt-get -qq download linux-image-${KERNEL_VERSION} && dpkg -x linux-image*.deb .
{ apt-get -qq download linux-modules-${KERNEL_VERSION} && dpkg -x linux-modules*.deb . || true; } 2> /dev/null
_apt_quiet download linux-image-${KERNEL_VERSION} && dpkg -x linux-image*.deb .
{ _apt_quiet download linux-modules-${KERNEL_VERSION} && dpkg -x linux-modules*.deb . || true; }
# linux-modules-extra contains pci-pf-stub which is required when enabling SR-IOV on a physical GPU
{ apt-get -qq download linux-modules-extra-${KERNEL_VERSION} && dpkg -x linux-modules-extra*.deb . || true; } 2> /dev/null
{ _apt_quiet download linux-modules-extra-${KERNEL_VERSION} && dpkg -x linux-modules-extra*.deb . || true; }
mv lib/modules/${KERNEL_VERSION}/modules.* /lib/modules/${KERNEL_VERSION}
mv lib/modules/${KERNEL_VERSION}/kernel /lib/modules/${KERNEL_VERSION}
depmod ${KERNEL_VERSION}
Expand All @@ -80,7 +94,7 @@ _install_prerequisites() {
# Cleanup the prerequisites installed above.
_remove_prerequisites() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
apt-get -qq purge linux-headers-${KERNEL_VERSION} > /dev/null
_apt_quiet purge linux-headers-${KERNEL_VERSION}
# TODO remove module files not matching an existing driver package.
fi
}
Expand Down
26 changes: 20 additions & 6 deletions vgpu-manager/ubuntu24.04/nvidia-driver
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,24 @@ MODPROBE_CONFIG_DIR="/etc/modprobe.d"

export DEBIAN_FRONTEND=noninteractive

# Run apt-get -qq quietly, on failure print actual error to stdout and exit.
_apt_quiet() {
local err_file
err_file=$(mktemp)
trap "rm -f \"$err_file\"" RETURN
if ! apt-get -qq "$@" 2>"$err_file"; then
echo "ERROR: apt-get failed (exit $?): $*"
echo "apt-get stderr:"
cat "$err_file"
return 1
fi
return 0
}

_update_package_cache() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
echo "Updating the package cache..."
apt-get -qq update
_apt_quiet update
fi
}

Expand Down Expand Up @@ -56,13 +70,13 @@ _install_prerequisites() {
mkdir -p /lib/modules/${KERNEL_VERSION}/proc

echo "Installing Linux kernel headers..."
apt-get -qq install --no-install-recommends linux-headers-${KERNEL_VERSION} > /dev/null
_apt_quiet install --no-install-recommends linux-headers-${KERNEL_VERSION}

echo "Installing Linux kernel module files..."
apt-get -qq download linux-image-${KERNEL_VERSION} && dpkg -x linux-image*.deb .
{ apt-get -qq download linux-modules-${KERNEL_VERSION} && dpkg -x linux-modules*.deb . || true; } 2> /dev/null
_apt_quiet download linux-image-${KERNEL_VERSION} && dpkg -x linux-image*.deb .
{ _apt_quiet download linux-modules-${KERNEL_VERSION} && dpkg -x linux-modules*.deb . || true; }
# linux-modules-extra contains pci-pf-stub which is required when enabling SR-IOV on a physical GPU
{ apt-get -qq download linux-modules-extra-${KERNEL_VERSION} && dpkg -x linux-modules-extra*.deb . || true; } 2> /dev/null
{ _apt_quiet download linux-modules-extra-${KERNEL_VERSION} && dpkg -x linux-modules-extra*.deb . || true; }
mv lib/modules/${KERNEL_VERSION}/modules.* /lib/modules/${KERNEL_VERSION}
mv lib/modules/${KERNEL_VERSION}/kernel /lib/modules/${KERNEL_VERSION}
depmod ${KERNEL_VERSION}
Expand All @@ -80,7 +94,7 @@ _install_prerequisites() {
# Cleanup the prerequisites installed above.
_remove_prerequisites() {
if [ "${PACKAGE_TAG:-}" != "builtin" ]; then
apt-get -qq purge linux-headers-${KERNEL_VERSION} > /dev/null
_apt_quiet purge linux-headers-${KERNEL_VERSION}
# TODO remove module files not matching an existing driver package.
fi
}
Expand Down