You are not logged in.

#1 2024-06-03 11:15:02

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

[SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Hi everyone! Any help is very welcome.

By following the information and secondary links on the wiki (https://wiki.archlinux.org/title/Xinit, http://blog.falconindy.com/articles/bac … stemd.html, https://tstarling.com/blog/2016/06/x11- … solation/) I was able to obtain these settings. Since I switched from XFCE to bspwm and from lightdm to ly (and subsequently to lemurs) the trick no longer works. It appears that these commands present in ~/.xinitrc and ~/.xserverrc are now ignored.

Here's my ~/.xinitrc

#!/bin/sh

TERMINAL=xfce4-terminal
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
 
# merge in defaults and keymaps

if [ -f $sysresources ]; then







   xrdb -merge $sysresources
 
fi

if [ -f $sysmodmap ]; then
   xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then







   xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
   xmodmap "$usermodmap"


# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

xinit -- "$@" vt2 &
exec bspwm

Here's my ~/.xserverrc

#!/bin/sh

exec /usr/bin/Xorg -nolisten tcp -nolisten local "$@" vt2 -keeptty > ~/.xorg.log 2>&1

Any suggestions will be greatly appreciated.

Last edited by pit_p_an-arch_y (2024-06-04 21:55:34)

Offline

#2 2024-06-03 15:58:21

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,313

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Lightdm would certainly not have used your ~/.xserverrc and typically not your ~/.xinitrc either.

 > ~/.xorg.log 2>&1

does not what you want

xinit -- "$@" vt2 &

seems crazy? The first blog you posted has that in some shell script for auto-starting X11 on login.

Abandon all of that. Remove the recursive xinit invocation from your xinitrc, feel free to redirect the Xorg stdout, but that's not the log - rather -keeptty would redirect the session output into the log.

Anyway, the critical term in your post is "lemurs" which apparently doesn't use xinit at all.
https://github.com/coastalwhite/lemurs/ … /xsetup.sh suggests the session is started w/ $HOME/.xsession
https://github.com/coastalwhite/lemurs/ … /x.rs#L150 looks like it reads some xserver_path config, consult the lemurs manpage.

Offline

#3 2024-06-03 18:28:50

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Thank you so much @set!

I'm so sorry, I'm such a noob, but I'm trying to learn something about xinit and Xorg.

I added this to my ~/.xserverrc

> ~/.xorg.log 2>&1

just following this link: https://wiki.archlinux.org/title/Xorg#S … edirection.

Ok, so I have to remove this line from ~/.xinitrc

xinit -- "$@" vt2 &

but how can I give "nolisten tcp" and "nolisten local" command to the X server if neither ly nor lemurs uses ~/.xserverrc?

Actually, accessing the graphical environment and bspwm without using any display manager would also be fine for me but, even in this case, how could I tell the X server "nolisten tcp" and "nolisten local"?

Thanks in advance for any help.

Offline

#4 2024-06-03 20:15:44

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,313

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Actually, accessing the graphical environment and bspwm without using any display manager would also be fine for me but, even in this case, how could I tell the X server "nolisten tcp" and "nolisten local"?

https://wiki.archlinux.org/title/Getty# … al_console
https://wiki.archlinux.org/title/Xinit# … X_at_login
And in that case xserverrc and xinitrc will become relevant again, https://wiki.archlinux.org/title/Xinit#Configuration

just following this link: https://wiki.archlinux.org/title/Xorg#S … edirection.

Ok, the name there is somewhat of a misnomer - this logs the session, not the server.
That's not "wrong", just something to be aware of - your "xorg log" (meaning the log of the X11 server) will be in ~/.local/share/xorg/

Offline

#5 2024-06-03 21:35:46

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Thanks for your patience @seth.

seth wrote:

And in that case xserverrc and xinitrc will become relevant again,

But in this case, is this command line in ~/.xinitrc okay or should it be removed anyway?:

xinit -- "$@" vt2 &

Furthermore, after following the instructions in the two links you indicated, is it necessary to follow this other link too: Automatic login into Xorg without display manager? Or would it be a redundant action?

Finally, the procedures described here Automatic login to virtual console and here Prompt only the password for a default user in virtual console login are two conflicting actions or, on the contrary, both files are necessary to be able to automatically log in to a virtual console and, at the same time, for a default user, to be able to type only the password without the need to enter the username at each login?

Offline

#6 2024-06-03 21:43:50

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,313

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

should it be removed anyway?:

xinitrc is executed by xinit, callign xinit inside will cause a recursion.

https://wiki.archlinux.org/title/System … ay_manager describes an alternative approach to start X11 as system user service.
Therere a bunch of caveats listed in the wiki and idk whether that will properly work.

You can configure agetty to
- ask for user and password
- only ask for the password of a pre-selected user
- automatically log in a pre-selected user w/o any password input request
These are mutually exclusive options and a matter of subjective preference.
It's not uncommon to automatically log into a user and automatically start an X11 session that immediately locks the screen (slock, i3lock, xscreensaver, …) to protect the session.

Offline

#7 2024-06-03 21:53:12

loqs
Member
Registered: 2014-03-06
Posts: 18,859

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Just to note `-nolisten tcp` is the default at least for X as shipped by Arch.  You would need to specify the reverse `listen tcp` to allow remote connections.

Offline

#8 2024-06-04 00:17:18

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Unfortunately it didn't work. I just changed the values from vt2 to vt$XDG_VTNR in the .xserverrc file. Initially logging into tty1 failed so I changed the value to tty 2 in the .zprofile file. At that point the login to tty1 was automatic but X didn't start even with the startx command: when I executed the startx command the terminal gave me an error relating to line 3 of .xserverrc which denied permission. This happens in every tty anyway.

Here's my .xserverrc

#!/bin/sh

exec /usr/bin/Xorg -nolisten tcp -nolisten local "$@" vt$XDG_VTNR -keeptty > ~/.xorg.log 2>&1

Here's my .zprofile

if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 2 ]; then
  exec startx
fi

Here's my /etc/systemd/system/getty@tty1.service.d/autologin.conf

[Service]
ExecStart=
ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin arch_peter %I $TERM
Type=simple
Environment=XDG_SESSION_TYPE=x11

I don't know what I did wrong.

Offline

#9 2024-06-04 06:39:13

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,313

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

startx command the terminal gave me an error relating to line 3 of .xserverrc which denied permission

Please don't paraphrase, https://bbs.archlinux.org/viewtopic.php?id=57855 - post the error verbatim

Offline

#10 2024-06-04 08:57:08

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

I'm so sorry for that.

This is the output of startx when I login without DM:

/home/arch_peter/.xserverrc: line 3: /home/arch_peter/.xorg.log: Permission denied
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error

Also this is the output of xinit:

/home/arch_peter/.xserverrc: line 3: /home/arch_peter/.xorg.log: Permission denied
X connect to :0 broken (explicit kill or server shutdown).

Offline

#11 2024-06-04 13:01:28

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,313

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

stat /home/arch_peter
stat /home/arch_peter/.xorg.log

There's probably such file, but root owned?

Offline

#12 2024-06-04 13:56:13

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

stat /home/arch_peter
  File: /home/arch_peter
  Dim.: 4096            Blocchi: 8          Blocco di IO: 4096   directory
Device: 259,7   Inode: 33816578    Links: 20
Accesso: (0700/drwx------)  Uid: ( 1000/arch_peter)   Gid: (  984/   users)
Accesso  : 2024-06-04 15:13:14.598057597 +0200
Modifica : 2024-06-04 15:13:46.086058292 +0200
Cambio   : 2024-06-04 15:13:46.086058292 +0200
Creazione: 2023-09-02 01:43:56.801556443 +0200
stat /home/arch_peter/.xorg.log
  File: /home/arch_peter/.xorg.log
  Dim.: 0               Blocchi: 0          Blocco di IO: 4096   file regolare v
Device: 259,7   Inode: 33838632    Links: 1
Accesso: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Accesso  : 2024-06-04 00:52:07.510029649 +0200
Modifica : 2024-05-04 04:38:22.404801675 +0200
Cambio   : 2024-05-04 04:38:22.404801675 +0200
Creazione: 2024-05-04 04:38:22.404801675 +0200

Sorry, how can I get output in english just to post it to the forum?

I am very grateful for your attention.

Offline

#13 2024-06-04 13:57:32

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,313

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

"export LC_ALL=C", but I can just about read

Accesso: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)

There's probably such file, but root owned?

=> Remove it (and yes, you'll have to sudo that)

Offline

#14 2024-06-04 20:51:09

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

I apologize but I couldn't try until recently.

seth wrote:

=> Remove it (and yes, you'll have to sudo that)

Thank you so much!!! It works!

I have just another question, if is not offtopic: if I run htop, I can see this two tasks running now:

/usr/bin/Xorg -nolisten tcp -nolisten local  :0 vt1 -keeptty -auth /tmp/serverauth.5FZAYHZ1KU vt1 -keeptty
xinit /home/arch_peter/.xinitrc -- /home/arch_peter/.xserverrc :0 vt1 -keeptty -auth /tmp/serverauth.5FZAYHZ1KU

The question is: What does -auth /tmp/serverauth.5FZAYHZ1KU do? And also, Why is -keeptty repeated 2 times in the first line?
In any case, thank you very much!

Offline

#15 2024-06-04 20:54:54

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,313

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

https://man.archlinux.org/man/extra/xor … .1.en#auth
The second -keeptty  looks like startx acutally adds that unconditionally to the server when running xinit.

Edit: Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Last edited by seth (2024-06-04 20:55:06)

Offline

#16 2024-06-04 22:00:19

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Ok. Thank you so much!!

For the second -keepty, is it a problem?

Offline

#17 2024-06-04 22:07:02

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,313

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

No, you can add the parameter several times - the server isn't going to keep the tty more, but also not less.
But as long as you're using startx (and not just xinit), you can also just remove it from your xserverrc again.

Offline

#18 2024-06-05 10:54:21

pit_p_an-arch_y
Member
Registered: 2024-05-18
Posts: 19

Re: [SOLVED] Set X server for "nolisten tcp" and "nolisten local"

Ok. Thank you so much again! I really appreciate all your tips!

Offline

Board footer

Powered by FluxBB