Page 2 of 3
XFCE - The keyboard layout changes automatically
Posted: 27 Jan 2023, 17:17
by Kulle
I used Rava's script.
After "Suspend" the time is also adjusted,
from January 27th to January 30th
Code: Select all
guest@porteus:~$ date
Fr 27. Jan 18:02:54 CET 2023
guest@porteus:~$ date
Mo 30. Jan 14:03:49 CET 2023
XFCE - The keyboard layout changes automatically
Posted: 27 Jan 2023, 19:55
by Rava
Kulle wrote: ↑27 Jan 2023, 17:17
I used Rava's script.
After "Suspend" the time is also adjusted,
from January 27th to January 30th
Code: Select all
guest@porteus:~$ date
Fr 27. Jan 18:02:54 CET 2023
guest@porteus:~$ date
Mo 30. Jan 14:03:49 CET 2023
Can you please post the script how you used it?
My script has no part that tweaks anything of the system date/time.
And when you go into suspend using your DE way, that also only calls
to go into suspend.
To debug a script, I always insert "echo INFO" lines, e.g. echo with the info what part of the script that echo is from.
In the phase of debugging I recommend using a better readable code, in this case, the one with if else fi and not the one with && and ||
I would also add info into there like so:
Code: Select all
echo debug - A ## DEBUG
date ## DEBUG
echo setxkbmap de
setxkbmap de
returnval=$?
echo debug - B ## DEBUG
echo '$returnval'=$returnval ## DEBUG
if [ $returnval -eq 0 ]; then
notify-send -i info -t 5000 "Keyboard set" "to DE"
else
notify-send -i error -t 0 "Keyboard setting to" "DE failed"
fi
echo debug - C ## DEBUG
date ## DEBUG
Set the number of the echo debug - X accordingly, and only use unique numbers so that one echo debug output will only be printed by one specific place in the script - and never by any other place in the script.
XFCE - The keyboard layout changes automatically
Posted: 27 Jan 2023, 20:17
by Ed_P
Rava wrote: ↑27 Jan 2023, 19:55
To debug a script, I always insert "echo INFO" lines, e.g. echo with the info what part of the script that echo is from.
I add a "set -x;" command near the top to help debug scripts I have problems with.
XFCE - The keyboard layout changes automatically
Posted: 28 Jan 2023, 00:20
by Rava
Ed_P wrote: ↑27 Jan 2023, 20:17
I add a "set -x;" command near the top to help debug scripts I have problems with.
What he said.
XFCE - The keyboard layout changes automatically
Posted: 28 Jan 2023, 16:03
by Kulle
Hi Rava,
1. Test
"suspend" by clicking on the Suspend button
Code: Select all
guest@porteus:~$ setxkbmap -query
rules: evdev
model: pc105
layout: de
options: grp:alt_shift_toggle,terminate:ctrl_alt_bksp
guest@porteus:~$ date
Sa 28. Jan 16:33:03 CET 2023
After suspend:
Code: Select all
guest@porteus:~$ setxkbmap -query
rules: evdev
model: pc105
layout: us
options: grp:alt_shift_toggle,terminate:ctrl_alt_bksp
guest@porteus:~$ date
Di 31. Jan 12:35:34 CET 2023
2. Test
"suspend" via the console command loginctl suspend
Code: Select all
guest@porteus:~$ setxkbmap -query
rules: evdev
model: pc105
layout: de
options: grp:alt_shift_toggle,terminate:ctrl_alt_bksp
guest@porteus:~$ date
Sa 28. Jan 16:38:01 CET 2023
guest@porteus:~$ loginctl suspend
guest@porteus:~$ setxkbmap -query
rules: evdev
model: pc105
layout: us
options: grp:alt_shift_toggle,terminate:ctrl_alt_bksp
guest@porteus:~$ date
Di 31. Jan 12:38:45 CET 2023
3. Test
"suspend" via Rava's Script ==> the same thing.
Kbmap and time are always changed !
XFCE - The keyboard layout changes automatically
Posted: 28 Jan 2023, 16:33
by Rava
Kulle wrote: ↑28 Jan 2023, 16:03
Hi Rava,
1. Test
"suspend" by clicking on the Suspend button
[…]
2. Test
"suspend" via the console command loginctl suspend
[…]
3. Test
"suspend" via Rava's Script ==> the same thing.
Kbmap and time are always "suspend" via Rava's Script ==> the same thing.
changed !
As I suspected, since all 3 variants did the same erroneous change of date/time, it has nothing to do with my script nor with calling loginctl suspend via a terminal.
My suggestion:
Post what gets written into /var/log/messages.
You can facilitate that by creating a script now owned and executed by root that does these things:
suspend-debug.sh (must be run as root!)
Code: Select all
#!/bin/sh
MYNAME=$0
function seconds2time ()
{
local T=$1;
local D=$((T/60/60/24));
local H=$((T/60/60%24));
local M=$((T/60%60));
local S=$((T%60));
if [[ ${D} != 0 ]]; then
if [[ ${D} = 1 ]]; then
printf '%d day %02d:%02d:%02d' $D $H $M $S;
else
printf '%d days %02d:%02d:%02d' $D $H $M $S;
fi;
else
printf '%02d:%02d:%02d' $H $M $S;
fi
}
function mydate () {
echo $(date +%d.%m.%Y\ %H:%M:%S) ____________________________________________________________
}
# we use the function mydate to more easily find the date/time info in /var/log/messages
declare -i startepoch=$(date +%s)
echo "●●●●● before $MYNAME ●●●●●●●●●●●●●●●" >>/var/log/messages
mydate >>/var/log/messages
echo loginctl suspend >>/var/log/messages
loginctl suspend >>/var/log/messages
echo '●● sleeping 10 seconds for loginctl suspend to background-suspend. ●●' |tee -a /var/log/messages
# now suspend should happen
sleep 10s
echo '●●●●● loginctl suspend took '$(seconds2time $(date +%s)-$startepoch)' … ●●●●●●●●●●●●●●●'|tee -a /var/log/messages
echo "●●●●● after $MYNAME ●●●●●●●●●●●●●●●" >>/var/log/messages
mydate >>/var/log/messages
Run suspend-debug.sh as root.
Post here what is printed in the terminal that ran suspend-debug.sh
Also post here all the info from /var/log/messages - starting with
Code: Select all
●●●●● before $MYNAME ●●●●●●●●●●●●●●●
and ending with
Code: Select all
●●●●● after $MYNAME ●●●●●●●●●●●●●●●
and the following date/time info as created by the mydate function.
$MYNAME gets replaced by the name you gave the script.
Unless the date/time change as recorded in /var/log/messages happens later than the
Code: Select all
●●●●● after $MYNAME ●●●●●●●●●●●●●●●
line and the date/time info as created by the mydate function - then post all beginning from
Code: Select all
●●●●● before $MYNAME ●●●●●●●●●●●●●●●
to the end of /var/log/messages
Hopefully then we do know more.
Why must the script be executed by root?
Because only root has read/write permission into /var/log/messages
HTH!
XFCE - The keyboard layout changes automatically
Posted: 28 Jan 2023, 17:00
by Ed_P
Kulle wrote: ↑28 Jan 2023, 16:03
3. Test
"suspend" via Rava's Script ==> the same thing.
The "setxkbmap de" at the end of
Rava's script didn't work??
Added in 7 minutes 8 seconds:
Rava wrote: ↑28 Jan 2023, 16:33
Why must the script be executed by root?
Because only root has read/write permission into /var/log/messages
You can't prefix the script's writes with "echo toor | sudo -S" ? If so guest can run the script.
XFCE - The keyboard layout changes automatically
Posted: 28 Jan 2023, 17:13
by Rava
Ed_P wrote: ↑28 Jan 2023, 17:07
The "setxkbmap de" at the end of Rava's script didn't work??
It's not about that, currently it is about the strange change of system time/date in his system when
● suspend is done via the menu in XFCE
● manually via loginctl suspend
● or via my script (that also uses loginctl suspend).
Ed_P wrote: ↑28 Jan 2023, 17:07
You can't prefix the script's writes with "echo toor | sudo -S" ? If so guest can run the script.
Only when the user did not change the root's password to a more secure one. Like is recommended.
XFCE - The keyboard layout changes automatically
Posted: 28 Jan 2023, 20:33
by beny
hi
Code: Select all
guest@porteus:~$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /etc/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: it,us
variant: ,
options: terminate:ctrl_alt_bksp
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+it+us:2+inet(evdev)+terminate(ctrl_alt_bksp)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+it+us:2+inet(evdev)+terminate(ctrl_alt_bksp)" };
xkb_geometry { include "pc(pc105)" };
};
XFCE - The keyboard layout changes automatically
Posted: 28 Jan 2023, 20:44
by Rava
This is my
setxkbmap -print -verbose 10 using probably the same setup as Kulle:
Code: Select all
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /etc/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: de
variant: nodeadkeys
options: terminate:ctrl_alt_bksp
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwertz)
types: complete
compat: complete
symbols: pc+de(nodeadkeys)+inet(evdev)+terminate(ctrl_alt_bksp)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwertz)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+de(nodeadkeys)+inet(evdev)+terminate(ctrl_alt_bksp)" };
xkb_geometry { include "pc(pc105)" };
};
as you can see, in contrast to beny's output mine only shows one layout:
XFCE - The keyboard layout changes automatically
Posted: 29 Jan 2023, 09:29
by Kulle
Another new test:
Rava wrote
"You can also set that via its settings menu Settings ▷ Keyboard ..."
I did that.
Result after "suspend" : keyboard map is preserved, time/date is also preserved
This solves the problem
Rava wrote "Post what gets written into /var/log/messages"
I'll do that soon, as soon as I have time
XFCE - The keyboard layout changes automatically
Posted: 29 Jan 2023, 12:42
by Kulle
I wrote hastily.
Also now was after a longer "suspend" date/time changed:
Code: Select all
guest@porteus:~$ date
Mi 1. Feb 09:31:45 CET 2023
(keyboard map has been retained)
It may be, so this effect occurs sometimes
or after a longer "suspend".
I will keep watching
XFCE - The keyboard layout changes automatically
Posted: 29 Jan 2023, 15:13
by Rava
Kulle wrote: ↑29 Jan 2023, 09:29
"You can also set that via its settings menu Settings ▷ Keyboard ..."
I did that.
Result after "suspend" : keyboard map is preserved, time/date is also preserved
This solves the problem
Yay!
And when I recall correctly it was my first suggestion to boot.
Good to know it helped.
Kulle wrote: ↑29 Jan 2023, 12:42
It may be, so this effect occurs sometimes
or after a longer "suspend".
I will keep watching
I am 99% sure that the date/time offset is unrelated to the setting of the keymap.
XFCE - The keyboard layout changes automatically
Posted: 29 Jan 2023, 17:02
by Rapha_
Kulle wrote: ↑25 Jan 2023, 18:03
in porteus-v5.0-x86_64.cfg file I have: kmap=de
lang=de
I dont see any
lang= in Porteus cheatcodes.txt
XFCE - The keyboard layout changes automatically
Posted: 29 Jan 2023, 17:05
by Rava
Rapha_ wrote: ↑29 Jan 2023, 17:02
I dont see any lang= in Porteus cheatcodes.txt
There are also more generic cheat codes that apply to most Linux kernels, not just the Porteus one. Many of those are not listed in cheatcodes.txt
I presume lang= is one of the generic cheat codes.