You are not logged in.

#26 2012-10-09 20:09:51

nathan0n5ire
Member
Registered: 2012-10-05
Posts: 9

Re: Automatic X login without a DM

hmm, wierd... Im using systemd-194, dbus-1.6.8-r1, and networkmanage-0.9.6.0  on gentoo, but they arent patched much, and as far as I can tell, all of the patches are unrelated to this. I havent used the dbus patch by sofar, nor do I have any dbus socket or service files in my .config/systemd/user

EDIT: DBUS of course starts from the system-systemd, but I think all the system-systemds start it.

Last edited by nathan0n5ire (2012-10-09 20:12:45)

Offline

#27 2012-10-10 03:05:07

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

Re: Automatic X login without a DM

I like what is going on here, so I decided to give it a try.  It works pretty darn well, and is definitely faster.  Though my previous method of autologin to tty1 and then auto launching X from there is not slow by any means.  This definitely definitely seems less hackish. 

I too am not being dumped into my normal shell.  I am going to try 65kid's method now and see how that goes.  Thanks!

Offline

#28 2012-10-10 03:41:42

nathan0n5ire
Member
Registered: 2012-10-05
Posts: 9

Re: Automatic X login without a DM

To fix my shell not being used Ive added "EnvironmentFile=-/home/%I/.env" to the xlogin@.service file, and I made a ~/.env that just contains "SHELL=/bin/zsh". That fixes things for me, and although I Imagine it would also work with the ExecStart set to '/bin/bash -l .xinitrc', I have my ExecStart set to '/usr/lib/systemd/systemd --user'

Offline

#29 2012-10-10 04:14:21

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

Re: Automatic X login without a DM

Thanks nathan0n5ire

Edit: BTW, I should probably mention that including the EnviromentFile=/home/%I/.env that nathan0n5ire mentioned certainly works.

Last edited by WonderWoofy (2012-10-11 02:30:49)

Offline

#30 2012-10-11 16:17:55

Alister.Hood
Member
From: Auckland, New Zealand
Registered: 2011-12-09
Posts: 18

Re: Automatic X login without a DM

Hi, I just tried this, and I was initially perplexed because X was starting, but nothing else (no window manager, filer/desktop or panel).
Of course, the reason for this is that my home folder is not /home/%I, so the .xinitrc was never being run.
It does work if I edit the .service file to use the correct path, but it would be nice if it was possible to generalise it to use $HOME (which doesn't seem to work...)

Also, if I switch back to tty1, there is no login prompt unless I press enter, which seems strange as a user.  Is it intended to be like this?

Last edited by Alister.Hood (2012-10-11 16:31:48)

Offline

#31 2012-10-14 02:06:11

Alister.Hood
Member
From: Auckland, New Zealand
Registered: 2011-12-09
Posts: 18

Re: Automatic X login without a DM

Oh, one other thing: should it be possible to use something like this to restart X?

systemctl restart x@vt7.service

For me it just restarts X but no window manager or anything.

Last edited by Alister.Hood (2012-10-14 02:20:40)

Offline

#32 2012-10-14 02:09:08

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

Re: Automatic X login without a DM

Did you do

# systemctl enable xlogin@alister.service 

The %I simply puts whatever is after the '@' in its place.  Hence the User=%i as well.

Edit: also you should not have to enable x@vt7 either, as it is pulled in by xlogin@.service automatically.

Last edited by WonderWoofy (2012-10-14 02:09:51)

Offline

#33 2012-10-14 02:20:15

Alister.Hood
Member
From: Auckland, New Zealand
Registered: 2011-12-09
Posts: 18

Re: Automatic X login without a DM

WonderWoofy wrote:

Did you do

# systemctl enable xlogin@alister.service 

Yes.

The %I simply puts whatever is after the '@' in its place.  Hence the User=%i as well.

What I mean is that I don't keep my home directory in /home.  /home doesn't even exist.

Offline

#34 2012-10-14 02:40:57

Alister.Hood
Member
From: Auckland, New Zealand
Registered: 2011-12-09
Posts: 18

Re: Automatic X login without a DM

Alister.Hood wrote:

Oh, one other thing: should it be possible to use something like this to restart X?

systemctl restart x@vt7.service

For me it just restarts X but no window manager or anything.

And these just rerun .xinitrc without restarting X:

systemctl restart xlogin\@Alister.service
systemctl restart graphical.target

Last edited by Alister.Hood (2012-10-14 02:41:30)

Offline

#35 2012-10-14 02:53:26

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

Re: Automatic X login without a DM

I believe that X is only restarted if you actually bring it down.  Since it is a separate service than the xlogin, it has been my experience that the X server itself will continue to run even if you restart the xlogin.  When I want to take down the graphical interface I either just stop both services or I isolate the multi-user.target.

Offline

#36 2012-12-28 12:45:38

jouke
Member
Registered: 2009-10-14
Posts: 63

Re: Automatic X login without a DM

I have updated https://github.com/joukewitteveen/xlogin and am convinced that the source now reflects the best possible way to have an automatic X login with systemd.

The dbus patches are in place, the right version of polkit is in the repositories, installation was never easier:

  • git clone git://github.com/joukewitteveen/xlogin.git

  • cd xlogin; make install (as root)

  • systemctl enable xlogin@<username> (as root)

Of course, it would be cool if someone packaged it.

Changes since the last version:

  • A systemd user session is started instead of running ~/.xinitrc. This is discussed in this thread. Please note that xlogin does not ship with any user services!

  • X now goes down when the session stops.

Offline

#37 2012-12-28 12:50:01

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 798

Re: Automatic X login without a DM

Thanks for your work. And, may be, you can provide any test result to clarify if it is someway faster than the old .xinitrc approach?
Because, probably future will be user session units, but now it is much easier the xinitrc method. smile
Thank you!

Offline

#38 2013-01-11 22:39:28

0ddba11
Member
From: UK
Registered: 2012-03-02
Posts: 20

Re: Automatic X login without a DM

Works great and starts an X session with dbus for me but doesn't start openbox. I have user-session-units installed and a default.target setup in ~/.config/systemd/user:

[Unit]
Description=openbox
Requires=dbus.socket
After=dbus.socket
Wants=openbox.service
AllowIsolate=yes

That just runs my openbox.service unit in the same directory:

[Unit]
Description=Run openbox
After=dbus.socket

[Service]
ExecStart=/user/bin/openbox-session

All pretty simple but can't work out why it's not starting openbox. The effect is the same whether xorg-launch-helper is installed or not (looks like that does the same job as xlogin and shouldn't be necessary). What's the obvious thing I've missed?

Last edited by 0ddba11 (2013-01-11 22:41:01)

Offline

#39 2013-01-12 06:21:08

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 433

Re: Automatic X login without a DM

0ddba11 wrote:

[Service]
ExecStart=/user/bin/openbox-session

Try to remove the e, e.g. /usr/bin/openbox-session... Otherwise look into journalctl's output to see what's wrong.

You need xorg-launch-helper to start Xorg as systemd service.

Offline

#40 2013-01-12 11:57:04

0ddba11
Member
From: UK
Registered: 2012-03-02
Posts: 20

Re: Automatic X login without a DM

Ach! Yes that would be the obvious thing I missed. Too much messing around with /user directories blinded me to it. Thanks.

Works fine now without xorg-launch-helper. The x-daemon part of xlogin does the same job of running X as a daemon.

Offline

#41 2013-10-15 15:25:26

jouke
Member
Registered: 2009-10-14
Posts: 63

Re: Automatic X login without a DM

The program has been brought in a working state for current iterations of systemd (most notably 208).

Because the user instance of systemd can now outlive the user session, we are back to using .xinitrc for starting window managers and what not. This is not as bad as it sounds, because those processes will be grouped nicely in a scope unit that now defines the session. Please read the updated README concerning dbus.

Offline

#42 2013-10-15 16:21:17

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 798

Re: Automatic X login without a DM

@jouke: what about an AUR package?
I'd like to try it out by installing it with pacman (and upgrading whenever you make changes/improvements) .

Offline

#43 2013-10-16 14:27:41

jouke
Member
Registered: 2009-10-14
Posts: 63

Re: Automatic X login without a DM

Sure: xlogin-git

Note: until this dbus bug gets fixed, you need to add your own dbus user service/socket files in order to be able to interface the systemd user instance.

Also make sure that the top of your .xinitrc contains

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

Read the README for more information.

Offline

#44 2013-10-17 14:06:19

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 798

Re: Automatic X login without a DM

Uhm what does

Note: until this dbus bug gets fixed, you need to add your own dbus user service/socket files in order to be able to interface the systemd user instance.

mean? I mean, what should I do? wink
Thanks!

Offline

#45 2013-10-18 10:44:28

jouke
Member
Registered: 2009-10-14
Posts: 63

Re: Automatic X login without a DM

If ignore the note, everything should work fine except interacting with the systemd user instance. When the referenced bug is fixed, this will also be fixed. Until then, you can create the following two files.

/etc/systemd/user/dbus.socket containing:

[Unit]
Description=D-Bus Message Bus Socket
Before=sockets.target

[Socket]
ListenStream=/run/user/%U/dbus/user_bus_socket

[Install]
WantedBy=default.target

/etc/systemd/user/dbus.service containing:

[Unit]
Description=D-Bus Message Bus
Requires=dbus.socket

[Service]
ExecStart=/usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation
ExecReload=/usr/bin/dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig

After creating those files, call (as root): systemctl --global enable dbus.socket.

Offline

#46 2013-10-18 15:45:28

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 798

Re: Automatic X login without a DM

It seems i won't need that.
By the way, an easy "systemctl enable xlogin@federico.service" makes everything work flawlessly, thanks!
Other two questions:
1) what does this mean?

As a consequence, systemd commands that interface the user session will no
longer be able to communicate with the systemd instance

2) how can i use xlogin without passing through .xinitrc (ie: using my .config/systemd/user/ service files, instead of xinitrc)?

Btw thank you!

Offline

#47 2013-10-20 21:54:16

jouke
Member
Registered: 2009-10-14
Posts: 63

Re: Automatic X login without a DM

nierro wrote:

1) what does this mean?

As a consequence, systemd commands that interface the user session will no
longer be able to communicate with the systemd instance

If you don't install the dbus service and socket, you wont be able to use any of the following commands:

  • systemctl --user

  • systemd-analyze --user

  • systemd-run --user

The global commands, however, will run just fine.

nierro wrote:

2) how can i use xlogin without passing through .xinitrc (ie: using my .config/systemd/user/ service files, instead of xinitrc)?

As long as the bug I mentioned earlier is not fixed, this is impossible. Regarding the discussion on that particular bug, xlogin implements option 2 of this post. Keep in mind that you cannot even interface the user instance of systemd from your .xinitrc altogether if you omit the dbus service and socket file (cf. my answer on your first question).

Offline

#48 2013-10-21 17:51:00

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 798

Re: Automatic X login without a DM

So, basically, we'll just have to wait until that bug is fixed, right?
Well, thanks again for your time and for your work. I think xlogin is a good solution, and i'll keep on using it.
Hope that bug gets fixed soon!

Offline

#49 2013-11-08 01:30:27

Alister.Hood
Member
From: Auckland, New Zealand
Registered: 2011-12-09
Posts: 18

Re: Automatic X login without a DM

Are you sure there is nothing else you need to do apart from creating /etc/systemd/user/dbus.socket and /etc/systemd/user/dbus.service and running this?:
systemctl --global enable dbus.socket

It doesn't seem to work for me.

Offline

#50 2013-11-08 01:41:28

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

Re: Automatic X login without a DM

I would think that if you are in an environment where there is no dbus socket on which systemd --user can run, using  systemctl --global is obviously not going to work.  It might work as far as running itself for --system, but when it tries to do the --user portion of the command it is going to fail.  This would be the same reason as why it would fail when doing systemctl --user enable dbus.socket.  You're in kind of a chicken/egg scenario. 

Fortunately, the systemctl command just makes symlinks, so if you determine what the symlink *should* be, then you can make it by hand.

Offline

Board footer

Powered by FluxBB