Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:installation:generic.sysupgrade [2021/09/03 08:55] – [Upgrade procedure] someothertimedocs:guide-user:installation:generic.sysupgrade [2023/01/18 10:38] – [Can you keep settings?] update link vgaetera
Line 1: Line 1:
 ====== Upgrading OpenWrt firmware using LuCI and CLI ====== ====== Upgrading OpenWrt firmware using LuCI and CLI ======
-  * Related pages+See also
-    * [[docs:techref:flash.layout|Flash Layout]]: provides background on how OpenWrt uses device storage space+    * [[docs:techref:flash.layout|OpenWrt flash Layout]]
     * [[docs:guide-user:installation:sysupgrade.cli|Upgrading OpenWrt firmware using CLI]]     * [[docs:guide-user:installation:sysupgrade.cli|Upgrading OpenWrt firmware using CLI]]
     * [[docs:guide-quick-start:sysupgrade.luci|Upgrading OpenWrt firmware using LuCI]]     * [[docs:guide-quick-start:sysupgrade.luci|Upgrading OpenWrt firmware using LuCI]]
 +    * [[docs:guide-quick-start:admingui_sysupgrade_keepsettings#upgrade_compatibility|Keep Settings and Upgrade Compatibility]]
 +    * [[docs:guide-user:installation:sysupgrade.packages|Saving/restoring user-installed packages]]
  
-An OpenWrt **upgrade** will replace the entire current OpenWrt installation with a new version. +===== How the OpenWrt upgrade works ===== 
-This includes the Linux kernel, the SquashFS partition and the JFFS2 partition. This is NOT the same as a first time installation.+An OpenWrt **sysupgrade** will replace the entire current OpenWrt installation with a new version. 
 +This includes the Linux kernel and SquashFS/ext4/ubifs/JFFS2/other OS partition/s. This is NOT the same as a first time installation (factory).
  
-The common upgrade paths below will automatically preserve much of the OpenWrt OS configuration by saving and then restoring configuration files in specific common locations (including ''/etc/config'')+Sysupgrade via LuCI or CLI works by optionally saving specified configuration files, **wiping the entire file system**, installing the new version of OpenWrt and then restoring back the saved configuration files. 
-This will preserve things like OpenWrt network settings, Wi-Fi settings, the device hostname, and so on.+**This means that any parts of the file system that are not specifically saved will be lost.**
  
 +In particular, any manually installed software packages you may have installed after the initial OpenWrt installation have to be reinstalled after an OpenWrt upgrade.
 +That way everything will match, e.g. the updated Linux kernel and any installed kernel modules.
 +
 +Any configuration files or data files placed in locations not specifically listed as being preserved below will also be lost in an OpenWrt upgrade.
 +Be sure to check any files you have added or customized from a default OpenWrt install to back up these items before an upgrade.
 +
 +See [[https://web.archive.org/web/20220919082336/https://blog.mbirth.de/archives/2014/05/26/openwrt-sysupgrade-with-extroot.html|this howto]] about extroot procedure.
 +
 +For [[tag:dual_firmware|Dual Firmware Devices]] please consult your device page for additional information.
 +
 +By compiling your own custom image with an OpenWrt buildroot or generating with the imagebuilder, it is possible to remove the need to perform many of the steps above.
 +
 +===== Upgrade steps =====
 +==== 1. Prepare ====
 The first part of the upgrade process is to prepare for the upgrade. The first part of the upgrade process is to prepare for the upgrade.
 +  - Setup for data migration ( keep settings ) and additional sysupgrade.conf entries
 +  - Export / save installed package list / manifest
 +  - Obtain / verify new installation sysupgrade image (and current / known good one to revert to)
 +
 This includes documenting programs and settings that will need to be re-installed or restored after the upgrade, locating and downloading the correct OpenWrt upgrade image for your hardware. This includes documenting programs and settings that will need to be re-installed or restored after the upgrade, locating and downloading the correct OpenWrt upgrade image for your hardware.
  
-Next is the actual upgrade. +When it is possible to 'keep settings' sysupgrade will automatically preserve much of the OpenWrt OS configuration by saving and then restoring configuration files in specific common locations (including ''/etc/config'')This will preserve things like OpenWrt network settings, Wi-Fi settings, the device hostname, and so onSome data files and directories for additional services will need to be configured manually.
-There are two common upgrade paths to actually perform the upgrade. +
-One uses the LuCI web interface "Flash new firmware image" command and one uses the command-line ''sysupgrade'' commandBoth use the same '...sysupgrade.bin' upgrade file (more below). +
-You can use either approach.+
  
-After the OS upgrade, there are usually some additional configuration steps required to re-install additional packages not part of the base OpenWrt install, to configure new OpenWrt functionality or to update configuration files to reflect new settings or updated packages. +==== 2. Upgrade ==== 
-Please see the section below with more details.+Next is the actual upgrade. The two common upgrade methods to perform the upgrade are: 
 +  * LuCI web interface System -> Backup / Flash Firmware -> "Flash new firmware image" 
 +  * Command-line using ''sysupgrade'' command over console or ssh
  
-===== Preparing for upgrade ===== +Both use the same ''...sysupgrade.bin/img.gz'' file (more below).
-==== How the OpenWrt upgrade works ==== +
-Both the LuCI and sysupgrade upgrade procedures work by saving specified configuration files, **wiping the entire file system**, installing the new version of OpenWrt and then restoring back the saved configuration files. +
-**This means that any parts of the file system that are not specifically saved will be lost.**+
  
-In particularany manually installed software packages you may have installed after the initial OpenWrt installation have to be reinstalled after an OpenWrt upgrade. +==== 3. Post Install ConfigurationSetup or Restore ==== 
-That way everything will match, e.g. the updated Linux kernel and any installed kernel modules.+After the OS upgrade, there are usually some additional configuration steps required to; 
 +  * Re-install additional packages not part of the base OpenWrt install 
 +  * Configure new OpenWrt functionality or to 
 +  * Update configuration files to reflect new settings or updated packages
  
-Any configuration files or data files placed in locations not specifically listed as being preserved below will also be lost in an OpenWrt upgrade. +Please see the section below with more details.
-Be sure to check any files you have added or customized from a default OpenWrt install to back up these items before an upgrade.+
  
-See [[https://wiki.mbirth.de/know-how/software/openwrt/sysupgrade-with-extroot.html|this howto]] about extroot procedure.+===== Preparing for upgrade =====
 ==== Can you keep settings? ==== ==== Can you keep settings? ====
 +See also:
 +[[docs:guide-quick-start:admingui_sysupgrade_keepsettings#upgrade_compatibility|Upgrade Compatibility]]
  
 Most of the time you can, jumping several versions, downgrading, if the release notes or upgrade message informs you it's not possible, then you will need to plan ahead of time and factor in the time and information required to re-apply some or most of your previous configuration manually. Most of the time you can, jumping several versions, downgrading, if the release notes or upgrade message informs you it's not possible, then you will need to plan ahead of time and factor in the time and information required to re-apply some or most of your previous configuration manually.
Line 40: Line 61:
   - It is worthwhile not keeping settings once every 12-16 months   - It is worthwhile not keeping settings once every 12-16 months
   - Trying to get around the advice to start with new settings when needed can result in odd issues that can be difficult to troubleshoot   - Trying to get around the advice to start with new settings when needed can result in odd issues that can be difficult to troubleshoot
 +
 ==== Will you need to revert? ==== ==== Will you need to revert? ====
- 
 A time may come when you attempt an upgrade and for whatever reason it is unsuccessful. Contingency planning is a good skill for anything in IT. A time may come when you attempt an upgrade and for whatever reason it is unsuccessful. Contingency planning is a good skill for anything in IT.
  
Line 47: Line 68:
   - Do you have a copy of your current (pre-upgrade) OS version if you need to re-install? (both factory and sysupgrade or even vendor firmware may be required)   - Do you have a copy of your current (pre-upgrade) OS version if you need to re-install? (both factory and sysupgrade or even vendor firmware may be required)
   - Do you have a spare device in case things go pear shaped or you need much more time than expected?   - Do you have a spare device in case things go pear shaped or you need much more time than expected?
-==== Saving/restoring user-installed packages ==== 
-:!: Set up [[docs:guide-user:advanced:opkg_extras|Opkg extras]] and [[docs:guide-user:advanced:hotplug_extras|Hotplug extras]] to be able to use the following features: 
-  * Automatically identify user-removed and user-installed packages. 
-  * Save the resulting Opkg profile to ''/etc/config/opkg'', which you can [[docs:guide-user:troubleshooting:backup_restore|back up]] as usual. 
-  * Automatically restore the profile if you [[docs:guide-quick-start:admingui_sysupgrade_keepsettings|keep settings]], or you can restore it manually. 
  
-<code bash> 
-opkg save 
-opkg restore 
-</code> 
- 
-==== Alternatives to save/restore user-installed packages ==== 
-=== Opkgscript === 
-Copy [[https://github.com/richb-hanover/OpenWrtScripts/blob/master/opkgscript.sh|opkgscript]] to your router. 
-Ideally in a directory which will be preserved after flashing so you don't have to copy it again. 
-Make it executable: 
- 
-<code bash> 
-chmod +x /path/to/the/opkgscript.sh 
-</code> 
- 
-Create a snapshot of the installed packages: 
- 
-<code bash> 
-/path/to/the/opkgscript.sh -v write 
-</code> 
- 
-By default the script will save the list in /etc/config/opkg.installed, which is preserved over flashing. 
-When you log back in after the upgrade configure the internet connectivity, run and wait until it finished with the installation: 
- 
-<code bash> 
-/path/to/the/opkgscript.sh -v install 
-</code> 
- 
- 
-For more examples see: [[docs:guide-user:installation:generic.sysupgrade#additional_package_export_or_restore_methods|Additional Package Export or Restore Methods]] 
 ==== Configure your backup ==== ==== Configure your backup ====
-Follow: [[docs:guide-user:troubleshooting:backup_restore|Backup and restore]] +{{section>docs:guide-user:installation:sysupgrade.cli#back_up_openwrt_configuration&noheader&nofooter&noeditbutton}}
- +
-Based on the list of [[docs:guide-user:installation:generic.sysupgrade#savingrestoring_user-installed_packages|user-installed packages]] customize your backup configuration to save the files not included in the default list. +
-Verify your backup configuration and ensure that all OpenWrt configurations and user data are going to be preserved.+
  
 ==== Downloading the OpenWrt upgrade image ==== ==== Downloading the OpenWrt upgrade image ====
 === Getting the right image === === Getting the right image ===
-In most cases, platforms that support sysupgrade, have a downloadable image labelled **"...-sysupgrade.bin"** ...+In most cases, platforms that support sysupgrade, have a downloadable image labelled **''...-sysupgrade.bin''** ...
  
   * Images labelled "factory" or otherwise are generally not intended to be installed via an existing OpenWrt web interface.   * Images labelled "factory" or otherwise are generally not intended to be installed via an existing OpenWrt web interface.
Line 99: Line 82:
  
 === OpenWrt on x86 === === OpenWrt on x86 ===
-For x86 use the same image you used to install OpenWrt as a sysupgrade image as well. So if you installed OpenWrt x86-64 **openwrt-version-number-x86-64-combined-ext4.img.gz** you need to choose same image to do a sysupgrade if you installed Openwrt with **openwrt-version-number-x86-64-combined-squashfs.img.gz** you need that image to do a firmware upgrade.+For x86 use the same image you used to install OpenWrt as a sysupgrade image as well. So if you installed OpenWrt x86-64 ''openwrt-version-number-x86-64-combined-ext4.img.gz'' you need to choose same image to do a sysupgrade if you installed Openwrt with ''openwrt-version-number-x86-64-combined-squashfs.img.gz'' you need that image to do a firmware upgrade.
  
 WARNING: Double check you have the exact model number and in some cases country... WARNING: Double check you have the exact model number and in some cases country...
Line 106: Line 89:
  
 NOTE: Keep a copy of images you use, you never know if you may need them again and that may be difficult if your internet is down! NOTE: Keep a copy of images you use, you never know if you may need them again and that may be difficult if your internet is down!
- 
  
 ===== Upgrade procedure ===== ===== Upgrade procedure =====
 +==== For LuCI-based upgrades ====
 +See also:
 +[[docs:guide-quick-start:sysupgrade.luci|Upgrading OpenWrt firmware using LuCI]]
  
-==== For LuCI-based upgrades ==== 
   * Download the desired upgrade file to your PC using a web browser   * Download the desired upgrade file to your PC using a web browser
   * Proceed to the LuCI upgrade procedure, below   * Proceed to the LuCI upgrade procedure, below
Line 126: Line 110:
   * See CLI instructions page below:   * See CLI instructions page below:
     * [[docs:guide-user:installation:sysupgrade.cli|Upgrading OpenWrt firmware using CLI]]     * [[docs:guide-user:installation:sysupgrade.cli|Upgrading OpenWrt firmware using CLI]]
 +
 === For sysupgrade cli based upgrades === === For sysupgrade cli based upgrades ===
   * Download the desired upgrade file to the local /tmp RAM drive on your OpenWrt system. The ''/tmp'' directory is stored in RAM (using [[wp>tmpfs]]), not in the permanent flash storage.   * Download the desired upgrade file to the local /tmp RAM drive on your OpenWrt system. The ''/tmp'' directory is stored in RAM (using [[wp>tmpfs]]), not in the permanent flash storage.
Line 134: Line 119:
 wget http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/openwrt-15.05-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin wget http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/openwrt-15.05-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin
  
-# check the integrity of the image file +# check the integrity of the image file via md5sums (older images)
-via md5sums+
 wget http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/md5sums wget http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/md5sums
-# via sha256sums+md5sum -c md5sums 2> /dev/null | grep OK 
 + 
 +check the integrity of the image file via sha256sums
 wget http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/sha256sums wget http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/sha256sums
 +sha256sum -c sha256sums 2> /dev/null | grep OK
 +
 # the desired result is that the downloaded firmware filename is listed with "OK" afterwards # the desired result is that the downloaded firmware filename is listed with "OK" afterwards
-via md5sums + 
-md5sum -c md5sums 2> /dev/null | grep OK +###################################################
-via sha256sums +# Initiate sysupgrade with your desired options 
-sha256sum -c sha256sums 2> /dev/null | grep OK+# by default ( no -n ) settings are kept 
 +#################################################### 
 +sysupgrade -/tmp/openwrt-15.05-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin
 </code> </code>
- 
-  * Proceed to the "Ensure desired configuration files will be saved" section, above 
  
 NOTE: see extras at end of page for low memory device workarounds NOTE: see extras at end of page for low memory device workarounds
- 
- 
  
 ===== Extras ===== ===== Extras =====
Line 157: Line 143:
   * In SSH, the login banner has the release information   * In SSH, the login banner has the release information
  
-==== Package upgrade warning ====+==== Upgrade installed packages ==== 
 +Follow: 
 +[[docs:guide-user:additional-software:opkg#upgrading_packages|Upgrading packages]] 
 After the initial update, it is good to check for any updated packages released after the base OS firmware image was built. After the initial update, it is good to check for any updated packages released after the base OS firmware image was built.
 Note that on a device with only 4MB of NVRAM, these updates may not fit – check free space first with ''df -h /'' and ensure there is at least 600KB or so free. Note that on a device with only 4MB of NVRAM, these updates may not fit – check free space first with ''df -h /'' and ensure there is at least 600KB or so free.
  
-{{page>meta:infobox:upgrade_packages_warning&noheader&nofooter&noeditbtn}}+==== Reinstall user-installed packages ==== 
 +See also: 
 +[[docs:guide-user:installation:sysupgrade.packages|Preserving packages]]
  
-==== Upgrade installed packages ==== 
-:!: Read the [[docs:guide-user:installation:generic.sysupgrade#package_upgrade_warning|package upgrade warning]] and follow [[docs:guide-user:advanced:opkg_extras|Opkg extras]] to upgrade installed packages. 
- 
-==== Reinstall user-installed packages ==== 
 After a successful upgrade, you will need to reinstall all previously installed and saved packages. After a successful upgrade, you will need to reinstall all previously installed and saved packages.
-Package configuration files should have been preserved due to steps above, but not the actual packages themselves. 
-You can reinstall packages manually with [[docs:guide-user:additional-software:opkg|Opkg]], or follow the section [[docs:guide-user:installation:generic.sysupgrade#savingrestoring_user-installed_packages|Saving/restoring user-installed packages]] to automate the process. 
  
 ==== Configure user-installed packages ==== ==== Configure user-installed packages ====
 +See also:
 +[[docs:guide-user:installation:sysupgrade.cli#comparing_new_package_config_options|Comparing configurations]]
 +
 The new package installations will have installed new, default versions of package configuration files. The new package installations will have installed new, default versions of package configuration files.
-As your existing configuration files were already in place, opkg would have displayed a warning about this and saved the new configuration file versions under ''*-opkg'' filenames.+If existing configuration files are in place, opkg displays a warning about this and saves the new configuration file versions under ''/etc/config/*-opkg'' filenames.
  
-The new package-provided configuration files should be compared with your older customized files to merge in any new options or changes of syntax in these files.+The new package-provided config files should be compared with your older customized files to merge in any new options or changes of syntax.
 The ''diff'' tool is helpful for this. The ''diff'' tool is helpful for this.
- 
-:!: Set up [[docs:guide-user:advanced:opkg_extras|Opkg extras]] and [[docs:guide-user:advanced:uci_extras|UCI extras]] to be able to use the following features. 
- 
-<code bash> 
-# Install packages 
-opkg update 
-opkg install diffutils 
- 
-# Find new configurations 
-opkg newconf 
- 
-# Compare UCI configurations 
-uci diff snmpd 
- 
-# Merge needed changes to the current version 
-vi /etc/config/snmpd 
-rm /etc/config/snmpd-opkg 
- 
-# Or replace the current version with the new one 
-mv /etc/config/snmpd-opkg /etc/config/snmpd 
- 
-# Apply new configuration 
-/etc/init.d/snmpd restart 
-</code> 
- 
-===== Upgrade compatibility ===== 
-//**The following section only applies if image metadata is used for the upgrade process.**// 
- 
-We regularly encounter the situation that devices are subject to changes that will make them incompatible to previous versions. 
-This typically happens when the setup of a device has changed in a way so that the configuration cannot be migrated or filesystem changes won't allow sysupgrade. 
- 
-Since August 2020 (20.xx release), an additional mechanism will make sure that users are warned when upgrading between incompatible versions like that. 
- 
-The is achieved by a compatibility version number that is stored on the device and the images. 
-The compat-version is built from a major revision x and a minor revision y: **x.y** 
- 
-For all devices and image before the introduction, the default value "1.0" is assumed. 
-The value is assigned for individual devices, so it does not tell anything about the general revision of OpenWrt. 
- 
-If an incompatible change is introduced, one can increase either the minor version (1.0->1.1) or the major version (1.0->2.0). 
- 
-**Minor version increment:** 
- 
-This will still allow sysupgrade, but require to reset config (uncheck "Keep Settings", run sysupgrade with -n or SAVE_CONFIG=0). 
-If sysupgrade is called without, a corresponding message will be printed. 
-If sysupgrade is called and settings are reset, it will just pass, with supported devices being checked as usual. 
- 
-**Major version increment:** 
- 
-This is meant for potential (rare) cases where sysupgrade is not possible at all, because it would "break" the device. 
-In this case, a warning will be printed, and resetting config (''sysupgrade -n'') won't help. 
-You will need to research instructions on how to proceed. 
- 
-Typically, in addition to the increment of the compatibility version, developers will also specify a message to be printed with the warnings above giving a first hint about the problem. 
- 
-==== Forcing upgrade ==== 
-In any case, upgrade can still be forced (''sysupgrade -F'') as usual, but then you will obviously run into the very problem the mechanism tries to save you from. 
- 
-If you do that, please note that the compatibility version on the device is a property of the config, i.e. the value is stored in uci: ''system.@system[0].compat_version'' 
- 
-Consequently, as a forced update won't reset your config, it also won't bump your compat-version, and you will have to do that manually afterwards, e.g. 
- 
-<code bash> 
-uci set system.@system[0].compat_version="1.1" 
-uci commit system 
-</code> 
- 
-==== Backward compatibility ==== 
-As stated above, all devices and images without compat-version set will be treated as "1.0". 
- 
-However, the new compat-version-aware upgrade mechanism will only be available on devices flashed after that point. 
- 
-For older devices, the metadata in new images has been altered to provide a similar experience for incremented compat-version: 
- 
-On those devices, when upgrading into an "incompatible" image, incompatibility warnings and hint message will be printed. 
-However, upgrade has to be forced in all cases (''sysupgrade -F -n''). 
-Make sure to also reset config in addition to the "force" parameter, as otherwise you will end up as described in "Forcing upgrade" section above. 
-The only exception applies to early DSA-adopters, which can keep their config. 
-Details are found in "Forcing upgrade" section above. 
- 
-==== Implementation details ==== 
-//**This section is focussed on developers wanting to implement compat-version after introducing an incompatible change.**// 
- 
-Setup consists of two parts: 
- 
-=== Image metadata === 
-To set the version of an image, which is checked against the locally installed OpenWrt config version, the variables DEVICE_COMPAT_VERSION and DEVICE_COMPAT_MESSAGE may be added to a device definition: 
- 
-<code bash> 
-define Device/somedevice 
-  ... 
-  DEVICE_COMPAT_VERSION := 1.1 
-  DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA 
-endef 
-</code> 
- 
-The DEVICE_COMPAT_VERSION is mandatory for any value other than "1.0". 
-The DEVICE_COMPAT_MESSAGE is optional and should be used to provide a hint about the problem and/or possibly measures for the user. 
- 
-=== Device config === 
-Beyond the image metadata, the compat-version also needs to be available on the running device, so it can be compared against any images. 
- 
-Like for the LED/network setup, this will be achieved by a command "ucidef_set_compat_version" to set the compat_version in board.d files, e.g. 
- 
-<code bash> 
-    ucidef_set_compat_version "1.1" 
-</code> 
- 
-During //firstboot//, this will then add a string to /etc/board.json, which will be translated into uci system config. 
- 
-By this, the compat_version, being a version of the config, will also be exposed to the user. 
- 
-Therefore, the on-device compat-version is a property of the config, not of the installation. 
-Consequently, it will be affected by Backup/Restore, but can also be adjusted by the user if necessary. 
- 
-==== Legacy: LuCI flash_keep section of /etc/config/luci ==== 
-LuCI has a separate set of settings for configuration files to be preserved, however it appears to be obsolete since OpenWrt 14.07 and should be ignored. 
- 
-<code bash> 
-uci show luci.flash_keep 
-</code> 
- 
-==== Device Low Memory Workarounds: /tmp is too small to hold the downloaded file ==== 
-If your device's /tmp filesystem is not large enough to store the OpenWrt upgrade image, this section provides tips to temporarily free up RAM. 
- 
-First check memory usage with the ''free'' or ''top'' or ''cat /proc/meminfo'' commands; proceed if you have as much free RAM as the image is in size plus an some additional MiB of free memory. 
- 
-<code bash> 
-# free 
-             total         used         free       shared      buffers 
-Mem:         29540        18124        **11416**                 1248 
--/+ buffers:              16876        12664 
-Swap:            0            0            0 
-</code> 
- 
-In this example there are precisely 11416 KiB of RAM unused. 
-All the rest 32768 - 11416 = 21352 KiB are used somehow and a portion of it can and will be made available by the kernel, if it be needed, the problem is, we do not know how much exactly that is. 
-Make sure //enough// is available. 
-Free space in /tmp also counts towards free memory. 
-Therefore with:  
- 
-<code bash> 
-# free 
-Mem:         13388        12636          752            0         1292 
-Swap:            0            0            0 
-Total:       13388        12636          752 
- 
-# df 
-Filesystem           1K-blocks      Used Available Use% Mounted on 
-/dev/root                 2304      2304         0 100% /rom 
-tmpfs                     6696        60      6636   1% /tmp 
-tmpfs                      512               512   0% /dev 
-/dev/mtdblock3             576       288       288  50% /overlay 
-mini_fo:/overlay          2304      2304         0 100% / 
-</code> 
- 
-One has actually 752+6636 KiB of free memory available. 
- 
-  * quickest and safest way to free up, some RAM is to delete the package lists: 
- 
-<code bash> 
-rm -r /tmp/opkg-lists/ 
-</code> 
- 
-  * drop caches: 
- 
-<code bash> 
-sync && echo 3 > /proc/sys/vm/drop_caches 
-</code> 
- 
-  * prevent wireless drivers to be loaded at next boot and then reboot: 
- 
-<code bash> 
-rm /etc/modules.d/*80211* 
-rm /etc/modules.d/*ath9k* 
-rm /etc/modules.d/b43* 
-reboot 
-</code> 
- 
-The wireless drivers, usually take up quite some amount of RAM and are not required (unless you are connected via wireless of course ;-)), so an easy way to free up some RAM is to delete the symlinks in ''etc/modules.d'' so these are not loaded into memory at the next reboot. 
- 
-==== Additional Package Export or Restore Methods ==== 
- 
-fixme: these need their own page 
- 
-=== Script by gsenna === 
-[[https://forum.openwrt.org/viewtopic.php?id=43480|Default packages attitude 12.09rc2 tplink 1043nd]] 
- 
-<code bash> 
-# Save the script 
-cat << "EOF" > /tmp/listuserpackages.sh 
-echo >&2 User-installed packages are the following: 
-sed -ne '/^Package:[[:blank:]]*/ { 
-    s/// 
-    h 
-} 
-/user installed/ { 
-    g 
-    p 
-}' /usr/lib/opkg/status 
-EOF 
- 
-# Run the script 
-chmod +x /tmp/listuserpackages.sh 
-/tmp/listuserpackages.sh 
-</code> 
- 
-Note that the script may list several packages that are part of the default OpenWrt install and will have their changed configuration files automatically backed up and restored. 
-In addition, packages installed as dependencies of other packages may show here. 
-**It is only important to note the names of packages that you directly installed manually.** 
-Any dependencies of these packages will automatically be reinstalled when the primary package is reinstalled. 
- 
-=== Script by valentijn === 
-<code bash> 
-# Save the script 
-cat << "EOF" > /tmp/listuserpackages.awk 
-#!/usr/bin/awk -f 
-/^Package:/{PKG= $2} 
-/^Status: .*user installed/{print PKG} 
-EOF 
- 
-# Run the script 
-chmod +x /tmp/listuserpackages.awk 
-/tmp/listuserpackages.awk /usr/lib/opkg/status 
-</code> 
- 
-This script will only output a list of user (and default) installed packages. 
- 
-=== Script by tboege === 
-Shows every package installed after the rom was build (flash_time), if no packages are depending on it. 
-Packages, that are manually installed may be omitted, since one of the listed packages must depends of such a package, all manually installed packages will be installed, if the listed packages are installed: 
- 
-<code bash> 
-cat << "EOF" > /tmp/listuserpackages.awk 
-#!/usr/bin/awk -f 
-BEGIN { 
-    ARGV[ARGC++] = "/usr/lib/opkg/status" 
-    cmd="opkg info busybox | grep '^Installed-Time: '" 
-    cmd | getline FLASH_TIME 
-    close(cmd) 
-    FLASH_TIME=substr(FLASH_TIME,17) 
-} 
-/^Package:/{PKG= $2} 
-/^Installed-Time:/{ 
-    INSTALLED_TIME= $2 
-    # Find all packages installed after FLASH_TIME 
-    if ( INSTALLED_TIME > FLASH_TIME ) { 
-        cmd="opkg whatdepends " PKG " | wc -l" 
-        cmd | getline WHATDEPENDS 
-        close(cmd) 
-        # If nothing depends on the package, it is installed by user 
-        if ( WHATDEPENDS == 3 ) print PKG 
-    } 
-} 
-EOF 
- 
-# Run the script 
-chmod +x /tmp/listuserpackages.awk 
-/tmp/listuserpackages.awk 
-</code> 
- 
-=== Script by mforkel and Rafciq === 
-[[https://forum.openwrt.org/viewtopic.php?id=42739|Identify packages to be re-installed after system upgrade]] 
-Information herein that pertains to 17 or older releases and/or no longer generally advised. 
- 
-=== Legacy scripts === 
-This is an alternative to the script above. 
-This command will list all packages related to any file in the whole file system that has changed from the default OpenWrt default version. 
- 
-Note that the script may list several packages that are part of the default OpenWrt install and will have their changed configuration files automatically backed up and restored. 
-In addition, packages installed as dependences of other packages may show here. 
-**It is only important to note the names of packages that you directly installed manually.** Any dependencies of these packages will automatically be reinstalled when the primary package is reinstalled. 
- 
-<code bash> 
-# OpenWrt 14.07 "Barrier Breaker" or earlier 
-find /overlay/ | while read -r FILE; do opkg search "${FILE#/overlay}"; done | sed -n -e "s/\s.*//p" | sort -u 
- 
-# OpenWrt 15.05 or later 
-find /overlay/upper/ | while read -r FILE; do opkg search "${FILE#/overlay/upper}"; done | sed -n -e "s/\s.*//p" | sort -u 
-</code> 
  
  • Last modified: 2024/10/19 20:05
  • by efahlgren