[Solved] MX Live: Can persistence easily be turned off entirely?

Message
Author
Winds

[Solved] MX Live: Can persistence easily be turned off entirely?

#1 Post by Winds »

Most of the time, I'll probably be booting with persistence. Being able to customize your live usb, save the changes, and run it anywhere is awesome!

What I'd like to do is build the system up however I want, but in between changes and updates, have the option to basically freeze it and run it in a purely read-only manner; where the system could not be changed in any way. If I want to mount another drive and save or create data there, I can, but the system will not and cannot write anything to the usb or any other connected drives unless I deliberately allow it. Otherwise, it gets RAM and that's it

There's a few obstacles to that, including "sticky" features and how swap is handled. The biggest obstacle is that I'm brand new to Linux, so what is possible for an advanced user may not be possible for me. If setting it up is over my head, then I couldn't possibly troubleshoot it. Out of the box, the live usb is pretty close to acheiving what I want, so maybe a few workarounds might get me there.

I'll post the background of what I've done so far, in case it helps any other newbies, or better explains how I'm trying to go about this. I'll put my questions below that. Thanks!
Last edited by Winds on Tue Apr 21, 2020 10:17 pm, edited 1 time in total.

Winds

Re: MX Live: Can persistence easily be turned off entirely?

#2 Post by Winds »

Background:



I downloaded the MX 19.1 32-bit iso and created a bootable usb in Windows using Rufus. That allowed me to boot to MX Linux, but in order to have a live usb with all of the persistence features, I'd need to create another usb using MX Live USB Creator. Since I didn't have a second usb handy, at the MX Linux boot screen, I chose F4 to boot with the "toram" option. I did this so I could load the MX operating system from the usb drive to RAM, and use MX Live USB Creator to write the new persistent live usb back to the same drive I made with Rufus.

The ability to do THAT is extremely convenient. No need to have another usb stick, dvd, or installed system. One usb stick is all you need! MX so far has been really smooth, more intuitive, and far less dauntng for a noob than I expected. I'm dreading the time I have to fix anything though..

Anyway, I created a Live USB with a rootfs, homefs, and swap file, along with a new root and user password. At the MX boot screen, I chose F5 to boot with persist static, as I don't have much RAM to spare. Then things got a little confusing...

The user name was still "demo". I obviously wanted to change that, but I couldn't because demo was logged in. Okay, so I'll log demo out and have root change the name. Nope! Once demo has logged in once, you'll have to reboot to change the name. Fine. The problem is, demo logs in automatically once you boot into the system, so rebooting won't help you. I went to MX User Manager > Options tab, selected demo as the user, and checked the box to require a password to log in. Rebooted. Now demo couldn't log in automatically, and so root could change the name now.

The second issue I had was that if I booted with persist off, I would still get the demo user and root accounts, with the demo passwords, and so I wanted to get rid of those. As I understand from dolphin_oracle's videos, the system runs on the linuxfs file, which is read-only and comes from the iso used to create the live usb. When you boot without persistence, I guess it doesn't load the rootfs and homefs files, and so any accounts or any other changes I make after the iso was created aren't loaded either. To be able to access any of that without persistence, I need to merge that information into the linuxfs file by doing a remaster with MX RemasterCC.

I did that, and it worked. Now when I booted without persistence, my accounts and any changes I previously made were there, and the demo accounts were gone. Now I wanted to make an iso of my newly remastered live usb using Snapshot, and save it to my pc hard drive. I tested the new iso on a DVD to make sure everything worked, then I rebooted with toram and used Live USB Creator to overwrite my old usb system with the new iso I'd just created.

When I created my new live usb, I was asked to create a new rootfs, homefs, and swap file again, but my root and user accounts did not need to be recreated, because those accounts were already merged into the linuxfs file during remaster before the iso was created by Snapshot.

So based on all of the above, I assumed that if I booted without persistence, no data was getting saved anywhere, and I was basically running the original iso on usb. However, it seems to be a bit more complicated than that.

Winds

Re: MX Live: Can persistence easily be turned off entirely?

#3 Post by Winds »

Questions:


viewtopic.php?p=538189&sid=9dcd777afe2a ... 7f#p538189

BitJam:
On the live system we normally use whatever swap partitions we can find which could be a security risk if you are running on someone else's machine. If you create even a small swap file on the live-usb then we will use that instead of using swap partitions. If you are using an encrypted live-usb then we will never use swap partitions unless you tell us.


Does this also apply if I created a swap file, but I'm booting a live usb *without* persistence? Is the swap file loaded? If not, or I never created one, is any data written outside of the usb when running without persistence?

What about a live DVD? It obviously can't have a writable swap file. Is any data written outside of RAM?



"Use "live_swap=off" to disable using swap partitions"


How do I do that?





https://antixlinux.com/the-most-extensi ... he-planet/
The live-usb-save feature will automatically save certain configuration files across reboots even if no form of persistence is enabled. For example, wireless networks and passwords are saved automatically. If a file or feature is automatically saved across reboots we say it is "sticky". Sticky features include...


Is there any easy way to set up non-persist to write absolutely nothing back to the live usb?
Without affecting files I'll need / want when booting with persistence?

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

Re: MX Live: Can persistence easily be turned off entirely?

#4 Post by dolphin_oracle »

The

live_swap=off

Woukd be with the boot codes like quiet in the live boot menus. On legacy you would just type it in the box provided but on uefi you would need to edit the grub boot entry by hitying "e" to edit the menu entry and f10 to boot when done.

You could also use the nosavestate to prevent any system info from being written back to the stick. Things like network settings and the like. They would still be used if present in the linuxfs file.

I never create live swap files.

After a remaster all the stuff (or at least anything not I the remasterexcludes files) gets put in the linuxfs file, becoming the new default filesystem. So after a remaster you don't get the original iso any more you get whatever you remastered. But it's still read only. If you boot without persistence enabled and nosavestate then nothing gets written to the disk.
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.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

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

Re: MX Live: Can persistence easily be turned off entirely?

#5 Post by anticapitalista »

F1 on live usb is your friend. Also, have a look at the FAQ.

https://download.tuxfamily.org/antix/do ... arams.html

nosavestate and nostore and live_swap=off are the 'cheats' you want.

Just type them at the boot menu.

(d_o beat me to it)
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: 22719
Joined: Sun Dec 16, 2007 12:17 pm

Re: MX Live: Can persistence easily be turned off entirely?

#6 Post by dolphin_oracle »

anticapitalista wrote: Sun Mar 15, 2020 11:29 am F1 on live usb is your friend. Also, have a look at the FAQ.

https://download.tuxfamily.org/antix/do ... arams.html

nosavestate and nostore and live_swap=off are the 'cheats' you want.

Just type them at the boot menu.

(d_o beat me to it)
but anti is the master :happy:
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.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

Winds

Re: MX Live: Can persistence easily be turned off entirely?

#7 Post by Winds »

Thanks for your responses!

I've been reading up and tinkering, and have some questions about how the boot codes work below, but I'm still not clear how exactly MX uses swap by default:


__________



1. As I understand, if I create a live usb *without* a swap file, MX will use whatever partitions it can find for swap. I have partitioned my hard drive for multiboot with Windows already, although I haven't installed MX yet. In this situation, will MX Live choose the empty swap partition on my hard drive, or could it use *any* available partitions? Could it possibly overwrite data by accident?

2. MX Live usb, again with no swap file: Is there any easy way to select which partition I want it to use for swap?

3. Do persistence settings affect whether or not the swap file is used? If I create a live usb *with* a swap file, will MX Live *always* use the swap file, regardless of whether or not I run with persistence?

4. If I'm running just a standard bootable MX usb made by Rufus in Windows, or a live DVD, obviously there's no persistence or swap file available. Will MX still use swap on any available partition?

5. Does fromiso work the same way (always non-persistent) as a standard Rufus usb or Live DVD?


__________



About the boot codes for swap:



I wasn't able to find any information about swap codes in the FAQ, but from what I've seen in the forums:

6. "live_swap=off" disables the system from using external swap partitions,
while "live_swap=all-off" disables external swap partitions AND the live-usb swap file.
Is that correct?



Also, I'm a little thrown off by what I saw during booting:



My default boot options are quiet nosplash

Booting with quiet nosplash live_swap=off

The screen said:

"Possibly unknown or misspelled boot codes:
(don't take this too seriously)
live_swap=off"

And later "Activating swap file swap... done."



Booting with quiet nosplash live_swap=all-off, the screen said:

"Possibly unknown or misspelled boot codes:
(don't take this too seriously)
live_swap=all-off"

And later "Activating swap.... done."



7. Is the unknown / misspelled notification normal? (I double checked that I entered it correctly)
And if "live_swap=all-off" means disable using external swap partitions AND the live-usb swap file, then what is it activating?



Thanks for your help!

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

Re: MX Live: Can persistence easily be turned off entirely?

#8 Post by dolphin_oracle »

Winds wrote: Tue Mar 17, 2020 2:35 am Thanks for your responses!

I've been reading up and tinkering, and have some questions about how the boot codes work below, but I'm still not clear how exactly MX uses swap by default:


__________



1. As I understand, if I create a live usb *without* a swap file, MX will use whatever partitions it can find for swap. I have partitioned my hard drive for multiboot with Windows already, although I haven't installed MX yet. In this situation, will MX Live choose the empty swap partition on my hard drive, or could it use *any* available partitions? Could it possibly overwrite data by accident?
it will use all available existing swap partitions.
2. MX Live usb, again with no swap file: Is there any easy way to select which partition I want it to use for swap?
I don't know the answer to that question. possibly you could define one in fstab, but I think the system will still mount any swap still available.
3. Do persistence settings affect whether or not the swap file is used? If I create a live usb *with* a swap file, will MX Live *always* use the swap file, regardless of whether or not I run with persistence?
no you do not need persistence to use the swap file. just writable media.
4. If I'm running just a standard bootable MX usb made by Rufus in Windows, or a live DVD, obviously there's no persistence or swap file available. Will MX still use swap on any available partition?
yes any swap partition that is available would be used by default. FYI, you can do persistence on rufus created live-usb's if you aren't using the image/dd type modes (I forget exactly what rufus calls it).
5. Does fromiso work the same way (always non-persistent) as a standard Rufus usb or Live DVD?
I haven't used fromiso in a long time, probably.

__________

About the boot codes for swap:



I wasn't able to find any information about swap codes in the FAQ, but from what I've seen in the forums:

6. "live_swap=off" disables the system from using external swap partitions,
while "live_swap=all-off" disables external swap partitions AND the live-usb swap file.
Is that correct?



Also, I'm a little thrown off by what I saw during booting:



My default boot options are quiet nosplash

Booting with quiet nosplash live_swap=off

The screen said:

"Possibly unknown or misspelled boot codes:
(don't take this too seriously)
live_swap=off"

And later "Activating swap file swap... done."
live_swap=off is done pretty late, but it is a code. you can confirm whether swap is used or not on a boot with 2 things.

Code: Select all

cat /etc/fstab
wills how any swap created by the live boot and

Code: Select all

free
will show info about memory usage, including swap. if no swap is enabled, all the swap values will be zero.

its possible there is a bug, so it might be good to check.

7. Is the unknown / misspelled notification normal? (I double checked that I entered it correctly)
And if "live_swap=all-off" means disable using external swap partitions AND the live-usb swap file, then what is it activating?
it would be normal as the live init system currently stands. that code should probably be added to the list of codes we don't tag with that message if they exist. Oversight really, the live system is pretty complex at this point.
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.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

Winds

Re: MX Live: Can persistence easily be turned off entirely?

#9 Post by Winds »

Sorry for the long delay in responding, but obviously the covid 19 outbreak has upended the country, and I hope everyone is safe.

I used the terminal commands you provided, and everything worked as you stated:

If I use a live dvd or non-persistent Rufus, and so do not have a swap file, then it will always use my hard drive's swap partition. The terminal codes show my swap partition label and how much swap is available. If I boot with "live_swap=off", then it will not use swap at all.

If I use an MX Live USB with a swap file, then it will always use that swap file instead of my swap partition, and so "live_swap=off" isn't needed. If I boot with "live_swap=all-off", then it won't use swap at all (neither the swap file nor the swap partition).

The results are the same whether or not I boot with persistence.



If I boot with "nostore", that removes the "Live-usb-storage" folder from /home/ and /root/. The root and user folders are still present in /live/boot-dev/Live-usb-storage, and I can still save things there, even without persistence. However, with "nostore", the system doesn't seem to write to the "live-logs" folder in root.



Questions:

1. Are there any disadvantages to booting with "nostore"?

2. As for "nosavestate": You'd mentioned that the state files were things like network settings, and after I looked at the files in /live/boot-dev/antiX/state/, the files and folders referenced seem like mostly configuration files. Could you elaborate on what kind of things are stored there, and the pros and cons of running with "nosavestate"?

3. You'd also mentioned that you never create live swap files. Why's that?

4. I'm basically curious as to how non-persistent I want to run the system, in between updates and tweaks, without making things too inconvenient. One reason is to keep the system secure, and another is to keep user data on a seperate partition from being unnecessarily searched, indexed, and copied to the stick (shadow copies, temp files, etc). Is running without persistence enough to prevent that sort of thing, or is that where "nostore" and "nosavestate" come into play?



I'll probably experiment with making an encrypted live usb soon, but it seems MX Live offers some options to keep user data seperated away from the system in a way not usually possible, certainly not with Windows, and so I wanted to explore those options first.

Thanks!

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

Re: MX Live: Can persistence easily be turned off entirely?

#10 Post by dolphin_oracle »

1. no really. if you had booted with nostore, the /Live/boot-dev/Live-usb-storage folder would never have been created. but nothing is saved there automatically.

2. yes, machine-specific and generic configuration files are stored. Here's a list

Code: Select all

/etc/adjtime
/etc/bcm.chk
/etc/default/acpi-support
/etc/default/acpid
/etc/default/bluetooth
/etc/default/dbus
/etc/default/ifplugd
/etc/default/networking
/etc/default/numlockx
/etc/default/smartmontools
/etc/default/tlp
/etc/default/ufw
/etc/default/wicd
/etc/modprobe.d/*.conf
/etc/modules
/etc/udev/rules.d/*-persistent-net.rules
# /etc/X11/xorg.conf
/etc/X11/xorg-bus-id
/etc/X11/xorg.conf.d/*
/lib/modprobe.d/i915-invert.conf
/var/lib/alsa/asound.state
/var/lib/connman/*
/var/lib/connman/*/*
/var/lib/live-mstate/*
/var/lib/initscripts/brightness*"

GSTATE_FILES="# File: general-state-files
# Files to be saved across reboots and across machines
/etc/default/unclutter
/etc/fstab.automount
/etc/fstab.hotplug.state
/etc/fstab.mount
/etc/wicd/*.conf
/etc/network/interfaces
/etc/network/interfaces.d/*
/var/log/live/persist-save.log
/var/log/live/live-remaster.log
/root/.bash_history
3. just never do. usually I have swap on the machines I'm running already, so I don't have any real reason to make another swapfile.

4. nostore won't do much, but if you really don't want any changes, then running without persistence, and using the nosavestate, will keep any changes from being made.
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.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

Post Reply

Return to “General”