erro xterm: erro xt não pode abrir exibição exibição xterm não está definida

2

Não tenho ideia de como definir a exibição. Eu continuo recebendo o seguinte erro de erro

xterm: xt error can't open display xterm display is not set

Eu pesquisei on-line, mas não encontrei nenhuma solução. Por favor, alguém pode me ajudar?

    
por Oyinade 27.05.2016 / 21:09

2 respostas

0

Isso provavelmente se deve a um problema de configuração incorreta ou a vários monitores. Como pode ser visto no xterm manpage ( man xterm ) você pode definir a exibição usando o -display flag:

   -display display
           This option specifies the X server to contact; see X(7).

Se você olhar em X(7) onde especifica a aparência ( man X ) você verá o que você precisa colocar após o sinalizador:

DISPLAY NAMES
       From  the  user's perspective, every X server has a display name of the
       form:

              hostname:displaynumber.screennumber

       This information is used by the application to determine how it  should
       connect  to  the  server  and which screen it should use by default (on
       displays with multiple monitors):

       hostname
               The hostname specifies the name of the  machine  to  which  the
               display is physically connected.  If the hostname is not given,
               the most efficient way of communicating to a server on the same
               machine will be used.

       displaynumber
               The  phrase  "display" is usually used to refer to a collection
               of monitors that share a common set of input devices (keyboard,
               mouse,  tablet, etc.).  Most workstations tend to only have one
               display.  Larger, multi-user systems, however, frequently  have
               several  displays  so  that  more  than one person can be doing
               graphics work at once.  To avoid confusion, each display  on  a
               machine  is assigned a display number (beginning at 0) when the
               X server for that display is started.  The display number  must
               always be given in a display name.

       screennumber
               Some displays share their input devices among two or more moni‐
               tors.  These may be configured  as  a  single  logical  screen,
               which  allows  windows to move across screens, or as individual
               screens, each with their own set  of  windows.   If  configured
               such  that each monitor has its own set of windows, each screen
               is assigned a screen number (beginning at 0) when the X  server
               for  that  display  is  started.   If  the screen number is not
               given, screen 0 will be used.

       On POSIX systems, the default display name is stored  in  your  DISPLAY
       environment  variable.  This variable is set automatically by the xterm
       terminal emulator.  However, when you log into  another  machine  on  a
       network,  you may need to set DISPLAY by hand to point to your display.
       For example,

           % setenv DISPLAY myws:0
           $ DISPLAY=myws:0; export DISPLAY

       The ssh program can be used to start an X program on a remote  machine;
       it automatically sets the DISPLAY variable correctly.

       Finally,  most X programs accept a command line option of -display dis‐
       playname to temporarily override the contents of DISPLAY.  This is most
       commonly used to pop windows on another person's screen or as part of a
       "remote shell" command to start an xterm pointing back to your display.
       For example,

           % xeyes -display joesws:0 -geometry 1000x1000+0+0
           % rsh big xterm -display myws:0 -ls </dev/null &

       X  servers  listen for connections on a variety of different communica‐
       tions channels (network byte  streams,  shared  memory,  etc.).   Since
       there  can be more than one way of contacting a given server, The host‐
       name part of the display name is used to determine the type of  channel
       (also  called  a transport layer) to be used.  X servers generally sup‐
       port the following types of connections:

       local
               The hostname part of the  display  name  should  be  the  empty
               string.   For  example:   :0, :1, and :0.1.  The most efficient
               local transport will be chosen.

       TCPIP
               The hostname part of the display  name  should  be  the  server
               machine's  hostname or IP address.  Full Internet names, abbre‐
               viated names,  IPv4  addresses,  and  IPv6  addresses  are  all
               allowed.     For    example:    x.org:0,    expo:0,    [::1]:0,
               198.112.45.11:0, bigmachine:1, and hydra:0.1.

Para obter o valor da sua exibição, você só poderá executar:

echo $DISPLAY
    
por user364819 28.05.2016 / 00:26
0

Em um script bash, uma maneira de encontrar a exibição associada a um usuário é executar o comando who . Os bits úteis neste caso seriam o nome de login e o display X.

Em um sistema de usuário único, você pode presumir com segurança que haverá apenas um usuário logado. Para um servidor multiusuário, pode ser necessário aplicar alguma lógica para escolher a exibição correta.

# process who for a unique list of users with their display as an array
USERLIST=($(/usr/bin/who | /bin/sed -e 's/[)(]//g' -e 's/ \+/ /g' | /usr/bin/cut -d ' ' -f1,5 | /usr/bin/sort -u | /usr/bin/tr -d '\n'))
# ${USERLIST[1]:-":0.0"} includes a default guess to be used if the array value is null.
xterm -display "${USERLIST[1]:-":0.0"}"
    
por J. Starnes 13.12.2017 / 08:56