"Make your own distribution" running wild on Parallels - recursively deletes network shares

Hi,
just started to install DietPi on a fresh Debian GNU Linux 11.3 ARM64 on ParallelsDesktop 18/Mac.
I used the guide at Supported hardware - DietPi.com Docs to get an ARM64 DietPi on a Parallels VM.

Unfortunately, the script that has to be run to install DietPi over Parallels Debian is running wild, recursively deleting whole network shares.
https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-installer

Maybe one of the lines after No. 251? ‘# Delete any previous existing data’
After a panic-eject of the network, the script halted and the VM went black over some device errors.

No harm is done due to nightly backups. Please be careful when trying to replay this combination.

Edit: Other attached volumes are affected too. USB-Stick is erased, so I guess this issue includes all storage.

Usually the script should not delete the entire share or USB device. As far as I can see, it’s going to check for folders named *dietpi* only. Do you have an example what has been deleted?

@MichaIng can you have a look?

Yes, this is somehow spooky.
The name of the USB-stick has been NO_NAME, containing at least one DietPi image with its original filename.
The network share has been called IT_EDV, from there it performed a descending deletion starting at ’ • Administration 2021’ erasing several GB. No dietpi in the path, deleting regardless of format or name images, tables, textfiles etc.
I’m still inspecting my boot HD and mounted images for lost files, but it looks like I stopped the wiping before.

let’s wait on our developer. Personally I’m not aware on other cases where this happened before.

Generally I’d not run that script with drives mounted you want to preserve. It really is meant to radically purge everything to transform the system into a minimal DietPi image, so if something you want to preserve is coincidentally at a path we intentionally remove, something like this is possible.

However, it is not intended that it purges the content of mounts at other paths, the line you thought of cannot be it since this triggers only if /DietPi or /boot/dietpi exists, which is not the case on plain Debian. Can you tell us the exact full path of the mountpoint that got removed?

Probably we can add some safety step to umount everything below /mnt and /media first.

or unmount everything that is not related to BootFS / RooFS ??

Please give me a little time to repeat the case.
I must confess, I didn’t care too much about the setup, as I just performed it for a dry run migration of a website.
All I remember is that the VM asked for access to the network share before running the DietPi script and I just hit Enter.
I will get a new fresh Debian VM, isolate it and plug in an slow USB-device with thousands of files and look at the mounts before starting the script.
After all, I come back on this.
Thanks for taking care!

It asked for access to the network share? With some kind of whiptail dialog or what? At least our script won’t do that.

Not sure. In theory there are systems with /var and/or /usr or some home dir(s) mounted from elsewhere. At least in the past this was common and even the reason why /usr exists. Probably a combination of unmounting drives from typical data mount locations (such which are not below necessary system dirs) and hardening some wildcard removals will do. But @fhals you do not know the path of that mount anymore?

I check everything, and the /mnt/*dietpi* (only if /boot/dietpi or /DietPi exists) + /media are the only problematic ones.

OK, found the time to replay, 100% reproducible.
This time I left out the network share for my own sake but mounted a cheap & slow USB-Device containing thousands of dummy files to be able to catch it in the act of vandalism.
Using a fresh Parallels VM install Debian GNU Linux11.3 ARM
Performing the recommended

apt update
apt install -y curl ca-certificates systemd-sysv

and after it starting the script:

bash -c "$(curl -sSfL 'https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-installer')"

After answering the questions about distro and install-options everything worked fine until step 5 of the Dietpi-script.
Step 5 then started with deleting files in /etc, erasing the content of /home (incl. Shared Folders) and proceeded with all mounted Volumes in /media.
There I halted the script and copied the output before I lost control over the VM.
Hope this helps!

Step: [5] Applying DietPi tweaks and cleanup

[ INFO ] DietPi-Installer | APT purge gcc-9-base:arm64, please wait...
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
  gcc-9-base*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
                                                              After this operation, 268 kB disk space will be freed.
(Reading database ... 25786 files and directories currently installed.)                                             (Reading database ... 
Removing gcc-9-base:arm64 (9.3.0-22) ...
[  OK  ] DietPi-Installer | APT purge gcc-9-base:arm64
[ INFO ] DietPi-Installer | Restoring default base files:
removed '/etc/motd'
removed '/etc/profile'
removed '/etc/update-motd.d/10-uname'
removed directory '/etc/update-motd.d'
removed '/etc/issue'
removed '/etc/issue.net'
removed directory '/root/.cache/appstream'
removed directory '/root/.cache'
removed '/root/.profile'
removed '/root/.bashrc'
removed directory '/root'
removed '/home/parallels/.config/monitors.xml'
removed '/home/parallels/.config/ibus/bus/a852749937fa462887f881048492900f-unix-wayland-0'
removed '/home/parallels/.config/ibus/bus/a852749937fa462887f881048492900f-unix-0'
removed '/home/parallels/.config/ibus/bus/a852749937fa462887f881048492900f-unix-1'
removed directory '/home/parallels/.config/ibus/bus'
removed directory '/home/parallels/.config/ibus'
removed '/home/parallels/.config/dconf/user'
removed directory '/home/parallels/.config/dconf'
removed '/home/parallels/.config/user-dirs.dirs'
removed directory '/home/parallels/.config/pipewire-media-session'
removed '/home/parallels/.config/gtk-3.0/bookmarks'
removed directory '/home/parallels/.config/gtk-3.0'
removed directory '/home/parallels/.config/goa-1.0'
removed '/home/parallels/.config/pulse/a852749937fa462887f881048492900f-card-database.tdb'
removed '/home/parallels/.config/pulse/cookie'
removed '/home/parallels/.config/pulse/a852749937fa462887f881048492900f-stream-volumes.tdb'
removed '/home/parallels/.config/pulse/a852749937fa462887f881048492900f-default-sink'
removed '/home/parallels/.config/pulse/a852749937fa462887f881048492900f-device-volumes.tdb'
removed '/home/parallels/.config/pulse/a852749937fa462887f881048492900f-default-source'
removed directory '/home/parallels/.config/pulse'
removed '/home/parallels/.config/user-dirs.locale'
removed '/home/parallels/.config/evolution/sources/system-calendar.source'
removed '/home/parallels/.config/evolution/sources/system-proxy.source'
removed '/home/parallels/.config/evolution/sources/birthdays.source'
removed directory '/home/parallels/.config/evolution/sources'
removed directory '/home/parallels/.config/evolution'
removed directory '/home/parallels/.config/nautilus'
removed directory '/home/parallels/.config'
removed '/home/parallels/Desktop/Parallels Shared Folders'
removed directory '/home/parallels/Desktop'
removed directory '/home/parallels/.ssh'
removed '/home/parallels/.cache/mesa_shader_cache/index'
removed directory '/home/parallels/.cache/mesa_shader_cache'
removed '/home/parallels/.cache/fontconfig/e4093edf-c37e-476a-8726-6f6875845016-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/9bf675ff-be70-4355-91c5-8e18080c8c68-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/d7faad9d-13fb-4b97-a1f3-1e26c953c39e-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/7ef2298fde41cc6eeb7af42e48b7d293-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/d82eb4fd963d448e2fcb7d7b793b5df3-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/fe547fea3a41b43a38975d292a2b19c7-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/6cc790b63b123a6a96ee260fcdad32a9-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/62f91419b9ebdb6975e7e41ab6412357-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/CACHEDIR.TAG'
removed '/home/parallels/.cache/fontconfig/34c14d25-aac1-49d7-8585-f07f1cdde26f-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/c3bb64600bf7a4aa73b55dc8bb82b27b-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/707971e003b4ae6c8121c3a920e507f5-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/f5182443-7f0a-402c-8c37-16e32fd9e2c0-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/573ec803664ed168555e0e8b6d0f0c7f-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/91249637-64e7-423d-8e99-ec8b1b6cfea2-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/e13b20fdb08344e0e664864cc2ede53d-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/91d6c576-b8f5-45f9-bc03-8b43204df48c-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/dad9d2ab-a340-4946-b128-709478dde81f-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/95530828ff6c81d309f8258d8d02a23e-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/3830d5c3ddfd5cd38a049b759396e72e-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/4c599c202bc5c08e2d34565a40eac3b2-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/31a5c1bd-ef59-4be8-908e-e881ee53145a-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/57e423e26b20ab21d0f2f29c145174c3-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/d3e5c4ee2ceb1fc347f91d4cefc53bc0-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/d2cf406b-af40-4f09-a9c1-06bf83e64db5-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/a4e60e8d1e10d2fdff3fe3037a1845fb-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/d589a48862398ed80a3d6066f4f56f4c-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/6333f38776742d18e214673cd2c24e34-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/f1f2465696798768e9653f19e17ccdc8-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/188ac73a183f12857f63bb60a4a6d603-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/32b6488e5b8292a2e95c79d947e009e8-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/309911ff-1c67-40a5-9264-e1760a9448da-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/0bd3dc0958fa2205aaaa8ebb13e2872b-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/a9549eab-b1ec-4bf3-b2de-74af27951325-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/30829fa25452a46451e813d634d7f916-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/238330de-d67f-4146-892b-ef3bdfc8ecfe-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/c855463f699352c367813e37f3f70ea7-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/cabbd14511b9e8a55e92af97fb3a0461-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/e52a45a1c8c8fe895fc0fc8c4e6999b8-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/4d710948-a55a-4bb6-830e-cfbee2e16a9e-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/da43223dd54fb3bb4243ae19d4b583b2-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/3f7329c5293ffd510edef78f73874cfd-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/eeebfc908bd29a90773fd860017aada4-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/21a99156bb11811cef641abeda519a45-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/609346ce-1bae-42db-adca-44f21adecedc-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/9d2451b1fd30e5bffe8383fd27c35478-le64.cache-7'
removed '/home/parallels/.cache/fontconfig/00849bfe-547f-4a8d-af35-750c962abc3f-le64.cache-7'
removed directory '/home/parallels/.cache/fontconfig'
removed '/home/parallels/.cache/gstreamer-1.0/registry.aarch64.bin'
removed directory '/home/parallels/.cache/gstreamer-1.0'
removed '/home/parallels/.cache/ibus/bus/registry'
removed directory '/home/parallels/.cache/ibus/bus'
removed directory '/home/parallels/.cache/ibus'
removed '/home/parallels/.cache/gnome-software/odrs/ratings.json'
removed directory '/home/parallels/.cache/gnome-software/odrs'
removed '/home/parallels/.cache/gnome-software/appstream/components.xmlb'
removed directory '/home/parallels/.cache/gnome-software/appstream'
removed '/home/parallels/.cache/gnome-software/fwupd/remotes.d/lvfs/metadata.xml.gz.jcat'
removed '/home/parallels/.cache/gnome-software/fwupd/remotes.d/lvfs/metadata.xml.gz'
removed directory '/home/parallels/.cache/gnome-software/fwupd/remotes.d/lvfs'
removed directory '/home/parallels/.cache/gnome-software/fwupd/remotes.d'
removed directory '/home/parallels/.cache/gnome-software/fwupd'
removed directory '/home/parallels/.cache/gnome-software'
removed directory '/home/parallels/.cache/folks/avatars'
removed directory '/home/parallels/.cache/folks'
removed '/home/parallels/.cache/event-sound-cache.tdb.a852749937fa462887f881048492900f.aarch64-unknown-linux-gnu'
removed '/home/parallels/.cache/champlain/osm.streets/2/2/3.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/2/2.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/2/1.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/2/0.png'
removed directory '/home/parallels/.cache/champlain/osm.streets/2/2'
removed '/home/parallels/.cache/champlain/osm.streets/2/1/3.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/1/2.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/1/1.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/1/0.png'
removed directory '/home/parallels/.cache/champlain/osm.streets/2/1'
removed '/home/parallels/.cache/champlain/osm.streets/2/3/3.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/3/2.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/3/1.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/3/0.png'
removed directory '/home/parallels/.cache/champlain/osm.streets/2/3'
removed '/home/parallels/.cache/champlain/osm.streets/2/0/3.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/0/2.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/0/1.png'
removed '/home/parallels/.cache/champlain/osm.streets/2/0/0.png'
removed directory '/home/parallels/.cache/champlain/osm.streets/2/0'
removed directory '/home/parallels/.cache/champlain/osm.streets/2'
removed directory '/home/parallels/.cache/champlain/osm.streets'
removed '/home/parallels/.cache/champlain/cache.db'
removed directory '/home/parallels/.cache/champlain'
removed '/home/parallels/.cache/tracker/meta.db-wal'
removed '/home/parallels/.cache/tracker/locale-for-miner-apps.txt'
removed '/home/parallels/.cache/tracker/db-locale.txt'
removed '/home/parallels/.cache/tracker/meta.db-shm'
removed '/home/parallels/.cache/tracker/last-crawl.txt'
removed '/home/parallels/.cache/tracker/parser-version.txt'
removed '/home/parallels/.cache/tracker/ontologies.gvdb'
removed '/home/parallels/.cache/tracker/meta.db'
removed '/home/parallels/.cache/tracker/first-index.txt'
removed '/home/parallels/.cache/tracker/db-version.txt'
removed directory '/home/parallels/.cache/tracker'
removed directory '/home/parallels/.cache/evolution/addressbook/trash'
removed directory '/home/parallels/.cache/evolution/addressbook'
removed directory '/home/parallels/.cache/evolution/sources/trash'
removed directory '/home/parallels/.cache/evolution/sources'
removed directory '/home/parallels/.cache/evolution/tasks/trash'
removed directory '/home/parallels/.cache/evolution/tasks'
removed directory '/home/parallels/.cache/evolution/calendar/trash'
removed directory '/home/parallels/.cache/evolution/calendar'
removed directory '/home/parallels/.cache/evolution/mail/trash'
removed directory '/home/parallels/.cache/evolution/mail'
removed directory '/home/parallels/.cache/evolution/memos/trash'
removed directory '/home/parallels/.cache/evolution/memos'
removed directory '/home/parallels/.cache/evolution'
removed directory '/home/parallels/.cache/libgweather'
removed directory '/home/parallels/.cache'
removed directory '/home/parallels/Documents'
removed directory '/home/parallels/.local/share/flatpak/db'
removed directory '/home/parallels/.local/share/flatpak'
removed '/home/parallels/.local/share/gvfs-metadata/root-4777ccde.log'
removed '/home/parallels/.local/share/gvfs-metadata/home-3c5b3c55.log'
removed '/home/parallels/.local/share/gvfs-metadata/root'
removed '/home/parallels/.local/share/gvfs-metadata/home'
removed directory '/home/parallels/.local/share/gvfs-metadata'
removed directory '/home/parallels/.local/share/sounds'
removed '/home/parallels/.local/share/folks/relationships.ini'
removed directory '/home/parallels/.local/share/folks'
removed '/home/parallels/.local/share/xorg/Xorg.0.log'
removed directory '/home/parallels/.local/share/xorg'
removed '/home/parallels/.local/share/gnome-shell/notifications'
removed '/home/parallels/.local/share/gnome-shell/gnome-overrides-migrated'
removed '/home/parallels/.local/share/gnome-shell/application_state'
removed directory '/home/parallels/.local/share/gnome-shell'
removed '/home/parallels/.local/share/keyrings/login.keyring'
removed '/home/parallels/.local/share/keyrings/user.keystore'
removed directory '/home/parallels/.local/share/keyrings'
removed '/home/parallels/.local/share/gnome-settings-daemon/input-sources-converted'
removed directory '/home/parallels/.local/share/gnome-settings-daemon'
removed '/home/parallels/.local/share/tracker/data/tracker-store.journal'
removed '/home/parallels/.local/share/tracker/data/tracker-store.ontology.journal'
removed directory '/home/parallels/.local/share/tracker/data'
removed directory '/home/parallels/.local/share/tracker'
removed '/home/parallels/.local/share/recently-used.xbel'
removed directory '/home/parallels/.local/share/icc'
removed directory '/home/parallels/.local/share/evolution/addressbook/trash'
removed '/home/parallels/.local/share/evolution/addressbook/system/contacts.db'
removed directory '/home/parallels/.local/share/evolution/addressbook/system/photos'
removed directory '/home/parallels/.local/share/evolution/addressbook/system'
removed directory '/home/parallels/.local/share/evolution/addressbook'
removed directory '/home/parallels/.local/share/evolution/tasks/trash'
removed '/home/parallels/.local/share/evolution/tasks/system/tasks.ics'
removed directory '/home/parallels/.local/share/evolution/tasks/system'
removed directory '/home/parallels/.local/share/evolution/tasks'
removed directory '/home/parallels/.local/share/evolution/calendar/trash'
removed '/home/parallels/.local/share/evolution/calendar/system/calendar.ics'
removed directory '/home/parallels/.local/share/evolution/calendar/system'
removed directory '/home/parallels/.local/share/evolution/calendar'
removed directory '/home/parallels/.local/share/evolution/mail/trash'
removed directory '/home/parallels/.local/share/evolution/mail'
removed directory '/home/parallels/.local/share/evolution/memos/trash'
removed directory '/home/parallels/.local/share/evolution/memos'
removed directory '/home/parallels/.local/share/evolution'
removed directory '/home/parallels/.local/share/applications'
removed directory '/home/parallels/.local/share'
removed directory '/home/parallels/.local'
removed '/home/parallels/.profile'
removed directory '/home/parallels/Videos'
removed '/home/parallels/.parallels/user-dirs.dirs'
removed '/home/parallels/.parallels/gtk-bookmarks.orig'
removed '/home/parallels/.parallels/user-dirs.dirs.orig'
removed '/home/parallels/.parallels/parallels.log'
removed '/home/parallels/.parallels/gtk-bookmarks'
removed directory '/home/parallels/.parallels'
removed directory '/home/parallels/Templates'
removed '/home/parallels/.bash_logout'
removed '/home/parallels/.bashrc'
removed directory '/home/parallels/Music'
removed '/home/parallels/.gnupg/trustdb.gpg'
removed '/home/parallels/.gnupg/pubring.kbx'
removed directory '/home/parallels/.gnupg'
removed directory '/home/parallels/Downloads'
removed directory '/home/parallels/Public'
removed directory '/home/parallels/Pictures'
removed directory '/home/parallels'
removed directory '/home'
removed directory '/media/cdrom0'
removed directory '/media/psf'
removed '/media/cdrom'
removed '/media/parallels/NO_NAME/file3881.txt'
removed '/media/parallels/NO_NAME/file3882.txt'
removed '/media/parallels/NO_NAME/file3883.txt'
removed '/media/parallels/NO_NAME/file3884.txt'
removed '/media/parallels/NO_NAME/file3885.txt'
removed '/media/parallels/NO_NAME/file3886.txt'
removed '/media/parallels/NO_NAME/file3887.txt'
removed '/media/parallels/NO_NAME/file3888.txt'
removed '/media/parallels/NO_NAME/file3889.txt'
removed '/media/parallels/NO_NAME/file3890.txt'
removed '/media/parallels/NO_NAME/file3891.txt'
removed '/media/parallels/NO_NAME/file3892.txt'

part if the reinitialization.

everything in /root, /media and /home will be removed.

As this includes any shares and mounts in the standard VM configuration (at least with Parallels), I’d prefer a warning and suggestion to isolate any VM carefully prior installation.

where did you mount your drive on?

@HolgerTB I know you created a Parallels installation as well. Maybe you can give some thoughts.

did you redirect any folders within parallels tonten vm?

All I’d suggest would be a script warning, that all mounts and shares will be deleted when proceeding with step 5.
BTW: The final steps didn’t work for me, but this is another topic:

[  OK  ] DietPi-Installer | Completed, disk can now be saved to .img for later use, or, reboot system to start first run of DietPi.
[  OK  ] DietPi-Installer | To create an .img file, you can "poweroff" and run the following command from the host/external DietPi system:
         - bash -c "$(curl -sSf https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-imager)"

After powerdown, the VM will not start.
error: you need to load the kernel first