Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

[TIP] Using xlaunch

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
166 posts
  • Page 6 of 7
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next
Author
Message
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Thu Nov 02, 2006 3:40 am

glad you soved it, I should probably set /bin/bash instead of /bin/sh
Next on the docket, figuring out why it's not exiting properly and returning me to my desktop..
on the first(s) page, there were the same problem, it was with the ut game which actually doesn't exit properly, try running your program in a term, exit from it, and see if you get the prompt back in the term.
The End of the Internet!
Top
destr0yr
Tux's lil' helper
Tux's lil' helper
Posts: 80
Joined: Sat Nov 29, 2003 10:02 am
Location: Kelowna, BC.
Contact:
Contact destr0yr
Website

  • Quote

Post by destr0yr » Thu Nov 02, 2006 6:55 am

truc wrote:glad you soved it, I should probably set /bin/bash instead of /bin/sh
on the first(s) page, there were the same problem, it was with the ut game which actually doesn't exit properly, try running your program in a term, exit from it, and see if you get the prompt back in the term.
I tried simply running 'xlaunch xterm' which launched full screen but didn't allow for any input. I had to Ctrl-alt-backspace to get out. (AIGLX on Ubuntu 6.10 (Edgy)). In any case, I have figured out that I can use beryl-manager to change my WM from Beryl to Metacity and back again when desired. Using this rather cumbersome method, I can launch any game I like sans xlaunch. I'll continue to play around with it and report back if I figure it out.

I appreciate your time. Thank you.
Top
ThomasAdam
Guru
Guru
Posts: 448
Joined: Sun Mar 20, 2005 10:27 pm
Location: England
Contact:
Contact ThomasAdam
Website

  • Quote

Post by ThomasAdam » Thu Nov 02, 2006 6:47 pm

I notice that the following is being used:

Code: Select all

if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
Don't do this -- at least, don't check for "$USER" being equal to root since anyone can change it:

Just check for the $EUID, this is a read-only environment variable.

-- Thomas Adam
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Thu Nov 02, 2006 7:20 pm

ThomasAdam wrote:I notice that the following is being used:

Code: Select all

if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
Don't do this -- at least, don't check for "$USER" being equal to root since anyone can change it:

Just check for the $EUID, this is a read-only environment variable.

-- Thomas Adam
:?: I never did this, the script doesn't even need root privileges :?:
The End of the Internet!
Top
ThomasAdam
Guru
Guru
Posts: 448
Joined: Sun Mar 20, 2005 10:27 pm
Location: England
Contact:
Contact ThomasAdam
Website

  • Quote

Post by ThomasAdam » Thu Nov 02, 2006 7:40 pm

truc wrote:
ThomasAdam wrote:I notice that the following is being used:

Code: Select all

if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
Don't do this -- at least, don't check for "$USER" being equal to root since anyone can change it:

Just check for the $EUID, this is a read-only environment variable.

-- Thomas Adam
:?: I never did this, the script doesn't even need root privileges :?:
You recommend the change in /etc/profile -- and whilst the initial check might not even be yours -- the use of checking $USER is completely unnecessary and dangerous.

-- Thomas Adam
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Thu Nov 02, 2006 7:46 pm

oh, I use the $USER env variable in the script, but it is just ignore if you don't use the "XPLAYER" feature, and even if you do, I don't think there is anything dangerous, but I can be wrong. anyway, so what would you recommend to me, using $UID right?
The End of the Internet!
Top
ThomasAdam
Guru
Guru
Posts: 448
Joined: Sun Mar 20, 2005 10:27 pm
Location: England
Contact:
Contact ThomasAdam
Website

  • Quote

Post by ThomasAdam » Thu Nov 02, 2006 7:52 pm

truc wrote:oh, I use the $USER env variable in the script, but it is just ignore if you don't use the "XPLAYER" feature, and even if you do, I don't think there is anything dangerous, but I can be wrong. anyway, so what would you recommend to me, using $UID right?
Yes, consider the following:

Code: Select all

[n6tadam@workstation ~]% echo "$USER"
n6tadam
Which is fine, but then:

Code: Select all

[n6tadam@workstation ~]% USER=root && echo "$USER"   
root
Oops. It's not a reliable means of ascertaining if a user is root or not. Plus, if you then had commands thereafter to change one's PATH or what have you, that's just going to be bad all round.

-- Thomas Adam
Top
user317
Guru
Guru
Posts: 314
Joined: Sun Jan 26, 2003 7:39 pm

  • Quote

Post by user317 » Wed Nov 15, 2006 5:42 am

I cant seem to get this script to work with the -screen option on 7.1. the server exits before starting the program
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Wed Nov 15, 2006 3:51 pm

user317 wrote:I cant seem to get this script to work with the -screen option on 7.1. the server exits before starting the program
Could you say exactly how you're using this option? I think you can use the -screen option as I described here(second part of the post) how to use the -config option.

I didn't know this option, but it looks like it's even better than the -config one :idea: :?:
The End of the Internet!
Top
Xamindar
Veteran
Veteran
User avatar
Posts: 1155
Joined: Sun Oct 03, 2004 2:52 am
Location: California
Contact:
Contact Xamindar
Website

Re: First test... Successful

  • Quote

Post by Xamindar » Mon Dec 04, 2006 6:49 pm

Condex wrote:I've tried Ubuntu Forum solution, so:

Changed: ServerCmd=/usr/bin/Xgl -br -ac -accel glx:pbuffer -accel xv:pbuffer
To: ServerCmd=/usr/bin/Xgl -br -ac -accel glx:pbuffer -accel xv:fbo -xorgAc

in /usr/kde/3.5/share/config/kdm/kdmrc

Start kdm, login and run:

$ openttd : (SDL game, windowed). Runs bad, problems with colors 8)
$ DISPLAY=:93 openttd : No problem with colors, runs fine. 8)

Now I'm emerging an OpenGL based game... tuxracer 8)

Edit:

-OpenTTD also runs ok in Fullscreen
- $ DISPLAY=:93 tuxracer runs perfect.

I think we got a solution 8)
I can't get that to work. Are there any other solutions? I get an error about -xorgAc not supported.
Top
dejawoo
n00b
n00b
Posts: 2
Joined: Tue Dec 05, 2006 3:05 am
Contact:
Contact dejawoo
Website

  • Quote

Post by dejawoo » Tue Dec 05, 2006 3:30 am

i wanna thank for the topic, and other points in this topic..
dejawoo
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Sat Feb 10, 2007 10:04 am

there was a problem with xlaunch when the arg/options to the program had spaces in it.

This is fixed now with xlaunch-20070210

for those who modify their xlaunch script, here is a short diff, with the previous (20070127)

Code: Select all

--- xlaunch     2007-01-27 16:26:30.000000000 +0100
+++ xlaunch-20070210    2007-02-10 10:54:46.075366591 +0100
@@ -6,7 +6,7 @@
 # commented so you should be able to easily use it.
 # See forum thread http://forums.gentoo.org/viewtopic-t-483004.html for more explanation.
 # 
-VERSION=20070127
+VERSION=20070210
 
 #########
 # ======= configuration ======= #
@@ -322,7 +322,7 @@ if [ "x$XPLAYER" != "x" ]; then 
                 fi
 
                 echo "Launching ${FULL_PROG_NAME##*/} as user: $XPLAYER"
-                sudo su - $XPLAYER -l -c "FULL_PROG_NAME=\"$FULL_PROG_NAME\" ${XLAUNCH_PATH:-$0} $*"
+                sudo su - $XPLAYER -l -c "FULL_PROG_NAME=\"$FULL_PROG_NAME\" ${XLAUNCH_PATH:-$0} ${*// /\\ }"
                 exit $?;;
                 
             error) 
@@ -336,8 +336,6 @@ if [ "x$XPLAYER" != "x" ]; then 
     fi
 fi
 
-
-
 ######
 # Thanks to LXj I added the following lines, which allows you launch several programs
 # each one on its own DISPLAY
@@ -374,7 +372,7 @@ case "${FULL_PROG_NAME##*/}" in
     
     *)  
         echo "Starting ${FULL_PROG_NAME} on DISPLAY $DISPLAY_TO_USE"
-        xinit "${FULL_PROG_NAME}" $* -- $Xserver :$DISPLAY_TO_USE $Xserverargs &>/dev/null &
+        xinit "${FULL_PROG_NAME}" "$@" -- $Xserver :$DISPLAY_TO_USE $Xserverargs &>/dev/null &
         ;;
 esac
 
@@ -412,7 +410,4 @@ if [ $? -eq 0 ]; then
     DISPLAY=:$DISPLAY_TO_USE numlockx on
 fi
 
-
-
-
 exit 0
The End of the Internet!
Top
garr0n
n00b
n00b
Posts: 2
Joined: Wed Mar 07, 2007 5:26 am

  • Quote

Post by garr0n » Wed Mar 07, 2007 7:00 am

Hey, very nice work here, truc. I'm having a strange issue running the script from within X though, maybe you or someone else here know what's wrong.

If I login to another text-mode tty (i.e. ctrl-alt-F2) and run a program with xlaunch, everything works fine. However, if I run xlaunch from an xterm or a graphical menu in X or whatnot, performance is much worse than it should be. The exact same parameters are used both times.

I'm using updated nvidia drivers, Xorg 6.9 on Slackware. I don't have any fancy composite WMs running.

As an aside, I thought I was having issues running the script in zsh, but it seems to work fine if I specify the path to xlaunch when running it.

Merci beaucoup! keep up the good work
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Wed Mar 07, 2007 9:35 am

this is wierd :O
When your in X you should check if variables such as __GL_FSAA_MODE are set (used for antialiasing and things like that). this is the only thing I can think of, so check your env :/
The End of the Internet!
Top
garr0n
n00b
n00b
Posts: 2
Joined: Wed Mar 07, 2007 5:26 am

  • Quote

Post by garr0n » Wed Mar 07, 2007 2:07 pm

Nope, definately not the problem. I'll keep experimenting and report back if I find a solution (or the cause of the problem at least :P).

EDIT: Bah, nevermind, I must have just had some secret runaway processes or something... everything's working fine after a reboot. (What is this, Windows 98? :?)

Thanks for the help anyhow.
Top
tekknokrat
Apprentice
Apprentice
Posts: 278
Joined: Sun Apr 17, 2005 8:51 am
Location: Magdeburg

  • Quote

Post by tekknokrat » Sun Mar 11, 2007 6:55 pm

very complex script with a lot of features in mind!

I just wonder how it would be to include (seperate) root access.
I know that root cannot use it by design for security reason but I am looking for a solution running seamonkey, firefox or thunderbird with root
access for installing several xpi plugins.
other tools like k3b sometimes also need more privileges (e.g. for testing device access)

how would it be if your script has something like an

Code: Select all

--root
switch which gathers root privileges via su/sudo and then executes x based apps
for installation/maintaining purposes.
Suggestions or Alternatives???
Optimism is solely an absence of information. / Optimismus ist nur ein Mangel an Information.
(Arthur Schopenhauer)
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Sun Mar 11, 2007 7:22 pm

I'm not sure I've understood exactly what you want :? you want to start an X session being root?

What's preventing you from running this script as root?
Also, if you edit your sudoers file you can even run this script as a normal user, and launch the different application as root (including the Xseesion), have a look at the "XPLAYER" feature, (I didn't find better for the name :D )
around line 316

Code: Select all

        case "$PROG_GROUP" in
            games)
                if [ -h "$0" ]; then
                    XLAUNCH_PATH=`readlink $0` || echo "Error: could not read the \"$0\" link"
                fi
                
                echo "Launching ${FULL_PROG_NAME##*/} as user: $XPLAYER"
                sudo su - $XPLAYER -l -c "FULL_PROG_NAME=\"$FULL_PROG_NAME\" ${XLAUNCH_PATH:-$0} ${*// /\\ }"
                exit $?;;
            
            error)
                echo "Could not determine group of ${FULL_PROG_NAME}. (Do you have 'stat' on your system?)"
                echo "Launching $FULL_PROG_NAME on DISPLAY=$DISPLAY_TO_USE as user: $USER"
                ;;
            
            *)  
                ;;
        esac
you can very easily create a script which will launch your different programs, chgrp it, then ass the case for this group in this loop, and either modify the XPLAYER value (set it to root) or even add your own new variable :)

I'm probably not very clear, but I explain a bit this on the first page, so you might wana have a look :)
The End of the Internet!
Top
tekknokrat
Apprentice
Apprentice
Posts: 278
Joined: Sun Apr 17, 2005 8:51 am
Location: Magdeburg

  • Quote

Post by tekknokrat » Sun Mar 11, 2007 8:34 pm

sorry for obfuscate my intention - sometimes i think/write too much in general terms.

when i can run this script also via sudo then everything is ok :D
thought the script path (and because of that access for root was denied) because of the line in /etc/profile
in /etc/profile, replace:
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
else
PATH="/usr/local/bin:/usr/bin:/bin:${PATH}"
fi


with the following:
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
else
PATH="/usr/local/bin:/usr/bin:/bin:/home/scripts:${PATH}"
fi
will have a deeper look in script now!

thanks for your fast answer!
Optimism is solely an absence of information. / Optimismus ist nur ein Mangel an Information.
(Arthur Schopenhauer)
Top
KevinLarson
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Sep 23, 2005 3:27 am
Location: Chaimpaign, IL

  • Quote

Post by KevinLarson » Tue Mar 13, 2007 9:36 pm

So I'm trying to use xlaunch to run another script of mine. The contents of the other script are:

wc3

Code: Select all

#! /bin/bash
setarch i386 -X wine ~/.wine/drive_c/Program\ Files/Warcraft\ III/Frozen\ Throne.exe -opengl 
When I run $xlaunch wc3 it says:
Starting /home/scripts/wc3 on DISPLAY 1
It then prints out 50-ish line feeds,
then it prints xrdb: "XTerm*boldMode" on line 19 overrides entry on line 3,
followed by around 100 prompts (user@localhost ~ $).

Sometimes it will NOT have the line feeds or the prompts, other times it will, but the rest is always the same.
It seems to more frequently print them (last 5 or times I tried, as I was trying to find some sort of correlation(I didn't)), than not.

Thanks,
-Kevin
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Wed Mar 14, 2007 2:22 pm

I do also have sometimes the 100 prompts, and sometimes don't, I just don't know why :roll:

Anyway, so your script isn't working?
Be sure

Code: Select all

xinit wc3 -- :1
works.
The End of the Internet!
Top
KevinLarson
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Sep 23, 2005 3:27 am
Location: Chaimpaign, IL

  • Quote

Post by KevinLarson » Wed Mar 14, 2007 7:52 pm

It opens another x session, but doesnt seem to do the script. Do you know why this might be?
Top
KevinLarson
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Sep 23, 2005 3:27 am
Location: Chaimpaign, IL

  • Quote

Post by KevinLarson » Wed Mar 14, 2007 7:59 pm

Do you want some of the output? I would have posted it, but I can't seem to find anything relevant.
Top
KevinLarson
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Sep 23, 2005 3:27 am
Location: Chaimpaign, IL

  • Quote

Post by KevinLarson » Wed Mar 14, 2007 8:07 pm

Update: I tried running the script in the second session, and it crashed it.

This printed:
Backtrace:
0: X(xf86SigHandler+0x7d) [0x4898bd]
1: /lib/libc.so.6 [0x2ad65f6dbac0]
2: /usr/lib64/xorg/modules//libfb.so(fbSolidFillmmx+0x142) [0x2ad6610df432]
3: /usr/lib64/xorg/modules//libfb.so(fbFillRegionSolid+0xcc) [0x2ad6610d1c2c]
4: /usr/lib64/xorg/modules/drivers//nvidia_drv.so(_nv000690X+0x199) [0x2ad660ce8449]

Fatal server error:
Caught signal 11. Server aborting
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Wed Mar 14, 2007 8:08 pm

what about

Code: Select all

xinit /path/to/wc3 -- :1
then?
The End of the Internet!
Top
KevinLarson
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Sep 23, 2005 3:27 am
Location: Chaimpaign, IL

  • Quote

Post by KevinLarson » Wed Mar 14, 2007 10:39 pm

It's a step closer, instead of opening the new session and doing nothing, it now opens the session, shows the little box while loading, then the whole thing dies, session and all.

Heres the output (after removing hundreds of line feeds (what is with this, I see this using xlaunch with other things as well))
xinit /home/scripts/wc3 -- :1
X Window System Version 7.2.0
Release Date: 22 January 2007
X Protocol Version 11, Revision 0, Release 7.2
Build Operating System: Linux 2.6.20-rc5 x86_64
Current Operating System: Linux kevin 2.6.20-rc5 #1 SMP PREEMPT Fri Jan 26 23:49:07 CST 2007 x86_64
Build Date: 20 February 2007
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed Mar 14 17:31:38 2007
(==) Using config file: "/etc/X11/xorg.conf"
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 0
ALSA lib control.c:910:(snd_ctl_open_noupdate) Invalid CTL default:0
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 0
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default:0
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 1
ALSA lib control.c:910:(snd_ctl_open_noupdate) Invalid CTL default:1
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 1
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default:1
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 1
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default:1
fixme:cdrom:CDROM_DeviceIoControl Unsupported IOCTL 2d1400 (type=2d access=0 func=500 meth=0)
fixme:cursor:SetSystemCursor (0x111e,00007f8a),stub!
fixme:cursor:SetSystemCursor (0x1126,00007f00),stub!
fixme:cursor:SetSystemCursor (0x1136,00007f03),stub!
fixme:cursor:SetSystemCursor (0x113e,00007f01),stub!
fixme:cursor:SetSystemCursor (0x114e,00007f88),stub!
fixme:cursor:SetSystemCursor (0x115e,00007f86),stub!
fixme:cursor:SetSystemCursor (0x116e,00007f83),stub!
fixme:cursor:SetSystemCursor (0x117e,00007f85),stub!
fixme:cursor:SetSystemCursor (0x118e,00007f82),stub!
fixme:cursor:SetSystemCursor (0x119e,00007f84),stub!
fixme:cursor:SetSystemCursor (0x11ae,00007f04),stub!
fixme:cursor:SetSystemCursor (0x11be,00007f02),stub!
err:ole:CoCreateInstance apartment not initialised
fixme:advapi:SetSecurityInfo stub
fixme:win:EnumDisplayDevicesW ((null),0,0x34ed44,0x00000000), stub!
fixme:win:EnumDisplayDevicesW ((null),0,0x34ed74,0x00000000), stub!
fixme:xrandr:X11DRV_XRandR_SetCurrentMode Cannot change screen BPP from 32 to 1 **** I believe this is cut off *****
waiting for X server to shut down X connection to :1.0 broke *********cut off?
server shutdown).
FreeFontPath: FPE "/usr/share/fonts/misc/" refcount is 2, sh *********cut off?
.
I removed alot of line feeds.
I know alot of these messages display when running wine regardless of the wc3 script or xlaunch.
Top
Post Reply

166 posts
  • Page 6 of 7
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic