Skip to content

LinuxCNC on Ubuntu 12.04LTS

Recent developments has made it possible to run LinuxCNC on the latest LTS release of Ubuntu. This is experimental work, so not recommended for controlling a real machine just yet. The main obstacle for moving LinuxCNC from 10.04LTS to a more recent distribution has been the RTAI real-time kernel, which has not been kept up-to-date with development of the normal Linux kernel. Fortunately there are alternatives such as Xenomai or RT_PREEMPT.

Here is a step-by-step description of the install/build process, if you want to experiment with this.

  1. Download and install a normal 32-bit 12.04LTS Ubuntu (ubuntu-12.04.1-desktop-i386.iso). Note that the 64-bit version is not supported for the steps that follow further down. I could not get Ubuntu's startup-disk-creator to work, so I used unetbootin to write the ISO-file to a USB-stick.
  2. It's possible to compile the xenomai-kernel from scratch, along with the runtime etc., but I used pre-compiled deb-packages by Michael Haberler from here: http://static.mah.priv.at/public/xenomai-debs/
  3. Install the xenomai kernel:
    sudo dpkg -i linux-headers-3.2.21-xenomai+_0.1_i386.deb
    sudo dpkg -i linux-image-3.2.21-xenomai+_0.1_i386.deb
  4. make sure it will show up as a GRUB-entry when booting:
    sudo update-initramfs -c -k 3.2.21-xenomai+
    sudo update-grub
  5. reboot. uname -r should now show: 3.2.21-xenomai+
  6. now install the xenomai runtime:
    sudo dpkg -i libxenomai1_2.6.1_i386.deb
    sudo dpkg -i libxenomai-dev_2.6.1_i386.deb
    sudo dpkg -i xenomai-runtime_2.6.1_i386.deb

This installs the xenomai system on top of which a recently available version of LinuxCNC can be built. There are probably many ways to now obtain the tools/dependencies that are required. I used the following:

  1. sudo apt-get install synaptic
    sudo apt-get install git
  2. Now using synaptic, install the following packages (I found these are required for a minimal linuxcnc build):
    build-essential
    autoconf
    libpth-dev
    libglib2.0-dev
    libgtk2.0-dev
    tcl-dev
    tk-dev
    bwidget
    libreadline-dev
    python-tk
    python-dev
    libgl1-mesa-dev
    libglu1-mesa-dev
    libxmu-dev
  3. Get Michael's version of LinuxCNC that can be compiled for Xenomai:
    git clone git://git.mah.priv.at/emc2-dev emc2-dev
    cd emc2-dev
    git branch --track rtos origin/rtos-integration-preview1
    git checkout rtos
  4. Configure and build for Xenomai:
    cd src
    ./configure --with-threads=xenomai-user --enable-run-in-place
    make
    sudo make setuid
  5. Test:
    . ./scripts/rip-environment
    latency-test

This new version of LinuxCNC can be built without a real-time kernel (previously called "simulator" or "sim") or with any of the real-time kernel alternatives: RTAI, Xenomai, RT_PREEMPT. It should be possible to compare real-time performance in the form of latency-numbers with different hardware and kernels.

20 Comments

  1. anders wrote:

    building the documentation requires: asciidoc

    Thursday, December 6, 2012 at 18:15 | Permalink
  2. anders wrote:

    and these may also be required for the doc-build:
    dvipng texlive-extra-utils texlive-latex-recommended texlive-fonts-recommended ghostscript imagemagick texlive-lang-french texlive-lang-german texlive-lang-spanish texlive-lang-polish texlive-font-utils asciidoc (>= 8.5) source-highlight dblatex (>= 0.2.12) xsltproc groff libgnomeprintui2.2-dev texlive-lang-cyrillic

    Thursday, December 6, 2012 at 18:16 | Permalink
  3. anders wrote:

    further (optional) dependencies:
    xemc-GUI: libxaw7-dev,
    printing from classicladder: libgnomeprinting-2.2-dev
    keystick-GUI: libncurses-dev

    Thursday, December 6, 2012 at 18:20 | Permalink
  4. orr wrote:

    with next 3.2.21-xenomai+_0.2 the system does not start. rebooting always. is that what should be?

    Thursday, December 27, 2012 at 10:16 | Permalink
  5. admin wrote:

    No, the xenomai-kernel should boot quite normally and you should see a normal Ubuntu startup sequence, desktop etc.
    If you can get your machine to boot from HDD you can edit the GRUB configuration so it boots to a stable kernel.
    If nothing else helps you can boot from a LiveCD or USB stick and try to edit the GRUB settings or even do a complete reinstall.

    Is this a very new or very old motherboard/cpu? I guess that xenomai kernel is built on top of a standard 3.2.21-kernel, so it might be worth testing if a standard 3.2.21-kernel (or any 3.2 series) installs and boots OK.
    Michael H might know more about what drivers or options are disabled in the xenomai kernel wrt. a standard kernel - maybe something is missing in xenomai and that is causing your problems.

    Thursday, December 27, 2012 at 10:43 | Permalink
  6. orr wrote:

    nope, it's a 2012 535u3c samsung notebook. i can boot to initial 12.10 kernel.

    Thursday, December 27, 2012 at 12:29 | Permalink
  7. orr wrote:

    maybe 12.10 does not suite

    Thursday, December 27, 2012 at 12:45 | Permalink
  8. admin wrote:

    yes it's best to try these things on 12.04LTS (32bit!) , since the xenomai kernel was built for that.

    Thursday, December 27, 2012 at 14:17 | Permalink
  9. orr wrote:

    i'm having endless ramdom freezings in 12.04.1 :( cannot test. it's a well-known problem not fixed.

    Sunday, December 30, 2012 at 19:53 | Permalink
  10. admin wrote:

    hm, nor sure why you are having problems. Did you do an md5sum check on your iso-download? Can you do a memcheck test on your machine to see that the hardware is ok?

    Sunday, December 30, 2012 at 21:48 | Permalink
  11. orr wrote:

    i did everything that. installed from alternate cd, deinstalled unity and gnome* - nothing helps, it just hangs without logic in not predicted moments. 12.10 is perfect when installed. i'll try to find some ways or wait 12.04.2 ))

    Monday, December 31, 2012 at 08:42 | Permalink
  12. John Morris wrote:

    Hi Anders, thanks for the instructions!

    Probably the other commenters with boot problems are having trouble with the kernel config, which we have found has turned off some drivers needed for some systems require to boot.

    There's a new wiki page on LinuxCNC.org that explains how to build a kernel yourself, or else install pre-built packages. The config file is based on the Ubuntu Precise kernel config. These packages should support just about any hardware that the normal Ubuntu Precise kernel supports.

    See the page here: http://wiki.linuxcnc.org/cgi-bin/wiki.pl?XenomaiKernel

    John/Zultron

    Sunday, January 27, 2013 at 05:42 | Permalink
  13. Andreas wrote:

    Thanks for the instructions. I managed to install linuxcnc but when i try to test my axis using stepconf i get the following error
    Stepconf encountered an error. The following information may be useful in troubleshooting:

    Traceback (most recent call last):
    File "./stepconf", line 1738, in on_xaxistest_clicked
    def on_xaxistest_clicked(self, *args): self.test_axis('x')
    File "./stepconf", line 2107, in test_axis
    if not self.check_for_rt(): return
    File "./stepconf", line 1282, in check_for_rt
    elif hal.is_rt and not hal.kernel_version == actual_kernel:
    AttributeError: 'module' object has no attribute 'kernel_version'

    halmodule.cc contains the following line

    #ifdef RTAPI_KERNEL_VERSION
    PyModule_AddStringConstant(m, "kernel_version", RTAPI_KERNEL_VERSION);

    My kernel is
    root@Mpoha> uname -a
    Linux Mpoha 3.2.21-xenomai+ #1 SMP PREEMPT Tue Oct 30 19:01:33 UTC 2012 i686 i686 i386 GNU/Linux

    Saturday, February 23, 2013 at 19:14 | Permalink
  14. admin wrote:

    Hi Andreas,

    You don't strictly need stepconf to run linuxcnc. It's a good idea to learn what goes into the INI and HAL files anyway and not blindly trust stepconf.

    I'm not sure why exactly you see that problem. Stepconf may be written in a way that assumes an RTAI system.

    There are about three good ways to report problems like these:
    - the mailing-list: https://lists.sourceforge.net/lists/listinfo/emc-users
    - the forum: http://www.linuxcnc.org/index.php/english/forum/index
    - on IRC: #LinuxCNC and #LinuxCNC-devel on irc.freenode.net

    Anders

    Saturday, February 23, 2013 at 19:51 | Permalink
  15. Andreas wrote:

    Thanks Anders :)

    Saturday, February 23, 2013 at 20:03 | Permalink
  16. Lucio wrote:

    hi dudes,
    thank's for this page, it has been the only valid way to install linuxcnc on xubuntu 12.04
    BUT... i've the followin' problem:
    i click on the con, program start and i can select the configuration options
    linuxcnc logo with penguin, version etc. appear and... a linuxcnc error window open and program exit.
    the error message is:
    Print file information:
    RUN_IN_PLACE=no
    LINUXCNC_DIR=
    LINUXCNC_BIN_DIR=/usr/bin
    LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
    LINUXCNC_SCRIPT_DIR=
    LINUXCNC_RTLIB_DIR=/usr/lib/linuxcnc/modules
    LINUXCNC_CONFIG_DIR=
    LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
    INIVAR=inivar
    HALCMD=halcmd
    LINUXCNC_EMCSH=/usr/bin/wish8.5
    LINUXCNC - 2.5.2-193-g6de7f0d
    Machine configuration directory is '/home/incisoria/linuxcnc/configs/cooltool-1'
    Machine configuration file is 'Basic540_4axes.ini'
    INIFILE=/home/incisoria/linuxcnc/configs/cooltool-1/Basic540_4axes.ini
    PARAMETER_FILE=stepper.var
    TASK=milltask
    HALUI=
    DISPLAY=axis
    Starting LinuxCNC...
    Starting LinuxCNC server program: linuxcncsvr
    Loading Real Time OS, RTAPI, and HAL_LIB modules
    Starting LinuxCNC IO program: io
    Shutting down and cleaning up LinuxCNC...
    Killing task linuxcncsvr, PID=7315
    Removing HAL_LIB, RTAPI, and Real Time OS modules
    Removing NML shared memory segments
    Cleanup done

    Debug file information:
    Can not find -sec MOT -var MOT -num 1
    Can not find -sec IO -var IO -num 1
    Can not find -sec LINUXCNC -var NML_FILE -num 1
    Can not find -sec EMC -var NML_FILE -num 1
    hal_parport: dlopen: /usr/lib/linuxcnc/modules/hal_parport.so: cannot open shared object file: No such file or directory
    S4_pinout.hal:6: /usr/bin/rtapi_app exited without becoming ready
    S4_pinout.hal:6: insmod failed, returned -1
    7315
    PID TTY STAT TIME COMMAND
    Stopping realtime threads
    Unloading hal components

    could somebody pleeeeeease help me?
    thanks

    Wednesday, April 17, 2013 at 08:57 | Permalink
  17. admin wrote:

    Lucio,
    You should try running linuxcnc in sim-mode. Does that work? That would indicate a problem with the parport driver.

    In general it's best to post all your configuration files and your error output on either the linuxcnc form or the linuxcnc mailinglist. My experience is that there is usually someone there who knows how to solve your problem and can help you.

    AW

    Wednesday, April 17, 2013 at 09:52 | Permalink
  18. kris wrote:

    Hi there, linux n00b here, I had great luck with your instructions up to #4. It reads:
    Configure and build for Xenomai:
    cd src
    ./configure --with-threads=xenomai-user --enable-run-in-place
    make
    sudo make setuid

    BUT I think it should read:
    Configure and build for Xenomai:
    cd src
    sh autogen.sh
    ./configure --with-threads=xenomai-user --enable-run-in-place
    make
    sudo make setuid

    Friday, May 3, 2013 at 00:26 | Permalink
  19. valgrind wrote:

    I installed 12.04.2, but according to latency-test outputs, it doesnt meet real-time requirements.

    Monday, May 13, 2013 at 23:40 | Permalink
  20. admin wrote:

    valgrind: you will need to provide more information. what kernel are you running? what hardware? what are the latency numbers? The LinuxCNC wiki has a list of common issues that affect RT performance:
    http://wiki.linuxcnc.org/cgi-bin/wiki.pl?TroubleShooting
    the most common problems are BIOS settings that affect on-board video/audio/USB/power-saving

    Tuesday, May 14, 2013 at 04:48 | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*