Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] parse_vt_settings: Cannot open /dev/tty0
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
open-antux
n00b
n00b


Joined: 19 Dec 2022
Posts: 10

PostPosted: Sun Apr 28, 2024 12:32 pm    Post subject: [SOLVED] parse_vt_settings: Cannot open /dev/tty0 Reply with quote

Hi all,

after the last system upgrade (27 April) I'm facing some issue with X, I use greetd as login system with the following configuration:
Code:
[terminal]
# The VT to run the greeter on. Can be "next", "current" or a number
# designating the VT.
vt = 7

# The default session, also known as the greeter.
[default_session]

# `agreety` is the bundled agetty/login-lookalike. You can replace `$SHELL`
# with whatever you want started, such as `sway`.
# command = "agreety --cmd $SHELL"
command = "tuigreet -t -r --asterisks --power-shutdown 'sudo poweroff' --power-reboot 'sudo reboot' --cmd startx"

# The user to run the command as. The privileges this user must have depends
# on the greeter. A graphical greeter may for example require the user to be
# in the `video` group.
user = "greetd"

But when I try to login, the Xorg server gives me this error:
Code:
[   427.212] (II) NVIDIA dlloader X Driver  550.78  Sun Apr 14 06:27:13 UTC 2024
[   427.212] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[   427.212] (EE)
Fatal server error:
[   427.212] (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
[   427.212] (EE)
[   427.212] (EE)
Please consult the The X.Org Foundation support
    at http://wiki.x.org
 for help.
[   427.212] (EE) Please also check the log file at "/home/antonio/.local/share/xorg/Xorg.0.log" for additional information.
[   427.213] (EE)
[   427.213] (WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor
[   427.213] (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor
[   427.217] (EE) Server terminated with error (1). Closing log file.

This issue happen only if I try to login via greetd, when I do startx with my normal user I can correctly use my environment.

Does anyone have any ideas?

Additional info:
Code:
λ ~/ id greetd
uid=396(greetd) gid=396(greetd) gruppi=396(greetd),27(video),97(input)
λ ~/ id antonio # normal user         
uid=1000(antonio) gid=1000(antonio) gruppi=1000(antonio),7(lp),10(wheel),27(video),97(input),16(cron),48(docker),509(pipewire),79(libvirt)
λ ~/ eix elogind                       
[I] sys-auth/elogind
     Available versions:  246.10-r3^t (~)252.9^t {+acl audit +cgroup-hybrid debug doc +pam +policykit selinux test}
     Installed versions:  252.9^t(13:53:25 18/06/2023)(acl cgroup-hybrid pam policykit -audit -debug -doc -selinux -test)
     Homepage:            https://github.com/elogind/elogind
     Description:         The systemd project's logind, extracted to a standalone package

λ ~/ eix xorg-server         
[I] x11-base/xorg-server
     Available versions:  21.1.13(0/21.1.13)^t **9999(0/9999)*l^t {debug +elogind minimal selinux suid systemd test +udev unwind xcsecurity xephyr xnest xorg xvfb}
     Installed versions:  21.1.13(0/21.1.13)^t(10:19:02 13/04/2024)(elogind udev xorg -debug -minimal -selinux -suid -systemd -test -unwind -xcsecurity -xephyr -xnest -xvfb)
     Homepage:            https://www.x.org/wiki/ https://gitlab.freedesktop.org/xorg/xserver/xorg-server
     Description:         X.Org X servers

λ ~/ cat .xinitrc
xsetroot -cursor_name left_ptr
exec dbus-launch /home/antonio/.xmonad/xmonad-x86_64-linux


Last edited by open-antux on Thu May 02, 2024 4:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1677
Location: South America

PostPosted: Sun Apr 28, 2024 3:32 pm    Post subject: Reply with quote

That's typically Xorg running with an unprivileged user, without meeting the required conditions for that. How do you start greetd?
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
open-antux
n00b
n00b


Joined: 19 Dec 2022
Posts: 10

PostPosted: Sun Apr 28, 2024 4:13 pm    Post subject: Reply with quote

GDH-gentoo wrote:
That's typically Xorg running with an unprivileged user, without meeting the required conditions for that. How do you start greetd?

Hi GDH-gentoo, thanks for the support.
I followed the documentation here.
Back to top
View user's profile Send private message
open-antux
n00b
n00b


Joined: 19 Dec 2022
Posts: 10

PostPosted: Mon Apr 29, 2024 11:18 am    Post subject: X error: Cannot open virtual console 8 (Permission denied) Reply with quote

A little update, I tried to add into the tty group my normal user and greetd user, now the error message is changed but the behavior is the same.
Code:

λ ~/ sudo gpasswd -a greetd tty                               
Password:
Aggiunta dell'utente greetd al gruppo tty
λ ~/ sudo gpasswd -a antonio tty
Aggiunta dell'utente antonio al gruppo tty

This is the error message:
Code:

[   226.280] Current Operating System: Linux gentoo 6.8.7-gentoo #1 SMP PREEMPT_DYNAMIC Thu Apr 25 08:49:19 CEST 2024 x86_64
  (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[   226.285] (EE)
[   226.285] (EE) xf86OpenConsole: Cannot open virtual console 8 (Permission denied)
[   226.285] (EE)
[   226.285] (EE)
[   226.285] (EE) Please also check the log file at "/home/antonio/.local/share/xorg/Xorg.0.log" for additional information.
[   226.285] (EE)
[   226.285] (EE) Server terminated with error (1). Closing log file.


EDIT: Changed title with the new error message.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6145
Location: Dallas area

PostPosted: Mon Apr 29, 2024 11:58 am    Post subject: Reply with quote

So you run the user as "greetd" , what permissions does he have, it's the one executing things from greetd?
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
open-antux
n00b
n00b


Joined: 19 Dec 2022
Posts: 10

PostPosted: Mon Apr 29, 2024 12:20 pm    Post subject: Reply with quote

Anon-E-moose wrote:
So you run the user as "greetd" , what permissions does he have, it's the one executing things from greetd?

Hi Anon-E-moose, thanks for the support.
Yes, I use greetd user for the login and the command that I execute is startx.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22602

PostPosted: Mon Apr 29, 2024 2:54 pm    Post subject: Reply with quote

open-antux wrote:
A little update, I tried to add into the tty group my normal user and greetd user, now the error message is changed but the behavior is the same.
You should not do this. On normal systems, a user does not need to be in the tty group, and membership there can be used for some types of attacks.
Back to top
View user's profile Send private message
open-antux
n00b
n00b


Joined: 19 Dec 2022
Posts: 10

PostPosted: Mon Apr 29, 2024 3:11 pm    Post subject: Reply with quote

Hu wrote:
open-antux wrote:
A little update, I tried to add into the tty group my normal user and greetd user, now the error message is changed but the behavior is the same.
You should not do this. On normal systems, a user does not need to be in the tty group, and membership there can be used for some types of attacks.

Hi Hu, I see, thanks for the annotation, I'll remove those users from the tty group :D
Back to top
View user's profile Send private message
open-antux
n00b
n00b


Joined: 19 Dec 2022
Posts: 10

PostPosted: Wed May 01, 2024 5:52 pm    Post subject: Reply with quote

Hi all,

after some research, I solved my issue. I'm thinking that the issue is startx, because if I run as command in greetd
Code:
startx -- vt7
the issue doesn't appear.

Before I tag this thread as solved, I'd like to understand if this workaround (I think?) could cause me some sort of security issue.

Thanks.
Back to top
View user's profile Send private message
entity
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2002
Posts: 93
Location: Joensuu, Finland

PostPosted: Thu Aug 01, 2024 7:53 am    Post subject: Reply with quote

Hi, I got this issue after updating to greetd-0.10.0, which apparently clears XDG_VTNR environment variable in source file session/worker.rs, so whatever you specify in /etc/greetd/config.toml for vt does not work.

Code:

// We are done with PAM, clear variables that the child will not need.
    let cleared_env = ["XDG_SESSION_CLASS", "XDG_VTNR"];
    for e in cleared_env.iter() {
        _ = pam.putenv(e);
    }


In greetd-0.10.3 issue is fixed:

Code:

// We are done with PAM, clear variables that the child will not need.
    _ = pam.putenv(&"XDG_SESSION_CLASS");


So instead of the previously suggested workaround, upgrading to newer version will also do the trick:
Code:

# emerge =greetd-0.10.3
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum