Debian 12 and Klipper

For @Sineos and @TheMonkeyKing I’m moving this discussion from Debian Bullseye Bug Remedy Script as I think it’s its own separate topic.

@TheMonkeyKing suggested that we look at converting to Debian 12 from the standard Debian 11 build used in Raspberry Pis and pointed to the link:

First off, this process doesn’t work for a Raspberry Pi. The sudo apt full-upgrade command has numerous failures and I didn’t see the point in trying to work through them. When I checked the version, it came up as Debian 12.1. On the off chance Klipper could work with all the installation errors, I tried to install Klipper, using KIAUH, but the Klipper installation process would not complete.

The next logical step was to try Raspberry Pi Debian 12 image and rather than go through the work of coming up with one on my own (and then load it using a PXE boot as was suggested in the previous thread), I decided to look for a Debian 12 image for the Raspberry Pi and found one here:

https://raspi.debian.net/

Now, I had a lot of problems with the June 12, 2023 “Tested Image” working with either a Raspberry Pi 4B or CM4. I was able to get the daily build working and ready for a Klipper install on the 4B using the following process (NOTE: text in square brackets “[” and “]'” are custom to the installation):

  1. Connect an HDMI display, USB keyboard and power supply to a Raspberry Pi 4 with the daily build of Raspberry Pi Debian 12 on the SD Card.
  2. Login as root with no password
  3. Enable WiFi on the Raspberry Pi by executing the command nano /etc/network/interfaces.d/wlan0 and when the file came up, editing it so it looks like:
# To enable wireless networking, uncomment the following lines and -naturally-
# replace with your network's details.
#
 allow-hotplug wlan0
 iface wlan0 inet dhcp
# iface wlan0 inet6 dhcp
    wpa-ssid [myNetworkName]
    wpa-psk [myNetworkPassword]
  1. reboot
  2. Login again using the display and keypad and enter the following commands to ensure the resources needed for installing Klipper were available:
apt update
apt full-upgrade -y
apt install sudo
apt-get install usbutils -y
apt install net-tools
apt install curl -y
  1. Set the root password, a new hostname using the commands:
passwd
hostnamectl set-hostname [NewHostname]
  1. Add a primary user with sudo access:
adduser [NewUserName]
su - root
usermod -aG sudo [NewUserName]
  1. Restart the Raspberry Pi with reboot

At this point, you can login to the Raspberry Pi through SSH and attempt to install Klipper using a typical process.

Using KIAUH, I installed Klipper, Moonraker and Mainsail. After doing this and ending KIAUH, I tried to access Mainsail’s web interface but with no luck. I have no idea why it wouldn’t come up.

Continuing on to see if I had any other issues, I was able to build Katapult and Klipper as well as burn them into an Octopus (STM32F446) board and get CAN UUIDs.

As for the CM4, I was never able to get the WiFi interface working - the Ethernet interface works fine and I was able to follow the process above from steps 5. onwards without any issues. I also had the same issue with not getting the Mainsail web interface working.

Getting Klipper running on Debian 12 is probably a good idea as I suspect Raspberry Pi Installer will soon start generating OS images running this kernel. There are a couple of things I would like to ask help on:

  1. I suspect that I don’t have all the packages installed that are required to run Mainsail and I can’t find a list of them - could anybody point me in the right direction?
  2. Not being able to run WiFi on the CM4 seems to be a known problem with Debian 12 but I couldn’t find a solid fix for it (it seems well established that the WiFi silicon on the 4B and the CM4 are different). Anybody have any ideas how to get CM4 WiFi working?
1 Like

It works. Done that already, although I would not recommend it. Especially not to move from RPi OS to vanilla Debian.
Also, the upgrade process likely takes sustainably longer than burning a new image to the SD and installing Klipper with KIAUH.

With your CM4 woes, I likely cannot contribute sustainably since I do not have a CM4, but I’d be surprised if a CM4 WIFI is problematic.

  • KIAUH makes sure that all needed packages are installed
  • I have tested KIAUH on Debian 12 already (albeit in the Armbian flavor) and it worked like expected
  • Theoretically it is possible that certain packages get renamed from one major release to the next, but I did not notice anything and Armbian is using the default Debian package sources
  • You should check the KIAUH log or closely monitor the installation process for any apt / package related errors

I would not be aware of any issues. Try

sudo nmcli d wifi connect "ssid_here" password "password_here" ifname wlan0

and get information about it with

iw dev wlan0 info
iw dev wlan0 link
1 Like

Small addition here: On distribution that use NetworkManager, one can also use the nmtui command to have a menu based network configuration.

What hardware did you use and what Raspberry Pi OS did you start with?

With a Raspberry Pi 4B and Raspberry Pi 32-Bit OS, I repeatedly got multiple errors in the sudo apt full-upgrade step followed by the Raspberry Pi locking up.

I’m curious as to what your differences were - I followed the process laid out exactly.

We’ve had this discussion before. The Raspberry Pi 4B uses a Cypress CYW43455 and CM4 a CYW43456. They’re mostly compatible but if you do a search, you’ll find many instances of people having issues with WiFi on the CM4 (along with several different solutions).

I haven’t been able to find a Debian specific example.

So, looking for more examples, I went through my process again… and sometimes you get lucky.

I had my phone ready when I booted the CM4 with Debian 12 the first time and caught this message:

Apologies for the crappy text quality - I’m using an old TV as I don’t have any HDMI monitors available that I want to rewire for this. But, I think the message that the brcm/bmac43455 firmware did not load is readable. I’m surprised that the install process recognized the CM4.

Repeating this for a Raspberry Pi 4B, I did not see this message.

Continuing on with the Raspberry Pi 4B, I edited the wlan0 file, as outlined in my process rebooted and just before the login prompt, I see that the wlan0 is ready (I have no idea why IPv6 is noted as I kept that line commented out):

I should note that “rp4.hitrunhub.home” appears when I look at my network.

Going back to the CM4 and after I update the wlan0 file I don’t see the same availability message and instead there was a timeout:

I should point out that an Ethernet connection works fine for the CM4 and I’m able to carry on the installation process as set out above. Once it’s complete I can SSH into the board via Ethernet.

Any ideas on what I can do to get Wireless working on the CM4 would be appreciated.

Where do I find the KIAUH log?

I’m going to end here and see if there’s any point in looking at the CM4 issue before going on.

Does your WIFI work with the standard Bullseye PiOS?

In /tmp. Unfortunately, it seems not to contain any apt information.
If you really want to cross-check against the needed packages then refer to the individual doc sites. They also list the requirements, e.g. https://docs.mainsail.xyz/setup/getting-started/manual-setup

i was on an arm64 debian 11 base, no pi os or something.
i did the following and runs fine so far

make a copy of your sdcard with Win32DiskImager i.e

update all packages to the latest version

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt --purge autoremove
sudo apt autoclean

change apt to the new debian12 packages

sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*
sudo sed -i 's/non-free/non-free non-free-firmware/g' /etc/apt/sources.list
sudo sed -i 's/non-free/non-free non-free-firmware/g' /etc/apt/sources.list.d/*

update packages

sudo apt update

do a minimal system update ( if you have changed system files, it will ask you what version you want to keep, in doubt and if you cant rember if you have made the changes, install the package owner version )

sudo apt upgrade --without-new-pkgs

do the rest, full system update ( if you have changed system files, it will ask you what version you want to keep, in doubt and if you cant rember if you have made the changes, install the package owner version )

you can also let the system update automatically restart the services ( blue screen prompt )

sudo apt full-upgrade

restart and hope :wink:

sudo reboot

reinstall or remove–>install broken or not running klipper components via kiauh or manually ( for me it was quite everything :wink: → klipper, moonraker, klipperscreen, mainsail, crowsnest …)

cd ~
sudo apt install git
git clone https://github.com/dw-0/kiauh
cd kiauh
./kiauh

running fine so far:

Is this Debian 11 or 12? Sorry you’re not clear on that. Debian 12 is where I’ve had the issue.

Where did you get your copy of Debian?

Thanx!

I was on 11 and now on 12. 12 is running fine so far. No Problems. If you want to Start over with a New Image there is also a Debian 12 Image available: Daily auto-built images

Or Update from 11 to 12 as mentioned above

/edit. You can See it in my Screenshot above under host that this is Debian 12

Trying to follow your process but getting stalled right at the start.

Downloaded today’s “Raspberry Family 4” Daily Build image from: Daily auto-built images

Now, if I try loading the SD Card with Raspberry Pi Imager, I get:

So, I tried imaging the SD Card with Win32DiskImager (Version 1.0 which is the latest download):

image

I’m selecting “Write” and then “Verify Only” (successful) and then putting it into the Raspberry Pi 4B…

Where nothing comes up on HDMI and the two LEDs on constantly.

EDIT:

I realized that I wasn’t being accurate when I’m saying that “nothing comes up on HDMI”, I should have been more specific and noted that the Raspberry Pi doesn’t recognize the SD Card as having an OS on it:

As noted above, the two LEDs are on constantly.

Any ideas what I’m doing wrong here?

/edit: In the case that the screen is black and green and red led is on and you have a dsi display connected, try this:

If so, put the sdcard back to the sdcard reader open the config.txt file on a windows / linux / mac machine and comment out all dtoverlay display drivers:

i.e. like this:

# Automatically load overlays for detected cameras
camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Enable DRM VC4 V3D driver
#dtoverlay=vc4-fkms-v3d # <-- comment this line out with a # in front
#dtoverlay=vc4-kms-v3d <-- comment this line out with a # in front
max_framebuffers=1

be sure not to load any dtoverlay display driver and try again

display_auto_detect is fine and can be activated

/edit: read your post - ignore my advise above - this is a different problem

give the pi os debian 11 a try:

pi imager:

image

and then try my update process above - maybe its easier for you and in general it should work with pi os too

1 Like

ill make a clean debian 12 image pi os lite ( no gui ) with a clean mainsail, moonraker and klipper installation for you. ill be back in about an hour. you can install the gui later with sudo apt install lightdm

all you need is a 64gb sdcard, because i only have 64gb cards here

Okay thanx - I’ll try your process above with the Debian Bullseye from the Raspberry Pi Imager.

I’ve got a 64GB SD Card all warmed up and ready to go.

writing sdcard to image file, sorry took a bit longer damn slow sdcards … ready in about 30 minutes

We’re working at the same pace here.

I just finished loading in the Debian 11 OS 64-Bit Lite using the Raspberry Pi Imager and then worked through your process above with the result being (I literally just did the reboot):

It’s a long process to go through the upgrade - not a lot of instructions technically, just takes a long time (and the next time I do it, I think I’ll add “-y” to the final sudo apt full-upgrade).

WiFi is up without any issues, let me see how loading Klipper (and Katapult) works…

So, I guess there’s no panic on the 64GB image - unless you want me to test that. I’m happy to do that if it would help.

1 Like

no its fine, ill upload it anyway in case s.o. or you want to try it out ( debian 12 with klipper preinstalled )

I’m going to try installing Klipper now - I’ve just moved the RPi 4B with the Debian 12 on it to a printer and as soon as it boots and I can SSH into it, I’ll go through the kiauh/klipper/Katapult install process and let you know how it goes (at least I don’t have to do sudo apt update and sudo apt upgrade -y after all the updates over the past hour).

1 Like

here is the clean 64bit debian 12 klipper preinstalled 64gb image if someone is interested

user: pi
pw: pi

first you need a lan connection to setup your wifi with sudo raspi-config via ssh ( or keyboard and hdmi if no lan is available )

pre-installed: moonraker, mainsail, fluidd, klipper, klipperscreen
i also installed log2ram to protect ur sdcard from wearing due writing log files - you can add the klipper log directory to the log2ram config too if you want ( /etc/log2ram.conf )

you should be able to reach the webinterface via ur-ip in the webbrowser

mainsail: http://ur-ip/
fluidd: http://ur-ip:81/

Download Image

Write the image to the sdcard via Win32DiskImager i.e.

glad to hear that it worked :+1:

I’m not having any luck with the “clean_debian12_klipper_preinstalled.7z”.

I’ve tried it burning it twice on a 64GB SD Card and once on a 64GB Card using “Windows Disk Imager”. Nothing booted, I got the Red and White Raspberry Pi waiting for Operating System message on HDMI.

I also tried burning a 64GB SD Card using Raspberry Pi Installer, but got the message:

Thinking that this was a problem Raspberry Pi Imager has with .7z compression scheme, I tried creating an uncompressed .img file using WinRar but got the message during expansion:

! C:\Users\User\Dropbox\me\Videos\clean_debian12_klipper_preinstalled.7z: Write error in the file

Now, it did expand to a 33GB file (taking almost an hour on a 8 core PC) and I did try Raspberry Pi Imager on the result (even though it has the error) and ended up with a Kernel panic:

I just completed burning an SD Card with the expanded image using Windows32 Disk Imager and ended up with the same result. :face_exhaling:

So I must be doing something wrong here. Any ideas?

1 Like