LinuxCNC from source - RIP Environment problems

More
23 Dec 2013 08:25 - 23 Dec 2013 08:28 #41939 by birchy
I have LinuxCNC installed on Debian Wheezy 7.2 with XFCE desktop, Arceye's RTAI kernel HERE and linuxcnc source HERE .

I am able to run the latency test from /usr/realtime/testsuite/usr/latency/run. I am able to start the rip-environment and launch either 'stepconf' or 'linuxcnc' from the terminal without any issues. Having run stepconf and configured it for my Warco WM16 milling machine, when I attempt to run linuxcnc with the confguration .ini, it fails to load, complaining about hal-lib, rtapi, rtai_math, rtai_sched, rtai_hal and shmdrv not being loaded. I get the same errors if I try to run one of the Sample Configurations in the linuxcnc tree menu.

What am I doing wrong?
Last edit: 23 Dec 2013 08:28 by birchy.

Please Log in or Create an account to join the conversation.

More
23 Dec 2013 16:56 #41942 by ArcEye
Hi

If you run latency-test from a terminal, this is what you get



You will get the same if you use halrun

Can you run the axis_mm sim from /configs/sim/axis/ in the RIP tree?

The output you should get is
LINUXCNC - 2.6.0~pre
Machine configuration directory is '/usr/src3/linuxcnc-dev-rtai/configs/sim/axis'
Machine configuration file is 'axis_mm.ini'
Starting LinuxCNC...
io started
halcmd loadusr io started
task pid=4786
emcTaskInit: using builtin interpreter


If that is OK, suggest your config needs looking at.

Post a zip of the whole dir, so we can try it

regards
Attachments:

Please Log in or Create an account to join the conversation.

More
24 Dec 2013 02:01 - 24 Dec 2013 02:12 #41953 by birchy
Despite being experienced with using linux, I'm confused! I notice you are running your linuxcnc as root user, yet the tutorial says to run it as 'username', which on my setup is 'birchy'. I don't think it's an issue, but during install, I ran "cp -R /usr/src/linuxcnc-dev-rtai /home/birchy" rather than "cp -R /usr/src/linuxcnc-dev-rtai /home/birchy/src". All it means is that I access the source using "cd /home/birchy/linuxcnc-dev-rtai" rather than "cd /home/birchy/src/linuxcnc-dev". The slightly shorter path shouldn't make any difference as I'm using the same sources?
birchy@linuxcnc:~$ cd linuxcnc-dev-rtai
birchy@linuxcnc:~/linuxcnc-dev-rtai$ . scripts/rip-environment
birchy@linuxcnc:~/linuxcnc-dev-rtai$ linuxcnc
LINUXCNC - 2.6.0~pre
Machine configuration directory is '/home/birchy/linuxcnc-dev-rtai/configs/sim/axis'
Machine configuration file is 'axis_mm.ini'
Starting LinuxCNC...
module 'shmdrv.ko' not found in directory
	/home/birchy/linuxcnc-dev-rtai/rtlib/rtai-kernel/3.5.7-rtai
/home/birchy/linuxcnc-dev-rtai/libexec/linuxcnc_module_helper: Unable to locate module 'shmdrv'
Realtime system did not load
Shutting down and cleaning up LinuxCNC...
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
halcmd: hal_init() failed: -22
NOTE: 'rtapi' module must be loaded
Error: Module hal_lib is not currently loaded
Error: Module rtapi is not currently loaded
Error: Module rtai_math is not currently loaded
Error: Module rtai_sched is not currently loaded
Error: Module rtai_hal is not currently loaded
realtime unload: warning: shmdrv expected to be loaded, but wasn't
Cleanup done
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/birchy/linuxcnc_debug.txt
and
    /home/birchy/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
birchy@linuxcnc:~/linuxcnc-dev-rtai$ 

It looks like the modules aren't loading? Output of lsmod:
birchy@linuxcnc:~$ lsmod
Module                  Size  Used by
aes_i586                6836  1 
aes_generic            25822  1 aes_i586
nfsd                  189716  2 
exportfs                2958  1 nfsd
nfs                   229247  0 
nfs_acl                 1827  2 nfs,nfsd
auth_rpcgss            24439  2 nfs,nfsd
fscache                34418  1 nfs
lockd                  49250  2 nfs,nfsd
sunrpc                139477  6 nfs,nfsd,auth_rpcgss,lockd,nfs_acl
ipv6                  241260  28 
loop                   14417  0 
arc4                    1014  2 
rt2800usb              12403  0 
rt2x00usb               7453  1 rt2800usb
rt2800lib              41866  1 rt2800usb
crc_ccitt                991  1 rt2800lib
rt2x00lib              30059  3 rt2x00usb,rt2800lib,rt2800usb
mac80211              227565  3 rt2x00lib,rt2x00usb,rt2800lib
cfg80211              144167  2 mac80211,rt2x00lib
rfkill                 12905  2 cfg80211
snd_via82xx            16230  1 
snd_ac97_codec         84512  1 snd_via82xx
snd_mpu401_uart         5063  1 snd_via82xx
ac97_bus                 577  1 snd_ac97_codec
nouveau               804221  2 
gameport                6348  1 snd_via82xx
ttm                    47258  1 nouveau
drm_kms_helper         21561  1 nouveau
drm                   172696  4 ttm,drm_kms_helper,nouveau
snd_seq_midi            3880  0 
snd_seq_midi_event      4568  1 snd_seq_midi
i2c_viapro              4391  0 
k8temp                  2454  0 
i2c_algo_bit            4312  1 nouveau
i2c_core               14911  5 drm,drm_kms_helper,i2c_algo_bit,i2c_viapro,nouveau
snd_rawmidi            15282  2 snd_mpu401_uart,snd_seq_midi
snd_pcm                57932  2 snd_via82xx,snd_ac97_codec
snd_page_alloc          5413  2 snd_via82xx,snd_pcm
snd_seq                42210  2 snd_seq_midi_event,snd_seq_midi
snd_seq_device          3949  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer              15908  2 snd_pcm,snd_seq
pcspkr                  1319  0 
amd64_agp               5943  1 
agpgart                20607  3 drm,ttm,amd64_agp
joydev                  7925  0 
snd                    42520  10 snd_via82xx,snd_ac97_codec,snd_timer,snd_pcm,snd_seq,snd_rawmidi,snd_mpu401_uart,snd_seq_device
soundcore               4239  1 snd
evdev                   8100  4 
shpchp                 21675  0 
pci_hotplug            16117  1 shpchp
serio_raw               3577  0 
ext3                  114058  1 
mbcache                 4094  1 ext3
jbd                    38716  1 ext3
hid_generic              637  0 
usbhid                 31223  0 
hid                    46036  2 hid_generic,usbhid
ide_gd_mod             20804  3 
ata_generic             2415  0 
pata_via                6968  0 
ide_pci_generic         1996  0 
sata_promise            8137  0 
uhci_hcd               18267  0 
firewire_ohci          27221  0 
ehci_hcd               33902  0 
firewire_core          44924  1 firewire_ohci
crc_itu_t                997  1 firewire_core
libata                137907  3 sata_promise,pata_via,ata_generic
scsi_mod               84841  1 libata
usbcore               106218  5 uhci_hcd,rt2x00usb,rt2800usb,ehci_hcd,usbhid
usb_common               517  1 usbcore
r8169                  41083  0 
mii                     3271  1 r8169
via82cxxx               4938  2 
ide_core               74127  3 ide_gd_mod,ide_pci_generic,via82cxxx
birchy@linuxcnc:~$ 

FYI: I've used ext3 format instead of ext2 as it was recommended by the realtime devs on another forum I read a few weeks ago (can't find it now though!).
Last edit: 24 Dec 2013 02:12 by birchy.

Please Log in or Create an account to join the conversation.

More
24 Dec 2013 19:04 - 24 Dec 2013 19:06 #41974 by ArcEye
It looks like the paths or permissions are messed up.
linuxcnc is a script and a lot of the paths etc are hardcoded and are dependent upon where you had it when you started the build process

Put the sources where you are going to run it from and then wipe everything and start again

First chown -R birchy:birchy /home/birchy so that everything in your home directory belongs to you

from /src make clean
then from the root dir, git clean -xdf

then from /src ./configure && make && make setuid && cd ../ && . ./scripts/rip-environment && linuxcnc

Hopefully it will work.

I notice you are running your linuxcnc as root user, yet the tutorial says to run it as 'username', which on my setup is 'birchy'.


A case of don't do as I do, do as I say :laugh:

The reason I run as root doing stuff like this is pure ease of use.

I have about 6 RIP environments on this partition alone and they are all in /usr/src (well several /usr/srcX directories with a symlink which points to the active one)

I launch mail and browser through scripts which su's me back to my user in a shell first.

regards
Last edit: 24 Dec 2013 19:06 by ArcEye.

Please Log in or Create an account to join the conversation.

More
24 Dec 2013 23:49 - 24 Dec 2013 23:55 #41983 by birchy
I've done clean installs of Wheezy about 5 or 6 times and followed your tutorial word for word over the last few weeks but had no joy with this. I'm using the CD 1 ISO as I don't have an internet connection during installation. I'm about to try your suggestions above but, TBH, don't hold much hope as I ran 'make clean' a few times over the weekend but had no success.

I think there is something else fundamentally wrong with my installations. Could it be that I'm using the Debian 7.2 CD1 with XFCE? Or maybe because I've been running 'apt-get update' and 'apt-get upgrade' before installing your rtai kernel and linuxcnc? If I run an upgrade now, I'll probably end up with Debian 7.3 as that's the current version.

Sorry to be a PITA, but what is your basic routine for a clean install on an empty HDD? I know you prefer lxde, but are you using the default Gnome version of Debian and THEN installing lxde or do you use the lxde version of Debian from the start? Do you think I will have more success using the Debian 7.1 CD from HERE asthe base?

Also, can you please post your sources.list? The CD install doesn't add the correct mirrors, so I use the ones generated from debgen.simplylinux.ch/ which are:
deb http://ftp.uk.debian.org/debian stable main contrib non-free
deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
Last edit: 24 Dec 2013 23:55 by birchy.

Please Log in or Create an account to join the conversation.

More
25 Dec 2013 01:29 - 25 Dec 2013 01:30 #41988 by ArcEye
Hi

I think you are barking up the wrong tree, which version of Debian 7 you have and which display / window manager should not matter.

So long as you have gcc 4.4 and not 4.6 or 4.7 as the default gcc, then Linuxcnc will work, the kernel and realtime already do, as you have shown.
Starting LinuxCNC...
module 'shmdrv.ko' not found in directory
	/home/birchy/linuxcnc-dev-rtai/rtlib/rtai-kernel/3.5.7-rtai
/home/birchy/linuxcnc-dev-rtai/libexec/linuxcnc_module_helper: Unable to locate module 'shmdrv'

This tells me that the paths are wrong, or the module did not get built.

You can soon check which it is by looking through the sources
There should be 148 kernel modules in /home/birchy/linuxcnc-dev-rtai/rtlib/rtai-kernel/3.5.7-rtai/ and shmdrv.ko is one of them

If you can't see it, go to the root directory of the RIP and run find ./ -name shmdrv.ko
you should get
root@INTEL-QUAD:/usr/src/linuxcnc-dev-rtai# find ./ -name shmdrv.ko
./src/objects/rtai-kernel/3.5.7-rtai/shmdrv.ko
./rtlib/rtai-kernel/3.5.7-rtai/shmdrv.ko


If there is nothing whatsoever in those 2 directories, it is not building for rtai, but that is unlikely because it has already made a kernel specific folder (3.5.7-rtai)

If it exists and module-helper cannot find it, the probability is that module-helper was not setuid root and/or that directory is not chowned to your user

I would go back to my last post, put it where you want to build it, clean it completely (not just make clean that will leave the configure files with wrong paths), make sure everything is owned by you and then run configure and start over
making sure to setuid at the end to give those files that need it root access

regards
Last edit: 25 Dec 2013 01:30 by ArcEye.

Please Log in or Create an account to join the conversation.

More
25 Dec 2013 01:42 - 25 Dec 2013 01:49 #41989 by birchy
Strangely enough, I ran find / -name "*shmdrv.ko*" last night but it didn't find anything, despite searching the whole filesystem.

This is the 'idiot' guide I wrote for my own reference. Obviously I'm a bigger idiot than I thought! Can you see any obvious cock-ups? I'm 95% confident it is correct as I wrote this while running my many attempts at getting this darn PC to run linuxcnc. Note that I've saved your deb files to a flash drive and changed the names slightly. I then copy those files to my home directory after installing debian. Changing the names shouldn't make any difference...or does it??
*** Install Debian ***
1. Enable 'usb legacy support' in BIOS if using wireless keyboard for install
2. NOTE: when installing Debian, on the 'Partition disks' page, use UP arrow key to highlight 'primary' and change format to 'ext3'. This is the recommended format for RTAI kernels.
3. Install Debian Wheezy 7.2 from CD (http://cdimage.debian.org/debian-cd/7.2.0/i386/bt-cd/debian-7.2.0-i386-xfce-CD-1.iso.torrent)
4. Boot default PAE kernel

*** Install Sumvision WiFi Dongle ***
1. su [enter password]
2. cp rt2870.bin /lib/firmware
3. echo 'install rt2800usb modprobe --ignore-install rt2800usb ; /bin/echo "148f 5370" > /sys/bus/usb/drivers/rt2800usb/new_id' | tee /etc/modprobe.d/rt2800usb.conf
4. nano /etc/modules
5. add 'rt2800usb' above 'loop' and save file
6. reboot
7. manually configure network-manager (left-click > choose access point (connection fails), then right-click on Network Manager > edit connections > wireless > set password)

*** Update software sources ***
1. su [enter password]
2. cp sources.list /etc/apt
3. apt-get update
4. apt-get upgrade
5. reboot

*** Install build dependencies ***
1. su [enter password]
2. apt-get install build-essential debhelper kernel-package libpth-dev libgtk2.0-dev tcl8.5-dev tk8.5-dev bwidget python-old-doctools python-tk python-dev libglu1-mesa-dev libgtk2.0-dev libgnomeprintui2.2-dev libncurses5-dev libxaw7-dev gettext libreadline-gplv2-dev lyx texlive-extra-utils imagemagick texinfo groff libmodbus-dev libudev-dev libmodbus-dev libboost-python-dev libboost-serialization-dev libboost-thread-dev libtk-img automake autoconf libtool xutils-dev cpp-4.4 gcc-4.4 g++-4.4 libstdc++6-4.4-dev sudo python-gnome2 python-glade2
3. adduser birchy sudo [user will be enabled after login]
4. reboot

*** Link gcc to version 4.4 ***
1. su [enter password]
2. cd /usr/bin
3. rm cpp gcc gcov g++
4. ln -s cpp-4.4 cpp && ln -s gcc-4.4 gcc && ln -s g++-4.4 g++ && ln -s gcov-4.4 gcov
5. check gcc -v (should be 4.4)

*** Install 3.5.7 RTAI Uni-Processor Kernel (compiled for single core cpu) ***
1. su [enter password]
2. cd to folder containing .deb files
3. dpkg -i kernel-3.5.7-rtai-UP.deb
4. update-grub
5. reboot (should load rtai kernel) check with uname -r
6. reboot again (apps freeze on first boot but ok after?)

*** Optimize operating system ***
1. disable 'usb legacy support' in BIOS
2. sudo apt-get remove upower
3. sudo apt-get install rcconf
4. sudo rcconf. use space bar to disable: acpid, alsa-utils, anacron, atd, avahi-daemon, cron, exim4, motd, rsync
5. disable screensaver

*** Run RTAI latency test ***
1. cd /usr/realtime/testsuite/user/latency
2. ./latency & sudo ./run (./run freezes if run first?)

*** Install LinuxCNC ***
1. gcc -v (version 4.4 sanity check!)
2. su [enter password]
3. dpkg -i linuxcnc-rtai-i386.deb
4. cp -R /usr/src/linuxcnc-dev-rtai /home/birchy
5. chown -R birchy:birchy /home/birchy/*
6. exit [leave su]
7. cd /home/birchy/linuxcnc-dev-rtai/src
8. ./autogen.sh
9. ./configure
10. make
11. sudo make setuid

*** Start Run-In-Place environment ***
1. cd /home/birchy/linuxcnc-dev-rtai
2. . scripts/rip-environment
3. sudo modprobe -r rt2800usb [unloads wifi driver from kernel = significant speed increase]

*** Run linuxcnc ***
1. cd /home/birchy/linuxcnc-dev-rtai
2. linuxcnc
Last edit: 25 Dec 2013 01:49 by birchy.

Please Log in or Create an account to join the conversation.

More
25 Dec 2013 09:56 - 25 Dec 2013 10:06 #41998 by birchy
One thing is now certain: linuxcnc is NOT building for the rtai kernel. Could it be related to the fact I'm installing on an AMD 64-bit processor? I notice your kernels are aimed at Intel processors, have you set some config in linuxcnc to also target Intel? I'm using the i386 version of debian which shows in 'uname -m' as i686. It's probably irrelevant because it IS an x86, but I'm wondering if the AMD processors handle shared memory differently to Intel?

After spending 100+ hours on this over recent weeks, I'm becoming more and more tempted to look at Mach. But I really don't want to go down the Windows route as I've not used it for about 5 or 6 years. Is there some other way I can avoid moving to the Dark Side? Maybe a different linuxcnc source?

FYI, my /home/birchy/linuxcnc-dev-rtai/rtlib folder only has 'posix' and 'rt-preempt' sub-folders. 'rtai-kernel' is NOT there. :(
Last edit: 25 Dec 2013 10:06 by birchy.

Please Log in or Create an account to join the conversation.

More
25 Dec 2013 15:43 #42001 by ArcEye
If necessary I will zip my working build and put it where you can download it.

When I get to my other machine later, I will check the configure options on that snapshot, in the meantime attach the file called config log or similar from the root dir of the RIP

Please Log in or Create an account to join the conversation.

More
26 Dec 2013 04:44 - 26 Dec 2013 04:47 #42007 by birchy
MERRY CHRISTMAS! And thanks for your patience so far!

Now that there's naff-all on telly and all the outlaws have left, here's my config.log as requested. I notice this line:
configure:2800: gcc -qversion >&5
gcc: unrecognized option '-qversion'
gcc: no input files

Is that just a generic number or is it related to the kernel modules? My usb wifi dongle uses the rt2800usb driver and requires some minor fiddling to install. I'm just wondering if it's causing an issue?

File Attachment:

File Name: config.log.txt
File Size:51 KB
Attachments:
Last edit: 26 Dec 2013 04:47 by birchy. Reason: log file did not attach - added .txt file extension

Please Log in or Create an account to join the conversation.

Time to create page: 0.096 seconds
Powered by Kunena Forum