I am trying to apply this (https://github.com/openSUSE/SUSEPrime#user-content-nvidia-power-off-support-with-435xxx-driver-and-later-g05-driver-packages) recommendation. As I understand I need to add the code written there and pack it into my initramfs so that it will be executed by the kernel on every boot.
How do I do this?
Hi
There are three commands there, just copy/paste and run them as root user (switch to root user via su - );
test -s /etc/modprobe.d/09-nvidia-modprobe-pm-G05.conf || cp 09-nvidia-modprobe-pm-G05.conf /etc/modprobe.d
if ! -s /etc/dracut.conf.d/90-nvidia-dracut-G05.conf ]; then cp 90-nvidia-dracut-G05.conf /etc/dracut.conf.d/ && dracut -f fi
test -s /etc/udev/rules.d/90-nvidia-udev-pm-G05.rules || cp 90-nvidia-udev-pm-G05.rules /etc/udev/rules.d/
The above three commands do everything for you, the ‘dracut’ command will rebuild your initrd
If you remove the trailing \ or you could just pop it in a bash script change permissions and run…
#!/bin/bash
test -s /etc/modprobe.d/09-nvidia-modprobe-pm-G05.conf || \
cp 09-nvidia-modprobe-pm-G05.conf /etc/modprobe.d
if ! -s /etc/dracut.conf.d/90-nvidia-dracut-G05.conf ]; then
cp 90-nvidia-dracut-G05.conf /etc/dracut.conf.d/ && dracut -f
fi
test -s /etc/udev/rules.d/90-nvidia-udev-pm-G05.rules || \
cp 90-nvidia-udev-pm-G05.rules /etc/udev/rules.d/
Open an editor, or use vi, save above as say myscript, chmod 0755 myscript, then as root user (not sudo, switch to root user via su -) run it ./myscript
There are all kinds of neat optimizations you can achieve with dracut; for example,
dracut --hostonly --force --no-compress *# run as root*
… tries to create an initrd that is customized to your box, without many of the unneeded drivers, boot-time services, scripts and other stuff omitted.
You can also specify which of the numerous dracut tasks you won’t ever need in a /etc/dracut.conf.d/01-custom-for-my-box.conf (filename mostly arbitrary):
hostonly="yes"
compress="cat"
omit_dracutmodules+=" network kernel-network-modules ifcfg img-lib cifs fcoe fcoe-uefi rdma multipath iscsi qemu lvm mdraid dm dmraid cdrom pollcdrom plymouth btrfs wacom convertfs wicked ipv6 mtp-probe warpclock i18n crypt crypt-gpg cryptfs crypt-loop selinux "
omit_drivers+=" usb-storage uas ums-* snd soundcore snd-* hid-wiimote wacom hv_vmbus rmi_core dm-mod iscsi_if iscsi_tcp dm_multipath parport pcmcia jsm cdrom serial pcspkr "
As you can see, I omit a whole bunch needed only for servers, NAS/SAN stuff and older hardware (cdrom, pollcdrom); and who really needs sound while booting?!
OTOH, you may need btrfs for booting from/mounting those types of filesystems, and crypt for block-/volume-level encryption, and so on. **Your mileage may vary. **
I also never compress my initrd when booting from SSD (compress=“cat” in the file above, or –no-compress for the command line), it boots far quicker that way. My fastest boots according to systemd-analyze were 1.143s (cold) and 1.199s (warm) from Grub to desktop manager+network (1 static IPv4 route to DSL router). Those are outliers, though — it’s been more like slightly beneath 1.3s on average.
Finally, to make sure your NVidia stuff has been packed into the initrd, you can list its contents with
lsinitrd | less -N *# run as root*
Cheers!
Hostonly is default in openSUSE anyway; and disabling compression may result in significantly increased time required to load initrd by bootloader. So it is not clear what exactly is being optimized here.
Finally, to make sure your NVidia stuff has been packed into the initrd
The whole point of code discussed here is to avoid packing nVidia stuff in initrd.
Thank you very much, shortly after posting this message I realized I had totally missed the obvious: the code snippet was indeed to be executed from a Terminal. (Let me just point out that the script requires of course to be run from the actual directory containing the adequate files (i.e. 09-nvidia-modporobe…)
One last question remains, however: Will I have to re-run this script upon every kernel update? (Well I guess NVIDIA proprietary drivers don’t belong to Tumbleweed target repos so I will have to install them upon every kernel update too …
Anyway, thanks for the reply !
No, you won’t.
On my system, boot time improves when the kernel isn’t busy uncompressing its initrd. As I wrote above: Your Mileage May Vary (YMMV), especially if you happen to boot from USB, network or rotating rust. On my SSD-based system, it makes a difference of about half a second. Best to try both ways, measure and compare.
As for the dracut defaults — when I started with openSUSE 42.1 I don’t think »hostonly« was set as default back then, but I could be wrong.
Ah, I see. My bad, I should have read OP more closely.