NAS540 Bootloop, then Upgradekey, now Nothing

2

All Replies

  • Nas540U2022
    Nas540U2022 Posts: 16  Freshman Member
    First Comment Friend Collector
    I answered here an tried to edit the post later, then it told me my comment is waiting for approval...
    So here we go again, in a shorter version:
    I tried to upload a file "boot_and_loop.txt" but this failed.

    What is interesting in that file is the following part:
    / # ipc_send:54: send IPC event OK
    sh: can't create /i-data/sysvol/.system/my_timezone.info: nonexistent directory
    [get_dst_info2]: year=2023 [get_dst_info2]: fp is NULL errno = 2 [sch_controller.c]: target sec(1675652400) vs Mon Feb  6 04:00:00 2023

    sh: can't create /i-data/sysvol/.system/my_timezone.info: nonexistent directory
    [get_dst_info2]: year=2023 [get_dst_info2]: fp is NULL errno = 2 [sch_controller.c]: target sec(1675652400) vs Mon Feb  6 04:00:00 2023

    sch_queue_del:206 found item 0x28388
    sch_queue_del:218: free 0x28388
    Jan  7 21:27:26 NAS540 linuxrc: starting pid 3887, tty '': '/etc/init.d/rc.shutdown'

    the ipc_send part seems to be pretty standard and might be the watchdog tony talked about.

    the more interesting part is the "target sec", which I'm guessing is some kind of scheduled task, which fails and because of that the shutdown is being executed... question is, why and how do I fix this?


  • Nas540U2022
    Nas540U2022 Posts: 16  Freshman Member
    First Comment Friend Collector
    I know what this is. I turned this feature on last year, which reboots the box every Monday morning a 4 o'clock. I guess there is a bug in the firmware, where it's not able to calculate and update the timestamp for the next reboot... can I turn this of via command line? Has probably to do with the new year.
  • Mijzelf
    Mijzelf Posts: 2,790  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    edited January 2023 Answer ✓
    Can I conclude that you managed to reflash the uImage? In that case a small how-to would be appreciated.
    The 'reboot permanently on scheduled reboot' is an old bug, from which I assumed it was squashed by now. But apparently not. Of course it can be turned of via the command line, but unfortunately I only know a way to simply delete the whole configuration. The configuration is stored on /etc/zyxel, on which a flash partition is mounted:
    ubiattach -m 3 -d 3
    mount -t ubifs ubi3:ubi_config /etc/zyxel

    It contains several config files in different formats (sqlite, xml, some python format, ...) and I don't know which file contains this specific setting. Deleting the complete content of this partition equals a factory reset.
    If you are not able to get a shell in Linux, you can use an 'Universal usb_key_func stick' to get telnet access. (Use the network_telnet_stop or telnet_stop function)
    Of course it should also be possible to erase that partition from barebox, but I don't know how.

  • Nas540U2022
    Nas540U2022 Posts: 16  Freshman Member
    First Comment Friend Collector
    Hello again,

    yes. I flashed the uImage.521 and used the upgrade key to install a system. I used your files from this directory.

    After that i used the universal key to get into the system.
    I mounted /etc/zykel to access the config files.
    I changed the file sch_starttime, with the little help of this website to something in the future.
    Now I think that is not the reason for rebooting anymore.

    Now I'm getting a ton of these errors:
    Jan  8 20:26:51 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 19)
    Jan  8 20:26:51 (none) cnid_metad[2322]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    Jan  8 20:26:52 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 20)
    Jan  8 20:26:52 (none) cnid_metad[2323]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    Jan  8 20:26:53 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 21)
    Jan  8 20:26:53 (none) cnid_metad[2324]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    Jan  8 20:26:54 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 22)
    Jan  8 20:26:54 (none) cnid_metad[2325]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    Jan  8 20:26:55 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 23)
    Jan  8 20:26:55 (none) cnid_metad[2326]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    ipc_send:54: send IPC event OK
    sh: can't create /i-data/sysvol/.system/my_timezone.info: nonexistent directory
    [get_dst_info2]: year=2023 [get_dst_info2]: fp is NULL errno = 2 [sch_controller.c]: target sec(1675656000) vs Mon Feb  6 04:00:00 2023

    sh: can't create /i-data/sysvol/.system/my_timezone.info: nonexistent directory
    [get_dst_info2]: year=2023 [get_dst_info2]: fp is NULL errno = 2 [sch_controller.c]: target sec(1675656000) vs Mon Feb  6 04:00:00 2023

    sch_queue_del:206 found item 0x28208
    sch_queue_del:218: free 0x28208
    Jan  8 20:26:55 (none) linuxrc: starting pid 2337, tty '': '/etc/init.d/rc.shutdown'

    Might change the timestamp back to see if this error disappears.

    I don't know where the rc.shutdown is coming from. Next thing I'll try is to change rc.shutdown script, so it doesn't do anything any more...

    What I find weird is that /i-data/ is completely empty.
    It should have at least the hidden folder .system inside.
  • Nas540U2022
    Nas540U2022 Posts: 16  Freshman Member
    First Comment Friend Collector
    I gave up. I deleted everything in /etc/zyxel, after that I was able to boot without errors.
    Logged into the web interface, did the latest firmware upgrade and tomorrow I'll put my disks back in.

    Ty for your support.

    I will write how I did the flashing, but for now I'm too tired. Have to stand up for work in about 5 hours ;)
  • Nas540U2022
    Nas540U2022 Posts: 16  Freshman Member
    First Comment Friend Collector
    I checked the /etc/config file and it has these two lines in it:
    bootargs="console=ttyS0,115200n8, init=/etc/preinit pcie_gen1_only=yes "
    bootargs="$bootargs mac_addr=$eth0.ethaddr,$eth1.ethaddr,$eth2.ethaddr"

    The documentation of barebox says the following:

    The simple method to pass bootargs to the kernel is with CONFIG_FLEXIBLE_BOOTARGS disabled: in this case the bootm command takes the bootargs from the bootargs environment variable.

    With CONFIG_FLEXIBLE_BOOTARGS enabled, the bootargs are composed from different global device variables. All variables beginning with global.linux.bootargs. will be concatenated to the bootargs
    and further:
    Additionally all variables starting with global.linux.mtdparts. are concatenated to a mtdparts= parameter to the kernel. This makes it possible to consistently partition devices with the addpart - add a partition description to a device command and pass the same string as used with addpart to the Kernel:
    Now I don't have the global keyword in barebox, but the two lines in the config are an exact match for the commandline that I got.

    Can I just edit that file and add everything I want?




  • Nas540U2022
    Nas540U2022 Posts: 16  Freshman Member
    First Comment Friend Collector
    I checked the /etc/config file and it has these two lines in it:
    bootargs="console=ttyS0,115200n8, init=/etc/preinit pcie_gen1_only=yes "
    bootargs="$bootargs mac_addr=$eth0.ethaddr,$eth1.ethaddr,$eth2.ethaddr"

    The documentation of barebox says the following:

    The simple method to pass bootargs to the kernel is with CONFIG_FLEXIBLE_BOOTARGS disabled: in this case the bootm command takes the bootargs from the bootargs environment variable.

    With CONFIG_FLEXIBLE_BOOTARGS enabled, the bootargs are composed from different global device variables. All variables beginning with global.linux.bootargs. will be concatenated to the bootargs
    and further:
    Additionally all variables starting with global.linux.mtdparts. are concatenated to a mtdparts= parameter to the kernel. This makes it possible to consistently partition devices with the addpart - add a partition description to a device command and pass the same string as used with addpart to the Kernel:
    Now I don't have the global keyword in barebox, but the two lines in the config are an exact match for the commandline that I got, it could also just be the standard config.

    Can I just edit that file and add everything I want?






  • Nas540U2022
    Nas540U2022 Posts: 16  Freshman Member
    First Comment Friend Collector
    Hello again,

    yes. I flashed the uImage.521 and used the upgrade key to install a system. I used your files from this directory.

    After that i used the universal key to get into the system.
    I mounted /etc/zykel to access the config files.
    I changed the file sch_starttime, with the little help of this website to something in the future.
    Now I think that is not the reason for rebooting anymore.

    Now I'm getting a ton of these errors:
    Jan  8 20:26:51 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 19)
    Jan  8 20:26:51 (none) cnid_metad[2322]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    Jan  8 20:26:52 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 20)
    Jan  8 20:26:52 (none) cnid_metad[2323]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    Jan  8 20:26:53 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 21)
    Jan  8 20:26:53 (none) cnid_metad[2324]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    Jan  8 20:26:54 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 22)
    Jan  8 20:26:54 (none) cnid_metad[2325]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    Jan  8 20:26:55 (none) netatalk[1384]: Restarting 'cnid_metad' (restarts: 23)
    Jan  8 20:26:55 (none) cnid_metad[2326]: tsockfd_create: getaddrinfo: Temporary failure in name resolution
    ipc_send:54: send IPC event OK
    sh: can't create /i-data/sysvol/.system/my_timezone.info: nonexistent directory
    [get_dst_info2]: year=2023 [get_dst_info2]: fp is NULL errno = 2 [sch_controller.c]: target sec(1675656000) vs Mon Feb  6 04:00:00 2023

    sh: can't create /i-data/sysvol/.system/my_timezone.info: nonexistent directory
    [get_dst_info2]: year=2023 [get_dst_info2]: fp is NULL errno = 2 [sch_controller.c]: target sec(1675656000) vs Mon Feb  6 04:00:00 2023

    sch_queue_del:206 found item 0x28208
    sch_queue_del:218: free 0x28208
    Jan  8 20:26:55 (none) linuxrc: starting pid 2337, tty '': '/etc/init.d/rc.shutdown'

    Might change the timestamp back to see if this error disappears.

    I don't know where the rc.shutdown is coming from. Next thing I'll try is to change rc.shutdown script, so it doesn't do anything any more...

    What I find weird is that /i-data/ is completely empty.
    It should have at least the hidden folder .system inside.
  • Mijzelf
    Mijzelf Posts: 2,790  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    The forum is doing weird again. Anyway, glad you sorted it.
    I don't know where the rc.shutdown is coming from. Next thing I'll try is to change rc.shutdown script, so it doesn't do anything any more...
    You can't edit rc.shutdown, it's in the initrd which is embedded in the kernel. And the running of rc.shutdown is not causing the reboot, it's the reboot status which makes linuxrc run rc.shutdown.
    What I find weird is that /i-data/ is completely empty.
    /i-data/ is also in the initrd, and there it's empty. The bootscript /etc/init.d/rcS (indirectly) creates the mountpoints of the data partitions/filesystems in it, and the .system symlink is created, which points to /etc/zyxel/'symlink to system partition'. Apparently the .system symlink isn't created when the symlink in /etc/zyxel/ points to nothing. Normally that is a trigger to define a new system partition, which in your case cannot be done as there is no partition available. Anyhow, that should not initiate a reboot. Booting without disks is a normal operation.
  • Nas540U2022
    Nas540U2022 Posts: 16  Freshman Member
    First Comment Friend Collector
    Answer ✓
    Mijzelf said:
    Can I conclude that you managed to reflash the uImage? In that case a small how-to would be appreciated.
    Thank you again @Mijzelf for your help, would not be at this point if it weren't for you. My NAS is up and running again. My disk were recognized in the first second. Only thing I had to to were turn on link aggregation, add my users and edit the sharing permissions that got deleted/disabled.

    Here is how I did it:
    1. Download any TFTP-Server onto your pc/notebook, I used the server from this website.
    2. Download the uImage of your Box, mine is uImage.521 from the link @Mijzelf provided.
    3. Connection via serial port to the box and turn it on.
    4. Cancel the autoboot to log into barebox shell.
    5. Open file /env/config with editor "edit"
    6. Change Line 11: eth0.serverip="192.168.188.100" <- this is my notebook, running the tftp server.
    7. Change Line 31: mfg_kernel_img=uImage.521 <- I have this file in the main folder of the tftp server.
    8. Exit with Ctrl+D to save the config file.
    9. Type "saveenv" to save the changes through the next boot.
    10. Now either power cycle or type "boot" and it's downloading the uImage from your tftp server directly to the nand twice, for each kernel once.
    11. This gives you your basic linux installation on top of barebox.
    12. Now you download the Rescue Stick Image and put that on a usb stick, I used a 16GB Toshiba USB 3.0 stick formatted to FAT32. If it doesn't work, try another stick, some simply don't work for reasons unknown.
    13. Replace the ras.bin with the Firmware Image matching the uImage you downloaded before.
    14. Edit the "ras.bin.md5sum" accordingly. Since I'm on windows I used Notepad++ for editing.
    15. To create the md5 hash you can use powershell (see attached image) or a good old cmd-droplet (see attached md5.rar) which will create a textfile with the name of the dropped file plus the extension .txt.
    I made the mistake to use the newest firmware available for my unit, just to realize, that the checksums don't match with the linux kernel and thus thinks the kernel is bad. As long as the tftp server is running though it will download and flash the uImage again and again and again ;)

    What was weird in my case, and I still can't explain why that is, was that my barebox kept rebooting after a couple minutes, so I had to to the editing of the config file quickly.


    To reset the NAS to a state where it wouldn't reboot anymore I did this:
    1. I flashed the linux image as described above.
    2. Then I downloaded the universal_usb_key_func-2015-10-12.zip and put it on the same stick from before, deleting everything else beforehand.
    3. I think I renamed the usb_key_func.sh.network_telnet_stop to usb_key_func.sh.2 as is described in the readme file.
    4. I did not use telnet, as the command line of the linux kernel was sufficent for the following commands:
    • ubiattach -m 3 -d 3
    • mount -t ubifs ubi3:ubi_config /etc/zyxel
    • cd /etc/zyxel
    • rm -r * < CAREFUL! this will delete everything in /etc/zyxel leaving the box in factory settings!
    • exit
    I did this because I couldn't find a way to transfer files to a stick or network location and no sqlite was installed to access the .db-files.

Consumer Product Help Center