LinuxCNC on LinuxMint 22

How to install LinuxCNC and Probe Basic on LinuxMint 22 XFCE, as of 10 January 2025, including configuring a PREEMPT_RT kernel for LinuxMint 22.

CONTENTS

Questions Up front:

  • Why Linux Mint 22? - Because (for me, on Optiplex 7050) I get a more responsive interface, the computer boots more quickly, and I have lower jitter when compared to a Debian install
  • What LinuxCNC Version? - Linux Mint 2.9.3 for now
  • Why Probe Basic? - Because you got your 3d probe and you’re wanting to use it, right? I prefer it over other options.

Assumptions Up Front:

  • You already have a working LinuxCNC config, maybe you already have Axis set up and working, or you have another config set up.
  • You’ve saved this LinuxCNC config to a thumb drive or another PC, since to make things easy we should have a fresh install on the PC for these steps

Linux Mint 22 Installation

Download Linux Mint 22 from the main website, I don’t imagine the UI makes so much difference, but I used the XFCE version since it’s the lightest weight one.

Burn it to a USB disk, stick it in your LinuxCNC PC, and install. The installation process is really painless, especially compared to Debian 10/11, and for me it took less time to install Linux Mint than it took to boot in Debian period.

After the installation, make sure you have internet access on your LinuxCNC PC - you’ll need it for the following steps since you’ve got a new installation, make sure to run the following to ensure your system is up-to-date:

sudo apt update
sudo apt upgrade

Install Realtime Kernel

As of the time of this writing, Linux Mint 22 comes with the 6.8.0-38-generic kernel. Since 6.12 incorporated the PREEMPT_RT kernel patches into the main codebase, we can compile our own RT kernel. We will specifically use 6.12.9.

In the future, it's likely this process will be streamlined, so double-check before you go through the effort of manually compiling the kernel (unless you like that sort of thing)

First, we'll download tools to build the kernel from source.

sudo apt update
sudo apt install bc binutils bison dwarves flex gcc git gnupg2 gzip libelf-dev libncurses5-dev libssl-dev make openssl pahole perl-base rsync tar xz-utils

Then, we'll download and decompress the kernel source.

cd ~/
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.tar.xz
tar -xf linux-6.12.tar.xz
cd linux-6.12

Lets first get the current system kernel config for the baseline and copy it to our directory. You may get a couple of warnings, but this is ok.

cp /boot/config-$(uname -r) .config
make olddefconfig

Then, we'll run the command to get an in-terminal GUI for configuring the kernel ourselves.

make menuconfig

After the command shows up, we perform the following in the menuconfig GUI

  1. Use the keyboard to navigate to "General Setup -->" and press enter
  2. Scroll down about halfway to "Preemption Model (Voluntary Kernel Preemption) --> and press enter
  3. Then select "Fully Preemptable Kernel (Real-Time) from the list and press enter
  4. Press escape twice to exit to the main menu again.
  5. Scroll towards the bottom and select "Cryptographic API -->" and press enter.
  6. Scroll to the bottom and select "Certificates for signature checking -->" and press enter.
  7. Where it says "(debian/canonical-certs.pem) Additional X.509 Keys..." select it and press enter.
  8. Delete the entire text field, then press enter to save it.
  9. Scroll down to "(debian/canonical-revoked-certs.pem) X.509 certificates to be ..." select it and press enter.
  10. Delete the entire text field, then press enter to save it.
  11. Then, press the right arrow key to scroll the cursor the "Save" option at the bottom of the screen. Save it as .config (the default value) and press enter again to exit the dialog.
  12. Press escape 6 times to exit the menu

Now we will build the kernel using the following command:

make -j$(nproc)

Now go grab a coffee and lunch because it's going to take a while to compile.

Once it's done building, we will install the modules and the kernel

sudo make modules_install
sudo make install

Then we need to update GRUB so the bootloader finds our new kernel and restart

sudo update-grub
sudo reboot

To verify it's running the PREEMPT_RT kernel, after the restart check with

uname -v

Hopefully there's an easier way to do this in the near future, but congrats on the hardest step!

Install LinuxCNC

Just to be sure we're up to date, make sure to run

sudo apt update
sudo apt upgrade

Lets make sure we have all the required dependencies

sudo apt-get install build-essential dpkg-dev devscripts equivs python3-pip

Lets make sure we're in an appropriate directory and then clone the LinuxCNC Repo

cd ~/
git clone --branch 2.9 https://github.com/LinuxCNC/linuxcnc.git linuxcnc-source-dir
cd linuxcnc-source-dir

Run the configure script

./debian/configure no-docs
sudo mk-build-deps -i
sudo apt get build-dep .
sudo apt --fix-broken install

Then build the LinuxCNC RIP version

cd src
./autogen.sh
./configure --with-realtime=uspace
make
sudo make setuid
cd ..

Then we need to make some update to the rules to fix a weird error ...

nano debian/rules

Then add the following two lines near the top of the file

export DEB_CFLAGS_MAINT_APPEND = -U_FORTIFY_SOURCE
export DEB_CXXFLAGS_MAINT_APPEND = -U_FORTIFY_SOURCE

Then press CTRL+S to save the file, Enter, then CTRL-X to exit.
Now we can build the .deb package

dpkg-buildpackage -b -uc

and install the package

sudo dpkg -i ../linuxcnc-uspace_2.9.3_amd64.deb

Install QTPYVCP

First install the big list of dependencies

sudo apt install -y python3-venv python3-pyqt5 python3-serial python3-dbus.mainloop.pyqt5 python3-pyqt5.qtopengl python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtquick qml-module-qtquick-controls gstreamer1.0-plugins-bad libqt5multimedia5-plugins pyqt5-dev-tools python3-dev python3-setuptools python3-wheel python3-pip python3-six python3-docopt python3-qtpy python3-pyudev python3-psutil python3-markupsafe python3-opengl python3-vtk9 python3-pyqtgraph python3-simpleeval python3-jinja2 python3-deepdiff python3-sqlalchemy python3-distro git qttools5-dev-tools

Clone the repository

cd ~/
git clone https://github.com/kcjengr/qtpyvcp.git

Make a virtual environment

python3 -m venv --system-site-packages venv
source venv/bin/activate
pip install hiyapyco

Install the prerequisites and compile

cd qtpyvcp
pip install -e .
qcompile .

Then copy the example configurations and scripts

cp scripts/.xsessionrc ~/
cp -r ~/qtpyvcp/linuxcnc ~/

Install Probe Basic

Don't close out of the venv for now

Copy the repository

cd ~/
git clone https://github.com/kcjengr/probe_basic.git

Install and compile it as well

cd ~/probe_basic
pip install -e .
qcompile .

Then copy the configs and scripts, and set the venv into the .bashrc

cp -r ~/probe_basic/configs/probe_basic/ ~/linuxcnc/configs/
cp -r ~/probe_basic/fonts/ ~/.local/share/fonts/BebasKai.ttf
echo "source ~/dev/venv/bin/activate" >> ~/.bashrc