Fixed userspace service when boot

Hi, NVIDIA developer:

Among the user services of NX, there are two services that are particularly time-consuming: nvpmodel and nv-l4t-usb-device-mode.service. Can these two services be disabled after the first startup? I use the following method to achieve it
Use systemctl edit to edit the following content,

For nvpmode

sudo systemctl edit nvpmodel.service

[Unit]
ConditionPathExists=!/etc/first_boot_nvpmodel_done

[Service]
ExecStartPost=/bin/touch /etc/first_boot_nvpmodel_done

For nv-l4t-usb-device-mode.service

sudo systemctl edit nv-l4t-bootloader-config.service

[Unit]
ConditionPathExists=!/etc/first_boot_l4t_config_done

[Service]
ExecStartPost=/usr/bin/touch /etc/first_boot_l4t_config_done

This will generate a file in the /etc directory at the first startup, and each subsequent startup will determine whether this file exists. If it exists, these two services will be skipped.

Now boot time:

Startup finished in 9.645s (kernel) + 5.684s (userspace) = 15.329s
multi-user.target reached after 5.580s in userspace

Is this feasible?

Thank you,

Best regards,
Ultwcz

Normally you would just disable or enable like this:

  • sudo systemctl disable <service name>
  • sudo systemctl enable <service name>

If the service was already running, the above won’t stop it until the next reboot. You could “sudo systemctl stop <service>”.

You can find all services via “systemctl list-units”. Typically you could search for key words via something like:
systemctl list-units | egrep -i '(usb|nvpmodel)'
(this would show units with the name “usb” or “nvpmodel” in the name)

You probably don’t want to stop nvpmodel. I don’t know which mode it would put it in, but this affects all CPU cores. I don’t know what the result is of stopping the service; perhaps it leaves it at the current setting, or at some other fallback setting. This is the service which monitors power usage and also sets clocks on CPU cores in a dynamic manner depending on circumstances.

One reason nvpmodel might take time might not be the service at all (maybe someone from NVIDIA can comment on this), but how a multi-core system starts up. During boot only the first CPU core runs. Once the system is fully booted the other cores tend to be enabled. As a requirement for nvpmodel to run I suspect it must wait for all cores to go online. Perhaps the wait is for the cores to come online, and not due to the service itself? Don’t know, but keep that in mind as you experiment with it.

Thank you, @linuxdev.

I know the importance of nvpmodel service. I’ll study it again and decide whether to disable this service.