Discussion:
[gentoo-user] can't start X as user
(too old to reply)
Philip Webb
2023-06-14 00:30:01 UTC
Permalink
My new machine has no problem with graphics using System Rescue etc
nor using 'startx' as root with Gentoo, but it refuses to start as user.

I've had a series of errors :

parse_vt_settings : can't open /dev/tty0 (permission denied)

after adding my user to 'tty input' in 'group' :

can't open virtual console 7 : permission denied

after adding 'elogind' to 'default' runlevel & starting it :

xf86EnableIO : failed to enable I/O ports 0000-03ff
(operation not permitted)

yes, my user is in the 'video' group & 'xorg-server' has USE="elogind" .

In my current machine, there is a /dev/fb0 with permission 660 .
but there is no such device in the new machine.

I've looked at several "solved" cases of the same error messages,
but they don't seem to help my problem.

Can anyone offer possible solutions ?
--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Jack
2023-06-14 00:40:01 UTC
Permalink
Post by Philip Webb
My new machine has no problem with graphics using System Rescue etc
nor using 'startx' as root with Gentoo, but it refuses to start as user.
parse_vt_settings : can't open /dev/tty0 (permission denied)
can't open virtual console 7 : permission denied
xf86EnableIO : failed to enable I/O ports 0000-03ff
(operation not permitted)
yes, my user is in the 'video' group & 'xorg-server' has USE="elogind" .
In my current machine, there is a /dev/fb0 with permission 660 .
but there is no such device in the new machine.
I've looked at several "solved" cases of the same error messages,
but they don't seem to help my problem.
Can anyone offer possible solutions ?
what does "ll /dev/tty*" show?  I see lots of them, including 0,
although I can't say which are relevant.  It does seem odd if you don't
have any.  Have you compared kernel config on the machine that works and
the one that doesn't?

what does /var/log/Xorg.0.log show?  It's likely to be more voluminous
than output to console.

what's in ~/.xinitrc?  I don't actually suspect anything there, but it
might be relevant.

In my case, X is started on the same virtual console it is invoked from,
but I don't remember where the change from always using 7 shows up in
any config file.  However, that does suggest some permission error MIGHT
be relevant (but no guarantees.)
Michael
2023-06-14 09:00:02 UTC
Permalink
Post by Philip Webb
My new machine has no problem with graphics using System Rescue etc
nor using 'startx' as root with Gentoo, but it refuses to start as user.
parse_vt_settings : can't open /dev/tty0 (permission denied)
can't open virtual console 7 : permission denied
Not sure if this is necessary:

$ grep 'tty|input' /etc/group
Post by Philip Webb
xf86EnableIO : failed to enable I/O ports 0000-03ff
(operation not permitted)
The elogind service ought to be in boot runlevel according to the wiki:

https://wiki.gentoo.org/wiki/Elogind#Configuration
Post by Philip Webb
yes, my user is in the 'video' group & 'xorg-server' has USE="elogind" .
In my current machine, there is a /dev/fb0 with permission 660 .
but there is no such device in the new machine.
Have you followed this wiki page to configure your kernel, include the
appropriate firmware for your card(s), set up INPUT_DEVICES & VIDEO_CARDS in
make.conf, emerge associated x11-base/xorg-drivers and the x11-base/xorg-
server packages before a reboot?

https://wiki.gentoo.org/wiki/Xorg/Guide

There should be a fb0 device listed:

$ ls -l /dev/fb*
crw-rw---- 1 root video 29, 0 Jun 14 08:52 /dev/fb0

You'll also need to have emerged a Desktop Environment, or at least a window
manager:

https://wiki.gentoo.org/wiki/Window_manager

Check the above wiki pages and post back with any queries and accompanying
logs if things do not work as expected.
Philip Webb
2023-06-15 02:30:01 UTC
Permalink
Post by Michael
Post by Philip Webb
My new machine has no problem with graphics using System Rescue etc
nor using 'startx' as root with Gentoo, but it refuses to start as user.
parse_vt_settings : can't open /dev/tty0 (permission denied)
can't open virtual console 7 : permission denied
$ grep 'tty|input' /etc/group
My user is in 'tty wheel usb input video' (among others).
Post by Michael
https://wiki.gentoo.org/wiki/Elogind#Configuration
I've corrected that & checked that Pam is running & Udev is in 'sysinit'.
Post by Michael
Post by Philip Webb
'xorg-server' has 'USE="elogind"'.
In my current machine, there is a /dev/fb0 with permission 660 .
but there is no such device in the new machine.
Ditto for /dev/dri/card0 .
Post by Michael
Have you followed this wiki page to configure your kernel,
include the appropriate firmware for your card(s),
set up INPUT_DEVICES & VIDEO_CARDS in make.conf,
emerged associated x11-base/xorg-drivers
and the x11-base/xorg-server packages before a reboot ?
https://wiki.gentoo.org/wiki/Xorg/Guide
Yes. I have "evdev" + "radeon vesa" in 'make.conf'.
'xf86-video-ati/vesa' are installed,
as is 'xorg-server' + all its requirements ("dependencies").
Post by Michael
$ ls -l /dev/fb*
crw-rw---- 1 root video 29, 0 Jun 14 08:52 /dev/fb0
ANB5 has /dev/fb0 /dev/dri/card0 with 660 permitions, ANB6 hasn't
(those are my names for the present + new machines).
Post by Michael
You'll also need to have emerged a Desktop Environment
or at least a window manager: https://wiki.gentoo.org/wiki/Window_manager
I've installed 'twm xterm' to test X for now.
I will install KDE for regular use later.

'.xinitrc' is

#xscreensaver &
numlockx
exec dbus-launch --exit-with-session /usr/bin/twm

ie the same as in ANB5, but substituting Twm for Plasma.
Post by Michael
what does /var/log/Xorg.0.log show ?
It has these errors (EE) in the X log file :

Failed to load module "fbdev" (does not exist)
Open /dev/dri/card0 : no such directory or file
VESA (0) : cannot read int vect
Screens found, but none has a useable configuration

Do I need 'fbdev' or 'card0' ? Whatever is "int vect" ?

When I try to 'startx' as user, the log file is in ~/.local/share/xorg ,
which is also where it is in ANB5. When I try 'Xorg -configure',
it produces nothing of use & dumps it in my home directory (ugh).

I can probably cut the Gordian knot by emerging Xorg-server with 'suid'.
How insecure is that for a single-user system in a house ?
The Elogind approach has worked in ANB5 since Aug 2020.

I can't make much of a useful comparison between the 2 machines,
as ANB5 dates from 2015, ie long before the 'elogind' affair in 2020,
& it has Nvidia graphics, whereas ANB6 has cutting-edge AMD.

BTW System Rescue + Mint (live USB) load modules for AMDGPU,
which seems to be the latest graphics offering ;
I need to find some firmware to get it to work
(enabling AMDGPU in the kernel causes the boot process to stall
with a message re missing firmware).
There are in fact 2 graphics tools in ANB6,
one in the CPU (AMD), the other on the Mobo (Gigabyte).
How can I tell which one the machine is trying to use ?

I will continue to poke around, but further advice is very welcome.
Please read my comments above carefully (smile).
--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca
Michael
2023-06-15 12:40:01 UTC
Permalink
Post by Philip Webb
Post by Michael
Post by Philip Webb
My new machine has no problem with graphics using System Rescue etc
nor using 'startx' as root with Gentoo, but it refuses to start as user.
parse_vt_settings : can't open /dev/tty0 (permission denied)
can't open virtual console 7 : permission denied
The startx command would launch a GUI in the same VT you are running startx in
- you will not have permission to launch a GUI in a console when you are not
logged in it.
Post by Philip Webb
Post by Michael
$ grep 'tty|input' /etc/group
My user is in 'tty wheel usb input video' (among others).
I understand, but this is not necessary - unless you have some special
programs requiring your user to have direct access to devices/libraries/
whatever is controlled by these groups - e.g. on the PC I'm currently logged
in:

$ grep 'tty|wheel|usb|input|video' /etc/group
tty:x:5:
wheel:x:10:root,michael
video:x:27:root,michael,sddm
usb:x:85:pcscd
Post by Philip Webb
Post by Michael
https://wiki.gentoo.org/wiki/Elogind#Configuration
I've corrected that & checked that Pam is running & Udev is in 'sysinit'.
"... Pam is running"?

Not sure what you mean here. Did you mean to say dbus is in the default run
level and running?
Post by Philip Webb
Post by Michael
Post by Philip Webb
'xorg-server' has 'USE="elogind"'.
Good.
Post by Philip Webb
Post by Michael
Post by Philip Webb
In my current machine, there is a /dev/fb0 with permission 660 .
but there is no such device in the new machine.
Ditto for /dev/dri/card0 .
Post by Michael
Have you followed this wiki page to configure your kernel,
include the appropriate firmware for your card(s),
set up INPUT_DEVICES & VIDEO_CARDS in make.conf,
emerged associated x11-base/xorg-drivers
and the x11-base/xorg-server packages before a reboot ?
https://wiki.gentoo.org/wiki/Xorg/Guide
Yes. I have "evdev" + "radeon vesa" in 'make.conf'.
You need to recast an eye over the above Xorg Guide:

There is a kernel module EVDEV:

$ grep EVDEV /usr/src/linux/.config
CONFIG_INPUT_EVDEV=y

which should not be confused with the portage variable INPUT_DEVICES "evdev",
now superseded by "libinput":

$ portageq envvar INPUT_DEVICES
libinput

About half way down the page the recommended INPUT_DEVICES flags to use when
emerging x11-base/xorg-drivers are shown as:

INPUT_DEVICES="libinput ... -evdev".

Also, the radeon input device is meant for older radeon cards.

As is vesa.
Post by Philip Webb
'xf86-video-ati/vesa' are installed,
These would not be installed if you had configured your kernel correctly for
your current video card.

You should not need the vesa generic driver for a graphic framebuffer these
days:

$ grep FB_VESA /usr/src/linux/.config
# CONFIG_FB_VESA is not set

What you should be using instead is kernel mode setting (KMS), by setting it
up in the kernel as explained in this section:

https://wiki.gentoo.org/wiki/Xorg/Guide#Kernel_modesetting

As suggested in the above guide and depending on how new your card is, check
this page to adjust your kernel config and specify the necessary firmware
accordingly:

https://wiki.gentoo.org/wiki/AMDGPU
Post by Philip Webb
as is 'xorg-server' + all its requirements ("dependencies").
Post by Michael
$ ls -l /dev/fb*
crw-rw---- 1 root video 29, 0 Jun 14 08:52 /dev/fb0
ANB5 has /dev/fb0 /dev/dri/card0 with 660 permitions, ANB6 hasn't
(those are my names for the present + new machines).
You need KMS and direct rendering configured in your kernel, which is why I
suspect your kernel requires more work as suggested above. Thereafter you'll
need to re-emerge xorg and mesa before your reboot to drag in the correct xf86
and mesa drivers.

[snip...]
Post by Philip Webb
Post by Michael
what does /var/log/Xorg.0.log show ?
Failed to load module "fbdev" (does not exist)
Open /dev/dri/card0 : no such directory or file
VESA (0) : cannot read int vect
Screens found, but none has a useable configuration
Do I need 'fbdev' or 'card0' ? Whatever is "int vect" ?
You're missing the appropriate graphics configuration in your kernel, hence
there's no direct rendering card0 available.

I think the "int vect" message is due to an old xorg-server bug, related to
keyboard hotkeys. Not relevant to your problem.
Post by Philip Webb
When I try to 'startx' as user, the log file is in ~/.local/share/xorg ,
which is also where it is in ANB5. When I try 'Xorg -configure',
it produces nothing of use & dumps it in my home directory (ugh).
Normally, you should not need an Xorg config file these days, unless you have
special requirements and GUI desktop configuration menu cannot address these.
Very much a last resort.
Post by Philip Webb
I can probably cut the Gordian knot by emerging Xorg-server with 'suid'.
How insecure is that for a single-user system in a house ?
If any of your graphics applications were to be compromised in any way, then
rogue code being run will be doing so with root access. This is not a
particularly good idea and a weakness in the old way Xorg used to be
configured. At long last, xorg-server is now run as non-suid:

https://www.gentoo.org/support/news-items/2020-06-24-xorg-server-dropping-default-suid.html
Post by Philip Webb
The Elogind approach has worked in ANB5 since Aug 2020.
I can't make much of a useful comparison between the 2 machines,
as ANB5 dates from 2015, ie long before the 'elogind' affair in 2020,
& it has Nvidia graphics, whereas ANB6 has cutting-edge AMD.
Their graphics drivers and firmware will be different between these two cards.
Corresponding Gentoo Wiki pages address this.
Post by Philip Webb
BTW System Rescue + Mint (live USB) load modules for AMDGPU,
which seems to be the latest graphics offering ;
I need to find some firmware to get it to work
(enabling AMDGPU in the kernel causes the boot process to stall
with a message re missing firmware).
See above links.
Post by Philip Webb
There are in fact 2 graphics tools in ANB6,
one in the CPU (AMD), the other on the Mobo (Gigabyte).
How can I tell which one the machine is trying to use ?
By tools do you mean graphics cards?
Post by Philip Webb
I will continue to poke around, but further advice is very welcome.
Please read my comments above carefully (smile).
Please provide the output of lshw, lspci, lsmod, dmesg if the above hints and
Wiki pages don't help to get your your graphics going.
Björn Fischer
2023-06-16 13:00:01 UTC
Permalink
Hi Philip,
Post by Philip Webb
My user is in 'tty wheel usb input video' (among others).
that shoud suffice.

You need to use '-keeptty' for xinit and preselect a TTY. For myself I
have put this into my bashrc and it works quite well:

xinit ()
{
local VT;
local DISPLAY;
VT=vt$(tty | sed 's/.*tty//');
DISPLAY=:$(pgrep -cf 'X.*keeptty.*vt');
/usr/bin/xinit -- $DISPLAY -keeptty -wr $VT
}

Cheers
Björn

James Cloos
2023-06-14 15:30:01 UTC
Permalink
if nothing else works, this should:

:; chmod 4711 /usr/bin/Xorg

that was changed to not be suid some time back, relying instead on
things like elogind. but the old way should still work.

on gentoo the suid use flag for x11-base/xorg-server would do that
at merge time.

-JimC
--
James Cloos <***@jhcloos.com> OpenPGP: 0x997A9F17ED7DAEA6
Loading...