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:
- The entire /config directory gets copied to the new image, so that's a good place to put things like scripts, openvpn keys, etc.
- 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.
Users have reported that the above script can cause problems when there is not enough space available on the root device. In which case the script below can be used to alleviate these issues:
sudo cat /config/scripts/post-config.d/install_my_packages.sh
packages='screen' doneit='/var/lib/my_packages' if [ -e $doneit ]; then
mount -t tmpfs -o size=30% tmpfs /var/lib/apt/lists
if [ $? != 0 ]; then
echo Could not mount tmpfs on /var/lib/apt/lists
apt-get update apt-get --no-install-recommends install -y $packages
if [ $? == 0 ]; then
echo Package install successful touch $doneit
echo Package install failed
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/