EdgeRouter - Are my changes lost when I upgrade the firmware image?

Q: I followed the instructions for adding debian packages to my system, but will those packages be lost when I upgrade to a new image?

A: Yes, the upgrade creates a new filesystem.  One approach that I use is to putting the following script in /config/scripts/post-config.d/

ubnt@RTR5:/config/scripts/post-config.d$ cat install_my_packages.sh

packages='screen rsync iftop iptraf mtr-tiny bmon'

if [ -e $doneit ]; then
exit 0;

apt-get update
apt-get install -y $packages 
if [ $? == 0 ]; then 
 echo package install successful 
 touch $doneit 
 echo package install failed 
exit 0

Things to note:

  1. The entire /config directory gets copied to the new image, so that's a good place to put things like scripts, openvpn keys, etc.
  2. Every executable in /config/scripts/post-config.d directory get run after boot-up and configuration is complete.  This script creates a file when upon completion, so it should only try to fetch the packages once.


Q: Since the system keeps 2 images, how do I switch back to the old image?

A: See the section on switching images at EdgeMAX image management.


Q: Can I find a file on the old image without rebooting into it?

A: Yes, the old filesystem can be found at  /root.dev/w.o/