XBMC for Linux - Tips and Tricks
#31
The scripts still basically work, but yeah, you need to use xbmc.bin instead of XboxMediacenter, and you should be using the new "xbmc" startup script as well. Unfortunately editing posts are disabled on these board for ideological reasons, so there's not much I can do about it. I reported the posts and asked the moderators to make the changes twice over the past couple of months, but no luck.

Edit: hey, editing posts works now!
Edit2: Updated all the tips/tricks posts. Please let me know if there are any further issues!
Reply
#32
rodalpho Wrote:Here are some simple shell scripts that you may find useful. I'm not a particularly strong scripter, so I'm sure these can be greatly improved.

Start/Kill XBMC with the remote control
If you don't have a wireless keyboard, it can be useful to start XBMC with the remote control. XBMC is still in beta, so it can lock up occasionally. When it does, you can SSH in and kill the process, get out that keyboard again and ctrl-alt-backspace, or use the remote to kill the process. The remote is the way to go.

=== 1
Install LIRC, the daemon that receives IR signals from the remote control. In the terminal:
Code:
sudo apt-get install lirc lirc-x liblircclient0

=== 2
To determine what should be placed in the "button" lines in your .lircrc, referenced in section 3:
1) Run "irw" from the terminal. It should appear to hang. If it doesn't, or you get an error message, your LIRC is setup incorrectly.
2) Point your remote at the receiver and press the button you want to assign. The buttons I've used are on the windows MCE remote and unused by XBMC.
3) Hit CTRL-C to exit irw.

=== 3
Put the following in your ~/.lircrc file, replacing the "button" arguments as you like. Create the file if it does not already exist.
Code:
# Start XBMC
begin
prog = irexec
button = RecTV
config = /home/youruser/scripts/startXBMC.sh
end

# Kill XBMC
begin
prog = irexec
button = DVD
config = /home/youruser/scripts/killXBMC.sh
end

=== 4
This script will start the IR daemons. Create it as "/home/youruser/scripts/startIRexec.sh":
Code:
#!/bin/bash

# Test to see if IRXevent is running first, if so kill it, then restart
if ps -ef|grep -v grep|grep -i irxevent
then
ps aux|grep -i youruser|grep -i irxevent |awk '{print $2}'|xargs kill
else
# Do nothing
echo "irxevent already dead!"
fi

# Test to see if IRexec is running first, if so kill it, then restart
if ps -ef|grep -v grep|grep -vi start|grep -i irexec
then
ps aux|grep -i youruser|grep -i irexec |grep -vi start|awk '{print $2}'|xargs kill
else
# Do nothing
echo "irexec already dead!"
fi

#test to see if an instance of irxevent is already running
if ps -ef|grep -v grep|grep irxevent
then
# do nothing
echo "irxevent already running"
else
# start irxevent
irxevent /home/youruser/.lircrc &
fi

#test to see if an instance of irexec is already running
if ps -ef|grep -v grep|grep irexec
then
# do nothing
echo "irexec already running"
else
# start irxevent
irexec -d /home/youruser/.lircrc &
fi

exit

=== 5
To automatically start the IRXevent and IRexec daemons when you login to the desktop, go to the SYSTEM, PREFERENCES, SESSIONS menu. Click "Add", and fill in the following:
Name: Start IR Daemons
Command: /home/youruser/scripts/startIRexec.sh
Comment: whatever you want

Click OK, then the checkbox so it's enabled. This will run the startIRexec.sh script every time you log on to the desktop.

=== 6
Create the following scripts. These actually start and kill XBMC.

/home/youruser/scripts/startXBMC.sh: (replace "youruser" with your user name)
Code:
#!/bin/bash

# Test to see if XBMC is running first
if ps -ef|grep -v grep|grep -i xbmc.bin
then
# Do nothing
echo "XBMC already Running!"
else
# Startup XBMC
xbmc
fi
exit

/home/youruser/scripts/killXBMC.sh:
Code:
#!/bin/bash

# Test to see if XBMC is running first
if ps -ef|grep -v grep|grep -i xbmc.bin
then
# Try a clean kill
ps aux|grep -i youruser|grep -v grep|grep -i xbmc.bin|awk '{print $2}'|xargs kill
echo `date` "Killed XBMC! (soft)" >> /tmp/killXBMC.log
else
echo "XBMC already dead! (soft)"
exit
fi

# takes a second or two to die with the soft kill
sleep 2

# Test to see if it's still running
if ps -ef|grep -v grep|grep -i xbmc.bin
then
# If it's still around, kill it -9
ps aux|grep -i youruser|grep -v grep|grep -i xbmc.bin|awk '{print $2}'|xargs kill -9
echo `date` "Killed XBMC! (hard)" >> /tmp/killXBMC.log
else
echo "XBMC already dead! (hard)"
exit
fi

=== 7
Make the scripts executable.
Code:
chmod +x /home/youruser/scripts/*.sh

=== 8
Log out of the desktop, then log back in. You should be set!

1) Press the button you set to start XBMC (Recorded TV if you used my suggestion). XBMC should start. Start playing a video.
2) Press the button you set to kill XBMC (DVD if you used my suggestion). XBMC should gracefully exit. Your mouse should still work in X windows, if you have one plugged in.
3) Start XBMC back up, start playing a video, then make XBMC lock up. The easiest way is to play a video, go to the video options, and change the interlacing method a couple of notches. Then press the kill button again-- it should hard kill XBMC, instantaneously taking you back to the desktop. Your mouse will likely be inoperable; to fix it just start and stop XBMC again.

Hope this helps, and please post any other tips you've hacked together!

Is it possible to change this guide working for xbmc installed using this guide http://www.xbmc.nu/index.php?option=com_...&Itemid=40

I have some settings in my /home/user/.xbmc
and the program it self is in /usr/share/xbmc
The program itself is called xbmc.bin.

killXBMC and startXBMC needs to be correted...

EDIT
Will read this thread and see if it helps me.


/Söder
Reply
#33
How to make sure Ubuntu mounts external drives in the same place at boot time

If you find that Ubuntu is randomly assigning mount points to an external USB or FireWire drive every time it boot up (eg /media/disk-2, /media/disk-3 etc.), it's probably because you haven't given your drive a name.

Unlabelled drives mean that Ubuntu will mount them with any old mount point. This is a good HOWTO that walks you through the process of naming a drive to so that it always mounts in the same place.
______________________

Acer Revo 1600 | SpeedLink SL-6399 | Kodibuntu :nerd:
Reply
#34
After a long haul with MythTV... I'm very pleased to have switched to XBMC.. Nice work guys! So.. to contribute a bit, I thought I'd provide my little tricks to running XBMC on my dedicated Ubuntu (Intrepid) HTPC.

Here is a link to the thread I started
http://forum.xbmc.org/showthread.php?p=266552

Cheers
Shane
Reply
#35
You can also use pidof instead of the multiple greps.

/usr/local/bin/xbmc-starter.sh
Code:
#!/bin/bash

XBMC=/usr/share/xbmc/xbmc.bin

if pidof -s $XBMC
then
  killall $XBMC
#  sleep 5
#  /usr/bin/shutdownvdr
else
  xinit /usr/bin/xbmc -fs --standalone &
fi

Is start linux without window- and desktopmanager.
Autologin with rungetty.
Irexec gets autostarted at login.

The start script is exectued when pessing the power button on the remote.

/etc/lirc/lircrc
Code:
begin
     remote = mceusb
     button = Power
     prog = irexec
     repeat = 0
     config = /usr/local/bin/xbmc-starter.sh
end
Reply
#36
The stock Ubuntu intrepid nvidia graphics drivers don't support video GPU offloading through VDPAU. To get offloading in the VDPAU XBMC branch, you need to upgrade. This isn't terribly difficult, but does have some fine points. Short walkthrough is below.

1) Get the newest version of the drivers from nvidia.com. Note that you should go to nvidia.com to get the newest link as 180.29 will not be the newest version forever.
Code:
wget http://us.download.nvidia.com/XFree86/Linux-x86/180.29/NVIDIA-Linux-x86-180.29-pkg1.run

2) Deactivate Ubuntu's version of the nvidia drivers under system|administration|hardware drivers

3) Uninstall any old nvidia drivers (This step can possibly be skipped; I needed it as I skipped step 2 my first try. Step 2 is definitely mandatory.)
Code:
sudo nvidia-uninstall

4) From a shell prompt (ssh into your box or go to a VT from the console via ctrl-alt-F2) run the following to stop X windows.
Code:
sudo /etc/init.d/gdm stop

5) From that same shell prompt, run the file downloaded in step 1 to install the new drivers. Allow it to download headers, recompile kernel modules, etc.
Code:
sudo sh NVIDIA-Linux-x86-180.29-pkg1.run

6) Reboot
Code:
sudo shutdown -r now
Reply
#37
I normally
PHP Code:
apt-get install build-essential 
before trying to install the NVIDIA drivers on a clean system.
Reply
#38
I tried 180.29 last week and it killed my hdmi audio. I reinstalled alsa 1.0.19 updated the alsa-base and configured .asoundrc but no go so I went back to 180.22

I tried this with mythbuntu 8.10 Xbmc SVN 17292 and Intrepid PPA on an Asus P5N7A-VM

Dave
Reply
#39
I have two machines running 180.29 and HDMI audio is working well. I have an older ALSA on both of them - 1.0.17 or 18 I think. Both of these are ASUS P5N7A-VM boards although one has sound setup better than the other. In any case souond does work with this driver.
Openelec Gotham, MCE remote(s), Intel i3 NUC, DVDs fed from unRAID cataloged by DVD Profiler. HD-DVD encoded with Handbrake to x.264. Yamaha receiver(s)
Reply
#40
I did this and now i cant get any nvidia driver to work :/
Reply
#41
Znubbis: You need to clear every last vestige of nvidia from your system before trying again.

Deactiviate the nvidia driver (if you're using it) in Hardware Drivers.

Use <ctrl><alt><f2> to switch to a console.

Become root:
Code:
sudo su

Stop the display manager:
Code:
/etc/init.d/gdm stop

Remove the nvidia module:
Code:
modprobe -r nvidia


Now begin removing nvidia files:

From the NVIDIA instructions:
Quote:If you use Ubuntu, please also ensure that the linux-restricted-modules or linux-restricted-modules-common packages have been uninstalled. Alternatively, you can edit the /etc/default/linux-restricted-modules or /etc/default/linux-restricted-modules-common configuration file and disable the NVIDIA linux-restricted kernel modules (nvidia, nvidia_legacy) via:

DISABLED_MODULES="nv nvidia_new"

Additionally, delete the following file if it exists:

/lib/linux-restricted-modules/.nvidia_new_installed


Next try deleting any other nvidia packages:
Code:
apt-get remove --purge nvidia-glx*
apt-get remove --purge nvidia*

Look for any possible leftovers:
Code:
find / -name nvidia.ko -print
and then delete those too.

Note: The above may be overkill, but it should get rid of all your (old) nvidia files.


Ensure necessary packages are installed
Code:
apt-get install make gcc pkg-config xserver-xorg-dev build-essential linux-headers-`uname -r`

Now as above, download the new driver and run it. It's not strictly necessary to reboot, though. Restart the display manager:
Code:
/etc/init.d/gdm start

Open a terminal and check that you're using the newest driver:
Code:
cat /var/log/Xorg.0.log | grep NVIDIA
Reply
#42
Thank you fasteddy after a long night i found that nvidia.ko that remained and deleted it. After that the install worked. I had that driver missmatch thing many wrote about on other forums first.

I wish i found your post before it would have speeded up the process hehe.
Reply
#43
Can anybody help me with an issue I seem to be having with irxevent/irexec?
Basically my setup works fine, strictly followed this guide to set lirc/irxevent/irexec up.
Problem is, sometimes the irxevent process suddenly exits and thus my mapped buttons don't work anymore, e.g. for shutting down my HTPC.
Is there any way to make sure irxevent keeps alive or even auto restarting it when it exits unexpectedly?

boba
Reply
#44
Question 
Hi everyone need help i donot know how to add scripts and plguins to my xbmc under ubuntu.Any infor will be great guys.Huh
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC for Linux - Tips and Tricks2