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.

  • Did you mean "Try Ubuntu without installing"? The option is available as soon as you boot LiveUSB. I generally do experiments which can break the system in a virtual machine. – Kulfy Mar 21 '19 at 13:36
  • The live USB does not allow me to install anything or modify it in any way. –  Mar 21 '19 at 13:38
  • 3
    Sounds weird since I can install any piece of software less than some GBs. But everything vanishes after reboot. You can try making a persistent USB. But in my opinion virtual machine is a better option – Kulfy Mar 21 '19 at 13:40
  • The guest account ? – pLumo Mar 21 '19 at 13:42
  • I never though about the guest account, that sounds exactly as what i need, no installs and does not break my own account. Can you set it as an answer so i can accept it? –  Mar 21 '19 at 13:56
  • FWIW, I use a virtual machine for the same purpose. – wjandrea Mar 21 '19 at 14:07
  • @mth1417un Unfortunately guest accounts are not fully contained, so you might want to avoid them. See https://askubuntu.com/q/926081/301745 – wjandrea Mar 21 '19 at 14:09
  • What about a standard user then? Just not my own user? –  Mar 21 '19 at 14:17

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.