0

Recently I purged grub on my EFI-System (before you ask: I simply don't like it). Now nvidia-settings and prime-select throw an error when I attempt to change GPU (which fails because of this 'stupid' error):

Info: selecting the intel profile
Traceback (most recent call last):
  File "/usr/bin/prime-select", line 298, in <module>
    switcher.enable_profile(arg)
  File "/usr/bin/prime-select", line 120, in enable_profile
    self._disable_nvidia()
  File "/usr/bin/prime-select", line 138, in _disable_nvidia
    self._update_grub()
  File "/usr/bin/prime-select", line 264, in _update_grub
    subprocess.call(['update-grub'])
  File "/usr/lib/python3.6/subprocess.py", line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'update-grub': 'update-grub'

Is it true they (nvidia) hardcoded the existence of grub in their script? Lines 127-159 of /usr/bin/prime-select:

 def _disable_nvidia(self):
        boot_params = {}
        # Get the VGA connectors to disable on card1
        # in the form of boot parameters
        vga_params = self._get_boot_params_from_phantom_vga_connectors()
        for elem in vga_params:
            elems = elem.split('=')
            boot_params[elems[0]] = elems[1]
        boot_params['nouveau.runpm'] = '0'
        self._add_boot_params(self._grub_cmdline_start, self._grub_path, boot_params)

        self._update_grub()

        self._blacklist_nvidia()
        self._update_initramfs()

        self._enable_prime_service()

    def _enable_nvidia(self):
        self._remove_boot_params(self._grub_cmdline_start,
                                 self._grub_path, ['nouveau.runpm', 'video=VGA'])
        self._update_grub()

        try:
            os.unlink(self._blacklist_file)
        except:
            pass

        self._update_initramfs()

        self._disable_prime_service()

    def _blacklist_nvidia(self):
...

I don't understand exactly what the script does in detail, and want to ask before I blame Nvidia directly.

Alternatively, I'd be thankful if someone could tell my which lines to comment out (in /usr/bin/prime-select) to just skip the grub-stuff. Thanks!

0

Well, you are using a Linux distribution that does use grub by default and many scripts assume that the grub tools are available to make changes that are easy to use for ordinary users.

Now if you change something like the bootloader, which is an essential part of the distro, the only one to blame is you.

An easy way to fix your problem would be to comment out the subprocess.call(['update-grub']) and replace it with pass, to make the function _update_grub do nothing.

def _update_grub(self):
    #subprocess.call(['update-grub'])
    pass

But you also might want to exchange this function to update the bootloader you are using to pick up an eventual newly generated initial ramdisk.

0

Solution is to simply add an empty file: /etc/default/grub

Now it works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.