노무현 대통령 배너


2007. 5. 4. 09:14

Install Beryl on Ubuntu Feisty with XGL

Link: http://wiki.beryl-project.org/wiki/Install_Beryl_on_Ubuntu_Feisty_with_XGL


Install Beryl on Ubuntu Feisty with XGL

From Beryl Wiki

Jump to: navigation, search

Note: Using AIGLX is preferred on Edgy Eft because it is included with X.org on Edgy.

Contents

[hide]

Introduction

Installing Xgl and Beryl in (K)ubuntu FeistyFawn is simple. Getting it working is slightly more complex, but thishow-to should make it easy. If you have used compiz previously, it willbe very familiar ground indeed. And yes, if you think you can update /clarify / improve the instructions on this page, please register, login and go ahead and add your suggestions. Have fun!


Note: More documentation is available at https://help.ubuntu.com/community/CompositeManager/XGL


Note: Lennart Hansen has written an all-graphical guide, Beryl and Xgl on Ubuntu Edgy Eft with ATI card. Lots of screenshots are handy for those who prefer not to use the terminal.

IMPORTANT PLEASE READ BEFORE BEGINNING

In order to use xinerama, you must put a "+xinerama" in any xgl command, for example:

/usr/bin/Xgl:0 -fp /usr/share/fonts/X11/misc -fullscreen -ac -accel glx:pbuffer -accel xv:fbo:0 +xinerama

Graphic Card Drivers and 3D Video Acceleration

Note: If you have previously used Xgl with compiz, you should be good to go and you can skip this step.

The Xgl X server requires 3D video acceleration. Most graphicscards should automatically support 3D acceleration in Edgy Eft; somegraphics cards might need some tweaking though.

You can check whether direct rendering is enabled by invoking

glxinfo | grep direct

in a terminal. If it returns

direct rendering: Yes

For ATi graphics cards you can check with:-

 fglrxinfo

then you're ready to install Xgl and Beryl. If it doesn't, you might need to install the appropriate driver for your graphics card. Follow the official Ubuntu Desktop Guide's instructions for Nvidia or ATI graphics card drivers, or check the ATI Linux Drivers Wiki for ATI fglrx drivers.

Migrating from Compiz-QuinnStorm

If you have the QuinnStorm version of Compiz installed on your system and want to migrate to Beryl, it's best to uninstall Compiz first and then install Beryl from scratch. Simply use Synaptic (GNOME) or Adept (KDE) to remove the compiz, compiz-gnome and gset-compiz meta-packages or use the command line:

sudo apt-get remove compiz compiz-gnome gset-compiz

and continue on with the rest of the tutorial.


Adding the Beryl Project repositories

Now add the Beryl Project's repository to /etc/apt/sources.list. This can be done using the Synaptic or Adept graphical interfaces, or from the command line. The line to be added is

deb http://ubuntu.beryl-project.org/ feisty main

Note: A number of mirrors are available if you find yourself getting slow speeds from the primary host. The current list of mirrors includes

deb http://www.beerorkid.com/compiz edgy main-edgy (latest: beryl 0.1.1)
deb http://media.blutkind.org/xgl edgy main (latest: beryl 0.1.1)
deb http://beryl.xglusers.de/ edgy main (latest: beryl 0.1.4; no aquamarine)
deb http://download.tuxfamily.org/3v1deb edgy beryl-svn ( bleeding edge beryl development, use with care )


Note: Are all these accurate? I've removed the ones I /know/ to be wrong...

Note: Fixed beerorkid.com repository; needed main-edgy instead of just main.

The packages in the repository are signed with a gpg signatureso you can verify that they are valid. To add the gpg key to yourkeychain, use Synaptic / Adept or invoke the following command:

$ wget http://ubuntu.beryl-project.org/root@lupine.me.uk.gpg -O- | sudo apt-key add -
$ wget http://download.tuxfamily.org/3v1deb/DD800CD9.gpg -O- | sudo apt-key add -
$ wget http://www.beerorkid.com/compiz/quinn.key.asc -O - | sudo apt-key add -

Next, make apt aware of the new software repositories by issuing the following command

$ sudo apt-get update

Done! The new software repositories should now be available for use.

Installing Xgl and Beryl

Installing the packages
Use Synaptic or Adept to install the xserver-xgl and either the beryl-ubuntu or beryl-kubuntu package, or use the command line:

For Ubuntu/Gnome:

$ sudo apt-get install xserver-xgl beryl-ubuntu  

For Kubuntu/KDE:

$ sudo apt-get install xserver-xgl beryl-kubuntu

Note: In some cases, beryl-manager and emerald are not installed automatically. As such, prepend 'emerald beryl-manager' to these commands if beryl doesn't launch.

Note: You may also want to install the emerald-themes package, although most emerald themes can be downloaded from within beryl-manager, which will sit in your system tray as the red gem icon.

IMPORTANT -- Downgrading beryl-core to 0.2.0

The Ubuntu version of beryl-core is incomplete. The beryl-xgl executable is not included in this package. To install a version of beryl-core that works, first run:

$ gksudo gedit /etc/apt/preferences

for Ubuntu, or for Kubuntu:

$ kdesu kate /etc/apt/preferences 

Then add the following to that file. If there are any other entriesin this file, separate this entry (all three lines) from those entriesby a blank line. Don't separate the three lines from each other.

Package: *
Pin: release o=lupine
Pin-Priority: 1000

Save the file.

This will cause your system to prefer beryl-project packages, but will keep Ubuntu packages if they are manually installed, and newer.

Next, we need to downgrade to a version from beryl-project that works with Ubuntu's confused and misguided Xgl.In synaptic package manager:

  1. click the 'reload' button
  2. find and select beryl-core
  3. click the 'package' menu, and select 'force version'.
  4. Choose version 0.2.0~0beryl1.

Or, from the command line:

$ sudo apt-get update

and then

$ sudo apt-get install beryl-core=0.2.0~0beryl1

Configuration

There are a number of ways to log into an Xgl Session and start the Beryl composite manager. Check and see which one suits you best.

Adding an Xgl login session

Adding a separate Xgl session to your (gdm or kdm) login screen isrecommended for most situations because it allows you to switch easilybetween Xgl and standard Xorg sessions. After all, Xglx is not meant tobe a full-fledged replacement for the standard Xorg server. Someapplications (such as OpenGL games) might not run properly in an Xglsession; and keep in mind that the Berylcomposite manager is still very much a work in progress. If you runinto bugs or problems, you'll have your standard X session at yourfingertips.

Adding an X session to your login screen is a two-step process:first we'll create a startup script that invokes the Xgl session andour desktop environment. Then we'll create the login screen entry thatuses our script.


The startup script: Use your favorite text editor to create a script startxgl.sh in your path, like so:

$ sudo gedit /usr/local/bin/startxgl.sh

Note: The contents of the script varies depending on yourdesktop environment and the graphics card you use. And yes, users ofother window managers, please help out and add your own startup scriptshere.


GNOME & Nvidia graphics card

#!/bin/sh
/usr/bin/Xgl:1 -fullscreen -ac -br -accel xv:fbo -accel glx:pbuffer &
sleep 4
export DISPLAY=:1
exec gnome-session

For KDE, change the last line to

exec startkde


GNOME & ATI graphics card

#!/bin/sh
Xgl -fullscreen:1 -ac -br -accel glx:pbuffer -accel xv:pbuffer &
sleep 4
export DISPLAY=:1
exec gnome-session

Shutdown and reboot buttons in GNOME

Zoogie reported in the Ubuntu forums the following solution to the missing shutdown and reboot buttons in GNOME's exit menu. Your startxgl.sh should look like this:

#!/bin/sh
Xgl -fullscreen:1 -ac -br -accel glx:pbuffer -accel xv:pbuffer &
sleep 4
export DISPLAY=:1
cookie="$(xauth -i nextract -:0 | cut -d ' ' -f 9)"
xauth -i add:1 . "$cookie"
exec gnome-session


Alternative

For me, above script did load XGL properly, and Berylcould be run too. However, my theme wasn't loaded, everything lookedincredibly ugly. Folders, files, everything had no theme. After somesearching I found the following startxgl.sh script, which loads gdm aswell, so gives me back my theme:

#!/bin/sh
Xgl:1 -fullscreen -ac -accel xv:pbuffer -accel glx:pbuffer &
DISPLAY=:1
exec dbus-launch --exit-with-session gnome-session

Note: You may also need to install beryl-dbus as it wasn't installed on my system by default.

If you have a problem with your fonts appearing tiny, you may need to add the -dpi 96 flag to the Xgl call:

Xgl:1 -fullscreen -ac -accel xv:pbuffer -accel glx:pbuffer -dpi 96 &

However, this is kind of a dirty trick. Normally the xserverautomatically calculates the correct dpi by using the resolution andthe size of the monitor. So if the dpi is too low, it probably meansthat the size of the monitor is not read correctly by the graphicscard. Adding the following line to the Monitor section of the xorg.confwill solve this;

DisplaySize  344        222

Of course with the two numbers corresponding to the size of your monitor!! In milimeters.


Note: If your shutdown/restart buttons disappear when you are in Xgl you can add these lines to your startxgl.sh script:

cookie="$(xauth -i nextract -:0 | cut -d ' ' -f 9)"
xauth -i add:1 . "$cookie"

making it look like this:

#!/bin/sh
Xgl:1 -fullscreen -ac -accel xv:pbuffer -accel glx:pbuffer &
DISPLAY=:1
cookie="$(xauth -i nextract -:0 | cut -d ' ' -f 9)"
xauth -i add:1 . "$cookie"
exec dbus-launch --exit-with-session gnome-session

For KDE, change the last line to

exec startkde

For XFCE, change the last line to

exec xfce4-session

Making the script executable: Now make sure the script hasthe right permissions settings set so that it can be invoked by sessionlogin entry - this can be done in Nautilus or Konqueror or simply bytyping the following into a terminal:

$ sudo chmod a+x /usr/local/bin/startxgl.sh


IMPORTANT NOTE I recently found that if we start Gnome/KDE this way,we may lose font or mouse pointer configuration, since they don't getloaded with Xgl. The correct way that I found was to use "exec/etc/X11/Xsession" instead of gnome-session or startkde. Then you canput gnome-session or startkde as an Xsession argument, for example,"exec /etc/X11/Xsession startkde". - Lesterchakyn


Creating the login session entry: To create the login entry, create a new file /etc/X11/sessions/xgl.desktop

$ sudo mkdir -p /etc/X11/sessions
$ sudo gedit /etc/X11/sessions/xgl.desktop

Make it look like this:

[Desktop Entry]
Encoding=UTF-8
Name=Xgl
Exec=/usr/local/bin/startxgl.sh
Icon=
Type=Application

Note: The Name=Xgl entry is the description of the session that you'll see in your login menu, so you could change it to 'Xgl-Gnome' or 'Xgl-Beryl' if it suits you better.

Note: When using kdm (the case in Kubuntu), create this file in /usr/share/xsessions


Done!


When you get to the GDM or KDM login screen, you should now have asession called 'Xgl' available; if you log into this session, Xgl willrun as an overlay to the standard Xorg X session (that is, on DISPLAY:1) and load your desktop environment. Logging into your normal sessionwill give you the standard, un-accelerated desktop for trouble-shootingor running programs which don't play nicely with Xgl.

Changing your standard login

ONLY DO THIS IF YOU DIDN'T ADD AN XGL SESSION TO GDM PER THE PREVIOUS SECTION!!! You only need one or the other.

For GNOME: Instead of adding a separate desktop session,you could alter your standard X session. This is not recommended formost users (see above). It might be useful however if you do not wantto set up a separate X session for Beryl for some reason.

First change gdm.conf-custom:

$ sudo nano /etc/gdm/gdm.conf-custom

Go to the very bottom of the file and add:

0=Xgl
[server-Xgl]
name=Xgl server
command=/usr/bin/Xgl:0 -fullscreen -ac -accel glx:pbuffer -accel xv:fbo
flexible=true

When you reboot or restart the graphical session, the Xgl server should be running.

Running Beryl

Now it's time to test your Beryl installation. Open a terminal and type

$ beryl-manager

If all goes well, you should see the Beryl splash screen and your windows will become wobbly! Your system tray should show the Beryl icon - a red gem - that you can use to adjust beryl's and emerald's settings. Click on 'Berylsettings manager' or Emerald, the theme manager. It also providesfallback to another window manager (metacity for example), in case Beryl crashes.

If you don't see the beryl splash screen immediately, you may need to tell the manager to load Beryl - right-click on the red gem, go to "Select Window Manager" and choose "Beryl".If that doesn't work, there's a problem somewhere! Often, usefuldebugging output will show in the terminal window you used to start beryl with.


IRC channels


Ubuntu users can ask for help on the #ubuntu-xgl or #xgl channels on irc://irc.freenode.net/


Adding Beryl to Session Startup

Assuming all goes well, you can set up Beryl Manager to start up every time you load into your Xgl session.


GNOME


Note: This method will add beryl-manager to everygnome session, not just the Xgl session. Not very useful for those whowish to keep their Xorg and Xgl sessions separate. See below.

  • Go to System? Preferences? Sessions
  • Go to the 'Startup Programs' tab
  • Click the 'Add' button and type beryl-manager into the dialog box
  • Click 'Close'

Addenda:

1) If the window decorations do not show up when starting beryl this way, try adding beryl-xgl to the startup programs as well. See the Troubleshooting section below.

2) A command line version of this tip can be seen here.


KDE


Add beryl-manager to KDE's autostart. Open a terminal and create the following symlink:

$ ln -s /usr/bin/beryl-manager ~/.kde/Autostart/beryl-manager

Adding Beryl to an Existing Session


GNOME


To start beryl-manager only when the session "xgl" is started, I modified a script from Gentoo Wiki scripts.so:


Create the script: Use your favourite text editor to create a script start_beryl.sh. I placed and created it in /usr/local/bin/ so:

$ sudo gedit /usr/local/bin/start_beryl.sh

In the file paste this:

#!/bin/bash
#
# Start beryl-manager within gnome-session
#
if (( `ps -A -o comm | grep -c '^Xgl$'` == "1" )); then
DISPLAY=:1 beryl-manager
DISPLAY=:1 beryl-xgl
else echo "${0}: Error: beryl-manager not launched. Xgl not running?"
fi

and save the file.

Making the script executable: Now make sure the scripthas the right permissions settings set so that it can be invoked bysession login entry - this can be done in Nautilus or Konqueror orsimply by typing the following into a terminal:

$ sudo chmod a+x /usr/local/bin/start_beryl.sh

Add the script to gnome session startup:

  • Go to System? Preferences? Sessions
  • Go to the 'Startup Programs' tab
  • Click the 'Add' button and type /usr/local/bin/start_beryl.sh into the dialog box
  • Click 'Close'

Now, you can logout and start a session. When you start a gnomesession, the script looks if XGL is started, and so, if you are in axgl-session, it launches beryl-manager.


KDE


The Gentoo Wiki offers several startup scripts that allow you to start beryl or compiz only when the Xgl server is running. If this script is added to GNOME's session startup programs or KDE's autostart, beryl won't start unless we have entered the Xgl session - a more elegant solution to berylstartup automation. However, these scripts were written for compiz andalso include various workarounds for font and keyboard-related issuesthat might not be needed for most situations. So please, everyone test these scripts and take the time to write up what works and what doesn't in the appropriate troubleshooting page. Thanks on behalf of the community!

Also, the script mentioned above for starting beryl in gnome also works if added to KDE's autostart.

Note: this command does not work under KDE: "ps -A -o comm |grep -c '^Xgl$'` == "1". Replace it with "ps -A -o comm | grep -c Xgl== "1""

As such, the script should appear something like the following:

#!/bin/bash
#
# Start beryl-manager within kde-session
#

if [ `ps -A -o comm | grep -c '^Xgl$'` == "1" ]; then

      DISPLAY=:1 beryl-manager
DISPLAY=:$1 dbus-launch emerald &
DISPLAY=:1 beryl-xgl

else echo "${0}: Error: beryl-manager not launched. Xgl not running?"fi

Troubleshooting

Ugly GTK/Icon Themes

If have problems with being unable to change the GTK(controls) oricon themes once logged into your XGL session; type the following intoa terminal:

$ gnome-settings-daemon &

Now try to change GTK/icon themes. If it fixes the problem, add itto your startup programs (In System --> Preferences -->Sessions).

Xgl start problem under Debian

If you use this howto to install Beryl under Debian, you should start xgl with:

/usr/bin/Xgl:0 -fp /usr/share/fonts/X11/misc -fullscreen -ac -accel glx:pbuffer -accel xv:fbo:0

because the fonts are not located in the same directory between ubuntu and Debian. Then, all is going fine:)

Using Beryl

See Default Commands for some default commands.