You are not logged in.

#1 2013-03-31 04:01:21

mohmann
Member
Registered: 2013-03-31
Posts: 13

loginctl show-session: "wrong" session type?

Hey guys,

First of all I wanted to say hi, since I'm new here, so here you go: HI wink.
I switched from Ubuntu to Arch a couple of days ago, since I felt that breaking my system with every mayor release isn't all that pleasing.

Now I'm running Xfce via .xinitrc, no login manager.

So here's my issue:

I was trying to get "Lock Screen on Suspend" to work as described in https://wiki.archlinux.org/index.php/XS … ibernating . However, xuserrun fails:

@X220 ➜ ~ % /usr/bin/xuserrun /usr/bin/xscreensaver-command -lock
Error: Active session is not x11

I examined xuserrun and found out, that loginctl tells that my session-type is "tty" rather than "x11". I'd expect an X11-session since I'm running Xfce atm, right?

Here's the loginctl output:

@X220 ➜ ~ % loginctl show-session $XDG_SESSION_ID
Id=1
Timestamp=Sun 2013-03-31 04:10:22 CEST
TimestampMonotonic=17373478
DefaultControlGroup=name=systemd:/user/mohmann/1
VTNr=1
TTY=tty1
Remote=no
Service=login
Leader=357
Audit=1
Type=tty
Class=user
Active=yes
State=active
KillProcesses=no
IdleHint=yes
IdleSinceHint=1364695821610992
IdleSinceHintMonotonic=16948179

Why would my session appear as a tty-session? Am I missing something in terms of Session handling? I dont use a login manager, i just login at tty1 and xinit/zprofile does the rest (see below). Is there something, I need to do, to get my Session recognized as X11-Session rather than TTY-Session?

I have Xfce autostart like this, once i login at tty1:

@X220 ➜ ~ % cat .zprofile
# autologin on tty1
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

My .xinitrc (quite default):

@X220 ➜ ~ % cat .xinitrc
#!/bin/bash

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

xset b off
exec startxfce4

I searched google and the arch forums regarding this issue, but didn't come up with something helpful.

I kinda fixed the "Lock Screen on Suspend" issue by just changing the services' ExecStart-line to

ExecStart=DISPLAY=":0.0" /usr/bin/xscreensaver-command -lock

which works fine as long as your Xsession is always at display :0.0. However, I'm curious about why my session is being recognized as "tty" in the first place.

Looking forward to some enlightment wink

Martin

Last edited by mohmann (2013-03-31 04:26:04)

Offline

#2 2013-03-31 04:58:29

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: loginctl show-session: "wrong" session type?

If you are the only user on the machine, instead of using xuserrun, you can simply issue the xscreensaver-command alone, and then add User=%I.  Then call the service xscreensaveer@.service and enable it as xscreensaver@<youruser>.

Offline

#3 2013-03-31 05:11:56

mohmann
Member
Registered: 2013-03-31
Posts: 13

Re: loginctl show-session: "wrong" session type?

yup, that sounds reasonable, haven't even thought about that until now, will give this a try! smile. But it's only some cleaner way to get my aforementioned ExecStart "hack?" done, tho. This "wrong"-session-type thing really bugs me.

Last edited by mohmann (2013-03-31 05:13:57)

Offline

#4 2013-03-31 05:52:26

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: loginctl show-session: "wrong" session type?

I'm not sure, as I don't use one, but I think a display manager will start the session in the traditional place.  I also have a service that simply runs xinit and sets some environment variables, and I have it set to start on vt7.  (I use systemd --user with the Arch kernel, but I also have a CK kernel set up which does not seem compatible with user sessions due to a difference in a cgroup kernel config.)

Offline

#5 2013-04-01 06:01:56

mohmann
Member
Registered: 2013-03-31
Posts: 13

Re: loginctl show-session: "wrong" session type?

So, essentially you "login" via xinitrc as well, rather than using a login manager? Does loginctl recognize your session as X11 then? i'm starting to believe that just logging in and starting your DE isn't sufficient to get the session info right.

Greets

Martin

Last edited by mohmann (2013-04-01 06:19:47)

Offline

#6 2022-03-24 01:38:43

yuzx2008
Member
Registered: 2022-03-24
Posts: 1

Re: loginctl show-session: "wrong" session type?

on ubuntu(startx)

```bash
sudo vim /etc/systemd/system/getty.target.wants/getty@tty1.service
```

add

```
Environment=XDG_SESSION_TYPE=x11
```

reboot

Last edited by yuzx2008 (2022-03-24 01:39:34)

Offline

#7 2022-03-24 07:02:19

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,704

Re: loginctl show-session: "wrong" session type?

I was about to shit on the OP for "I'm new - registered 9 years ago" … please don't necrobump. Also the bbs doesn't do markdown, https://bbs.archlinux.org/help.php#bbcode

Offline

#8 2022-03-24 08:13:14

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,285

Re: loginctl show-session: "wrong" session type?

Closing this old topic, don't necrobump.

https://wiki.archlinux.org/title/Genera … bumping%22

Offline

Board footer

Powered by FluxBB