Hey guys,
Is there a way to make automatic saving of the root file system work with an antix-core LiveUSB. Lets assume all command-line at the moment. I can build the live usb persistence file with the scripts in /usr/local/bin and I can save manually with persist-save, but I'm looking for an automatic save. This is a question from someone who viewed one of my videos, and I'm trying to get him an answer.
Thanks guys!
d.o.
topic title: Root Persistence with an antix-core LiveUSB
7 posts
• Page 1 of 1
-
Posts: 2,238
- Joined: 16 Dec 2007
-
Posts: 1,308
- Joined: 31 Aug 2009
#2
The easiest solution is to use static root persistence. This way everything is saved as it is written and there is no need to run persist-save. But that might be too slow.
There is a script /etc/init.d/persist-autosave that is supposed to run when exiting runlevel 3. The solution could be as simple as making sure there is a"3" boot parameter so you are in runlevel 3. Then on shutdown or reboot, you leave runlevel 3 and your changes should be saved if auto-save was selected. If manually saving was selected then, of course, the automatic saving will be disabled. You should be able to select auto-save with the persist-config command. It is possible that semi-automatic saving during runlevel 3 is broken due to conflicts over who controls the console.
If auto-save is already selected and you are in runlevel 3 and it still doesn't work then it is broken and I will have to fix it. I have not tested it recently here. I know it used to work.
BTW: an easy way to test is to use the"telinit" command to switch to a different runlevel. I have not tried this on core but if I am in runlevel 3 in a full system and root persistence is enabled then when I run"telinit 5" it first exits runlevel 3 and the autosave is done. I consider this to be a bug but it can be useful now for testing since you don't have to shutdown or reboot to test autosave. To test it again run"telinit 3" followed by another"telinit 5".
HTH. If these suggestions don't help then I suggest you send me a PM or an email so we can continue this via email.
BTW: Besides fixing this problem, I'm curious to know if there are other things we can do to improve the antiX-core experience. For example, perhaps there could be a text menu system that has functionality similar to the antiX GUI Control Centre.
BTW2: the"db+" boot parameter will automatically log you in as root on vt2, vt3, and vt4. It will also make a fancy Bash prompt that spans the screen. I find this useful. YMMVG.
BTW3: Great videos!
There is a script /etc/init.d/persist-autosave that is supposed to run when exiting runlevel 3. The solution could be as simple as making sure there is a"3" boot parameter so you are in runlevel 3. Then on shutdown or reboot, you leave runlevel 3 and your changes should be saved if auto-save was selected. If manually saving was selected then, of course, the automatic saving will be disabled. You should be able to select auto-save with the persist-config command. It is possible that semi-automatic saving during runlevel 3 is broken due to conflicts over who controls the console.
If auto-save is already selected and you are in runlevel 3 and it still doesn't work then it is broken and I will have to fix it. I have not tested it recently here. I know it used to work.
BTW: an easy way to test is to use the"telinit" command to switch to a different runlevel. I have not tried this on core but if I am in runlevel 3 in a full system and root persistence is enabled then when I run"telinit 5" it first exits runlevel 3 and the autosave is done. I consider this to be a bug but it can be useful now for testing since you don't have to shutdown or reboot to test autosave. To test it again run"telinit 3" followed by another"telinit 5".
HTH. If these suggestions don't help then I suggest you send me a PM or an email so we can continue this via email.
BTW: Besides fixing this problem, I'm curious to know if there are other things we can do to improve the antiX-core experience. For example, perhaps there could be a text menu system that has functionality similar to the antiX GUI Control Centre.
BTW2: the"db+" boot parameter will automatically log you in as root on vt2, vt3, and vt4. It will also make a fancy Bash prompt that spans the screen. I find this useful. YMMVG.
BTW3: Great videos!
-
Posts: 2,238
- Joined: 16 Dec 2007
#3
Well, shutting down with"sudo halt" or"shutdown -h now" does not initiate the save, even though the system looks like its dropping from runlevel 3 to runlevel 0 (if I saw it right, it goes by pretty fast).
static persistence works as expected, and I'm recommending this to the viewer.
As far as the text based menu, that has some merit, particularly for some antix-specific scripts that are included. Perhaps final message at login before the command prompt that says"type menu" for a menu, or some such. I would need to think about what to include, as core's target audience may not need it for much beyond the antix-specific tools.
and thanks for the comment about the videos. they are fun to make and so far the response is generally positive. I'm working on a STEAM video right now. I've learned so much from the forums that I'm glad to give a little back.
static persistence works as expected, and I'm recommending this to the viewer.
As far as the text based menu, that has some merit, particularly for some antix-specific scripts that are included. Perhaps final message at login before the command prompt that says"type menu" for a menu, or some such. I would need to think about what to include, as core's target audience may not need it for much beyond the antix-specific tools.
and thanks for the comment about the videos. they are fun to make and so far the response is generally positive. I'm working on a STEAM video right now. I've learned so much from the forums that I'm glad to give a little back.
-
Posts: 1,308
- Joined: 31 Aug 2009
#4
Okay. I will work on fixing this. Sorry for the inconvenience. I'm delighted that someone wants to use persistence on a core system.dolphin_oracle wrote:Well, shutting down with"sudo halt" or"shutdown -h now" does not initiate the save, even though the system looks like its dropping from runlevel 3 to runlevel 0 (if I saw it right, it goes by pretty fast).
-
Posts: 2,238
- Joined: 16 Dec 2007
#5
No worries, thanks for the help!
-
Posts: 1,308
- Joined: 31 Aug 2009
#6
It mostly works here. If I run"/etc/init.d/persist-autosave stop" then the script works. The problem is that this script is no longer running when runlevel 3 stops. I tried using:to see if I could get it to run when runlevel 3 stops. I first had to remove some question marks from the header in /etc/init.d/persists-autosave in order to get this command to complete. Unfortunately, this command caused the script to run when entering runlevel 3 instead of when leaving it!
I think the Debian init system might have changed. Some documentation says that links in the /etc/rc?.d/ directories that start with"K" are disabled. I think this used to signify that the program was to be run at shutdown.
Strange as it may sound, I am not familiar with the Debian init system. I don't know how to get a script to run when you leave a runlevel. One easy (I hope) workaround is to add persist-autosave as a top priority stop script to runlevels 0 and 6. This should cause it to run on shutdown and reboot which is exactly what you want. Unfortunately, I don't even know how to make that work. Creating symlinks and running:did not work. This should be easy to fix for someone who is familiar with the Debian init system.
Code: Select all
update-rc.d persist-autosave stop 3 20
I think the Debian init system might have changed. Some documentation says that links in the /etc/rc?.d/ directories that start with"K" are disabled. I think this used to signify that the program was to be run at shutdown.
Strange as it may sound, I am not familiar with the Debian init system. I don't know how to get a script to run when you leave a runlevel. One easy (I hope) workaround is to add persist-autosave as a top priority stop script to runlevels 0 and 6. This should cause it to run on shutdown and reboot which is exactly what you want. Unfortunately, I don't even know how to make that work. Creating symlinks and running:
Code: Select all
update-rc.d persist-autosave stop 0 0 6
-
Posts: 2,238
- Joined: 16 Dec 2007
#7
I'm no expert, but...
I've been working on the init system issue and persistent saves and I've come up with the following. I do have persist-autosave working at shutdown and reboot from the command line.
I've made the following changes to /etc/init.d/persist-autosave
1. In the init header, I've removed the question marks as you did.
2. In the init header, at default start, I've added 3 4 5
3. In the init header, at default stop, I've added 0 1 6
4. At the end of the file, I've changed"exit" to"exit 0" . This seems to be important to the system that processes the init scripts.
so /etc/init.d/persist-autosave now looks like this
5. I removed the symlinks in /etc/rc3.d to persist-autosave (the K01persist-autosave and S19persist-autosave).
6. I issued the following command once all changes were made
update-rc.d persist-autosave defaults (note I'm not sure which takes precedence here, the defaults or the run levels specified in the file)
7. I manually saved one more time and rebooted the usbkey.
8. issued a"echo cat7>>test7.txt" in the home directory as a marker for changes.
9. issued"sudo reboot" and rebooted as normal, selecting the first root persistence option.
10. at both shutdown and reboot, the persist-autosave script is invoked and the rysnc to the rootfs is performed.
I'll be honest, I'm not sure exactly why any of this worked, other than I think the symlinks and the init headers were somehow in conflict. The update-rc.d command DID NOT place any symlinks in /etc/rc3.d .
Hope this helps.
d.o.
I've been working on the init system issue and persistent saves and I've come up with the following. I do have persist-autosave working at shutdown and reboot from the command line.
I've made the following changes to /etc/init.d/persist-autosave
1. In the init header, I've removed the question marks as you did.
2. In the init header, at default start, I've added 3 4 5
3. In the init header, at default stop, I've added 0 1 6
4. At the end of the file, I've changed"exit" to"exit 0" . This seems to be important to the system that processes the init scripts.
so /etc/init.d/persist-autosave now looks like this
Code: Select all
#!/bin/bash
### BEGIN INIT INFO
# Provides: persist-autosave
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ??
# Description: Save persistent root filesystem changes at shutdown
### END INIT INFO
case"$1" in
start)
/usr/local/bin/persist-config --cli --startup
;;
stop)
/usr/local/bin/persist-config --cli --shutdown
;;
*)
echo"Usage: $0 {start|stop}"
;;
esac
exit 0
6. I issued the following command once all changes were made
update-rc.d persist-autosave defaults (note I'm not sure which takes precedence here, the defaults or the run levels specified in the file)
7. I manually saved one more time and rebooted the usbkey.
8. issued a"echo cat7>>test7.txt" in the home directory as a marker for changes.
9. issued"sudo reboot" and rebooted as normal, selecting the first root persistence option.
10. at both shutdown and reboot, the persist-autosave script is invoked and the rysnc to the rootfs is performed.
I'll be honest, I'm not sure exactly why any of this worked, other than I think the symlinks and the init headers were somehow in conflict. The update-rc.d command DID NOT place any symlinks in /etc/rc3.d .
Hope this helps.
d.o.