Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-08-12 19:02:17

johnywhy
Member
Registered: 2011-10-09
Posts: 283

[Solved] Automatically start xfce from terminal login?

How to automatically boot straight into xfce from terminal login?

I'm logging into arch at terminal, without a DM.
xfce doesn't start when i login, so i have to type startxfce4.

My .xinitrc contains:

exec i3
exec startx
exec startxfce4

But i still have to type startxfce4 at terminal after logging in.

Last edited by johnywhy (2019-08-13 02:04:24)


arch xfce x86_64

Offline

#2 2019-08-12 19:45:20

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Automatically start xfce from terminal login?

If you're using bash, add the following to ~/.bash_profile:

if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
  exec startx
fi

What this is does, is it only runs startx if you are on tty1 (this allows you to move to another virtual terminal and still only access the text console). When you first boot, the default virtual terminal is the first one. So simply logging in will trigger the startx command.

Also, your .xinitrc needs some work. Consider using the following:

#!/bin/sh

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

mv ~/.xsession-errors ~/.xsession-errors.old
exec startxfce4 > ~/.xsession-errors 2>&1

The first if block properly sets up your dbus environment so some apps can run properly, and the second set of code runs startxfce4 and captures startxfce4 output to an ~/.xsession-errors file so you have a record of output for troubleshooting purposes.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2019-08-12 19:56:53

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: [Solved] Automatically start xfce from terminal login?

Thx ToZ

If you're using bash, add the following to ~/.bash_profile:

Same for zsh?

it only runs startx if you are on tty1 (this allows you to move to another virtual terminal

When might i move to another virtual terminal? If i'm never going to do that, how can i simplify this script?

.xinitrc ...The first if block properly sets up your dbus environment so some apps can run properly

Currently, when i simply type startxfce4 at terminal, is this same thing happening? If not, why is it needed?

...captures startxfce4 output to an ~/.xsession-errors file so you have a record of output for troubleshooting purposes.

Is that error-capture normally done a different way, if i'm using a DM?

thx!

Last edited by johnywhy (2019-08-12 19:58:51)


arch xfce x86_64

Offline

#4 2019-08-12 20:56:31

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Automatically start xfce from terminal login?

Same for zsh?

I've never used zsh, but from a quick search on the internet, the comparable seems to be .zprofile.

When might i move to another virtual terminal? If i'm never going to do that, how can i simplify this script?

Then use just:

exec startx

Currently, when i simply type startxfce4 at terminal, is this same thing happening? If not, why is it needed?

From what I've gathered on Arch, running startxfce4 doesn't fully initialize the dbus environment. Some apps, notably xfce4-notifyd, require it to run properly. Adding this part won't hurt your startup.

Is that error-capture normally done a different way, if i'm using a DM?

Some DMs, like lightdm, do this automatically. This log file is very helpful when troubleshooting issues.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2019-08-12 21:23:39

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: [Solved] Automatically start xfce from terminal login?

Ok cool. For the moment, i want the simplest case, no error-logging.

When i put `exec startx` into .zshrc, i get this error whenever i start zsh terminal:

/usr/lib/Xorg.wrap: Only console users are allowed to run the X server

Putting `exec startxfce4` into .zshrc has the desired effect of starting xfce when i login at terminal,
but it causes terminal to instantly shutdown whenever i try to run it.

Putting this into my .xinitrc seemed to do nothing:

#!/bin/sh
exec i3
exec startxfce4

arch xfce x86_64

Offline

#6 2019-08-12 22:31:47

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Automatically start xfce from terminal login?

johnywhy wrote:

When i put `exec startx` into .zshrc, i get this error whenever i start zsh terminal:

/usr/lib/Xorg.wrap: Only console users are allowed to run the X server

Create the file /etc/X11/Xwrapper.config with the following content:

needs_root_rights = no

If that doesn't work, then instead of "needs_root_rights", try"

allowed_users = anybody

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2019-08-12 22:39:18

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: [Solved] Automatically start xfce from terminal login?

But that doesn't seem to start xfce from terminal login.
Only putting `exec startxfce4` into .zshrc seems to do that (but causes other problems, above)

Is there a simple way to emulate manually typing "startxfce4" at the terminal, after logging in? That works, with no extra configs needed.

i don't see .zprofile,  only .xprofile.

thx

Last edited by johnywhy (2019-08-12 22:45:47)


arch xfce x86_64

Offline

#8 2019-08-12 22:45:42

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Automatically start xfce from terminal login?

I'm not familiar with zsh. From what I read, .zprofile is the comparable to .bash_profile. Try creating .zprofile and add:

startxfce4

...and see if it works.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#9 2019-08-12 22:58:17

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: [Solved] Automatically start xfce from terminal login?

ToZ wrote:

Try creating .zprofile and add:

startxfce4

Solved

Works! that's all that was needed. Boots xfce on terminal login. Nothing strange when i run terminal.

I didn't put anything extra into .xprofile, .zshrc, or .xinitrc. Didn't have to create Xwrapper.config.

Question: If startxfce4 is all that's needed, and assuming "startx" isn't needed, is there a place where could i put startxfce4 to work in case xfce-terminal isn't installed (is that even possible with xfce)?

thx!


arch xfce x86_64

Offline

#10 2019-08-12 23:40:14

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: [Solved] Automatically start xfce from terminal login?

Question 1 (from other thread)
Without a DM installed, i have to type username/password at a terminal, before starting xfce.
How can i get automatic login on boot, so i don't have to type username/password at terminal?

Question 2 (repeat from this thread, above):
If startxfce4 is all that's needed to start xfce, and assuming "startx" isn't needed, is there a place where could i put "startxfce4", in case xfce-terminal isn't installed (is that even possible with xfce)?

Last edited by johnywhy (2019-08-12 23:54:03)


arch xfce x86_64

Offline

#11 2019-08-13 00:01:49

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Automatically start xfce from terminal login?

johnywhy wrote:

Question 1 (from other thread)
Without a DM installed, i have to type username/password at a terminal, before starting xfce.
How can i get automatic login on boot, so i don't have to type username/password at terminal?

See: https://wiki.archlinux.org/index.php/Ge … al_console

Question 2 (repeat from this thread, above):
If startxfce4 is all that's needed to start xfce, and assuming "startx" isn't needed, is there a place where could i put "startxfce4", in case xfce-terminal isn't installed (is that even possible with xfce)?

See: https://wiki.archlinux.org/index.php/Zs … X_at_login. For what you are trying to do, add:

startxfce4

to ~/.zprofile.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#12 2019-08-13 00:57:08

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: [Solved] Automatically start xfce from terminal login?

Re Question 1 (auto-login):

i performed steps in the arch article you linked.
Changed username to johny. Unclear where to put the password.

systemctl edit getty@tty1 and pasting its content:
/etc/systemd/system/getty@tty1.service.d/override.conf

[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin johny --noclear %I $TERM

On boot, it hangs at:

archlabs login: username (automatic login)
User not known to the underlying authentication module

Couldn't login.

-----
Re Question 2 (the original topic of this thread, auto-starting xfce):
So basically, this depends on whether running Zsh or Bash, correct? For zsh, we use .zprofile, and for bash, .bash_profile, right?

thx!

Last edited by johnywhy (2019-08-13 01:19:59)


arch xfce x86_64

Offline

#13 2019-08-13 01:20:09

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Automatically start xfce from terminal login?

Here a similar Arch forums thread with a similar error message and a resolution. This really isn't an Xfce issue - you may get better assistance at the Arch forums for this issue.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#14 2019-08-13 02:03:26

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: [Solved] Automatically start xfce from terminal login?

Re: Auto-logon

Here's correct format for auto-login (on ArchLabs):

do this as root:

systemctl edit getty@tty1

paste in this, and save

[Service]
ExecStart=
ExecStart=/usr/bin/agetty --autologin johny --noclear %I 38400 linux
Type=simple

This will write to /etc/systemd/system/getty@tty1.service.d/override.conf
https://bbs.archlinux.org/viewtopic.php?id=222762

needs
`38400 linux`
or (not sure which makes it work)
`Type=simple`

Re: Auto-startxfce4
Works!

~/.zprofile
startxfce4

for bash, put that into ~/.bash_profile

Last edited by johnywhy (2019-08-27 23:51:24)


arch xfce x86_64

Offline

Board footer

Powered by FluxBB