0

Since Linux distributions are extremely powerful, it can also allow the user to type a terminal command that breaks / uninstalls some important part of the OS. Is it possible to run the system in some "temporary mode", test a terminal command or anything else, and if something breaks, one can just exit this mode and return to the "real" OS?

I know I could do one of the following:

  • Install a second Ubuntu for testing on the disk (imo this is too much space considering I only need to try some terminal commands).
  • Install Ubuntu in a VM (a VM is too limited and has the same problem as the first point)
  • Some type of container?

Any other options? I am just curious since I have reinstalled the system so many times now because of something breaking.

1 Answers1

1

Well you can at least use containers and KVM to achieve that by using snapshots.

For LXD this might be as easy as:

lxc launch ubuntu-daily:b b
lxc exec b bash
# do some work
lxc snapshot b b-state-1
# do some other work, but revert later
lxc revert b b-state-1

If you realize a config is nice you can even clone keep this container but clone the old snapshot to a new name to continue with other experiments. The options are nearly limitless. See sections "Snapshot management" and "Cloning and renaming" in this blog. From there you can go as needed.

And if even with all the nice features system containers have these days that isn't enough you can achieve the same with libvirt and snapshots for VM Guests with Disks or even live snapshots depending on your needs.

Christian Ehrhardt
  • 2,195
  • 16
  • 22