Using Ubuntu 20.04. I can disable Overlay file system by manually calling a command which creates a shell, then calling a second script from within this new shell. However I would like to be able to script it so I can auto update a pc.
Here are the two scripts I run to diable OverlayFS:
Script 1: Open a shell that allows permanent changes (overlayroot-chroot creates a new shell)
#!/bin/bash
# Enter chroot mode, which allows one to make permanent changes to / parition
echo "Enter mood to make permanent changes"
echo "Press CTRL+D to exit when finished editing"
sudo overlayroot-chroot
Script 2: Make the changes
#!/bin/bash
# Disable OverlayFS
echo "Disable overlayfs (read only file system at /)"
FILE=/etc/overlayroot.conf
cat << EOF | sudo tee $FILE
overlayroot_cfgdisk="disabled"
overlayroot=""
EOF
echo "COMPLETE."
echo "Press CTRL+D to exit chroot mode."
echo "Then 'sudo reboot' for the changes to take effect."
Script 2 needs to run within the shell that script 1 created.
But how does one pass the command to run into the new created shell?