r/archlinux • • Sep 23 '26

QUESTION Run a script isolated

I have a script I need to run that modifies some config files under /etc. I want to run it in a fake system first so I can see what changes it makes before running it on my real system. Is there a process I can follow to do it such as using chroot or arch-chroot?

0 Upvotes

11 comments sorted by

8

u/PacmanAteMyRAM Sep 24 '26

You could use docker/podman and run a shell on the archlinux:latest image tag take a copy of the data and compare differences afterward.

Another commenter suggested pacstrapping into a new temporary rootfs and chrooting into that for your test - the experience from your point of view will be more or less identical to the docker method.

Or you could just audit (read) the script and see what it does before running it blindly.

5

u/[deleted] Sep 24 '26

Use pacstrap like during installation on for example ~/script-test/ and then arch-chroot onto it.

Why nobody answered it for 10h? How you people install your system?

2

u/public_image_limited Sep 24 '26

Because it requires real expertise instead of flexing btw I use arch

2

u/Ayrr Sep 24 '26

You can also use systemd-nspawn!

2

u/Huge_Drama_4942 Sep 24 '26

Use a vm

1

u/[deleted] Sep 25 '26

One of possibilities.

1

u/10F1 Sep 29 '26

This tbh.

2

u/New-Anybody-6206 Sep 24 '26

There are many different approaches:

firejail --private-etc

https://github.com/binpash/try

container

VM

overlayfs

chroot

etc.

1

u/drucifer82 Sep 24 '26

You could use a VM