Skip to content

Change nvidia.service from simple to oneshot service #1136

@shsamkit

Description

@shsamkit

Current situation

Currently nvidia.service is configured as a simple service.

Impact

A simple service is considered united started as soon as the ExecStart is kicked off

will consider the unit started immediately after the main service process has been forked offIf set to simple (the default if ExecStart= is specified but neither Type= nor BusName= are), the service manager will consider the unit started immediately after the main service process has been forked off.

This makes it impossible to wait for gpu driver installation to actually finish.

Ideal future situation

When changed to oneshot, the subsequent services will actually wait for the nvidia.service to finish, i.e. wait for drivers to be installed (see below Butane config for the full set of options to set).
The subsequent services can be configured to wait for nvidia.service as follows

[Unit]
Description=Bring up my GPU application
Requires=nvidia.service
After=nvidia.service

This needs to be coupled with RemainAfterExit=yes to ensure it doesn't get kicked-off automatically again.

Implementation options

Workaround: This can also be achieved with a drop-in systemd file for nvidia.service.

#butane config
storage:
  files:
    - path: /etc/systemd/system/nvidia.service.d/service-type-simple.conf
      contents:
        inline: |
          [Service]
          Type=oneshot
          RemainAfterExit=yes
          Before=containerd.service

However, this looks like a good to have default.

Additional information

Creating a new request from a brief discussion here: #1034 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions