1

I noted recent downloaded distro(s) of my favorite Linux Mint when written to USB and booted create "writable" partition on USB and write logs there. Logs might be interesting to look at, however if I want to preserve USB livespan, is there an easy way to prevent writing to USB?

6
  • Use another liveCD which doesn't torture your USB drive. The fact that Mint does that by default is inexcusable. Mar 25, 2022 at 9:45
  • @ArtemS.Tashkinov, I thought there could be some boot parameter, like persistence to alter that behavior to no writes. IMO all distors have pros and cons, I know Mint better than others to know pros and try to mitigate cons. Mar 25, 2022 at 16:26
  • 1
    There is such a boot parameter. nopersistent, but if your system is cloned, it is a bit difficult to add it. You can use mkusb-plug to create a nopersistent USB pendrive with Linux Mint (mkusb is made for Ubuntu, but it works with Linux Mint too). See also this link that describes how to do it.
    – sudodus
    Aug 24, 2022 at 13:07
  • @sudodus, hello again. Somehow I had not realized nopersistent works at the time of the question. Only recently I've been looking into casper script and saw all parameters, including that one and how it is used in the code for LM 21. It works when I run ISO via e.g Ventoy. Do you want to write an answer? Jan 1, 2023 at 11:59
  • @sudodus, I'm not sure what you meant by "cloned", I know I can dd ISO to USB or put ISO file to stick with Ventoy. Jan 1, 2023 at 12:01

2 Answers 2

1

Boot parameter nopersistent

The boot parameter nopersistent makes a Linux Mint live system not write logs to a [USB] writable partition.

If your system is cloned, it is a bit difficult to add a boot parameter. You can use mkusb-plug to create a nopersistent USB pendrive with Linux Mint (mkusb is made for Ubuntu, but it works with Linux Mint too). See also this link that describes how to create a persistent live drive or a nopersistent live drive.

You can do it with sed

    sed 's/quiet splash/persistent  /' standard.iso > persistent.iso
    sed 's/quiet splash/nopersistent/' standard.iso > nopersistent.iso

and clone the modified iso file, or flash directly with

    sed 's/quiet splash/persistent  /' standard.iso > /dev/sdx
    sed 's/quiet splash/nopersistent/' standard.iso > /dev/sdx

where x is the device letter for the USB pendrive.

Cloning

Cloning means to copy each byte of the source to the target as it is without modifying, excluding or adding anything. dd is often used to clone from an iso file, but there are several other cloning tools, that are safer. I prefer tools with a final checkpoint, that help avoid writing to the wrong target device.

An alternative is extraction from an iso file to an already created file system. There are more details about it here.

4
  • Thanks. That parameter is with IMO not trivial spelling, I'd like it be called notpersistent / non-persistent, maybe I'll try to write a suggestion for developers, to change is one line in casper script as I see it. P.S. I now see what you meant by cloning. I usually keep ISOs of downloaded distros, so I can change them and it is minor issue for me. Jan 2, 2023 at 12:58
  • 1
    @Martian2020, Please don't suggest a modification, that adds characters, because the work-around that I use might no longer work: sed 's/quiet splash/nopersistent/' uses all available characters.
    – sudodus
    Jan 2, 2023 at 15:34
  • I have not thought about that particular issue. However I did think about backward compatibility (and who will accept such request w/out it?) and thought about only ADDING all the above parameters with OR to casper script. I have not made it clear in my previous comment though. Jan 8, 2023 at 4:52
  • @Martian2020, Sounds good :-) Maybe not-persist or something else which does not contain too many characters? But I agree, adding a boot option (in this case as an alias) would be OK too.
    – sudodus
    Jan 8, 2023 at 9:50
1

You can rename the "writable" partition to any other name and it won't be mounted to /var/log anymore. You can do it from any computer (or even by booting from the Live USB itself, using Disks : the name can be changed but the partition can't be unmounted). Then (re)start from the Live USB and all will be fine.

By the way, if you chose to add "persistent" parameter into your menuentry, then renaming "writable" to "home-rw" will give a persistent Home partition mounted to /home.

1
  • +1; There is another label, that should be avoided, casper-rw. See also this link
    – sudodus
    Aug 24, 2022 at 13:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .