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

    Raspberry Pi, Arch Linux,and DWC.

    Scheduled Pinned Locked Moved
    Duet Web Control
    4
    10
    1.3k
    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.
    • Scottbg1undefined
      Scottbg1
      last edited by

      Hello all,

      This isn't a Duet controller issue and might not be welcome here, but it is involving Duet Web Control and I hoped it would be ok to post. This entire forum has always been so generous in helping each other out on any problems I have seen folks post. And I am at my wits end and relented to post here as a last effort to fix it.

      I have been tinkering around with a firmware called Klipper on my Prusa clone.
      Klipper is most widely used as an add-on to Octoprint, which would of course employ Octoprint's UI to control and monitor things. This is all ran on a Raspberry Pi, plugged into the printer's controller via USB.

      There is a lesser known option to eliminate Octoprint completely and use our beloved Duet Web Control as a web interface, and it's absolutely fantastic! I have it installed and running great on my RPi running Raspbian OS.
      Here is an earlier discussion I started about it.
      https://forum.duet3d.com/topic/11169/dwc-on-my-small-prusa-clone/6

      I have 2 or 3 Raspberry pi micro-computers around my house that I use as a media center on my TV, a camera pointed at my CoreXY, and one plugged into my CNC router that I use to transfer gcode to it. I love these things.
      And I have them all loaded with Arch Linux rather than Raspbian. IMHO they just run better.
      I am currently trying to get Klipper and DWC running on Arch on my RPi.
      It's not a must as I have it running fine on Raspbian, but I like to tinker with stuff and I would like to see if I can get it going with Arch.

      I have run into a brick wall right at the finish line and I was hoping there were Linux gurus here that were familiar with Arch that might could help me get the rest of the way. A guru I am not. I know just enough to be dangerous, but I feel I know enough as I have gotten this far by myself.
      I have posted my problem on the Klipper and DWC-for-Klipper github sites, but support for both are weak and slow responding. The only responses I have gotten so far from there are suggestions that I re-read the install instructions and make sure I didn't miss a step. The install instructions are catered toward a Raspbian install, complete with a install script that takes most of the work out of it. Making it a complete manual install onto Arch, so reading the install instructions over and over haven't helped much.
      I have the Klipper firmware installed and running properly, and it is communicating with the printer's controller.
      So that isn't a problem anymore. What I am having difficulties with is getting Klipper to connect to Duet Web Control.
      I either don't have a .py file sym-linked to the correct directory or the correct path set for Klipper to interface with DWC. It has to be something simple but I am stumped after scouring the internet and trying different configurations for the last 2 days.

      Is there anyone who would be able to give some suggestions on how to solve it?
      I won't post the errors yet as this post has already become a book to read.
      But if anybody is interested I will post the errors I am getting from the Klipper service log and detail what I have already tried to fix it, if needed.

      Thanks in advance for any attention I get on this.

      JoergS5undefined 1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

        You might have better luck in the Klipper github or Klipper reddit.

        Z-Bot CoreXY Build | Thingiverse Profile

        Scottbg1undefined 1 Reply Last reply Reply Quote 0
        • JoergS5undefined
          JoergS5 @Scottbg1
          last edited by

          @scottbg1 I would start analyzing the communication between Klipper and DWC. If you post your error logs (maybe on dropbox), this may give a first hint what could be the reason.

          1 Reply Last reply Reply Quote 0
          • Scottbg1undefined
            Scottbg1 @Phaedrux
            last edited by Scottbg1

            @phaedrux said in Raspberry Pi, Arch Linux,and DWC.:

            You might have better luck in the Klipper github or Klipper reddit.

            As mentioned, I have already tried there and those posts are still open but responses are slow.
            What little help I have received has been to re-read the install instructions, which I have done so much I just about have them memorized.

            @joergs5 said in Raspberry Pi, Arch Linux,and DWC.:

            @scottbg1 I would start analyzing the communication between Klipper and DWC. If you post your error logs (maybe on dropbox), this may give a first hint what could be the reason.

            The communication between Klipper and DWC is the problem, and it all hinges on a .py file that has to be sym-linked from the Klipper service to the DWC installation.
            Here is the only error message I am getting at the moment. It's easy to just post it here rather than linking a drop box file, but I will if you would rather see that instead.

            Section dwc2_web is not a valid config section

            The following is several lines in Klippers configuration file that tells Klipper where to connect to for access to DWC.

            [virtual_sdcard]
            path: /home/scott/sdcard

            [web_dwc2]
            ## optional - defaulting to Klipper
            printer_name: Anet A8
            # optional - defaulting to 0.0.0.0
            listen_adress: 0.0.0.0
            # needed - use above 1024 as nonroot
            listen_port: 4750
            # optional defaulting to dwc2/web. Its a folder relative to your virtual sdcard.
            web_path: dwc2/web

            The section in the configuration [web_dwc2] is what the error message is referring to.

            The directory housing the DWC stuff is located in the user folder and it has a file called web_dwc2.py. That file is to be sym-linked to the same file located in /opt/klipper/klippy/extras.

            So the command to handle that would be:
            ln -s ~/dwc2-for-klipper/web_dwc2.py ~/opt/klipper/klippy/extras/web_dwc2.py

            The /opt directory in Arch Linux is where Klipper is installed, hence directing the sym-link to that location. In Raspbian, Klipper seems to be installed and located in the user directory. So if you follow the install directions to the letter, you are obviously placing things in the wrong spot, as far as Arch is concerned.....I think.

            Ans thats my problem. I have tried to mimic the install instructions and place things where I am pretty sure they should go in Arch, but it isn't working and I get the error mentioned above. It certainly doesn't work if I install it exactly as the directions call for, which has Raspbian in mind.
            I feel in my heart this is just a simple matter of I have the paths set incorrectly.
            I just can't figure out exactly, what it is.

            I posted this here on a whim, since it involves printer firmware and specifically something we use everyday, such as DWC.
            I will try one of the Arch Linux forums next if I haven't gotten this figured out in a couple of days.

            Again, thanks to whatever attention I get for this.

            wilrikerundefined 1 Reply Last reply Reply Quote 1
            • wilrikerundefined
              wilriker @Scottbg1
              last edited by

              @scottbg1 OK, so this might be a stupid question but did you run ln -s with sudo? Usually /opt/ and all it's subdirs belong to root so you would not be allowed to create a symlink there.

              Just check that... wait a second...

              ln -s ~/dwc2-for-klipper/web_dwc2.py ~/opt/klipper/klippy/extras/web_dwc2.py

              I hope that's a typo... you prefixed the link name with a ~ creating the symlink inside the current user's home dir. That does not seem to be what you want.

              Also: Arch does not really care where you install things. It's your system, make it your own and if you want to install things to paths like in Raspbian then Arch won't complain - if it's in /opt you already have to manage the binaries being in $PATH yourself anyway.

              Manuel
              Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
              with probably always latest firmware/DWC (incl. betas or self-compiled)
              My Tool Collection

              Scottbg1undefined 1 Reply Last reply Reply Quote 0
              • Scottbg1undefined
                Scottbg1 @wilriker
                last edited by

                @wilriker said in Raspberry Pi, Arch Linux,and DWC.:

                @scottbg1 OK, so this might be a stupid question but did you run ln -s with sudo?

                Not a stupid question at all, and the answer is yes and no.

                I did have to use sudo when I first installed and I took that into consideration that it was failing because of a permissions thing.
                I did change ownership of that directory with:
                sudo chown scott /opt/klipper/klippy/extras
                And then I tried ln -s again without root to see if that was the case, but it wasn't and it still failed and the error about the config section continued..
                I know now it was stupid but at the time I was at the mercy of where I found it installed and it seemed like a good idea at the time.

                @wilriker said in Raspberry Pi, Arch Linux,and DWC.:

                Just check that... wait a second...

                ln -s ~/dwc2-for-klipper/web_dwc2.py ~/opt/klipper/klippy/extras/web_dwc2.py

                I hope that's a typo... you prefixed the link name with a ~ creating the symlink inside the current user's home dir. That does not seem to be what you want.

                Ok, here is where I might be screwing up. And now I feel even more stupid for changing that directory ownership.
                I git cloned the klipper tar and the DWC.git into my user directory per the instructions. Its where they ended up on Raspbian so I thought it would work here.
                I built the package for Klipper from my user dir and when it installed all those files ended up in /opt. And when I saw in the log that it pulls the config files for klipper from directories in the /opt folder I just thought thats where they were supposed to be. And in my readings, /opt is usually the place where the bulk of programs are installed to in Arch.
                It confused me because on Raspbian, everything was still running from my user directory, so I just chocked it up as the Arch way. And once I was at a point I would try stupid stuff like changing directory permissions, I even deleted all those Klipper install folders from the user directory and Klipper was still running fine. So that was more proof that the /opt folder was the place to target the sym-link.

                The folder with DWC was unzipped and remains in the user directory and it is just like the DWC folder we would push to the duet wifi. It just holds directories and config files.

                If I did something stupid, I'll own that. But if I were to point the sym-link from the Klipper folders in the user directory to the DWC folders also in the user directory that didn't work either at first. That is why I mentioned the idea to link it to the folders in /opt since the log stated that is where it was reading all the other .py files from.

                What do you recommend and I'll do it!

                Thank you so much for commenting. I appreciate the help immensely!

                1 Reply Last reply Reply Quote 0
                • Scottbg1undefined
                  Scottbg1
                  last edited by

                  You've got me thinking about something and the differences in the install process between Raspbian and Arch.
                  Raspbian built the install package and installed it via a python script.

                  I have never tried to compile a package before just using the makefile in the git file downloaded from github.
                  I thought I was lucky when I found klipper on AUR and I built the package from that.
                  I read the PKGBUILD and that is what placed Klipper in the /opt folder.
                  I wonder if it would be worth changing the package directory in the PKGBUILD back to the user folder instead of the /opt folder?
                  This is over my head and I worry that I would need to change more than that than just that one line.
                  No where else mentions putting anything in /opt.

                  wilrikerundefined 1 Reply Last reply Reply Quote 0
                  • wilrikerundefined
                    wilriker @Scottbg1
                    last edited by

                    @scottbg1 OK, I looked at the AUR package for klipper. Installing it this way is basically fine, but - and this is good practice - klipper runs under a user with the same name. This user won't have read rights on your home directory and as such even if you succeed to create the symlink under /opt/klipper/... klipper won't be able to read it. There are now several ways to address this:

                    1. Change the user that runs klipper to your own user (edit the systemd unit) - usually there is no harm in this but you probably also have to change the owner of /opt/klipper to your own user
                    2. Change the permissions on the path to the required .py file by adding world x to the directories in between, e.g. chmod 701 /home/<yourusername> and so on until you come to the directory where the .py file is located. This needs chmod 705 to have it not only accessible but also readable by anyone. The x permission on a directory means an otherwise unauthorized user can travel through this directory to one nested deeper where the user also has read rights
                    3. Create e.g. /opt/dwc2-for-klipper, install the stuff from this repo there and make sure it either also is owned by the user klipper or it is owned by a group that klipper also has (and of course appropriate read-rights) (best way: create your own PKGBUILD for this)
                    4. Directly copy/move dwc2_web.py into /opt/klipper/extras/

                    Personally I would start at number 4. I don't see a reason why this would not work though I haven't worked with any of this stuff so far.

                    I think the only reason why the instructions call for a symlink is that it also says to git clone the repo and this way later updates via git pull would be reflected automatically compared to you having to do the copy/move action again.

                    Manuel
                    Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                    with probably always latest firmware/DWC (incl. betas or self-compiled)
                    My Tool Collection

                    1 Reply Last reply Reply Quote 1
                    • Scottbg1undefined
                      Scottbg1
                      last edited by

                      You sir, are a scholar, a gentleman and a god among men.

                      I am at work right now, and I have an RPi with Arch installed on it here in my office and I just installed Klipper and DWC onto it to see if I could get it to work.
                      I am no longer receiving the error regarding the config section but because it's not plugged into a printer I am getting loads of other errors, but I expected that.

                      The acid test will be when I get home tonight and try this out on the machine connected to the printer.
                      Now, for which of your suggestions worked:
                      Per your suggestion, I started with #4 and I deleted the linked file and just moved the .py file from the downloaded git folder to the folder in /opt. Bingo!

                      I'll report back tonight on how it goes.

                      FWIW, I want to give #3 a try later down the road. I think that figuring out how to create my own PKGBUILD would be a great lesson in improving my Arch Linux kung fu.
                      Besides I would really like to create install procedures for installing this onto Arch/RPi and post it somewhere, because I can't be the only guy in the world that would want this over a Raspbian install. And maybe I can save somebody a headache.

                      A thousand thank yous to you, sir.

                      wilrikerundefined 1 Reply Last reply Reply Quote 0
                      • wilrikerundefined
                        wilriker @Scottbg1
                        last edited by

                        @scottbg1 said in Raspberry Pi, Arch Linux,and DWC.:

                        FWIW, I want to give #3 a try later down the road. I think that figuring out how to create my own PKGBUILD would be a great lesson in improving my Arch Linux kung fu.
                        Besides I would really like to create install procedures for installing this onto Arch/RPi and post it somewhere, because I can't be the only guy in the world that would want this over a Raspbian install. And maybe I can save somebody a headache.

                        That's the basic idea of AUR. So just upload it there. If you need help in creating the PKGBUILD then first of all the Arch Wiki is always a great source (for anything related to Arch or Linux) and second you can contact me via chat here as well (just don't want to spam the forum with Arch-related stuff).

                        A thousand thank yous to you, sir.

                        Happy to help. 🙂

                        Manuel
                        Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                        with probably always latest firmware/DWC (incl. betas or self-compiled)
                        My Tool Collection

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