info_i_25x25.png See important information about Ubiquiti Devices and KRACK Vulnerability in this article. We will update this document as more information becomes available.

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
#!/bin/bash

doneit='/var/lib/my_packages'
packages='screen rsync iftop iptraf mtr-tiny bmon'

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

apt-get update
apt-get install -y $packages 
if [ $? == 0 ]; then 
 echo package install successful 
 touch $doneit 
else 
 echo package install failed 
fi 
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/