Skip to content

Add KlipperScreen installation module#319

Open
dozed-dev wants to merge 3 commits intomainsail-crew:developfrom
dozed-dev:KlipperScreen
Open

Add KlipperScreen installation module#319
dozed-dev wants to merge 3 commits intomainsail-crew:developfrom
dozed-dev:KlipperScreen

Conversation

@dozed-dev
Copy link

Hi, this is a KlipperScreen module for the new refactor. The old MainsailOS has a KlipperScreen module, so I thought it'd make sense to have it in the refactor too, for feature parity.

@meteyou
Copy link
Member

meteyou commented May 20, 2025

pls move this module to "special". All modules in the "special" directory are optional. We never published a image with KlipperScreen installed, we only used this module for internal testen and let it install for PR tests or other tests.

@dozed-dev
Copy link
Author

oh ok! will do

@dozed-dev
Copy link
Author

hmm, if I understand correctly, the modules in special only run if they're referenced in config.yml. and since KlipperScreen module isn't referenced by anything, it won't run ever...

@dozed-dev
Copy link
Author

i feel like merging code that will never run is not good.
how should it run? maybe a -ks variant should be built for each board, like before the refactor?

@meteyou
Copy link
Member

meteyou commented May 21, 2025

I will add another config parameter that some entries in the config.yml will only be used in the PR build tests. We used this module also in the old workflow only for testing. We didn't include it in the release builds, because we are not able to give enough support für KlipperScreen and not every user will use KlipperScreen and it also need a little bit of load on the pi also without a screen.

@GiacomoGuaresi
Copy link
Contributor

@dozed-dev is the klipperscreen module installed correctly like this? because from what I saw the last installation script was broken if launched with the parameters declared before execution

scripts/KlipperScreen-install.sh@ln293

...
if [ -z "$NETWORK" ]; then
        echo "Press enter for default (Yes)"
        read -r -e -p "Install NetworkManager for the network panel [Y/n]" NETWORK
        if [[ $NETWORK =~ ^[nN]$ ]]; then
            echo_error "Not installing NetworkManager for the network panel"
        else
            echo_ok "Installing NetworkManager for the network panel"
            echo_text ""
            echo_text "If you were not using NetworkManager"
            echo_text "You will need to reconnect to the network using KlipperScreen or nmtui or nmcli"
            sudo apt install network-manager
            sudo mkdir -p /etc/NetworkManager/conf.d
            sudo tee /etc/NetworkManager/conf.d/any-user.conf > /dev/null << EOF
            ...
        fi
fi
...

see, if you declare the network parameter first it skips the entire installation of the same, same thing with the other parameters
😞
I opened a PR fixing the problem but for now no response
KlipperScreen/KlipperScreen#1578

@dozed-dev
Copy link
Author

dozed-dev commented May 23, 2025

@dozed-dev is the klipperscreen module installed correctly like this? because from what I saw the last installation script was broken if launched with the parameters declared before execution

judging from logs, it installs fine (see this build)
I can test the image on real hardware if needed

@meteyou
Copy link
Member

meteyou commented May 23, 2025

@dozed-dev do you have more informations about the backend in KlipperScreen? I see that KlipperScreen has Wayland and X11 support and you use X11 in this module. Shouldnt it be Wayland on raspberry pi since bookworm?

@GiacomoGuaresi
Copy link
Contributor

GiacomoGuaresi commented May 23, 2025

@dozed-dev I saw that it builds correctly (I built it for myself) but skips are implemented for each parameter and even if it builds it does not install the service and the backend (network and start are skipped by chance) thus creating an image that does not run Klipperscreen correctly...

scripts/KlipperScreen-install.sh@ln326

if [ -z "$SERVICE" ]; then
    echo_text "Install standalone?"
    echo_text "It will create a service, enable boot to console and install the graphical dependencies."
    echo_text ""
    echo_text "Say no to install as a regular desktop app that will not start automatically"
    echo_text ""
    echo "Press enter for default (Yes)"
    read -r -e -p "[Y/n]" SERVICE
    if [[ $SERVICE =~ ^[nN]$ ]]; then
        echo_text "Not installing the service"
        echo_text "The graphical backend will NOT be installed"
    else
        install_graphical_backend
        install_systemd_service
        if [ -z "$START" ]; then
            START=1
        fi
    fi
fi

scripts/KlipperScreen-install.sh@ln36

if [ -z "$BACKEND" ]; then
    echo_text ""
    echo_text "Choose graphical backend"
    echo_ok "Default is Xserver"
    echo_text "Wayland is EXPERIMENTAL, needs kms/drm drivers, and doesn't support DPMS"
    echo_text ""
    echo "Press enter for default (Xserver)"
    read -r -e -p "Backend Xserver or Wayland (cage)? [X/w]" BACKEND
    if [[ "$BACKEND" =~ ^[wW]$ ]]; then
      echo_text "Installing Wayland Cage Kiosk"
      if sudo apt install -y $CAGE; then
          echo_ok "Installed Cage"
          BACKEND="W"
          break
      else
          echo_error "Installation of Cage dependencies failed ($CAGE)"
          exit 1
      fi
    else
      echo_text "Installing Xserver"
      if sudo apt install -y $XSERVER; then
          echo_ok "Installed X"
          update_x11
          BACKEND="X"
          break
      else
          echo_error "Installation of X-server dependencies failed ($XSERVER)"
          exit 1
      fi
    fi
fi

@GiacomoGuaresi
Copy link
Contributor

@meteyou on RPI4 it seems to work fine with X11, but if you want I can test it with Wayland since I plan to see it in a few weeks 😄

@dozed-dev
Copy link
Author

dozed-dev commented May 23, 2025

@meteyou

@dozed-dev do you have more informations about the backend in KlipperScreen? I see that KlipperScreen has Wayland and X11 support and you use X11 in this module. Shouldnt it be Wayland on raspberry pi since bookworm?

X is the default, and during installation it says that Wayland is experimental

Choose graphical backend
Default is Xserver
Wayland is EXPERIMENTAL, needs kms/drm drivers, and doesn't support DPMS

@dozed-dev
Copy link
Author

dozed-dev commented May 23, 2025

@GiacomoGuaresi oh, I understand now! you're right, it skips the whole thing..
since my installation script currently uses default values for SERVICE and BACKEND, they can be left undefined as a workaround, until the script is fixed upstream.
before the CustoPiZer refactor, KlipperScreen was installed with default parameters, and that's why there were no such issues. but it doesn't work now, with the new chroot environment. NETWORK and START have to be explicitly disabled

@GiacomoGuaresi
Copy link
Contributor

Hi all,

I wanted to let you know that my PR on KlipperScreen has been approved. Therefore, we can proceed to rebuild MainsailOS with the KlipperScreen module integrated and verify that the installation is successful.

Unfortunately, I will be traveling until May 31st and will not be able to test before then. However, as soon as I return, I will be available to perform all the necessary verifications.

In the meantime, if anyone has the opportunity to test the updated build, it would be a great help to speed up the process.

@GiacomoGuaresi
Copy link
Contributor

Hi @dozed-dev could you launch the build pipeline for me so I can download the image and test it on real hardware? thanks a lot 😄

@meteyou
Copy link
Member

meteyou commented Jun 3, 2025

sry, i'm a little bit behind my roadmap. i will add this module as a "build workflow only" build. but i have to add this function to the MainsailOS workflow first.

@dozed-dev
Copy link
Author

@GiacomoGuaresi i had to revert a commit so that KlipperScreen actually builds. here's the workflow (currently building): https://github.com/dozed-dev/MainsailOS-dev/actions/runs/15423530973

@GiacomoGuaresi
Copy link
Contributor

Hi @dozed-dev and @meteyou, I tested the build on a Raspberry Pi 4, checked the build logs and verified it works, I attach the photos for me this PR seems ok (at least the install script part) 😄

IMG_20250604_135523_463

@meteyou
Copy link
Member

meteyou commented Jun 8, 2025

@dozed-dev i added the function for "build_only" images here: #325

pls update this branch and add a build_only raspberry pi image with klipperscreen in the config.

@meteyou
Copy link
Member

meteyou commented Jun 17, 2025

@dozed-dev why did you add to every image the new attribute?

@dozed-dev
Copy link
Author

@meteyou oh.. idk why i done that lol
should i add a new build_only ks config for raspberry pi boards? or for every board?

@meteyou
Copy link
Member

meteyou commented Jun 17, 2025

@dozed-dev yes pls. add a new image for rpi 64bit incl. KS, but build_only.

Copy link

@my-dudhwala my-dudhwala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have installed KlipperScreen with this few lines of script, now as a begginer, I curious about the difference between this long script and the few lines it is working with...

`#!/bin/bash -e

Ensure pi user exists (pi-gen normally creates it)

id -u pi &>/dev/null || useradd -m -s /bin/bash pi

Clone KlipperScreen as pi

if [ ! -d /home/pi/KlipperScreen ]; then
su - pi -c "git clone https://github.com/KlipperScreen/KlipperScreen.git /home/pi/KlipperScreen"
fi

Run installer as pi, non-interactively

su - pi -c "yes | bash /home/pi/KlipperScreen/scripts/KlipperScreen-install.sh"`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants