Differences

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

doc:howto:generic.sysupgrade [2013/04/16 03:46]
iprouteth0
doc:howto:generic.sysupgrade [2014/07/04 16:10] (current)
theoradicus add stable links
Line 1: Line 1:
====== OpenWrt Sysupgrade ====== ====== OpenWrt Sysupgrade ======
-Once again, please have a look at [[doc:techref:Flash Layout]]. A sysupgrade will replace the Linux Kernel and the SquashFS contents and it will erase the entire JFFS2 partition. You can save a couple or all of your your configuration files, but be aware that on rare occasions old configuration files don't work with new program versions. You cannot save installed binaries, you will have to install them again after sysupgrade. That way, everything will match, e.g. the flashed Linux Kernel and installed Kernel modules.+Before reading this, please have a look at [[doc:techref:Flash Layout]].
-It is important to download the firmware image file to ''/tmp''-directory, a [[wp>tmpfs]] drive is mounted to it. That way the data will be downloaded into memory and not onto the flash storage because most likely there is not enough flash storage available! -> [[doc:howto:user.beginner.fhs]]. That means you should [[#Free up RAM |free up enough memory]] beforehand.+A sysupgrade will replace the entire OpenWrt installation: the Linux kernel, the SquashFS partition and the JFFS2 partition. You cannot save installed OPKG packages: you will have to install them again after sysupgrade. That way everything will match, e.g. the flashed Linux Kernel and installed Kernel modules. You can manually save a some of your configuration files, but be aware that on rare occasions you will need to modify an old configuration file to work with the updated program.  
 + 
 +It is important to download the firmware image file to the ''/tmp'' directory
 +The  ''/tmp'' directory is stored in RAM (using [[wp>tmpfs]]), not in the flash storage
 +It is unlikely that there is sufficient free space in flash memory but it is possible to arrange sufficient free space in RAM. 
 +You may need to [[#Free up RAM]] beforehand.
===== Terminal Upgrade Process ===== ===== Terminal Upgrade Process =====
-  - you should check how much RAM you have currently available<code>free</code>. In case you do not have enough left, consult [[#Free up RAM]]. +  - You should check how much main memory you have currently available:<code>free</code> In case you do not have enough free main memory, consult [[#Free up RAM]]. 
-  - populate your ''[[doc/howto/notuci.config#etcsysupgrade.conf|/etc/sysupgrade.conf]]'' +  - Populate your ''[[doc/howto/notuci.config#etcsysupgrade.conf|/etc/sysupgrade.conf]]'' with the configuration files you want to keep 
-  - obtain suitable OpenWrt firmware image (trunk or stable):<code> +  - Obtain suitable OpenWrt firmware image: for trunk<code> 
-cd /tmp +   cd /tmp 
-wget http://downloads.openwrt.org/snapshots/trunk/PLATFORM/xxx-sysupgrade.bin +   wget http://downloads.openwrt.org/snapshots/trunk/PLATFORM/xxx-sysupgrade.bin 
-wget http://downloads.openwrt.org/snapshots/trunk/PLATFORM/md5sums</code>+   wget http://downloads.openwrt.org/snapshots/trunk/PLATFORM/md5sums</code>AA stable<code> 
 +    cd /tmp 
 +    wget http://downloads.openwrt.org/attitude_adjustment/12.09/PLATFORM/xxx-sysupgrade.bin 
 +    wget http://downloads.openwrt.org/attitude_adjustment/12.09/PLATFORM/md5sums</code>
-Some brief things to consider if you are attempting this on a system with an extroot configured +  - check the integrity of the image file:<code> 
-You will need to reinstall your packages, so before you upgrade take some condiseration and follow a few extra steps. +md5sum -c md5sums 2> /dev/null | grep OK</code> 
-I recommend to make a quick list of the packages you had installed.+  - use the following command to upgrade:<code> 
 +sysupgrade -v /tmp/openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-sysupgrade.bin</code>
-<code> 
- 
-opkg list-installed > /etc/installed-pkgs 
- 
-</code> 
- 
-  - check the integrity of the image file: 
-<code> 
-md5sum -c md5sums 
-</code> When it says something like ''md5sum: WARNING: 195 of 196 computed checksums did NOT match'' it means the only one you downloaded did match ;-) 
-  - use the following commands to upgrade:<code> 
-sysupgrade -v /tmp/openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-sysupgrade.bin</code> 
  * The verbose-option should give some output similar to this:<code>   * The verbose-option should give some output similar to this:<code>
root@openwrt:/tmp$ sysupgrade -v openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin root@openwrt:/tmp$ sysupgrade -v openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin
Saving config files... Saving config files...
-root/zeit 
root/statistics root/statistics
-root/quelen 
-root/auswurfeln 
etc/sysupgrade.conf etc/sysupgrade.conf
etc/sysctl.conf etc/sysctl.conf
-etc/shells 
etc/rc.local etc/rc.local
-etc/TC_hfsc.sh 
etc/profile etc/profile
etc/passwd etc/passwd
-etc/inittab 
-etc/init.d/trafficc 
-etc/hotplug.d/iface/30-trafficc 
-etc/hosts 
-etc/group 
etc/firewall.user etc/firewall.user
etc/dropbear/dropbear_rsa_host_key etc/dropbear/dropbear_rsa_host_key
etc/dropbear/dropbear_dss_host_key etc/dropbear/dropbear_dss_host_key
-etc/crontabs/root 
etc/config/wireless etc/config/wireless
-etc/config/timeserver 
etc/config/system etc/config/system
etc/config/network etc/config/network
Line 58: Line 43:
etc/config/dropbear etc/config/dropbear
etc/config/dhcp etc/config/dhcp
-etc/collectd.conf 
Switching to ramdisk... Switching to ramdisk...
Performing system upgrade... Performing system upgrade...
Line 71: Line 55:
Rebooting system... Rebooting system...
</code> </code>
-  * After the automatic reboot, the system should come up with the same network IP addresses, same dropbear password, etc. It is however possible that it does not. In that case, try a [[wp>Booting#Hard_reboot|cold reset]] (= interrupt the electrical current to the device, wait a couple of seconds and then connect it again.) +  * After the automatic reboot, the system should come up with the setting in the saved configuration files: same network IP addresses, same SSH password, etc. In case that it does not, try a [[wp>Booting#Hard_reboot|cold reset]] (= interrupt the electrical current to the device, wait a couple of seconds and then connect it again).
  * After the cold reboot, you should gain access and here you could check things out:<code bash>   * After the cold reboot, you should gain access and here you could check things out:<code bash>
dmesg dmesg
Line 79: Line 63:
</code> </code>
-  * You do need to reinstall opkg-packages:<code sh> +| {{:meta:icons:tango:48px-dialog-warning.svg.png?nolink}} | For unknown reasons such a cold reset has often been reported to be necessary after a sysupgrade. This is very very bad in case you performed this remotely! |
-opkg update +
-opkg install tc iptables-mod-ipopt wol +
- +
-</code> +
- +
-optional EXTROOT notes continued...  +
-I use a USB flash drive for my extroot.  Modify as needed if you are using a different medium. Of course you'll want to setup your extroot +
-before reinstalling all of your packages.  fdisk is optional, but can be useful if you do not remember your partitioning schema. +
- +
-<code> +
- +
-opkg install blockmount +
-opkg install kmod-usb-storage +
-opkg install kmod-fs-ext4 +
-opkg install e2fsprogs +
-opkg install kmod-scsi-generic +
-opkg install fdisk +
-opkg install nano +
- +
-</code> +
- +
-You'll need to modify /etc/config/fstab again per instructions in [[http://wiki.openwrt.org/doc/howto/extroot]] +
-I am using this example +
- +
-<code> +
- +
-config mount +
-        option target        /overlay +
-        option device        /dev/sda1 +
-        option fstype        ext4 +
-        option options      rw,sync +
-        option enabled      1 +
-        option enabled_fsck +
-</code> +
- +
-Which is working well on my current trunk r36141.  Do not use on revisions earlier than r25787 +
- +
-Now mount your device and copy the overlay to it, enable fstab so it mounts on startup and reboot +
- +
-<code> +
- +
-mkdir /mnt/sda1 +
-mount /dev/sda1 /mnt/sda1 +
-tar -C /overlay -cvf - . | tar -C /mnt/sda1 -xf - +
-/etc/init.d/fstab enable +
-reboot +
- +
-</code> +
- +
-Once the device is running again, check to see that your extroot is mounted.  My storage medium again is USB flash drive 8GB. +
- +
-<code> +
- +
-root@OpenWrt:~# df -h +
-Filesystem                Size      Used Available Use% Mounted on +
-rootfs                    7.2G    58.0M      6.8G  1% / +
-/dev/root                1.8M      1.8M        0 100% /rom +
-tmpfs                    30.0M    472.0K    29.6M  2% /tmp +
-tmpfs                  512.0K        0    512.0K  0% /dev +
-/dev/sda1                7.2G    58.0M      6.8G  1% /overlay +
-overlayfs:/overlay        7.2G    58.0M      6.8G  1% / +
- +
-root@OpenWrt:~# mount +
-rootfs on / type rootfs (rw) +
-/dev/root on /rom type squashfs (ro,relatime) +
-proc on /proc type proc (rw,noatime) +
-sysfs on /sys type sysfs (rw,noatime) +
-tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime) +
-tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755) +
-devpts on /dev/pts type devpts (rw,noatime,mode=600) +
-/dev/sda1 on /overlay type ext4 (rw,sync,relatime,data=ordered) +
-overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay) +
-debugfs on /sys/kernel/debug type debugfs (rw,noatime) +
- +
-</code> +
- +
-Now update package cache and reinstall your packaged based on the list you made before.  The cut command cleans the version numbers from the list.  Pay careful attention to any errors at the end of the operation.  The only ones I encountered were due to saved configuration files. +
- +
-<code>+
 +  * You do need to reinstall opkg-packages:<code>
opkg update opkg update
-opkg install $(cat /etc/installed-pkgs | cut -d' ' -f 1 ) +opkg install tc iptables-mod-ipopt wol ...
</code> </code>
-Note that you can preserve scripts, settings, and documents across sysupgrade by putting them in a directory in /etc/config.  Otherwise, most will be lost. 
-| {{:meta:icons:tango:48px-dialog-warning.svg.png?nolink}} | For unknown reasons such a cold reset has often reported to be necessary after a sysupgrade. This is very very bad in case you performed this remotely!  | 
===== LuCI Web Upgrade Process ===== ===== LuCI Web Upgrade Process =====
-  - Download a suitable OpenWrt firmware image file+  - Download a suitable OpenWrt firmware image file to your PC
  - Login to the WebInterface of the router (default: http://192.168.1.1)   - Login to the WebInterface of the router (default: http://192.168.1.1)
-  - Select //System// => //System// => //Custom Files// {{ :doc:howto:luci.sysupgrade.conf.png?100}} +  - Select //System// => //Backup / Flash Firmware// => //Configuration// to edit ''/etc/sysupgrade.conf'' (Attitude Adjustment) 
-  - Select //System// => //Flash Firmware// {{ :doc:howto:luci.sysupgrade.png?100}}+    * Select //System// => //System// => //Custom Files// to edit ''/etc/sysupgrade.conf'' (Previous versions) 
 +  - Select //System// => //Backup / Flash Firmware// => //Actions// (Attitude Adjustment) 
 +    * Select //System// => //Flash Firmware// (Previous versions)
  - Upload the OpenWrt image file you downloaded to your PC at step 1 to your router via LuCI   - Upload the OpenWrt image file you downloaded to your PC at step 1 to your router via LuCI
  - LuCI will calculate the MD5 checksum of the file, if it's correct, you are green to go   - LuCI will calculate the MD5 checksum of the file, if it's correct, you are green to go
-  - wait until the router comes back online+  - Wait until the router comes back online 
 +  - You do need to reinstall opkg-packages 
 + 
 +{{:doc:howto:luci.sysupgrade.conf.png?200}} 
 +{{:doc:howto:luci.sysupgrade.png?200}}
Line 204: Line 113:
== Transferring image file to a temporary location == == Transferring image file to a temporary location ==
-  - On your Linux PC run:<code>cat [specified firmware].bin | pv -b | nc -l 3333</code>+  - On your Linux PC run:<code>cat [specified firmware].bin | pv -b | nc -l -p 3333</code>
  - On the router run:<code>nc 192.168.1.111 3333 > /tmp/[specified firmware].bin </code>   - On the router run:<code>nc 192.168.1.111 3333 > /tmp/[specified firmware].bin </code>
The port 3333 an IP address 192.168.1.111 are just examples. The command 'pv -b' is optional for tracking progress but maybe you have to install pv to your system previously. The port 3333 an IP address 192.168.1.111 are just examples. The command 'pv -b' is optional for tracking progress but maybe you have to install pv to your system previously.
Line 217: Line 126:
I have tested under Ubuntu 11.10. I have tested under Ubuntu 11.10.
=== Some useful links for netcat === === Some useful links for netcat ===
-[[http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/]] + 
-[[http://www.screenage.de/blog/2007/12/30/using-netcat-and-tar-for-network-file-transfer/]] +[[http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/]]  
-[[https://help.ubuntu.com/community/BackupYourSystem/TAR]] + 
-[[http://www.aboutdebian.com/tar-backup.htm]]+[[http://www.screenage.de/blog/2007/12/30/using-netcat-and-tar-for-network-file-transfer/]]  
 + 
 +[[https://help.ubuntu.com/community/BackupYourSystem/TAR]]  
 + 
 +[[http://www.aboutdebian.com/tar-backup.htm]]  
 + 
 +==== scp ==== 
 +Make sure your router have enough memory. 
 +<code> 
 +root@OpenWrt:/# free 
 +</code> 
 + 
 +Make sure you have set the password for your router.(you must set a password for your router to enable the SSH). If not, set by doing this: 
 +<code> 
 +linux$ telnet 192.168.1.1 
 +root@OpenWrt:/# passwd 
 +</code> 
 +See [[/doc/howto/firstlogin|First Login]] for more details. 
 +=== Copy your firmware to your router === 
 +On your Linux PC run: 
 +<code> 
 +linux$ scp openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin root@192.168.1.1:/tmp 
 +</code> 
 +Input 'yes' to estabilish authenticity, then input the password of your router. Wait ''scp'' command finished. 
 +Now you can see your firmware in /tmp directory. 
 + 
 +=== Write the firmware to your router === 
 +<code>root@OpenWrt:/# sysupgrade -v /tmp/[specified firmware].bin </code> 
 + 
 +=== Note === 
 +**192.168.1.1** is the ip address(may be called GateWay) of your router. Check by run: 
 +<code>linux$ route -n </code> 
 +or you can check the the /etc/config/network file, '127.0.0.1' is the loopback ipaddress, the other one is the ip address of your router. 
 +<code>root@OpenWrt:/# cat /etc/config/network | grep 'ipaddr' </code>
===== Free up RAM ===== ===== Free up RAM =====
Line 253: Line 195:
  * drop caches:<code>   * drop caches:<code>
echo 3 > /proc/sys/vm/drop_caches</code> echo 3 > /proc/sys/vm/drop_caches</code>
-  * prevent [[wireless.essentials|wireless drivers]] to be loaded at next boot and then reboot:<code>+  * prevent wireless drivers to be loaded at next boot and then reboot:<code>
rm /etc/modules.d$/*80211* rm /etc/modules.d$/*80211*
rm /etc/modules.d$/*ath9k* rm /etc/modules.d$/*ath9k*
Line 259: Line 201:
</code> </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:+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.
===== Notes ===== ===== Notes =====
  * [[doc/techref/sysupgrade|Sysupgrade – Technical Reference]]   * [[doc/techref/sysupgrade|Sysupgrade – Technical Reference]]

Back to top

doc/howto/generic.sysupgrade.1366076812.txt.bz2 · Last modified: 2013/04/16 03:46 by iprouteth0