View previous topic :: View next topic |
Author |
Message |
sebaro Veteran


Joined: 03 Jul 2006 Posts: 1141 Location: Romania
|
|
Back to top |
|
 |
eccerr0r Watchman

Joined: 01 Jul 2004 Posts: 10024 Location: almost Mile High in the USA
|
Posted: Wed Aug 16, 2017 2:47 pm Post subject: |
|
|
Hmm...interesting.
Traditionally there should be a temporary "/etc/nologin" file to tell login to prohibit logins during shutdown/reboot, but it seems to not use this during the actual reboot (or --autologin ignores that fact).
You probably can work around this fact by checking the current runlevel and don't startx when it's trying to reboot or shutdown. /sbin/runlevel or 'who -r' will tell your current runlevel. Look in /etc/inittab for "id" for the default runlevel and only startx when the current runlevel matches the default runlevel:
Code: | if [ $(who -r|awk '{print $2}') = $(grep ^id: /etc/inittab |cut -f2 -d:) ]; then
echo starting x11...
startx
else
echo not in normal runlevel due to reboot or shutdown, sleeping...
sleep 30;
fi
|
(actually I'm not sure this works, and thinking that there might be a race condition on boot-startup. YMMV. Probably best to detect if it's in either reboot or shutdown and don't startx when in these cases.)
systemd probably simply "works" because of some other mechanism as things are more tightly integrated together. _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
 |
sebaro Veteran


Joined: 03 Jul 2006 Posts: 1141 Location: Romania
|
Posted: Wed Aug 16, 2017 6:51 pm Post subject: |
|
|
That's the solution I've been thinking about.
The problem is that '/sbin/runlevel' and 'who -r' don't work because I'm using openrc-init as init not sysvinit.
OpenRC stores the runlevel in /var/run/openrc/softlevel but I'm not sure how accurate it is.
This seems to be working fine so far.
Code: |
if [[ -t 0 && $(tty) == /dev/tty1 && ! $DISPLAY ]]; then
if ! grep -q "shutdown" "/var/run/openrc/softlevel"; then
exec startx &>/home/.session.log
fi
fi
|
This should be working too:
Code: | if grep -q "default" "/var/run/openrc/softlevel"; then |
|
|
Back to top |
|
 |
sebaro Veteran


Joined: 03 Jul 2006 Posts: 1141 Location: Romania
|
Posted: Thu Aug 17, 2017 5:14 am Post subject: |
|
|
The startx issue seems to be solved but I've found the same issue with autologin. It repeats until agetty is stopped. |
|
Back to top |
|
 |
|