Loading a kernel module at boot












0















I have an Intel NUC, and I've compiled a kernel extension to control the LED. It has created a .ko file at /lib/modules/4.15.0-38-generic/updates/dkms/nuc_led.ko (which matches uname -r). Manually loading the extension works great:



sudo modprobe wmi
sudo insmod /lib/modules/4.15.0-38-generic/updates/dkms/nuc_led.ko
echo 'ring,80,blink_medium,green' | sudo tee /proc/acpi/nuc_led > /dev/null


This works.



However the extension is not currently loaded at boot. I would like to put commands to turn the LED on and off in rc.local and rc6.d/ but these are not working, I have to run the modprobe commands manually, and even then my file in rc6.d/ (shown below) is not working - the LED remains on.



What am I doing wrong?



$ cat /etc/rc6.d/zz_led_off.sh
#! /bin/bash

echo 'ring,0,none,off' | sudo tee /proc/acpi/nuc_led > /dev/null

$ ls -la /etc/rc6.d/zz_led_off.sh | grep zz
-rwxr-xr-x 1 root root 79 Nov 9 10:07 zz_led_off.sh









share|improve this question























  • why not compile directly into the kernel, instead of being a module?

    – Doug Smythies
    Nov 9 '18 at 16:18











  • @DougSmythies I'm not sure what that means, how would I compile it directly into the kernel?

    – user31415629
    Nov 12 '18 at 15:32











  • Sorry, I think I was wrong. If I understand correctly, because it isn't part of the kernel code, but rather an extension to it, I don't think direct compile into the kernel is an option.

    – Doug Smythies
    Nov 12 '18 at 15:51
















0















I have an Intel NUC, and I've compiled a kernel extension to control the LED. It has created a .ko file at /lib/modules/4.15.0-38-generic/updates/dkms/nuc_led.ko (which matches uname -r). Manually loading the extension works great:



sudo modprobe wmi
sudo insmod /lib/modules/4.15.0-38-generic/updates/dkms/nuc_led.ko
echo 'ring,80,blink_medium,green' | sudo tee /proc/acpi/nuc_led > /dev/null


This works.



However the extension is not currently loaded at boot. I would like to put commands to turn the LED on and off in rc.local and rc6.d/ but these are not working, I have to run the modprobe commands manually, and even then my file in rc6.d/ (shown below) is not working - the LED remains on.



What am I doing wrong?



$ cat /etc/rc6.d/zz_led_off.sh
#! /bin/bash

echo 'ring,0,none,off' | sudo tee /proc/acpi/nuc_led > /dev/null

$ ls -la /etc/rc6.d/zz_led_off.sh | grep zz
-rwxr-xr-x 1 root root 79 Nov 9 10:07 zz_led_off.sh









share|improve this question























  • why not compile directly into the kernel, instead of being a module?

    – Doug Smythies
    Nov 9 '18 at 16:18











  • @DougSmythies I'm not sure what that means, how would I compile it directly into the kernel?

    – user31415629
    Nov 12 '18 at 15:32











  • Sorry, I think I was wrong. If I understand correctly, because it isn't part of the kernel code, but rather an extension to it, I don't think direct compile into the kernel is an option.

    – Doug Smythies
    Nov 12 '18 at 15:51














0












0








0








I have an Intel NUC, and I've compiled a kernel extension to control the LED. It has created a .ko file at /lib/modules/4.15.0-38-generic/updates/dkms/nuc_led.ko (which matches uname -r). Manually loading the extension works great:



sudo modprobe wmi
sudo insmod /lib/modules/4.15.0-38-generic/updates/dkms/nuc_led.ko
echo 'ring,80,blink_medium,green' | sudo tee /proc/acpi/nuc_led > /dev/null


This works.



However the extension is not currently loaded at boot. I would like to put commands to turn the LED on and off in rc.local and rc6.d/ but these are not working, I have to run the modprobe commands manually, and even then my file in rc6.d/ (shown below) is not working - the LED remains on.



What am I doing wrong?



$ cat /etc/rc6.d/zz_led_off.sh
#! /bin/bash

echo 'ring,0,none,off' | sudo tee /proc/acpi/nuc_led > /dev/null

$ ls -la /etc/rc6.d/zz_led_off.sh | grep zz
-rwxr-xr-x 1 root root 79 Nov 9 10:07 zz_led_off.sh









share|improve this question














I have an Intel NUC, and I've compiled a kernel extension to control the LED. It has created a .ko file at /lib/modules/4.15.0-38-generic/updates/dkms/nuc_led.ko (which matches uname -r). Manually loading the extension works great:



sudo modprobe wmi
sudo insmod /lib/modules/4.15.0-38-generic/updates/dkms/nuc_led.ko
echo 'ring,80,blink_medium,green' | sudo tee /proc/acpi/nuc_led > /dev/null


This works.



However the extension is not currently loaded at boot. I would like to put commands to turn the LED on and off in rc.local and rc6.d/ but these are not working, I have to run the modprobe commands manually, and even then my file in rc6.d/ (shown below) is not working - the LED remains on.



What am I doing wrong?



$ cat /etc/rc6.d/zz_led_off.sh
#! /bin/bash

echo 'ring,0,none,off' | sudo tee /proc/acpi/nuc_led > /dev/null

$ ls -la /etc/rc6.d/zz_led_off.sh | grep zz
-rwxr-xr-x 1 root root 79 Nov 9 10:07 zz_led_off.sh






kernel






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 9 '18 at 10:21









user31415629user31415629

1012




1012













  • why not compile directly into the kernel, instead of being a module?

    – Doug Smythies
    Nov 9 '18 at 16:18











  • @DougSmythies I'm not sure what that means, how would I compile it directly into the kernel?

    – user31415629
    Nov 12 '18 at 15:32











  • Sorry, I think I was wrong. If I understand correctly, because it isn't part of the kernel code, but rather an extension to it, I don't think direct compile into the kernel is an option.

    – Doug Smythies
    Nov 12 '18 at 15:51



















  • why not compile directly into the kernel, instead of being a module?

    – Doug Smythies
    Nov 9 '18 at 16:18











  • @DougSmythies I'm not sure what that means, how would I compile it directly into the kernel?

    – user31415629
    Nov 12 '18 at 15:32











  • Sorry, I think I was wrong. If I understand correctly, because it isn't part of the kernel code, but rather an extension to it, I don't think direct compile into the kernel is an option.

    – Doug Smythies
    Nov 12 '18 at 15:51

















why not compile directly into the kernel, instead of being a module?

– Doug Smythies
Nov 9 '18 at 16:18





why not compile directly into the kernel, instead of being a module?

– Doug Smythies
Nov 9 '18 at 16:18













@DougSmythies I'm not sure what that means, how would I compile it directly into the kernel?

– user31415629
Nov 12 '18 at 15:32





@DougSmythies I'm not sure what that means, how would I compile it directly into the kernel?

– user31415629
Nov 12 '18 at 15:32













Sorry, I think I was wrong. If I understand correctly, because it isn't part of the kernel code, but rather an extension to it, I don't think direct compile into the kernel is an option.

– Doug Smythies
Nov 12 '18 at 15:51





Sorry, I think I was wrong. If I understand correctly, because it isn't part of the kernel code, but rather an extension to it, I don't think direct compile into the kernel is an option.

– Doug Smythies
Nov 12 '18 at 15:51










1 Answer
1






active

oldest

votes


















0














Add the module to /etc/modules, in this case, add the following two lines:



wmi
nuc_led





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%2f1091379%2floading-a-kernel-module-at-boot%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Add the module to /etc/modules, in this case, add the following two lines:



    wmi
    nuc_led





    share|improve this answer




























      0














      Add the module to /etc/modules, in this case, add the following two lines:



      wmi
      nuc_led





      share|improve this answer


























        0












        0








        0







        Add the module to /etc/modules, in this case, add the following two lines:



        wmi
        nuc_led





        share|improve this answer













        Add the module to /etc/modules, in this case, add the following two lines:



        wmi
        nuc_led






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 3 at 16:34









        user31415629user31415629

        1012




        1012






























            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%2f1091379%2floading-a-kernel-module-at-boot%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

            Ellipse (mathématiques)

            Quarter-circle Tiles

            Mont Emei