Error install nvidia-387: Error! Bad return status for module build on kernel:












7















I'm trying to install nvidia-387 on my fresh Ubuntu 16.04.



Once I launch sudo apt-get install nvidia-387 I always end up in the following outputs:



Building initial module for 4.13.0-26-generic
Error! Bad return status for module build on kernel: 4.13.0-26-generic (x86_64)


During my searches I found lot of issues pointing to a wrong gcc version but after several attempts I wasn't able to find a way to go: following this discussion I tried with gcc 4.8/4-9/5.4/6 without any luck.



Any help?



Thank you very much.










share|improve this question



























    7















    I'm trying to install nvidia-387 on my fresh Ubuntu 16.04.



    Once I launch sudo apt-get install nvidia-387 I always end up in the following outputs:



    Building initial module for 4.13.0-26-generic
    Error! Bad return status for module build on kernel: 4.13.0-26-generic (x86_64)


    During my searches I found lot of issues pointing to a wrong gcc version but after several attempts I wasn't able to find a way to go: following this discussion I tried with gcc 4.8/4-9/5.4/6 without any luck.



    Any help?



    Thank you very much.










    share|improve this question

























      7












      7








      7


      5






      I'm trying to install nvidia-387 on my fresh Ubuntu 16.04.



      Once I launch sudo apt-get install nvidia-387 I always end up in the following outputs:



      Building initial module for 4.13.0-26-generic
      Error! Bad return status for module build on kernel: 4.13.0-26-generic (x86_64)


      During my searches I found lot of issues pointing to a wrong gcc version but after several attempts I wasn't able to find a way to go: following this discussion I tried with gcc 4.8/4-9/5.4/6 without any luck.



      Any help?



      Thank you very much.










      share|improve this question














      I'm trying to install nvidia-387 on my fresh Ubuntu 16.04.



      Once I launch sudo apt-get install nvidia-387 I always end up in the following outputs:



      Building initial module for 4.13.0-26-generic
      Error! Bad return status for module build on kernel: 4.13.0-26-generic (x86_64)


      During my searches I found lot of issues pointing to a wrong gcc version but after several attempts I wasn't able to find a way to go: following this discussion I tried with gcc 4.8/4-9/5.4/6 without any luck.



      Any help?



      Thank you very much.







      drivers nvidia gcc






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 15 '18 at 1:16









      luke035luke035

      5015




      5015






















          2 Answers
          2






          active

          oldest

          votes


















          9














          Looks like the issue is cause by some shuffling of linux headers in some recent linux kernel updates.



          Relevant discussion:
          https://devtalk.nvidia.com/default/topic/1028016/linux/patch-for-compiling-v384-98-modules-with-linux-v4-14-9-/



          I had the exact same issue and I fixed it by applying the patch suggested by user PGNd in the discussion above.



          Step by step instructions for manual edit of the nvidia src files on Ubuntu 16.04:





          1. sudo apt-get install nvidia-387 (this will fail)


          2. sudo nano /usr/src/nvidia-387-387.26/nvidia-uvm/uvm8_va_block.c
            (you should replace nvidia-387-387.26 with the version you are trying to install.)

          3. Add the line #include <linux/sched/task_stack.h> before the other include statements at the beginning of the file

          4. Run sudo dpkg-reconfigure nvidia-387 to rebuild the nvidia driver

          5. Reboot


          This should work as a temporary workaround until nvidia releases a fix.
          I was able to install cuda-9.1 after doing this.






          share|improve this answer



















          • 1





            It worked perfectly, you saved me! Thanks a lot!

            – luke035
            Jan 15 '18 at 23:07











          • This worked! For posterity this can also cause a login loop. You may have found yourself in this situation by trying to install nvidia drivers (in my case to get CUDA 9.1 running) prior to a fresh 16.04 install being fully updated. Initially the drivers may have appeared to work (on an older kernel) but then the update to 14.3.x left them in this broken state.

            – Ian Danforth
            Jan 21 '18 at 18:25



















          0














          @adikus's answer did not work for me. Even after adding the header the build error continue to happen. What fixed the issue for me was upgrading the version of the drivers to 410:



          sudo apt-get update
          sudo apt-get install nvidia-410


          The compilation for this version succeeded and I'm now able to play games once again.






          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%2f995969%2ferror-install-nvidia-387-error-bad-return-status-for-module-build-on-kernel%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









            9














            Looks like the issue is cause by some shuffling of linux headers in some recent linux kernel updates.



            Relevant discussion:
            https://devtalk.nvidia.com/default/topic/1028016/linux/patch-for-compiling-v384-98-modules-with-linux-v4-14-9-/



            I had the exact same issue and I fixed it by applying the patch suggested by user PGNd in the discussion above.



            Step by step instructions for manual edit of the nvidia src files on Ubuntu 16.04:





            1. sudo apt-get install nvidia-387 (this will fail)


            2. sudo nano /usr/src/nvidia-387-387.26/nvidia-uvm/uvm8_va_block.c
              (you should replace nvidia-387-387.26 with the version you are trying to install.)

            3. Add the line #include <linux/sched/task_stack.h> before the other include statements at the beginning of the file

            4. Run sudo dpkg-reconfigure nvidia-387 to rebuild the nvidia driver

            5. Reboot


            This should work as a temporary workaround until nvidia releases a fix.
            I was able to install cuda-9.1 after doing this.






            share|improve this answer



















            • 1





              It worked perfectly, you saved me! Thanks a lot!

              – luke035
              Jan 15 '18 at 23:07











            • This worked! For posterity this can also cause a login loop. You may have found yourself in this situation by trying to install nvidia drivers (in my case to get CUDA 9.1 running) prior to a fresh 16.04 install being fully updated. Initially the drivers may have appeared to work (on an older kernel) but then the update to 14.3.x left them in this broken state.

              – Ian Danforth
              Jan 21 '18 at 18:25
















            9














            Looks like the issue is cause by some shuffling of linux headers in some recent linux kernel updates.



            Relevant discussion:
            https://devtalk.nvidia.com/default/topic/1028016/linux/patch-for-compiling-v384-98-modules-with-linux-v4-14-9-/



            I had the exact same issue and I fixed it by applying the patch suggested by user PGNd in the discussion above.



            Step by step instructions for manual edit of the nvidia src files on Ubuntu 16.04:





            1. sudo apt-get install nvidia-387 (this will fail)


            2. sudo nano /usr/src/nvidia-387-387.26/nvidia-uvm/uvm8_va_block.c
              (you should replace nvidia-387-387.26 with the version you are trying to install.)

            3. Add the line #include <linux/sched/task_stack.h> before the other include statements at the beginning of the file

            4. Run sudo dpkg-reconfigure nvidia-387 to rebuild the nvidia driver

            5. Reboot


            This should work as a temporary workaround until nvidia releases a fix.
            I was able to install cuda-9.1 after doing this.






            share|improve this answer



















            • 1





              It worked perfectly, you saved me! Thanks a lot!

              – luke035
              Jan 15 '18 at 23:07











            • This worked! For posterity this can also cause a login loop. You may have found yourself in this situation by trying to install nvidia drivers (in my case to get CUDA 9.1 running) prior to a fresh 16.04 install being fully updated. Initially the drivers may have appeared to work (on an older kernel) but then the update to 14.3.x left them in this broken state.

              – Ian Danforth
              Jan 21 '18 at 18:25














            9












            9








            9







            Looks like the issue is cause by some shuffling of linux headers in some recent linux kernel updates.



            Relevant discussion:
            https://devtalk.nvidia.com/default/topic/1028016/linux/patch-for-compiling-v384-98-modules-with-linux-v4-14-9-/



            I had the exact same issue and I fixed it by applying the patch suggested by user PGNd in the discussion above.



            Step by step instructions for manual edit of the nvidia src files on Ubuntu 16.04:





            1. sudo apt-get install nvidia-387 (this will fail)


            2. sudo nano /usr/src/nvidia-387-387.26/nvidia-uvm/uvm8_va_block.c
              (you should replace nvidia-387-387.26 with the version you are trying to install.)

            3. Add the line #include <linux/sched/task_stack.h> before the other include statements at the beginning of the file

            4. Run sudo dpkg-reconfigure nvidia-387 to rebuild the nvidia driver

            5. Reboot


            This should work as a temporary workaround until nvidia releases a fix.
            I was able to install cuda-9.1 after doing this.






            share|improve this answer













            Looks like the issue is cause by some shuffling of linux headers in some recent linux kernel updates.



            Relevant discussion:
            https://devtalk.nvidia.com/default/topic/1028016/linux/patch-for-compiling-v384-98-modules-with-linux-v4-14-9-/



            I had the exact same issue and I fixed it by applying the patch suggested by user PGNd in the discussion above.



            Step by step instructions for manual edit of the nvidia src files on Ubuntu 16.04:





            1. sudo apt-get install nvidia-387 (this will fail)


            2. sudo nano /usr/src/nvidia-387-387.26/nvidia-uvm/uvm8_va_block.c
              (you should replace nvidia-387-387.26 with the version you are trying to install.)

            3. Add the line #include <linux/sched/task_stack.h> before the other include statements at the beginning of the file

            4. Run sudo dpkg-reconfigure nvidia-387 to rebuild the nvidia driver

            5. Reboot


            This should work as a temporary workaround until nvidia releases a fix.
            I was able to install cuda-9.1 after doing this.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 15 '18 at 15:29









            adikusadikus

            1061




            1061








            • 1





              It worked perfectly, you saved me! Thanks a lot!

              – luke035
              Jan 15 '18 at 23:07











            • This worked! For posterity this can also cause a login loop. You may have found yourself in this situation by trying to install nvidia drivers (in my case to get CUDA 9.1 running) prior to a fresh 16.04 install being fully updated. Initially the drivers may have appeared to work (on an older kernel) but then the update to 14.3.x left them in this broken state.

              – Ian Danforth
              Jan 21 '18 at 18:25














            • 1





              It worked perfectly, you saved me! Thanks a lot!

              – luke035
              Jan 15 '18 at 23:07











            • This worked! For posterity this can also cause a login loop. You may have found yourself in this situation by trying to install nvidia drivers (in my case to get CUDA 9.1 running) prior to a fresh 16.04 install being fully updated. Initially the drivers may have appeared to work (on an older kernel) but then the update to 14.3.x left them in this broken state.

              – Ian Danforth
              Jan 21 '18 at 18:25








            1




            1





            It worked perfectly, you saved me! Thanks a lot!

            – luke035
            Jan 15 '18 at 23:07





            It worked perfectly, you saved me! Thanks a lot!

            – luke035
            Jan 15 '18 at 23:07













            This worked! For posterity this can also cause a login loop. You may have found yourself in this situation by trying to install nvidia drivers (in my case to get CUDA 9.1 running) prior to a fresh 16.04 install being fully updated. Initially the drivers may have appeared to work (on an older kernel) but then the update to 14.3.x left them in this broken state.

            – Ian Danforth
            Jan 21 '18 at 18:25





            This worked! For posterity this can also cause a login loop. You may have found yourself in this situation by trying to install nvidia drivers (in my case to get CUDA 9.1 running) prior to a fresh 16.04 install being fully updated. Initially the drivers may have appeared to work (on an older kernel) but then the update to 14.3.x left them in this broken state.

            – Ian Danforth
            Jan 21 '18 at 18:25













            0














            @adikus's answer did not work for me. Even after adding the header the build error continue to happen. What fixed the issue for me was upgrading the version of the drivers to 410:



            sudo apt-get update
            sudo apt-get install nvidia-410


            The compilation for this version succeeded and I'm now able to play games once again.






            share|improve this answer




























              0














              @adikus's answer did not work for me. Even after adding the header the build error continue to happen. What fixed the issue for me was upgrading the version of the drivers to 410:



              sudo apt-get update
              sudo apt-get install nvidia-410


              The compilation for this version succeeded and I'm now able to play games once again.






              share|improve this answer


























                0












                0








                0







                @adikus's answer did not work for me. Even after adding the header the build error continue to happen. What fixed the issue for me was upgrading the version of the drivers to 410:



                sudo apt-get update
                sudo apt-get install nvidia-410


                The compilation for this version succeeded and I'm now able to play games once again.






                share|improve this answer













                @adikus's answer did not work for me. Even after adding the header the build error continue to happen. What fixed the issue for me was upgrading the version of the drivers to 410:



                sudo apt-get update
                sudo apt-get install nvidia-410


                The compilation for this version succeeded and I'm now able to play games once again.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 17 at 23:17









                SergioSergio

                101




                101






























                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f995969%2ferror-install-nvidia-387-error-bad-return-status-for-module-build-on-kernel%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

                    數位音樂下載

                    When can things happen in Etherscan, such as the picture below?

                    格利澤436b