Talk:Xinit - ArchWiki
Contents
Running "Notes" Section
The two sets of notes at the bottom of xinitrc#Configuration should be condensed in some way. The first five bullet points all concern which tty X is running on. I could create this as its own subsection, and contain the information there, though I am not entirely convinced that this is necessary/appropriate/needed on this page at all. Would it be more appropriate to merge the relevant sections into the Xorg article, perhaps? Pid1 (talk) 00:30, 26 July 2015 (UTC)
- First of all, the first 4 points are inaccurate. Back in 2013, this was indeed handled by the default
/etc/X11/xinit/xserverrc, which contained#!/bin/sh if [ -z "$XDG_VTNR" ]; then exec /usr/bin/X -nolisten tcp "$@" else exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR fi
- Now it contains only
#!/bin/sh exec /usr/bin/X -nolisten tcp "$@"
- This will be more work than it seemed, we should investigate... Nevertheless, startx handles the
vtparameter, but plain xinit doesn't, so I'd say the note is perfectly suitable for this page. - -- Lahwaacz (talk) 08:17, 26 July 2015 (UTC)
propose to add to automatic startx
When combine automatic startx + automatic login to console, it may come to infinite loop/crash if (a) ~/.xinitrc goes wrong somewhere, after editing; or (b) after pacman -Syyu and Xorg crash. I propose to check if the last GUI session (startx session) really last long before start a new one.
if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then if [[ -f /tmp/login-check-startx.flag ]]; then rm /tmp/login-check-startx.flag echo -e "\nFile '/tmp/login-check-startx.flag' found, maybe the last GUI session did not last long!\n" ## do nothing, start automatic console login else touch /tmp/login-check-startx.flag ( sleep 120; rm /tmp/login-check-startx.flag ) & exec startx fi fi ## Change '/tmp/login-check-startx.flag' to '$HOME/login-check-startx.flag' if you want that check also valid after reboot.
Triplc (talk) 20:42, 20 April 2016 (UTC)
- You might do that without the temporary file by simply looking at the age of the log file:
if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then if [[ ! -e ~/.local/share/xorg/Xorg.0.log || $(find ~/.local/share/xorg/Xorg.0.log -mmin +2) != "" ]]; then exec startx fi fi
- Or even more simply, don't
exec startx, check its return code and drop to interactive shell on errors:if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then startx && exit fi
-- Lahwaacz (talk) 21:10, 20 April 2016 (UTC)
- Thanks Lahwaacz. But (a) so the age of a file is based on it's creation time, not update time. OK, i did not know that. (b) about the startx exit code, i am not sure that it will correctly set if i edit something wrong in ~/.xinitrc which make GUI session crash
examples
there are 2 xinit examples which by themselves do not work as laid out, imo they should be removed and instead an optional note could be put (somewhere) that says something like:
- xinit can be executed instead of startx if you know what options to use
otherwise it seems frustrating to recommend examples which will obviously fail --Ubone (talk) 02:29, 12 November 2018 (UTC)
- xinit would not obviously fail if you specified the options in xserverrc. If you already have an X server started, you should also pass the
:display_numberoption mentioned in the note after the first example. -- Lahwaacz (talk) 07:35, 12 November 2018 (UTC)
- then replace or in #Usage with or if #xserverrc is configured: ? --Ubone (talk) 08:10, 12 November 2018 (UTC)
Add `export DESKTOP_SESSION=something` to ~/.xinitrc
I have had issues previously described here:
https://bbs.archlinux.org/viewtopic.php?pid=1904173
https://www.reddit.com/r/archlinux/comments/hhl3s9/how_do_you_trace_dbus_automatic_activation/
In summary, and how to reproduce:
sudo pacman -S xorg-xinit plasma deepin- follow the wiki's instructions to set up
~/.xinitrc, e.g. below
~/.xinitrc
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec startplasma-x11
I observed the following glitches:
- the command
startplasma-x11leads to/usr/lib/deepin-daemon/dde-system-daemonbeing forked off of systemdbus.service - less important but, kvantum themes do not apply to autostarted X apps.
However these problems do not occur when starting KDE Plasma from gdm. I used printenv to track differences.
If you add the line export DESKTOP_SESSION=plasma before exec startplasma-x11 in ~/.xinitrc, KDE loads correctly (without deepin processes in the background and themes correctly applied to autostarted applications).
Maybe we should add export DESKTOP_SESSION=desktop_environment to the wiki instructions?
Jennydaman (talk) 18:47, 29 June 2020 (UTC)
- I don't think it's an issue with other desktop environments, so add it to KDE#From the console instead. -- Lahwaacz (talk) 08:38, 30 June 2020 (UTC)
xorg-xinit and inetutils dependency
As of September 2020 xorg-xinit providing the binaries startx and xinit stil depend on the package "inetutils"
pacman -Si xorg-xinit
Depends On : libx11 xorg-xauth xorg-xrdb xorg-xmodmap inetutils
This is because it needs "hostname" as I understand it, https://bugs.archlinux.org/task/24811
Closed by Jan de Groot (JGC) Monday, 19 December 2011, 11:59 GMT Reason for closing: Fixed Additional comments about closing: Fixed in svn. Preparing a new package at this moment, so should be in repos soon.
This is from 2011. So this "new package ... so should be in repos soon, apparently never happened.
I'm a bit confused. Shouldnt this information be in the wiki ? Or a note or alternative of using sx for example ?
https://bbs.archlinux.org/viewtopic.php?id=238026
eschwartz: ...Use https://github.com/Earnestly/sx instead, it's available in [community].. Trilby: ...I also agree with ESchwartz that xinit code is a mess (and startx more so).
https://old.reddit.com/r/archlinux/comments/g7gzdx/installing_xorgxinit_needs_dependency_with/
Try sx, in my sxrc I just source .xinitrc.
M040601 (talk) 10:28, 15 September 2020 (UTC)
- It happened, see [1]. Every newer version of the package released to the binary repository includes the dependency. -- Lahwaacz (talk) 11:08, 15 September 2020 (UTC)
- What I meant by "never happened" was, the removal of that dependency. That is I was expecting xorg-xinit was gonna be built without depending on inetutils. Using something other from some other package for the needed hostname. Because that dependency is the security risk right ? Whatever the case, doesn't it make sense, in this same wiki page, to add an additional note or warning mentioning this and clarifying some concern an uninformed user might have ? Put yourself in a position of someone running arch-audit. The user is confronted with the warning "high-risk" word, associated with "inetutils", and ends up tracing it to xorg-xinit. Additionally, a note, mentioning "... an alternative to xorg-xinit is sx ...." M040601 (talk) 04:23, 16 September 2020 (UTC)
- The FS#24811 was not about removing the dependency, but adding the dependency to the package metadata. The use of
hostnameis not insecure - the reason why people consider inetutils insecure isrsh,telnetetc. which work with an insecure protocol. - Anyway, the call to
hostnamecan be replaced withuname -n, but startx useshostname -f. How would you replace that? - -- Lahwaacz (talk) 07:06, 16 September 2020 (UTC)
- The FS#24811 was not about removing the dependency, but adding the dependency to the package metadata. The use of