Start X11 as specific user

General support questions
Post Reply
lpc
Posts: 2
Joined: 2018/01/18 08:53:58

Start X11 as specific user

Post by lpc » 2018/01/18 09:04:40

Hi everybody,

I'm currently using Centos on an embedded system, and I need to start a X session when the OS boots, in order to start an application in fullscreen.
The application MUST be started as a specific user.
In the .xinitrc of my user, I added few lines to start my application.

Actually I tried to create a new service in systemd, but I didn't succeed to start the application. Service is starting when I'm in a tty, but when I'm rebooting the computer, I get the tty login.
Journalctl informs me that X11 didn't start because of a socket connection refused.

Code: Select all

[Unit]
After=systemd-user-sessions.service
Description= My fullscreen app

[Service]
ExecStart=/usr/bin/xinit
User=my_user

[Install]
WantedBy=multi-user.target
I also tried to copy the rules of the gdm login service, but I didn't succeed as well.

Any help would be really appreciated,

Have a nice day.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Start X11 as specific user

Post by TrevorH » 2018/01/18 09:32:51

Did you copy the bits of gdm.service like this:

Code: Select all

[Unit]
Description=GNOME Display Manager

# replaces the getty
Conflicts=getty@tty1.service
After=getty@tty1.service

# replaces plymouth-quit since it quits plymouth on its own
Conflicts=plymouth-quit.service
After=plymouth-quit.service

# Needs all the dependencies of the services it's replacing
# pulled from getty@.service and plymouth-quit.service
# (except for plymouth-quit-wait.service since it waits until
# plymouth is quit, which we do)
After=rc-local.service plymouth-start.service systemd-user-sessions.service

# GDM takes responsibility for stopping plymouth, so if it fails
# for any reason, make sure plymouth still stops
OnFailure=plymouth-quit.service
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

lpc
Posts: 2
Joined: 2018/01/18 08:53:58

Re: Start X11 as specific user

Post by lpc » 2018/01/18 12:09:38

Hi

Thank you for the quick reply. Yes, I already tried this trick, but doesn't work unfortunately, the tty1 only have a dash blinking, nothing in journalctl. I suspect xinit script to break the systemd service.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Start X11 as specific user

Post by TrevorH » 2018/01/18 12:10:40

More specifically I meant the

After=rc-local.service plymouth-start.service systemd-user-sessions.service
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply