OPI-to-Kinguard upgrade FAILED

Put questions that seem to be of non-product specific nature here.
Most software related issues should go here unless it is related to a service provider like backup backends and DNS services.
Post Reply
DarS
Posts: 16
Joined: Sun Oct 05, 2014 2:46 am

OPI-to-Kinguard upgrade FAILED

Post by DarS » Sun Dec 09, 2018 8:43 am

(I've posted two topics related to the same upgrade, although each topic focuses on a separate subject).
My MS Windows ownCloud clients were complaining about OPI server being too old, and recently fully refused to synchronize. This pushed me towards OPI-to-Kinguard upgrade. I tried to do it yesterday:
- backup of OPI was made on USB memory
- new SD card with Kinguard image was prepared
- Kinguard SD card was booted, but the system failed to install and operate

The behavior of fresh new Kinguard was a bit strange. LEDs on the device were flashing for 3-4 minutes, then ... the device powered off itself. Further reboots ended the same way.
I managed to solder serial console connector (see below for tech.details) and connected to it. For reading only, because OPI seems to have 3.3V serial, and my USB-RS232 converter is 5V.

But thanks to the serial console I could observe the boot sequence:

The beginning was promising, although a bit buggy (I doubt these errors had any influence on the ultimate failure of the upgrade):

Code: Select all

U-Boot SPL 2018.01 (Mar 07 2018 - 11:50:50)
Trying to boot from MMC2
*** Warning - bad CRC, using default environment
reading u-boot.img
reading u-boot.img
U-Boot 2018.01 (Mar 07 2018 - 11:50:50 +0100)
CPU  : AM335X-GP rev 2.1
I2C:   ready
DRAM:  512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment
Then a typical kernel logging was followed by start of first services:

Code: Select all

Starting logging: OK
Initializing random number generator... done.
Starting haveged: OK
Starting network: 
[    2.535997] net eth0: initializing cpsw version 1.12 (0)
[    2.619182] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=-1)
[    2.638277] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc: started, v1.27.2
udhcpc: sending discover
[    4.724319] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[    4.743608] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    5.625825] random: crng init done
udhcpc: sending discover
udhcpc: sending select for 192.168.13.138
udhcpc: lease of 192.168.13.138 obtained, lease time 864000
Starting dropbear sshd: OK
From this moment I could ssh to OPI and ... it worked! With the default 'root' password set for serial (op237).

However, then a series of unusual messages appeared, every after approx. 10 seconds. Once they were done, the device ... started to power off automatically. See the log:

Code: Select all

[   26.019885] ttyS ttyS0: tty_port_close_start: tty->count = 1 port count = 2
[   36.058090] ttyS ttyS0: tty_port_close_start: tty->count = 1 port count = 2
[...]
[  246.936624] ttyS ttyS0: tty_port_close_start: tty->count = 1 port count = 2
[  256.960576] ttyS ttyS0: tty_port_close_start: tty->count = 1 port count = 2
Usage: /etc/init.d/S60keepinstall {start}
Stopping dropbear sshd: OK
Stopping network: OK
Stopping haveged: stopped /usr/sbin/haveged (pid 103)
OK
Saving random seed... done.
Stopping logging: OK
umount: devtmpfs busy - remounted read-only
[  259.933379] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
[  261.952735] reboot: Power down
[  261.956143] omap_poweroff!!
I tried the boot for several times, and every time the end result was identical - power off.

How can I troubleshoot the upgrade process further to ensure that my OPI upgrades to Kinguard?

TECHNICAL DETAILS
OPI serial console: https://www.kinguardproject.org/wiki/in ... al_console
Voltage: 3.3V (your 5V USB-RS232 converter might damage the OPI if you connect converter's Tx pin to OPI)
PINS: Ground=1, Rx=5 (this is Receive for USB converter, which means Tx for OPI)

Best regards,
-DarS

DarS
Posts: 16
Joined: Sun Oct 05, 2014 2:46 am

Re: OPI-to-Kinguard upgrade FAILED

Post by DarS » Sun Dec 09, 2018 9:00 am

Supplement.
I managed to capture few screenshots of top during the Kinguard upgrade to see, what processes were running that time.
1. Some time in the middle of upgrade
20181208-OPI.02-boot_after_failed_upgrade-top.png
20181208-OPI.02-boot_after_failed_upgrade-top.png (80.33 KiB) Viewed 193 times
2. Just before the end of operation, before OPI powered itself off.
20181208-OPI.03-boot_end-top.png
20181208-OPI.03-boot_end-top.png (74.98 KiB) Viewed 193 times
So it looks that payload-opi-root.tar.gz got extracted and then kgp-install.sh script was followed, but something in this script (or elsewhere) failed with finishing the upgrade.

Regards,
-Darek

User avatar
pa
Posts: 66
Joined: Thu Aug 14, 2014 7:44 am

Re: OPI-to-Kinguard upgrade FAILED

Post by pa » Sun Dec 09, 2018 10:35 am

Hi Darek,

I do not quite follow you here on why yo say the update fails. The installation process for OPI is just as you say, the leds flashes for a couple of minutes then the system makes a power down and the LEDs turn off.
This is since the SD-card needs to be replaced and it is a bit different from how KEEP is doing where the USB installation memory actually can remain in the device (still requires a power-cycle though).

Maybe this is what is confusing? Otherwise I am missing something on why you say that the installation fails.

/PA

DarS
Posts: 16
Joined: Sun Oct 05, 2014 2:46 am

Re: OPI-to-Kinguard upgrade FAILED

Post by DarS » Sun Dec 09, 2018 2:53 pm

Gosh! Shame on me!
I did not realize that you need to have two SD cards for OPI to Kinguard upgrade:
  • first card - with flashed ISO Kinguard image (you just need it for the initial device booting/upgrade)
  • second card - empty formatted Flash that would serve as the Kinguard store throughout it's regular operation
Of course you can use just one SD card, but then you need to play with it during the upgrade - first flash with ISO image, then (after OPI auto-shutdown) re-format to empty the memory.

I kept the same (single) SD card in the device all the time, so it (again and again) tried to install Kinguard and then auto-shutdown...
This is why I was certain that my upgrade failed. Sorry!

I guess such error might be typical for people with Raspberry Pi experience, where SD card is the only form of permanent memory. I did not realize (or forgot...) that OPI hardware has it's own Flash on board and the operating system is kept mainly there. Therefore the replacement of SD cards in the middle of upgrade process is possible (unlike the Raspberry Pi).
Thanks for help. I'm glad to report that my upgrade is in progress, with backup being restored right now. It is a really smooth ride!

I would advise to adjust the release notes with appropriate warning for OPI owners. Current wording on firmware download page is misleading:
For OPI write the image file (.img) to a uSD card (using Etcher or similar tool), insert it into OPI and apply power. OPI will turn off all LEDs when the installation is complete.
It says nothing about inserting new/empty SD card after the auto-shutdown.

Regards,
-DarS

DarS
Posts: 16
Joined: Sun Oct 05, 2014 2:46 am

Re: OPI-to-Kinguard upgrade FAILED

Post by DarS » Mon Dec 10, 2018 4:51 am

The upgrade is over now and my feelings went from desperation to appreciation!
The entire process was so smooth and comprehensive. All my data seems to be in the right place now, just magic :-) Thanks! Perhaps years of developer's experience with embedded devices just paid off. I am very thankful.

One additional remark on documentation - it is worth adding that the device will start in DHCP mode and the static IP address will not be restored after the upgrade. Such clear statement could help people like me, who had OPI with static IP and wondered how the device will function after the upgrade.

Regards,
-DarS

Post Reply