Testing live persistence

Message
Author
User avatar
anticapitalista
Developer
Posts: 4285
Joined: Sat Jul 15, 2006 10:40 am

Re: Testing live persistence

#21 Post by anticapitalista »

Ok. It might be that the stick needed to be already partitioned as fat32 for it to work. In that case there is a bug in the app.
anticapitalista
Reg. linux user #395339.

Philosophers have interpreted the world in many ways; the point is to change it.

antiX with runit - lean and mean.
https://antixlinux.com

User avatar
loco
Posts: 23
Joined: Mon Jan 14, 2008 1:00 am

Re: Testing live persistence

#22 Post by loco »

:deleted text..
thanks :thumbup:

.. more:
Last edited by loco on Sun Feb 02, 2014 4:59 pm, edited 1 time in total.

User avatar
BitJam
Developer
Posts: 2303
Joined: Sat Aug 22, 2009 11:36 pm

Re: Testing live persistence

#23 Post by BitJam »

I'm made a quick version of xfce4-session-logout that triggers persist-save. Installation:

Code: Select all

gunzip xfce4-session-logout.gz
sudo cp xfce4-session-logout /usr/local/bin
DO NOT overwrite /usr/bin/xfce4-session-logout!

This is alpha code. I wanted to just PM it to D.O. but I didn't see an option to attach files on the send-PM page.

Once it is installed in /usr/local/bin, the program should run when you try to logout from XFCE. If you are not on a Live system or if dynamic root persistence was not enabled then it should fallback to the normal xfce4-session-logout. If you are on a Live system with dynamic persistence enabled then it should obey the settings made by persist-config. If persist-config has not be run then we fall back to semi-automatic mode which means you are prompted before persistence is saved. In all cases (unless there was an error saving persistence) you should end up with the normal XFCE logout screen.

If things don't work, there might be a few more clues available if you run it from the command line:

Code: Select all

/usr/local/bin/xfce4-session-logout

User avatar
dolphin_oracle
Developer
Posts: 22145
Joined: Sun Dec 16, 2007 12:17 pm

Re: Testing live persistence

#24 Post by dolphin_oracle »

BitJam wrote:I'm made a quick version of xfce4-session-logout that triggers persist-save. Installation:

Code: Select all

gunzip xfce4-session-logout.gz
sudo cp xfce4-session-logout /usr/local/bin
DO NOT overwrite /usr/bin/xfce4-session-logout!

This is alpha code. I wanted to just PM it to D.O. but I didn't see an option to attach files on the send-PM page.

Once it is installed in /usr/local/bin, the program should run when you try to logout from XFCE. If you are not on a Live system or if dynamic root persistence was not enabled then it should fallback to the normal xfce4-session-logout. If you are on a Live system with dynamic persistence enabled then it should obey the settings made by persist-config. If persist-config has not be run then we fall back to semi-automatic mode which means you are prompted before persistence is saved. In all cases (unless there was an error saving persistence) you should end up with the normal XFCE logout screen.

If things don't work, there might be a few more clues available if you run it from the command line:

Code: Select all

/usr/local/bin/xfce4-session-logout
OK, I'll check it out.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
anticapitalista
Developer
Posts: 4285
Joined: Sat Jul 15, 2006 10:40 am

Re: Testing live persistence

#25 Post by anticapitalista »

I tried this Bj with success. Cool!
anticapitalista
Reg. linux user #395339.

Philosophers have interpreted the world in many ways; the point is to change it.

antiX with runit - lean and mean.
https://antixlinux.com

User avatar
dolphin_oracle
Developer
Posts: 22145
Joined: Sun Dec 16, 2007 12:17 pm

Re: Testing live persistence

#26 Post by dolphin_oracle »

Yep, I agree with anti. As long as you log out from xfce4-session-logout, it works great! No problems going back and forth with static persist (no save dialog, which is good) and dynamic (save dialog, again which is good). And this way if you don't like your changes from that session, you can still use the gui-logout while after canceling the save.

Perhaps a special bash prompt that warns folks not to reboot or shutdown from the cli without running persist-save?
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
BitJam
Developer
Posts: 2303
Joined: Sat Aug 22, 2009 11:36 pm

Re: Testing live persistence

#27 Post by BitJam »

We could intercept reboot and shutdown commands like we intercept xfce4-session-logout. Do you want to give that a try? It might be a few hours before I can get to it.

User avatar
dolphin_oracle
Developer
Posts: 22145
Joined: Sun Dec 16, 2007 12:17 pm

Re: Testing live persistence

#28 Post by dolphin_oracle »

BitJam wrote:We could intercept reboot and shutdown commands like we intercept xfce4-session-logout. Do you want to give that a try? It might be a few hours before I can get to it.
I'm game. You could almost do it with a bash alias I would think.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
BitJam
Developer
Posts: 2303
Joined: Sat Aug 22, 2009 11:36 pm

Re: Testing live persistence

#29 Post by BitJam »

Okay I made a little tarball that contains 3 commands and a little Makefile. Unpack the tarball and then:

Code: Select all

cd persist-logout-0.01
sudo make install
You can use "sudo make uninstall" to remove the the programs it installed. The halt and reboot commands are just symlinks to the xfce4-session-logout command. It figures out what to do based on the name of the program. Please check and make sure xfce4-session-logout still works because the program has changed a lot and a bug may have crept in.

Since testing programs that turn off the system can be a royal pain you can give it a "-t" or "--test" parameter and then it will just print out the name of the program it would run instead of running it. But even in test mode, persist-save does get called.

I've made the program flexible so you can create a link to it with the name of almost any program and if we can find the full path to that program then we will run persist-save and then run that program. We might want to lock out this feature before we release the program to the public. For example:

Code: Select all

cd /usr/local/bin
sudo ln -s xfce4-session-logout ls
Then whenever you run the "ls" command, we would first run persist-save. BTW: both "halt" and "reboot" are in /sbin so they are not on the PATH of the normal user but they are on root's path. By putting dopple-gangers in /usr/local/bin, our versions will be on the PATH of normal users. So if a user is used to running /sbin/reboot or /sbin/halt then they will bypass our code and persist-save won't be run.

This might not be the best approach for "halt" and "reboot". I'm open to other suggestions. Also, I was thinking that we might want to bypass calling persist-save if our program is called by root. That way if some system software calls "halt" or "reboot" without specifying a path then we will just mimic the program they are trying to call.

Oh yes. If you are running Live then the "db+" boot parameter automatically changes the Bash prompt to something a bit more fancy. There will be 12 different fancy prompts available, each with a slew of options. Use "prompt-usage" to get instructions. If you forgot to use the "db+" boot parameter then you can get fancy prompts for the current session with "source /usr/local/bin/fancy-prompts.bash" Then use "prompt-fancy" to get the basic fancy prompt. You can also experiment with something like:

Code: Select all

prompt-fancy --title "Remember to run persist-save"
I think that constant reminder would get annoying after a while and it would likely either get removed or ignored.

User avatar
dolphin_oracle
Developer
Posts: 22145
Joined: Sun Dec 16, 2007 12:17 pm

Re: Testing live persistence

#30 Post by dolphin_oracle »

Works pretty well. If you run halt as a regular user, the save still happens before the warning that you have to be superuser to run halt.

reboot function also works.

regarding bypassing with /sbin/halt and /sbin/reboot ---I don't know how big a problem that is...I'm not sure I would worry about it.

One other point...if you want to talk about old-school commands, you might want to also link shutdown (as in shutdown -h now).
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

Post Reply

Return to “Older Versions”