Upgrade from 19.07.0 to 19.07.1: does it require sysupgrade?

Hello,

I have installed here a RPi 1 with OpenWRT 19.07.0.

I used to update all software each week in order to be keep in pace with latest versions and be secure as most as possible using opkg update/list-upgradable/install.

In the wake of version 19.07.1 I tried to modify /etc/opkg/distfeeds.conf, changing 19.07.0 to 19.07.1 and running opkg update/opkg list-upgradable. I noticed then that the kernel was updated in the same 4.14 series (from .162 to .167), but the package changed its URL in the server and one "failed download" resulted at the end.

Of course I could do a sysupgrade, but a question arose, that is, is there a smooth way of upgrading from 19.07.0 to 19.07.1, or more broadly, from XX.YY.n to XX.YY.n+1?

Anyway, I am aware that updating the kernel could be an tough issue and this may make things difficult: possibly sysupgrade could be the only alternative.

Thanks,

Luiz Ramos
São Paulo - Brazil

Yes, it requires sysupgrading - in place upgrades are not possible (and trying it is often fatal).

2 Likes

Do not use opkg upgrade - it will almost certainly break things and cause lots of headaches until you start over. Just search the forums and you’ll see plenty of people who have done this and the problems that they have encountered.

2 Likes

@slh, @psherman:
Thanks for the tips!

However as I see myself as a diehard, I tried two things, given a backup was done prior to any procedure and nothing would be lost.

The first trial was a plain sysupgrade. Following a previous trial where the sysupgrade file could not be uploaded into the RPi (you may check this post: Sysupgrade in Raspberry Pi (1B)), I tried a new recipe, doing sysupgrade using luci but (very important) raising the /tmp size using this command at the console:

mount -oremount,size=400M /tmp

I had to resize /tmp because that with only 256 Mb the sysupgrade image could not be uploaded. Raising that size allows this step to go until the end.

Unfortunately it didn't work. A progress bar is shown at position 100% and nothing else happens.

I have some concerns about that, because in a perfect world the sysupgrade procedure should work (or I don't know why there are two images, factory and sysupgrade). A second concern related to that is the fact that I intend to convert a TP-Link TL-WR741ND clone in a OpenWrt box and in this case is much more difficult to do any file change externally as the Flash-ROM is not that easy to detach from the board. Hopefully sysupgrade is better in such devices.

The second trial was almost successful. I will try to give a draft recipe, which is subject to improvements. If you find it useful, I could work some more hours in that in order to get a more precise description of the whole procedure.

  1. First of all, make a backup, meaning both the "configuration backup" from the LuCI interface and remove the SD card and backup both partitions, with dd or dd_rescue (my preference), for instance

  2. Change /etc/opkg/distfeed.conf and change 19.07.0 for 19.07.1. A special step is necessary for the kernel modules, because the kernel changed. In the case of changing 19.07.0 for 19.07.1, the kernel has gone from 4.14.162 to 4.14.167 and the hash changed as well. So, I catched the new URL pointing a browser to the download.openwrt.org, which led ultimately me to this URL:

    http://downloads.openwrt.org/releases/19.07.1/targets/brcm2708/bcm2708/kmods/4.14.167-1-1e1f49421f1facff51a1411021c6d082

  3. Run opkg update (giving the device is connected to the internet)

  4. Download all kmod packages to /root with a command like this:

    cd /root opkg download $(opkg list-upgradable | grep 4.14.162 | cut -f1 -d' ')

  5. Get the new kernel image and prepare to copy it to /boot. This can be made extracting the kernel from the new "factory" image. I would not depict here all steps, but in short, I ran fdisk to get the image geometry; extracted the first partition to a file (like mmc-p1.bin); mounted this partition file to /mnt using the loop device (I'm using Linux) and grabbing the kernel.img file from there

  6. The commands in step 6 should be made without powering off the RPi. I copied the kernel to the /boot using scp. After that, I upgraded all kmod packages downloaded before to /root using these commands:

    cd /root opkg install --force-depends kmod-*.ipk

    After this, the kernel and the kernel modules should be updated in the persistent storage. I rebooted the device. In my case, I monitored the power up messages using the serial console and checked everything was running well.

  7. Given the system was brought up, do a full upgrade, but with the exception of two packages: kernel and base-files:

    opkg update
    opkg upgrade \
    $(opkg list-upgradable | \
    awk '!/^kernel/ && !/^base-files/ { print; }' | \
    cut -f1 -d' ')


    also copy some files, which can be found in the image (as done for kernel.img, but these files are in the partition 2):

    /etc/openwrt-release
    /etc/banner
    /usr/lib/os_release

  8. Known issues so far: the packages "kernel" and "base-files" will stay with the older version and the package database is somewhat confused:

    root@OpenWrt:/# opkg list | awk '/^kernel/ || /^base-files/ { print; }' base-files - 204.2-r10911-c155900f66 - This package contains a base filesystem and system scripts for OpenWrt. base-files - 204.2-r10860-a3ffeb413b kernel - 4.14.162-1-1e1f49421f1facff51a1411021c6d082

I"d like to hear from you if this can be a start for getting a way for a smooth upgrade, or how you are used to do such migration.

Many thanks,

Luiz Ramos
Sao Paulo - Brazil
lramos dot prof at yahoo dot com dot br

I have never tried what you are proposing/testing. I would regard it as high risk to use any upgraded packages via opkg upgrade, especially kernel modules and the kernel itself, as there are no compatibility checks to ensure that things will continue to work properly. You could seriously mess up your installation and need to start over. You could have all sorts of unexplained, confusing, and time consuming issues after running the upgrade command that will only be resolved by resetting to defaults.

In most cases with non removable memory, as long as failsafe works, you can just run firstboot to revert everything back to defaults (removable memory can just be pulled out and rewritten on another host).

That said, if you are willing to deal with potentially serious complications, have at it with opkg upgrade. Otherwise, stick to flashing complete images from either snapshot or better yet stable release builds.

Well, given that the kernel image itself isn't packaged in the first place, it can't be installed/ upgraded via opkg. Trying to shoehorn OpenWrt into a usage it isn't meant for is just self-destructive madness.

3 Likes

@slh, @psherman: It was not my intention to bother you or to start any type of rant. So please apologize me if my message was understood as a challenge, what it isn't in any sense.

Your message that OpenWrt is designed to not be (sys-)upgraded using opkg upgrade was understood.

Anyway, all this thing started with (my) inability of making sysupgrade using LuCI in RPi1. IF that had worked in the first time, I possibly would never try the procedure above.

Having said that, I would say the device is running well after this procedure, and the fact that I hadn't to reinstall all packages installed on top of the basic image, backup and reload the old configuration and cut some rough edges in some configuration files made me satisfied with the results. I've seen no complications so far except those known issues listed above.

Again, please don't get me wrong. I appreciate your comments and the attitude of answering objectively my questions.

Perhaps the only thing I could miss after all of this is an online sysupgrade recipe for RPi1. Yes, I'm aware that there is something written about that (e.g., this article: https://openwrt.org/docs/guide-quick-start/sysupgrade.luci); however, as told before, it didn't work for me and I couldn't know if this is a problem of mine or an unsupported feature.

Luiz Ramos
Sao Paulo - Brazil

I've never tried to use an RPi (of any flavor) for OpenWrt, but because it has removable media and a different file system type, the upgrade process may necessarily be different than the standard sysupgrade method (which is primarily designed for consumer router type systems with non-removable memory). But, whenever there is removable media, there is the relatively simple option of simply downloading the latest image and writing that directly to the card from a host computer. So, while I can't say if sysupgrade does or should work on a device like the RPi, I suspect that the process you are using is a workaround that was not really intended and could break things.

In my experience, completely reinstalling OpenWrt and not preserving settings, then reinstalling packages of interest and restoring settings from a backup is pretty easy and fast (I think it took me less than 15 minutes to upgrade from 19.07.0 > 19.07.1 on a RouterStation Pro, complete with the extroot process and reinstalling a bunch of packages). As such, I'd personally opt for the option to simply start fresh and minimize risk rather than sort of patching together an upgrade.

That said, my intent is not to rant and tell you you're wrong -- after all, you said that it is working, which is great (and it appears that you are pretty knowledgeable about linux systems and such). Just sharing my knowledge and experience (as well the things I've seen go wrong according to the experiences of others on the forum), and providing my recommendations accordingly.

Very clear. Again, thanks for helping me with this issue.

Luiz Ramos
Sao Paulo - Brazil

1 Like