Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    ExecOnMcode + 3.4.6, sudo commands are not executed

    Scheduled Pinned Locked Moved
    Plugins for DWC and DSF
    3
    5
    362
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • EagleB3undefined
      EagleB3
      last edited by

      Re: ExecOnMcode
      Hello!
      I'm using Duet3HC + SBC Raspberry Pi3
      I deployed the Duet3-Lite image (v.3.4.6 from 09/06/2023, taken from https://github.com/Duet3D/DuetPi) to MicroSD, configured the network, and restored the configuration files of my printer.
      Then I installed the ExecOnMcode plugin (ExecOnMcode-0.5.zip) in DWC exactly according to the instructions https://plugins.duet3d.com/plugins/DSF_ExecOnMcode_Plugin.html,
      including creating the file /etc/sudoers.d/010_dsf-nopasswd and writing dsf ALL=(ALL) NOPASSWD: ALL in it

      Restarted Duet3HC+SBC
      Launched the ExecOnMcode plugin in DWC
      I edited the M1201 command and specified 'sudo reboot' in it
      M1201_sudo reboot.png
      In the console DWC I executed commands M1200 and M1201 sequentially.
      Raspberry did not restart.

      The lines appeared in the log:
      Duet3 kernel: audit: type=1400 audit(1701354925.815:8):apparmor="DENIED" operation="capable" profile="/opt/dsf/plugins/ExecOnMcode/" pid=820 comm="sudo" capability=7 capname="setuid"
      Duet3 kernel: audit: type=1400 audit(1701354925.815:9): apparmor="DENIED" operation="capable" profile="/opt/dsf/plugins/ExecOnMcode/
      " pid=820 comm="sudo" capability=6 capname="setgid"

      What should I do to be able to use the plugin to run "sudo reboot" and "sudo poweroff" with M-Code commands?

      P.S. IMHO, it would be useful for many users if you added one more example to the two existing example commands that appear after installing the plugin: a command using sudo. For example, "sudo reboot".

      jay_s_ukundefined Falcounetundefined 2 Replies Last reply Reply Quote 0
      • jay_s_ukundefined
        jay_s_uk @EagleB3
        last edited by

        @EagleB3 i'm going to ping @Falcounet as he should be able to help you.
        Did you know you can reboot the pi anyway using the duetpimanagement plugin? https://github.com/Duet3D/DuetSoftwareFramework/blob/master/src/DuetPiManagementPlugin/README.md

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

        EagleB3undefined 1 Reply Last reply Reply Quote 0
        • EagleB3undefined
          EagleB3 @jay_s_uk
          last edited by

          @jay_s_uk , many thanks! I didn't know about this possibility.
          I tried it and it worked! 👍

          1 Reply Last reply Reply Quote 0
          • Falcounetundefined
            Falcounet @EagleB3
            last edited by

            @EagleB3 plugins including ExecOnMcode doesn't have the right (unless you change the DSF config) to use sudo commands. That's intended.
            As Jay said, duetpimanagement plugin is the way to go for this.

            EagleB3undefined 1 Reply Last reply Reply Quote 0
            • EagleB3undefined
              EagleB3 @Falcounet
              last edited by

              @Falcounet , thank you very much for your quick response! Please tell me what changes should be made to DSF config and how this can be done? Maybe there is a link to the description?
              Is it possible to give the plugin the necessary rights by changing the manifest of the ExecOnMcode plugin before installing it in the DWC interface (https://github.com/Duet3D/DuetSoftwareFramework/blob/master/PLUGINS.md#list-of-permissions, "SuperUser" )?
              P.S. I have extensive experience in IT, but practically no experience with *nix systems... 👶

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Unless otherwise noted, all forum content is licensed under CC-BY-SA