No capability to remove boot media with a savefile

Please reproduce your error on a second machine before posting, and check the error by running without saved changes or extra modules (See FAQ No. 13, "How to report a bug"). For unstable Porteus versions (alpha, beta, rc) please use the relevant thread in our "Development" section.
User avatar
KingJames
White ninja
White ninja
Posts: 25
Joined: 26 Nov 2022, 17:20
Distribution: porteus5.0

No capability to remove boot media with a savefile

Post#1 by KingJames » 26 May 2023, 19:31

I am not entirely sure how to submit a bug report, but here goes.

Often I find it very handy to be able to boot a persistent Linux system to RAM from a thumb drive, then remove the thumb drive and use the system like normal until I need to save a file to it or save the session's changes to the persistence file, which is usually on shutdown. It seems logical to me that there should be a way to remove the boot media after booting to RAM, and still be able to use a persistence file without having to create a module with any changes each time a change is made.

I use MX Linux pretty extensively with a similar setup to what Porteus has to offer. I boot from a thumb drive with a copy to RAM cheatcode and a persistent savefile. However, it is setup only to save to the savefile on shutdown, so I am able to remove the thumb drive and use the system like normal until I decide to shutdown. The system even asks whether the drive is plugged in and whether or not I wish to save that session, and then searches for the savefile partition by UUID. However, it takes at least a minute even on an extremely fast thumb drive to copy all 2.5 GB into RAM and boot, and I would like to switch to Porteus with a similar setup, where I can copy a very similar system to RAM and boot in under 30 seconds.

I have found that I can achieve something very similar to this setup if I pass the changes=EXIT:/path_to_savefile boot code. However, even though this tells the system I only want to save changes on shutdown, the system still won't release the drive to be unmounted. I found several other topics where this is also the case. Here's three in particular:
Cheatcodes and removing USB
[Solved] Newbie - Remove CD/USB after booting
Caja - Unmount USB stick failed

First, if there is a way to release the thumb drive and still have a persistent file on it already, please enlighten me! I would love to find out this is already a capability.

Otherwise, I suppose this is less a bug report than a feature request. I may be the only one who wants this feature, but I'd be surprised if there aren't others who would benefit from this. Also admins feel free to move this topic if this is the incorrect location.

Thanks!
Porteus 5.0. I'm still learning linux. I hate Big Tech spying on me and I like open source. I am really enjoying Porteus. I keep it on a thumb drive and I copy to ram in less time than it takes Windows on my hard drive to boot up.

beny
Full of knowledge
Full of knowledge
Posts: 2092
Joined: 02 Jan 2011, 11:33
Location: italy

No capability to remove boot media with a savefile

Post#2 by beny » 26 May 2023, 21:06

well,if i have understand you can use the root of the usb key to save a temporary file because is the only writeable place and if you remove the key is archived,and you can work with it after...

User avatar
KingJames
White ninja
White ninja
Posts: 25
Joined: 26 Nov 2022, 17:20
Distribution: porteus5.0

No capability to remove boot media with a savefile

Post#3 by KingJames » 29 Jul 2023, 06:30

If I understand you correctly @beny, I believe you are saying that after booting and copying to ram with the changes=EXIT:/path/to/savefile boot code, the system will remember (archive) the drive somehow, and one could remove the drive hot (hopefully won't catch it in a write). Later, before shutting down, the drive can be reinserted and on shutdown (because of the "archive") it should remember and use the drive to write the changes. Please correct me if I am incorrect in this interperetation.

Unfortunately, I have been unable to make this work.
After hot removing the drive, the system remains usable as expected. After making some change such as creating a file on my desktop, I reinserted the drive, waited a minute, and shutdown. The shutdown dialog acted as though everything worked okay, and even prompted saying it was writing changes, but after reboot, none of the changes persisted. I am able to replicate this behavior.
I tried mounting the drive after reinserting it, but strangly enough I was unable to test that because within a minute of mounting it, my graphical interface stopped working almost completely. I believe some of the kernel was still operational, because I was able to force it into init 3 (using CTRL + ALT + F3) but none of my logins (including root) worked. I am able to replicate this behavior.

I'd like to echo the sentements of @Mikie in his thread Unable to remove boot media and ask what is the purpose of the changes=EXIT... code if the drive cannot be removed in the interum? I may be entirely off track trying to use it in this way but I can't think of any other reason for it.

Thank you for any advice,
James

PS. After posting I found the Development topic. Apologies for posting this in the wrong thread.
Last edited by KingJames on 03 Aug 2023, 11:57, edited 1 time in total.
Porteus 5.0. I'm still learning linux. I hate Big Tech spying on me and I like open source. I am really enjoying Porteus. I keep it on a thumb drive and I copy to ram in less time than it takes Windows on my hard drive to boot up.

User avatar
Ed_P
Contributor
Contributor
Posts: 8359
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

No capability to remove boot media with a savefile

Post#4 by Ed_P » 29 Jul 2023, 15:46

If you want to remove the USB drive don't use the changes= cheatcode pointing to a file on the drive. A simple solution to a simple problem.
KingJames wrote:
29 Jul 2023, 06:30
what is the purpose of the changes=EXIT... code if the drive cannot be removed in the interum?
It's purpose is to reduce the writes to the USB drive which makes running the system faster and reduces the wear on the USB drive which helps extend it's life.

If you want to save files after the USB drive has been removed save them to a different drive. Of if you want/need to save files to the USB drive after it has been removed, remount it and save your file(s) to it either manually or with a script. A script you may find useful is posted here: Find Files in -specific- folders... :)
Ed

User avatar
KingJames
White ninja
White ninja
Posts: 25
Joined: 26 Nov 2022, 17:20
Distribution: porteus5.0

No capability to remove boot media with a savefile

Post#5 by KingJames » 03 Aug 2023, 11:57

Oh, that makes sense. Thank you for the info. I'll give the scripts a look.

Thank you,
James
Porteus 5.0. I'm still learning linux. I hate Big Tech spying on me and I like open source. I am really enjoying Porteus. I keep it on a thumb drive and I copy to ram in less time than it takes Windows on my hard drive to boot up.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No capability to remove boot media with a savefile

Post#6 by Rava » 30 Aug 2023, 05:01

KingJames wrote:
29 Jul 2023, 06:30
the system will remember (archive) the drive somehow, and one could remove the drive hot (hopefully won't catch it in a write)
If by "hot remove" you mean remove the file without umounting?

That most likely won't work. Let's presume the following

Code: Select all

sda internal hard drive
sdb USB thumbdrive used for the live system (boot, save changes)
sdc another USB drive, added later.
When you remove sdb1 without unmounting it and add it later on, then the system remembers that sdb1 is still mounted (regardless of it being not accessible / not available) and will assign the"new" drive sde / sde1 - because that's the lowest designation available.

When your setup is like so:

Code: Select all

sda internal hard drive
sdb USB thumbdrive used for the live system (boot, save changes)
and you remove sdb1 and plug it in later, then the system will assign the"new" drive sdc / sdc1

Even when your system has no internal drive and you only have

Code: Select all

sda USB thumbdrive used for the live system (boot, save changes)
and you remove sda1 and plug it in later, then the system will assign the"new" drive sdb / sdb1

Therefore when the live system wants to write to e.g. /mnt/sda1/whatever (an in the last example) it fails since that designation is no longer valid.

So, when ou live OS doen't support unmounting the boot drive and mounting it later on by itself, seems you are out of luck, at least with this "hot unplug" attempt, when indeed by "hot remove" you meant remove the file without unmounting.

Added in 8 minutes 50 seconds:
Ed_P wrote:
29 Jul 2023, 15:46
A script you may find useful is posted here: Find Files in -specific- folders... :)
Cave! Be aware that most likely in /home there are quite some files you do not want to save, e.g. the often quite large ~/.cache/ .
There are newer versions of creating a save file that omits many such folders, but since I not use save-on-exit I do not recall out of the box where they are on the forum.
The size of ~/.cache/ depends on how the program got used, e.g. your browser has almost nothing in there, but it could go up massively after you visited many sites, especially when you ot shut down your browser prior using the save-on-exit script.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8359
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

No capability to remove boot media with a savefile

Post#7 by Ed_P » 30 Aug 2023, 06:00

Rava wrote:
30 Aug 2023, 05:09
Be aware that most likely in /home there are quite some files you do not want to save, e.g. the often quite large ~/.cache/ .
Yes and to address that there is the /etc/changes-exit.conf file.

These are folders I'm omitting saving:

Code: Select all

!/root/.local/share/Trash/
!/root/.cache/thumbnails/normal
!/home/guest/.local/share/Trash/
!/home/guest/.cache/thumbnails/large
!/home/guest/.cache/thumbnails/normal
!/home/guest/.cache/mozilla/firefox/ple67xm3.default-release/thumbnails/
!/home/guest/.cache/mozilla/firefox/ple67xm3.default-release/cache2/
!/home/guest/.mozilla/firefox/Crash?Reports/pending/
!/home/guest/.mozilla/firefox/ple67xm3.default-release/datareporting/archived
!/home/guest/.java/deployment/cache/6.0/
!/home/guest/.config/microsoft-edge-beta/Default/
!/home/guest/.config/microsoft-edge-beta/Edge?Shopping/
!/home/guest/.cache/microsoft-edge-beta/Default/Cache/
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No capability to remove boot media with a savefile

Post#8 by Rava » 30 Aug 2023, 06:06

Ed_P wrote:
30 Aug 2023, 06:00
Yes and to address that there is the /etc/changes-exit.conf file.

These are folders I'm omitting saving:
I do not see any use of /etc/changes-exit.conf file in the code you gave in your answer:
fanthom wrote:
21 Oct 2012, 08:11

Code: Select all

#!/bin/sh

# folders to check (tweak for your needs):
folders="/etc /home /root /opt /usr /var"

# gather all files in one place:
mkdir /tmp/backup_folder
find $folders | xargs -I {} cp -a --parents {} /tmp/backup_folder

#create the module on your desktop with current date:
dir2xzm /tmp/backup_folder $HOME/Desktop/changes-`date +"%m-%d-%y"`.xzm
rm -r /tmp/backup_folder
But please enlighten me where I overlooked the use of /etc/changes-exit.conf in that code.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8359
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

No capability to remove boot media with a savefile

Post#9 by Ed_P » 30 Aug 2023, 16:19

I don't see the name of the file you posted :hmmm: but these postings may help you:
fanthom wrote:
03 Feb 2013, 20:30
there is a /etc/changes_exit.conf file which let's you decide which folders should be saved.
Rava wrote:
03 Feb 2013, 22:29
What about some special syntax in /etc/changes_exit.conf ?

Like, when the line / folder name starts with an "!" than that means, it and all its subfolders should not be saved?
And if you check your /etc/changes-exit.conf file at the top you will see this which may help enlighten you also.

Code: Select all

# Folders listed in this config file will be saved during reboot and shutdown when 'changes=EXIT:' cheatcode is used.
# Folders starting with '!' are omitted. This is useful if you want to save whole folder except for particular subfolder(s).
# An example is inclued in default config below: Porteus will save whole /var folder except for /var/run and /var/tmp subfolders.
# Other example: "!/home/guest/.mozilla/firefox/c3pp43bg.default/Cache" will skip saving of Firefox caches from guest account.
# Thanks to Rava for suggesting implementation of '!' exceptions in /etc/changes-exit.conf.
;)
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No capability to remove boot media with a savefile

Post#10 by Rava » 30 Aug 2023, 17:35

Ed_P wrote:
30 Aug 2023, 16:19
I don't see the name of the file you posted :hmmm: but these postings may help you:
When you refer to me, I just quoted the link you gave above verbatim. It was the info you shared and what was claimed by you simply was not to be found in the link you provided.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8359
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

No capability to remove boot media with a savefile

Post#11 by Ed_P » 30 Aug 2023, 18:09

Two different discussions. One for changes=EXIT, one for saving files without changes=EXIT. changes=EXIT uses the changes-exit.conf file, saving files without it doesn't.

Quoting a posted link and posting the contents of the link are not the same thing which can be confusing. If you could code a way for the posted code to use the .conf file, or a similar one, that would be great. :good:
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No capability to remove boot media with a savefile

Post#12 by Rava » 30 Aug 2023, 18:35

Ed_P wrote:
30 Aug 2023, 18:09
Quoting a posted link and posting the contents of the link are not the same thing
What precisely is the difference. Both refer to the very same data.
Ed_P wrote:
30 Aug 2023, 18:09
If you could code a way for the posted code to use the .conf file, or a similar one, that would be great.
Better ask someone who uses save-on-exit since I never used it, not even once.
But you confuse me, when you say there is a config that defines what files/folders should be omitted in the changes-module, then you already must have a script that uses that technique and very confg, no?
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8359
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

No capability to remove boot media with a savefile

Post#13 by Ed_P » 30 Aug 2023, 19:30

Rava wrote:
30 Aug 2023, 18:35
What precisely is the difference. Both refer to the very same data.
Same info, different views.
Rava wrote:
30 Aug 2023, 18:35
Better ask someone who uses save-on-exit since I never used it, not even once.
Yet you were involved in a discussion on a way to improve it that got implimented.
Rava wrote:
03 Feb 2013, 22:29
What about some special syntax in /etc/changes_exit.conf ?

Like, when the line / folder name starts with an "!" than that means, it and all its subfolders should not be saved?
Rava wrote:
30 Aug 2023, 18:35
But you confuse me, when you say there is a config that defines what files/folders should be omitted in the changes-module,
I was referring to the module that the OP's changes=EXIT cheatcode creates. And it would be very helpful to many if you could tweak the fanthom code you posted to exclude folders like you did for the changes=EXIT code. Your coding skills are much better than mine.
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No capability to remove boot media with a savefile

Post#14 by Rava » 31 Aug 2023, 01:00

Ed_P wrote:
30 Aug 2023, 19:30
Yet you were involved in a discussion on a way to improve it that got implimented.
Yes? And? You made it sound that this is some kind of bad thing?
Ed_P wrote:
30 Aug 2023, 19:30
I was referring to the module that the OP's changes=EXIT cheatcode creates. And it would be very helpful to many if you could tweak the fanthom code you posted to exclude folders like you did for the changes=EXIT code.
I still do not get it.

To quote you:
Ed_P wrote:
30 Aug 2023, 06:00
Rava wrote:
30 Aug 2023, 05:09
Be aware that most likely in /home there are quite some files you do not want to save, e.g. the often quite large ~/.cache/ .
Yes and to address that there is the /etc/changes-exit.conf file.

These are folders I'm omitting saving:

Code: Select all

!/root/.local/share/Trash/
!/root/.cache/thumbnails/normal
!/home/guest/.local/share/Trash/
!/home/guest/.cache/thumbnails/large
!/home/guest/.cache/thumbnails/normal
!/home/guest/.cache/mozilla/firefox/ple67xm3.default-release/thumbnails/
!/home/guest/.cache/mozilla/firefox/ple67xm3.default-release/cache2/
!/home/guest/.mozilla/firefox/Crash?Reports/pending/
!/home/guest/.mozilla/firefox/ple67xm3.default-release/datareporting/archived
!/home/guest/.java/deployment/cache/6.0/
!/home/guest/.config/microsoft-edge-beta/Default/
!/home/guest/.config/microsoft-edge-beta/Edge?Shopping/
!/home/guest/.cache/microsoft-edge-beta/Default/Cache/
That sounds like there is aleady some kind of solution. As you wrote
Ed_P wrote:
30 Aug 2023, 06:00
to address that there is the /etc/changes-exit.conf file.

These are folders I'm omitting saving:
Highlighing by me.

The way you phrased that make it sound like /etc/changes-exit.conf does already somehow control the omission when creating the save-at-exit-changes.xzm module. To be able doing so there must a a script based solution already available. Maybe it's in initrd?

What else could your line "to address that there is the /etc/changes-exit.conf file" mean?

User avatar
Ed_P
Contributor
Contributor
Posts: 8359
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

No capability to remove boot media with a savefile

Post#15 by Ed_P » 31 Aug 2023, 02:23

Rava wrote:
31 Aug 2023, 01:00
The way you phrased that make it sound like /etc/changes-exit.conf does already somehow control the omission when creating the save-at-exit-changes.xzm module.
Yup. It does and has for about 10 yrs now.
Rava wrote:
31 Aug 2023, 01:00
To be able doing so there must a a script based solution already available. Maybe it's in initrd?
Agreed but I have no idea where. I'm sure it's been discussed, probably when it was implemented.
Ed

Post Reply