Cannot Connect Ardour 2 to Jack2 in Lucid

Everything was fine when I had the packages installed from the package manager. I wanted to install guitarix, but for that to work, I had to have Jack2. I’ve removed and manually built and installed Jack and Ardour 2, and now everything works fine except that even when Jack is running, Ardour will not connect to it. The path to the Jack command is right, but whether I start with jack running or not, I get an error saying connection refused. I know the first thing that will be pointed out is the part of the message saying hw0:0 already in use. It’s in use because jack is running- I’ve already rebooted and tried to start ardour without starting jack first and still no go.
I’ve pasted the output below. Thanks a million in advance for any help!
Keven

dfwsupergeek@dfwsupergeek-laptop:~$ sudo /usr/bin/ardour2
[sudo] password for dfwsupergeek:
WARNING: Your system has a limit for maximum amount of locked memory!
This might cause Ardour to run out of memory before your system runs
out of memory. You can view the memory limit with ‘ulimit -l’, and it
is normally controlled by /etc/security/limits.conf

Ardour/GTK 2.8.7
(built using 6628 and GCC version 4.4.3)
Copyright © 1999-2008 Paul Davis
Some portions Copyright © Steve Harris, Ari Johnson, Brett Viren, Joel Baker

Ardour comes with ABSOLUTELY NO WARRANTY
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This is free software, and you are welcome to redistribute it
under certain conditions; see the source for copying conditions.
/usr/share/themes/showtime/gtk-2.0/gtkrc:89: Murrine configuration option “scrollbar_color” is no longer supported and will be ignored.
/usr/share/themes/showtime/gtk-2.0/gtkrc:94: Murrine configuration option “gradients” is no longer supported and will be ignored.
theme_init() called from internal clearlooks engine
loading default ui configuration file /etc/ardour2/ardour2_ui_default.conf
loading user ui configuration file /root/.ardour2/ardour2_ui.conf
Loading ui configuration file /etc/ardour2/ardour2_ui_dark.rc
ardour: [INFO]: Ardour will be limited to 1024 open files
loading system configuration file /etc/ardour2/ardour_system.rc
ardour: [INFO]: Using SSE optimized routines
ardour: [INFO]: looking for control protocols in /root/.ardour2/surfaces/:/usr/lib/ardour2/surfaces/
ardour: [INFO]: Control surface protocol discovered: “Mackie”
powermate: Opening of powermate failed - No such file or directory
ardour: [INFO]: Control protocol powermate not usable
ardour: [INFO]: Control surface protocol discovered: “Generic MIDI”
system template path = /usr/share/ardour2//templates
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
JACK COMMAND: /usr/local/bin/jackd -p 128 -R -P 60 -T -d alsa -n 2 -r 48000 -p 1024 -d hw:0,0
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jackdmp 1.9.5
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2009 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
JACK server starting in non-realtime mode
creating alsa driver … hw:0|hw:0|1024|3|44100|2|2|nomon|hwmeter|-|32bit
Using ALSA driver ICH4 running on card 0 - Intel ICH6 with STAC9750,51 at irq 16
the playback device “hw:0” is already in use. Please stop the application using it and run JACK again
JackTemporaryException : now quits…
Cannot connect to server socket err = Connection refused
Cannot connect to server socket
Cannot connect to server socket err = Connection refused
Cannot connect to server socket
Cannot connect to server socket err = Connection refused
Cannot connect to server socket
Cannot connect to server socket err = Connection refused
Cannot connect to server socket
Cannot connect to server socket err = Connection refused
Cannot connect to server socket
jack server is not running or cannot be started
dfwsupergeek@dfwsupergeek-laptop:~$ ^C
dfwsupergeek@dfwsupergeek-laptop:~$

Fire up a terminal and type:

groups username (change username to yours)

You should be listed in the audio group. If not:

sudo gedit /etc/group

look for a line that says something like:

audio:x:29:

and add your username in that line.

Then do:

sudo gedit /etc/security/limits.conf

and at the very bottom add these 2 lines:

@audio - rtprio 99
@audio - memlock unlimited

Save, close and reboot.

And as it goes sometimes, the problem vanished, making me look like a complete Noob! Ok, then…
After another reboot, started jack with Qjackctl- then stopped it, then started ardour2, let it start the audio server… then stopped it. Then, the next time, Ardour couldn’t start it, but qjackctl would-
So, all is fine, and I have guitarix too!