dump-session: too many error messages
- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
dump-session: too many error messages
I'm confused. Does this impact the current changes=EXIT shutdown code? That works fine as is.
-
- Warlord
- Posts: 768
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
dump-session: too many error messages
Thank you! Let me start using your new
for the
That's the standard content of the rc.local_shutdown, I don't add anything to it. Could be blank for what I care. I'm just curious about the rm /var/run/slim.lock, because I remember it used to be a crucial fix back then?
instead of the old (or fixed) /opt/porteus-scripts/dump-session
for the
as a first test. As for replacing rc.6 and rc.local_shutdown, I'll be happy to replace them even on my main system but where did the slim.lock fix currently in my rc.local_shutdown go? Or is it not relevant anymore?
Code: Select all
root@porteus:~# cat /etc/rc.d/rc.local_shutdown
#!/bin/sh
#
# rc.local_shutdown
#
# This script is executed at shutdown (rc0) and reboot (rc6).
# You need to make it executable before using.
#
# Example:
# /etc/rc.d/rc.samba stop
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Red
rst=$(tput sgr0) # Reset
function redwarning() {
echo -e $txtred "$1" $rst
}
## remove /var/run/slim.lock (in case it causes a problem with changes)
[ -e /var/run/slim.lock ] && rm /var/run/slim.lock
if [ $(grep ".dat" /mnt/live/tmp/changes-exit 2>/dev/null) ]; then
## wait for elogind/chvt to settle
sleep 3
SDspace=$(df -BM --output=size,used,avail,pcent /mnt/live/memory/images/changes | tail -n1)
read size used avail percent <<< $SDspace
if [ ${percent%\%} -gt 85 ]; then
echo
redwarning "Warning! save.dat file $percent full. Used: $used Free: $avail"
sleep 5
echo
else
echo
echo $txtbold "save.dat file $percent full. Used: $used Free: $avail" $rst
echo
fi
fi
-
- Warlord
- Posts: 768
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
dump-session: too many error messages
No, it's just going to be the same code script for both in session commit and shutdown commit. They should both work the same. If you like you can test on your save.dat. I don't use save.dat so I'll be testing on /changes folder.
- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
dump-session: too many error messages
Not with /etc changes involved.
Code: Select all
guest@porteus:~/Downloads/zz-changes-exit-test/etc/rc.d$ ls -l
total 8
-rwxr-xr-x 1 guest users 2289 Jul 9 08:55 rc.6*
-rwxr-xr-x 1 guest users 185 Jul 11 09:05 rc.local_shutdown*
guest@porteus:~/Downloads/zz-changes-exit-test/etc/rc.d$
- ncmprhnsbl
- DEV Team
- Posts: 4253
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
dump-session: too many error messages
we haven't used slim for a while, so i assumed it was no longer relevant. (it's lxdm these days)
i really don't know what else to add to dump-session: too many error messages (Post by ncmprhnsbl #99983) by way of explanation ... read through this whole topic thoroughly and the linked topics in dump-session: too many error messages (Post by ncmprhnsbl #99899)
in short: the impact should be: no impact.
one script that handles both in-session changes 'commit' and end-of session(shutdown/reboot) changes 'commit'.
it's just a rationalization of functions duplicated and spread over several locations.
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
-
- Warlord
- Posts: 768
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
dump-session: too many error messages
OK then, that line has been void anywayncmprhnsbl wrote: ↑13 Jul 2024, 01:16we haven't used slim for a while, so i assumed it was no longer relevant. (it's lxdm these days)
-- the script seems to be working alright so far, for in session commit
However, when/if it runs at shutdown, it no longer displays this:
It used to be displayed at the final screen by the initrd/cleanup, with an option to skip saving. Now even when I just boot and immediately shutdown, there is no "3 seconds" output anywhere? Where would the output from rc.6 be, same final screen? It's not there. The delay itself and changes saving could still be happening, and definitely the removal of /mnt/live/tmp/changes-exit happens because initrd/cleanup doesn't display the "3 seconds" message either.ncmprhnsbl wrote: ↑12 Jul 2024, 02:01echo -e "Your session will be saved in [1;33m3[0m seconds.\nPress space/enter to start doing it now or any other key to skip."; x=3
- ncmprhnsbl
- DEV Team
- Posts: 4253
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
dump-session: too many error messages
i did a test, and yes it does run, but isn't visible due to a little hack for elogind not present:
added:
sleep 3 to the beginning of rc.6 (it may need longer, or it can get mixed in with X11 exit messages) (also removed this from the check size section of changes-commit)
fixed non functioning root escalation for in session commit.
todo: colorize messages for better visibility ..and probably use the color functions from porteus-functions
it may be that rc.6 isn't the best place for the sleep, and in that case i'll put it at the beginning of changes-commit like: [ $1 == 6 ] && sleep 3
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
- ncmprhnsbl
- DEV Team
- Posts: 4253
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
dump-session: too many error messages
here's a tested update: zz-changes-exit-test.xzm
appears with skip functionality at shutdown
reworded the size checking to cover both folders and save.dat
sourced color functions from porteus-functions
colorized various outputs
added message: 'Skipping' ..when user chooses to skip the commit
and i think having the sleep in rc.6 uncovers some messages from there that were hidden before.
appears with skip functionality at shutdown
reworded the size checking to cover both folders and save.dat
sourced color functions from porteus-functions
colorized various outputs
added message: 'Skipping' ..when user chooses to skip the commit
and i think having the sleep in rc.6 uncovers some messages from there that were hidden before.
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
-
- Warlord
- Posts: 768
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
dump-session: too many error messages
ncmprhnsbl, I'm testing it and will update what I see at shutdown. But first let me ask you something, as one programmer of another 
rc.6 calls it like this:
but then in changes-commit:
rc.6 KNOWS itself when calling the changes-commit. Whereas the latter can be made agnostic of who is calling it. So why not remove all the if [ "$1" != "6" ]; then checks from the changes-commit and the timer too, making it more like an unconditional, raw directive, and instead decorate the call in the rc.6 as follows:
rc.6 alternative:
So, no more if [ "$1" != "6" ] inside, and I don't think I need a timer and the extra confirmation in 99% cases when I, a user, has just called the changes-commit myself, it's not that dangerous after all to commit changes by mistake.
The following two checks should still be present inside changes-commit, some duplicate safeguarding is unavoidable:
Not a big deal of course, just a discussion (and trying to get rid of the "$1" != "6"
. What you've done is good already, thanks!

rc.6 calls it like this:
Code: Select all
# Run changes-commit for changes=EXIT:
[ -f /mnt/live/tmp/changes-exit ] && /opt/porteus-scripts/changes-commit 6
Code: Select all
if [ "$1" != "6" ]; then
rc.6 alternative:
Code: Select all
# Run changes-commit for changes=EXIT:
if [ -f /mnt/live/tmp/changes-exit ]; then
echo "Your session will be saved in [1;33m3 seconds[0m"
echo "Press space/enter to start doing it now or any other key to skip."
x=3
while [ $x -gt 0 ]; do read -s -t1 -n1 ans && break || sleep 1; let x=x-1; done
if [ "$ans" = "" ]; then
/opt/porteus-scripts/changes-commit
else
echo "Skipping."
fi
rm /mnt/live/tmp/changes-exit
fi
The following two checks should still be present inside changes-commit, some duplicate safeguarding is unavoidable:
Code: Select all
test -f /mnt/live/tmp/changes-exit || { echo "'changes=EXIT:' cheatcode is not active - exiting..."; exit; }
if [ `whoami` != root ]; then
yellow "Please enter root's password below:"
su -c "$0"
exit
fi

-
- Warlord
- Posts: 768
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
dump-session: too many error messages
No, sorry, this still doesn't work for me. Even increasing in your new rc.6 sleep to 6 seconds still shows no output and no offer to skip. As I shutdown by typing poweroff command, the screen switches to vt1 immediately where it simply waits those 3 or 6 seconds without displaying anything.ncmprhnsbl wrote: ↑15 Jul 2024, 09:36i think having the sleep in rc.6 uncovers some messages from there that were hidden before.
Well, if the rc.6 can't actually display, then indeed initrd/cleanup was the only place to do the changes-commit. And I guess it can't just call that script because some commands aren't available in the BusyBox so it has to reimplement the same algorithm the best it can

- ncmprhnsbl
- DEV Team
- Posts: 4253
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
dump-session: too many error messages
my logic on this is:
1. the check for space
2. then choose whether to skip
with your suggestion, the skip would happen before any size check happens.. and in the case of not skipping , there's no chance to after the size check reports a problem..
i realize that it's somewhat superfluous when in-session but also harmless..
(i've had a look and removed some of the unnecessary checks)
oh, it can and does.. the question i see here is: why it isn't displaying(up to the point of cleanup) when you use `poweroff`(which is a link to halt), instead of the shutdown dialog which uses `loginctl poweroff`
guessing it has something to do with "seat handling", wtaa.. ...stdout is going to ? ? maybe still vt7 perversely... maybe because the login seat hasn't "unseated" ..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
-
- Warlord
- Posts: 768
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
dump-session: too many error messages
Yes, I've checked and the output of rc.6 is still on vt7! Could it be moved to the active vt1?
How does one shut down Porteus properly from CLI? I thought it was with poweroff...ncmprhnsbl wrote: ↑16 Jul 2024, 03:05when you use `poweroff`(which is a link to halt), instead of the shutdown dialog which uses `loginctl poweroff`
In that very exotic force majeure I'd rather see a red warning and the actual error of cp commands failing to add to /changes. Or, if it's really full, like 99%, the changes-commit could exit early -- when skipping or not isn't really an option for the user to decide.
Actually, I'm not sure skipping saving changes is a decision for the last stages of shutdown. I'd rather have a special command, poweroff-discarding-changes or a GUI menu entry. In the rest 99.9% cases I just want a 2 seconds quick shutdown

- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
dump-session: too many error messages
I prefer it to corrupting my save.dat file but then again I rarely shutdown my notebook, I reboot it back to safe mode. If time is more important to you change the time in the /etc/rc.d/rc.local-shutdown file to be 2 seconds and disregard any warnings.
- ncmprhnsbl
- DEV Team
- Posts: 4253
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
dump-session: too many error messages
use `loginctl poweroff` < can used by normal user.
poweroff, reboot were fine until elogind replaced consolekit, apparently... an easy solution might be to alias these to the loginctl equivalents.
without testing i'd guess that poweroff would be ok for visibility of this stuff if you're already in runlevel 3 on vt1/tty1 ..
i'd imagine the decision to skip/not skip is(or should be) made well before shutdown, with the user ready with their finger on either enter/space(to skip the countdown) or any other key(to skip the save(and the countdown))

i havn't, so far, tried to do much more than put existing behavior into one script, without complicating it too much..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
dump-session: too many error messages
In most cases I agree but then the surprising msg saying the save.dat is full, or near full, and the user has to think about what he/she has changed and what impact it may/will have on what's going to be saved. A new bookmark, a new browser, a new picture app, ....ncmprhnsbl wrote: ↑17 Jul 2024, 00:50i'd imagine the decision to skip/not skip is(or should be) made well before shutdown,