nvidia-settings (&prime-select) fails to switch GPU after removal of GRUB












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!










share|improve this question





























    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!










    share|improve this question



























      0












      0








      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!










      share|improve this question















      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!







      nvidia nvidia-optimus nvidia-prime nvidia-settings






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 5 '18 at 13:45

























      asked Oct 5 '18 at 13:40









      Basti

      164




      164






















          2 Answers
          2






          active

          oldest

          votes


















          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.






          share|improve this answer





























            0














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



            Now it works






            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1081183%2fnvidia-settings-prime-select-fails-to-switch-gpu-after-removal-of-grub%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              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.






              share|improve this answer


























                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.






                share|improve this answer
























                  0












                  0








                  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.






                  share|improve this answer












                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 6 '18 at 10:04









                  Thomas

                  3,53581427




                  3,53581427

























                      0














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



                      Now it works






                      share|improve this answer


























                        0














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



                        Now it works






                        share|improve this answer
























                          0












                          0








                          0






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



                          Now it works






                          share|improve this answer












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



                          Now it works







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 27 '18 at 8:36









                          Basti

                          164




                          164






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1081183%2fnvidia-settings-prime-select-fails-to-switch-gpu-after-removal-of-grub%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How did Captain America manage to do this?

                              迪纳利

                              南乌拉尔铁路局