Xvfb for dummys? - Xwindows

This is a discussion on Xvfb for dummys? - Xwindows ; I am trying to run an X application in "batch" mode without displaying any windows. All I want from the application is an output data file. The windows can display in a black hole for all I care. I was ...

+ Reply to Thread
Results 1 to 18 of 18

Thread: Xvfb for dummys?

  1. Xvfb for dummys?

    I am trying to run an X application in "batch" mode without displaying
    any windows. All I want from the application is an output data file.
    The windows can display in a black hole for all I care. I was told a
    while back that Xvfb is the answer, so I got my sysadmin to install it
    for me (on Solaris).

    I read the man page and did a google search, but I can't find a
    friggin' clue as to how to use Xvfb for my purposes. OK, maybe I'm an
    idiot. Will some one please give me a clue about how to run an X
    application with no windows? Oh, and I'd like to have my computer
    behave normally for all other applications, of course. Thanks.


  2. Re: Xvfb for dummys?

    In comp.windows.x, 18k11tm001@sneakemail.com
    <18k11tm001@sneakemail.com>
    wrote
    on 3 Jan 2005 18:32:28 -0800
    <1104805948.631338.68820@z14g2000cwz.googlegroups.c om>:
    > I am trying to run an X application in "batch" mode without displaying
    > any windows. All I want from the application is an output data file.
    > The windows can display in a black hole for all I care. I was told a
    > while back that Xvfb is the answer, so I got my sysadmin to install it
    > for me (on Solaris).
    >
    > I read the man page and did a google search, but I can't find a
    > friggin' clue as to how to use Xvfb for my purposes. OK, maybe I'm an
    > idiot. Will some one please give me a clue about how to run an X
    > application with no windows? Oh, and I'd like to have my computer
    > behave normally for all other applications, of course. Thanks.
    >


    One simple use model might be

    $ mkdir /home/alpha/fb
    $ Xvfb :1 -screen 0 1600x1200x32 -fbdir /home/alpha/tmpfbdir

    (I'm assuming one logs in with the username 'alpha' here;
    substitute as appropriate. Any directory with write
    and search permissions can be used.)

    One can then do things such as

    $ cp /home/alpha/tmpfbdir/Xvfb_screen0 somewhere.xwd
    $ xwud -in somewhere.xwd

    which will capture, then display, the X stipple.

    Or one can do things such as

    $ xterm -display :1 &

    or

    $ DISPLAY=:1
    $ export DISPLAY
    $ xterm -e 'program; read dummy'

    and then capture the screen, resulting, if one is lucky, in
    a window in the X stipple with an xterm prompt. (Since there's
    no window manager, the xterm may look a bit peculiar.) Be
    warned that the xterm will close if the program terminates;
    I've put in a 'read dummy' in the above so that it will wait
    for a newline -- which Xvfb can't give it.

    Note that Xvfb_screen0 is *open for write* (actually, mmap()ed
    for write); it will change if the X server draws things (e.g.,
    new client opens a window thereon). This means one can capture
    multiple screens by doing multiple copies from the same file.
    It also means one might get various rendering artifacts, if the
    Xvfb server is drawing while cp is copying.

    The '-fbdir' is important, otherwise Xvfb will just allocate some
    private memory and play with that; there's no easy way to get
    to it.

    An alternative, if you're knowledgeable about shared memory segments,
    is the -shmem option. This works to some extent as well but requires
    familiarity with the shmget() and such calls; the actual key is
    printed to standard output and is a bit hard to get at. For those not
    so familiar therewith, use -fbdir.

    Both generate dumps that are in 'xwd' format.

    It looks rather difficult to feed mouse and keyboard events to
    Xvfb. Synthesized events might work, for some applications;
    however, more intelligent apps will look at the .send_event
    field in the event and ignore synthesized events.

    (For those not desiring batch output, alternatives such as Xnest or
    even just xwd (or Gimp's built-in capture utility) might be
    preferable.)

    --
    #191, ewill3@earthlink.net
    It's still legal to go .sigless.

  3. Re: Xvfb for dummys?

    Thanks for the information. I have a few questions.

    >One simple use model might be


    >$ mkdir /home/alpha/fb
    >$ Xvfb :1 -screen 0 1600x1200x32 -fbdir /home/alpha/tmpfbdir


    Did you intentionally use a different directory in the second line than
    you used in the first?

    Is ":1" necessary, or can any number be used?

    You discuss ways to save the X output, but I have no interest in it
    whatsoever. Storing it would just be a waste of space for me. Can I
    just send it to /dev/null or something? Thanks.


  4. Re: Xvfb for dummys?

    In comp.windows.x, 18k11tm001@sneakemail.com
    <18k11tm001@sneakemail.com>
    wrote
    on 3 Jan 2005 21:48:54 -0800
    <1104817734.926118.289520@z14g2000cwz.googlegroups. com>:
    > Thanks for the information. I have a few questions.
    >
    >>One simple use model might be

    >
    >>$ mkdir /home/alpha/fb
    >>$ Xvfb :1 -screen 0 1600x1200x32 -fbdir /home/alpha/tmpfbdir

    >
    > Did you intentionally use a different directory in the second line than
    > you used in the first?


    Oops. Fumblefingers. I was changing it in my post and forgot one. :-)

    >
    > Is ":1" necessary, or can any number be used?


    Any number (up to :999, maybe; port 7000 is used by another daemon)
    other than :0 can be used; :0 can be used if an X server is not
    already running (on most Linux installations, however, one does).

    Display to port mapping is: :n => 6000 + n

    >
    > You discuss ways to save the X output, but I have no interest in it
    > whatsoever. Storing it would just be a waste of space for me. Can I
    > just send it to /dev/null or something? Thanks.
    >


    If the output is not desired at all one can simply
    run Xvfb sans -fbdir option (and accompaying directory path).
    Xvfb will hang out its port and allow servers, but there
    would be no output as such as the screenbuffer is
    in privately malloc()ed memory. I'll refer you to the
    manpages for details.

    The OP, however, wanted screenshots.

    --
    #191, ewill3@earthlink.net
    It's still legal to go .sigless.

  5. Re: Xvfb for dummys?

    Thanks again. Apparently I have an installation problem. Here's what I
    get:

    prompt> Xvfb :1 -screen 0 1600x1200x32
    Couldn't open RGB_DB '/usr/X11R6/lib/X11/rgb'

    Fatal server error:
    Failed to establish all listening sockets
    What should I tell my sysadmin?


  6. Re: Xvfb for dummys?

    In comp.windows.x, 18k11tm001@sneakemail.com
    <18k11tm001@sneakemail.com>
    wrote
    on 4 Jan 2005 10:25:34 -0800
    <1104863134.199008.173730@z14g2000cwz.googlegroups. com>:
    > Thanks again. Apparently I have an installation problem. Here's what I
    > get:
    >
    > prompt> Xvfb :1 -screen 0 1600x1200x32
    > Couldn't open RGB_DB '/usr/X11R6/lib/X11/rgb'
    >
    > Fatal server error:
    > Failed to establish all listening sockets
    > What should I tell my sysadmin?
    >


    Try '-co /usr/local/X11R6/lib/X11/rgb', assuming your sysadmin
    put it in /usr/local/X11R6/lib/X11/rgb.txt . If not, adjust
    accordingly. It is also possible you may be unable to read
    the file.

    'man Xserver' for more details on this and other possible options.

    Xvfb is, after all, an Xserver, so it can take a good chunk
    of these options. (Not that they would have that much of
    a visible effect in most cases, of course. :-) )


    --
    #191, ewill3@earthlink.net
    It's still legal to go .sigless.

  7. Re: Xvfb for dummys?

    18k11tm001@sneakemail.com writes:

    > Thanks again. Apparently I have an installation problem. Here's what I
    > get:
    >
    > prompt> Xvfb :1 -screen 0 1600x1200x32
    > Couldn't open RGB_DB '/usr/X11R6/lib/X11/rgb'


    Somebody answered this.

    > Fatal server error:
    > Failed to establish all listening sockets
    > What should I tell my sysadmin?


    The problem is that on Solaris only root are allowed to create these
    sockets.

    That is on a Solaris box you have

    >ls -ld /tmp/.X11-unix

    drwxrwxr-x 2 root root 1548 Jan 5 16:58 /tmp/.X11-unix

    , while on Linux you normally have

    >ls -ld /tmp/.X11-unix

    drwxrwxrwt 2 root root 72 4 jan 20.29 /tmp/.X11-unix

    So if your administrator do

    chmod 777 /tmp/.X11-unix

    you should be fine.

    --
    - Mårten

    mail: msv@kth.se *** ICQ: 4356928 *** mobile: +46 (0)707390385

  8. Re: Xvfb for dummys?

    f95-msv@f.kth.se (=?iso-8859-1?Q?M=E5rten?= Svantesson) writes:

    >> Fatal server error:
    >> Failed to establish all listening sockets
    >> What should I tell my sysadmin?


    >The problem is that on Solaris only root are allowed to create these
    >sockets.


    Group root, really.

    >That is on a Solaris box you have


    >>ls -ld /tmp/.X11-unix

    >drwxrwxr-x 2 root root 1548 Jan 5 16:58 /tmp/.X11-unix


    >, while on Linux you normally have


    >>ls -ld /tmp/.X11-unix

    >drwxrwxrwt 2 root root 72 4 jan 20.29 /tmp/.X11-unix


    >So if your administrator do


    >chmod 777 /tmp/.X11-unix


    >you should be fine.


    Apart from the security hole you've just introduced.

    In Solaris, Xvfb is generally a script these days which calls
    Xsun; Xsun is either set-uid root (Solaris x86, needed for /dev/xsvc)
    or set-gid root (Solaris SPARC, needed to safely create
    /tmp/.X11-{pipe,unix}/X pipes and sockets).

    So the Sun provided Xvdfb should work.

    Casper

  9. Re: Xvfb for dummys?

    >So the Sun provided Xvdfb should work.

    Where can I find this program? It is not in my search path, and I could
    not find under the top-level Xvfb directory.

    Also, are you saying that Xvdfb should work for me "out of the box"
    with no help from my sysadmin? Thanks.


  10. Re: Xvfb for dummys?

    18k11tm001@sneakemail.com writes:

    >>So the Sun provided Xvdfb should work.


    >Where can I find this program? It is not in my search path, and I could
    >not find under the top-level Xvfb directory.


    Fat finger; Xvfb is found at /usr/openwin/bin/Xvfb; but perhaps
    not in older releases.

    >Also, are you saying that Xvdfb should work for me "out of the box"
    >with no help from my sysadmin? Thanks.


    Xvfb; yes.

    Casper

  11. Re: Xvfb for dummys?

    Casper H.S. Dik writes in comp.windows.x:
    |18k11tm001@sneakemail.com writes:
    |
    |>>So the Sun provided Xvdfb should work.
    |
    |>Where can I find this program? It is not in my search path, and I could
    |>not find under the top-level Xvfb directory.
    |
    |Fat finger; Xvfb is found at /usr/openwin/bin/Xvfb; but perhaps
    |not in older releases.

    Solaris 9 and later only.

    --
    __________________________________________________ ______________________
    Alan Coopersmith * alanc@alum.calberkeley.org * Alan.Coopersmith@Sun.COM
    http://www.csua.berkeley.edu/~alanc/ * http://blogs.sun.com/alanc/
    Working for, but definitely not speaking for, Sun Microsystems, Inc.

  12. Re: Xvfb for dummys?

    Just for the record, I have yet to get Xvfb working (Solaris). When I
    type

    Xvfb :1

    Here's what I get:

    Fatal server error:
    Failed to establish all listening sockets

    My sysadmin is very competent, but he doesn't know what to do and
    doesn't have a lot of time to spend on it. I thought I could expect
    more from Unix, but apparently not. All I want to do is turn off the
    friggin' windows. I am surprised that it is so difficult. Suggestions
    welcomed. Thanks.


  13. Re: Xvfb for dummys?

    18k11tm001@sneakemail.com writes:

    > Just for the record, I have yet to get Xvfb working (Solaris). When I
    > type
    >
    > Xvfb :1
    >
    > Here's what I get:
    >
    > Fatal server error:
    > Failed to establish all listening sockets
    >
    > My sysadmin is very competent, but he doesn't know what to do and
    > doesn't have a lot of time to spend on it.


    Hmm, what's this next part?

    > I thought I could expect
    > more from Unix, but apparently not. All I want to do is turn off the
    > friggin' windows. I am surprised that it is so difficult. Suggestions
    > welcomed. Thanks.


    What's with the bad attitude?

    Your problem MAY be that the Xvfb executable is not marked suid root.

  14. Re: Xvfb for dummys?

    >What's with the bad attitude?

    I just installed Adobe Acrobat Reader on my PC, and it was a snap.
    Click, click, click, and everything works fine. Yet I have a
    professional installing Xvfb for me, and he has mysterious problems.

    Hey, don't get me wrong. I'm no fan of Microsoft. In fact, I only use
    it when I absolutely must (to create ppt slides in collaboration with
    others). But the fact is that installation is often worlds easier with
    MS than it is with Unix.

    >Your problem MAY be that the Xvfb executable is not marked suid root.


    Thanks for the suggestion, but does that introduce a security hole? And
    if it needs to be that way, why wasn't it configured that way by
    default?


  15. Re: Xvfb for dummys?

    18k11tm001@sneakemail.com writes:

    >>What's with the bad attitude?

    >
    > I just installed Adobe Acrobat Reader on my PC, and it was a snap.
    > Click, click, click, and everything works fine. Yet I have a
    > professional installing Xvfb for me, and he has mysterious problems.
    >
    > Hey, don't get me wrong. I'm no fan of Microsoft. In fact, I only use
    > it when I absolutely must (to create ppt slides in collaboration with
    > others). But the fact is that installation is often worlds easier with
    > MS than it is with Unix.


    No reason to bring your problems here.

    >>Your problem MAY be that the Xvfb executable is not marked suid root.

    >
    > Thanks for the suggestion, but does that introduce a security hole? And
    > if it needs to be that way, why wasn't it configured that way by
    > default?


    I believe the principle is, only programs that need to be suid
    should be suid.

    This is hypothetical until you verify that it helps.

    I made the suggestion because on the second screen of Google
    hits this was suggested as a solution for the same message
    from a similar program.

    On my Linux system, Xvfb is not suid.
    Our Solaris systems lack Xvfb so I can't give you a
    definitive answer that that will fix it.

  16. Re: Xvfb for dummys?

    18k11tm001@sneakemail.com writes in comp.windows.x:
    |Just for the record, I have yet to get Xvfb working (Solaris). When I
    |type
    |
    |Xvfb :1
    |
    |Here's what I get:
    |
    |Fatal server error:
    |Failed to establish all listening sockets

    http://www.science.uva.nl/pub/solari...is2/Q3.59.html

    --
    __________________________________________________ ______________________
    Alan Coopersmith * alanc@alum.calberkeley.org * Alan.Coopersmith@Sun.COM
    http://www.csua.berkeley.edu/~alanc/ * http://blogs.sun.com/alanc/
    Working for, but definitely not speaking for, Sun Microsystems, Inc.

  17. Re: Xvfb for dummys?

    >>Your problem MAY be that the Xvfb executable is not marked suid root.

    Yes, that seems to have been the problem. Works fine now. Thanks.
    I can only hope it didn't open a security hole.


  18. Re: Xvfb for dummys?

    18k11tm001@sneakemail.com wrote:
    >
    > >>Your problem MAY be that the Xvfb executable is not marked suid root.

    >
    > Yes, that seems to have been the problem. Works fine now. Thanks.
    > I can only hope it didn't open a security hole.


    Uhm... on Solaris an Xserver just needs to be setgid "root" (set-groupid
    root) to access the /tmp/.X11*-files (pipes, sockets etc., the
    restriction to the group "root" was added in Solaris to avoid that a
    malicious user can mess with those files (another gaping security hole
    in Linux noone cares about... ;-()) - not setuid (set-uid root). The
    setgid root thing is far less problematic than running Xvfb as user
    "root".

    ----

    Bye,
    Roland

    --
    __ . . __
    (o.\ \/ /.o) roland.mainz@nrubsig.org
    \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
    /O /==\ O\ TEL +49 641 7950090
    (;O/ \/ \O

+ Reply to Thread