Firmware error 999 and disk gets forgotten about after initiation

Discussion on setting up QNAP NAS products.
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

Hey Qnap Gods. Prepare for quite an interesting one...

I got my hand on TS-219p model with no hard drives. Brought myself WD red 4tb drive and installed it. Installed firmware over Qfinder, and everything went good until server reboots, then it shows that drives are missing and nothing more. Sometimes if I hotswap drive while it says that there is no drive, it detects that drive with Qnap configuration and lets me initialize it, but after that it's the same. Can't update firmware, current is 4.3.3.1432 and website has newer one 4.3.3.1624. After Firmware instalation (I dont even know how it downloads it and from where, because that firmware is downloaded or so I see and installed via website). After instalation I have to go thrue whole proccess of setup, then it finishes and reboots. after reboot it starts to act up does that before mentioned thing of no drive error. website gives me quick.cgi to download, I found workaround by going to http://ip:8080/cgi-bin/quick/html/index.html. When I try to install any firmware, no matter what way (QFinder, Manual, website) it fails ussually at 12-15 %. when used update.sh it gives error FW error 999. after innitialization hdd is not mounted I checked fdisk -l and found that it's not mounted at all, not showned in fdisk -l nor in mount as HDA_ROOT. I dont really know what to do next, maybe there is a way to reflash main flash chip. I have few adapters for flashing mcu's ands so on. please let me know what you guys think

I suspect that this firmware is somehow corrupt and keeps from updating to newer one. By the way since there is no shared/Public folder I download firmware as zip to HDA_ROOT/update adn unzip, then remove zip (since space is limited) and execute update.

My commands that I use for update:

Code: Select all

cd /mnt/HDA_ROOT/update
wget -c https://eu1.qnap.com/Storage/TS-219/TS-219_20210416-4.3.3.1624.zip
md5sum TS-219_20210416-4.3.3.1624.zip
unzip TS-219_20210416-4.3.3.1624.zip
rm TS-219_20210416-4.3.3.1624.zip
rm -fr /mnt/update && ln -sf /mnt/HDA_ROOT/update /mnt/update
rm /sbin/lock_system_update && echo '#!/bin/sh' > /sbin/lock_system_update && chmod +x /sbin/lock_system_update
/etc/init.d/update.sh /mnt/HDA_ROOT/update/TS-219_20210416-4.3.3.1624.img
df output

Code: Select all

[~] # df
Filesystem                Size      Used Available Use% Mounted on
/dev/ram0                32.9M     31.3M      1.7M  95% /
tmpfs                    64.0M    108.0k     63.9M   0% /tmp
tmpfs                    64.0M     35.0M     29.0M  55% /tunnel_agent
/dev/md9                509.5M     17.1M    492.5M   3% /mnt/HDA_ROOT
flidk -l output:

Code: Select all

[~] # fdisk -l

Disk /dev/mtdblock0: 0 MB, 524288 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock0 doesn't contain a valid partition table

Disk /dev/mtdblock1: 2 MB, 2097152 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock1 doesn't contain a valid partition table

Disk /dev/mtdblock2: 9 MB, 9437184 bytes
255 heads, 63 sectors/track, 1 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock2 doesn't contain a valid partition table

Disk /dev/mtdblock3: 3 MB, 3145728 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock3 doesn't contain a valid partition table

Disk /dev/mtdblock4: 0 MB, 262144 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock4 doesn't contain a valid partition table

Disk /dev/mtdblock5: 1 MB, 1310720 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock5 doesn't contain a valid partition table
You must set cylinders.
You can do this from the extra functions menu.

Disk /dev/sda: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      267350  2147483647+  ee  EFI GPT
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 0, 1) logical=(0, 0, 2)
Partition 1 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(267349, 89, 4)

Disk /dev/sda4: 469 MB, 469893120 bytes
2 heads, 4 sectors/track, 114720 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/sda4 doesn't contain a valid partition table

Disk /dev/md9: 542 MB, 542834688 bytes
2 heads, 4 sectors/track, 132528 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md9 doesn't contain a valid partition table

Disk /dev/md2: 542 MB, 542851072 bytes
2 heads, 4 sectors/track, 132532 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md2 doesn't contain a valid partition table

mount output

Code: Select all

[~] # mount
/proc on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
sysfs on /sys type sysfs (rw)
tmpfs on /tmp type tmpfs (rw,size=64M)
none on /proc/bus/usb type usbfs (rw)
tmpfs on /tunnel_agent type tmpfs (rw,size=64m)
/dev/md9 on /mnt/HDA_ROOT type ext3 (rw)
update script output:

Code: Select all

<tc/init.d/update.sh /mnt/HDA_ROOT/update/TS-219_20210416-4.3.3.1624.img
cksum=546222954
Check disk space available for FW update: OK.
Using 120-bit encryption - (QNAPNASVERSION4)
len=1048576
model name = TS-219
version = 4.3.3
boot/
config/
fw_info
fw_info.conf
initrd.boot
initrd.boot.cksum
libcrypto.so.1.0.0
libssl.so.1.0.0
qpkg.tar
qpkg.tar.cksum
rootfs2.img
rootfs2.img.cksum
rootfs_ext.tgz
rootfs_ext.tgz.cksum
uImage
uImage.cksum
update/
update_img.sh
/usr/bin/du: invalid option -- b
BusyBox v1.01 (2020.10.05-19:03+0000) multi-call binary

Usage: du [-aHLdclsxhmk] [FILE]...

Summarizes disk space used for each FILE and/or directory.
Disk space is printed in units of 1024 bytes.

Options:
        -a      show sizes of files in addition to directories
        -H      follow symbolic links that are FILE command line args
        -L      follow all symbolic links encountered
        -d N    limit output to directories (and files with -a) of depth < N
        -c      output a grand total
        -l      count sizes many times if hard linked
        -s      display only a total for each argument
        -x      skip directories on different filesystems
        -h      print sizes in human readable format (e.g., 1K 243M 2G )
        -m      print sizes in megabytes
        -k      print sizes in kilobytes(default)

expr: syntax error
 expr: syntax error

expr: syntax error

OLD MODEL NAME = TS-219P
Allow upgrade
gzip: crc error
Allow upgrade
/mnt/HDA_ROOT/update
tune2fs 1.41.4 (27-Jan-2009)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
Update image using HDD ...
uImage cksum ... Pass
initrd.boot cksum ... Pass
rootfs2.img cksum ... Pass
/bin/cat: /mnt/HDA_ROOT/update/newver: No such file or directory
[Firmware Update] System update failed. Error code: FW999

What I have tried:

Downgrade and install newest firmwares: FAILED
Install firmware over SSH via /etc/init.d/update.sh: FAILED
FIrmware recovery over VMware: FAILED
Checked md5sum of zips and etc before installing.
managed to get update process to run normally, but now it has errors (see log attached.)


So guys what do you think? What could cause this problem?
elvisimprsntr

Firmware error 999 and disk gets forgotten about after initiation

Post by elvisimprsntr »

TS-219P is EOL. Sounds like you picked it up second hand. There likely is a reason the former owner dumped it. Dump it in the recycle bin and spend some coin on a new unit.
Last edited by elvisimprsntr on Mon Apr 19, 2021 1:32 am, edited 2 times in total.
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

I know it's EOL, so thats it? it's dead? I would gladly stay on last supported firmware
elvisimprsntr

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by elvisimprsntr »

Also are the WD Reds CMR or SMR drives? Avoid SMR like the plague.

https://www.servethehome.com/wd-red-smr ... d-red-smr/
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

elvisimprsntr wrote: Mon Apr 19, 2021 1:45 am Also are the WD Reds CMR or SMR drives? Avoid SMR like the plague.

https://www.servethehome.com/wd-red-smr ... d-red-smr/

I don't want to swear, but yeah I have SMR.. :D F**K! well nevermind. Still problem presist... I want to solve it just because I learned a lot by sniffing around qnap shell.

Do enyone knows why I see those errors while upgrading? can I flash directly to hardware?
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

Here is nas report

Code: Select all

*********************
** QNAP NAS Report **
*********************

NAS Model:      TS-219P
Firmware:       4.3.3 Build 20201006
System Name:    NAS8CEB18
Workgroup:      NAS
Base Directory: /share/HDA_DATA
NAS IP address: 192.168.1.236

Default Gateway Device: eth0

          inet addr:192.168.1.236  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:376 errors:0 dropped:0 overruns:0 frame:0
          TX packets:516 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:532
          RX bytes:35673 (34.8 KiB)  TX bytes:268955 (262.6 KiB)
          Interrupt:11


DNS Nameserver(s):192.168.1.254


HDD Information:

HDD1 - Model=WDC WD40EFAX-68JH4N0                    , FwRev=82.00A82, SerialNo=     WD-WX32D80R97H0

Model: WDC WD40EFAX-68JH4N0 (scsi)
Disk /dev/sda: 4001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system     Name     Flags
 1      20.5kB  543MB   543MB   ext3            primary
 2      543MB   1086MB  543MB   linux-swap(v1)  primary
 3      1086MB  4000GB  3999GB  ext4            primary
 4      4000GB  4001GB  510MB                   primary


001 Raw_Read_Error_Rate          0        100 253 051 OK
003 Spin_Up_Time                 2866     202 198 021 OK
004 Start_Stop_Count             59       100 100 000 OK
005 Reallocated_Sector_Ct        0        200 200 140 OK
007 Seek_Error_Rate              0        200 200 000 OK
009 Power_On_Hours               22       100 100 000 OK
010 Spin_Retry_Count             0        100 253 000 OK
011 Calibration_Retry_Count      0        100 253 000 OK
012 Power_Cycle_Count            52       100 100 000 OK
192 Power-Off_Retract_Count      49       200 200 000 OK
193 Load_Cycle_Count             33       200 200 000 OK
194 Temperature_Celsius          27       120 113 000 OK
196 Reallocated_Event_Count      0        200 200 000 OK
197 Current_Pending_Sector       0        200 200 000 OK
198 Offline_Uncorrectable        0        100 253 000 OK
199 UDMA_CRC_Error_Count         0        200 200 000 OK
200 Multi_Zone_Error_Rate        0        100 253 000 OK

HDD2 -/dev/sdb: No such device or address

Error: Error opening /dev/sdb: No such device or address
Retry/Cancel? c
cdone
carted: invalid token: #done
Retry/Cancel? cancel
cancel

Open device fail

Volume Status


Personalities : [raid1] [linear] [raid0] [raid6] [raid5] [raid4]
md2 : active raid1 sda2[0]
                 530128 blocks super 1.0 [2/1] [U_]

md13 : active raid1 sda4[0]
                 458880 blocks super 1.0 [2/1] [U_]
                 bitmap: 1/8 pages [4KB], 32KB chunk

md9 : active raid1 sda1[0]
                 530112 blocks super 1.0 [2/1] [U_]
                 bitmap: 9/9 pages [36KB], 32KB chunk

unused devices: <none>

Disk Space:

Filesystem                Size      Used Available Use% Mounted on
/dev/ram0                32.9M     31.3M      1.7M  95% /
tmpfs                    64.0M     80.0k     63.9M   0% /tmp
/dev/md9                509.5M     20.0M    489.5M   4% /hd_root_tmp
/dev/md9                509.5M     20.0M    489.5M   4% /mnt/HDA_ROOT
/dev/sda3                 3.6T    196.2M      3.6T   0% /share/HDA_DATA

Mount Status:

/proc on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
sysfs on /sys type sysfs (rw)
tmpfs on /tmp type tmpfs (rw,size=64M)
none on /proc/bus/usb type usbfs (rw)
/dev/md9 on /hd_root_tmp type ext3 (rw,data=ordered)
/dev/md9 on /mnt/HDA_ROOT type ext3 (rw,data=ordered)
/dev/sda3 on /share/HDA_DATA type ext4 (rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,delalloc,noacl)


Memory Information:

              total         used         free       shared      buffers
  Mem:       515428       102940       412488            0         3336
 Swap:       530124            0       530124
Total:      1045552       102940       942612

NASReport completed on 2021-04-18 07:13:20 (/tmp/nasreport) 
elvisimprsntr

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by elvisimprsntr »

Have you first tried to add a drive or drives to a storage pool under old firmware?

Then once you have a storage pool and appears to be a accessible and working, then try to update the firmware.
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

elvisimprsntr wrote: Mon Apr 19, 2021 2:30 am Have you first tried to add a drive or drives to a storage pool under old firmware?

Then once you have a storage pool and appears to be a accessible and working, then try to update the firmware.
What do you mean by that? Currently I can see /share/Public folder from SSH
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

I booted without any drive, then installed hdd when it said that there is no disks, nas detected QTS configuration and I clicked factory reset, selected nevwer firmware in this case QTS 4.3.3.1624 and started uploading, it gave me error 000007. See it in screenshot

Image
elvisimprsntr

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by elvisimprsntr »

From your log only one drive is in storage pool. Log into the GUI. Http://{ip}:8080, User ID: admin, Password: what ever you set. Use the GUI to add drives to pool and initialize them. Not the command line.
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

elvisimprsntr wrote: Mon Apr 19, 2021 2:44 am From your log only one drive is in storage pool. Log into the GUI. Http://{ip}:8080, User ID: admin, Password: what ever you set. Use the GUI to add drives to pool and initialize them. Not the command line.
Thank you for your quick reply.

first of all, I only have one disk inserted. i'm tryimg to configure it woth one hdd.

Another thing is that I can't access web gui, whenever I try to go to ip:8080, it tries to download quick.cfg... so I cant access web interface. I thing reinatalling firmware would help, but I cant reinatall it ... 😑.

SMB is not working too, Icant access \\192.168.1.236 from explorer.
elvisimprsntr

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by elvisimprsntr »

Seems error 999 firmware image failed.

https://wiki.qnap.com/wiki/What_to_do_i ... ate_failed

I assume u are following.

https://wiki.qnap.com/wiki/Manually_Updating_Firmware

Unfortunately, google hits don’t find any real solutions other that call QNAP. Since it’s EOL you likely will not get any support.
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

elvisimprsntr wrote: Mon Apr 19, 2021 4:35 am Seems error 999 firmware image failed.

https://wiki.qnap.com/wiki/What_to_do_i ... ate_failed

I assume u are following.

https://wiki.qnap.com/wiki/Manually_Updating_Firmware

Unfortunately, google hits don’t find any real solutions other that call QNAP. Since it’s EOL you likely will not get any support.
Well thats interesting, will look for error 999
If enyone has ideas how I can bring it back to life, please tell me.
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

This is update script from my nas, (/etc/init.d/update.sh)

can someone compare?

Code: Select all

#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

UPDATE_FOLDER="/mnt/update"
ROOT_PART="/mnt/HDA_ROOT"
UPDATEPKG_DIR="/mnt/HDA_ROOT/update_pkg"
PIC_RAW="/sbin/pic_raw"
SET_STATUS_LED="/sbin/set_status_led"
UPDATE_PROCESS="/tmp/update_process"
UPDATE_FW_PROCESS="/tmp/update_fw_process"
SYS_UPDATE_PROGRESS="/tmp/.sys_update_progress"
LIVE_UPDATE_DO_REBOOT="/tmp/do_reboot"
TAS_UPDATE_FILE="/android/tmp_data/update_image.tgz"
RAIDMNG_STATUS="/tmp/raidmng.status"
BOOT_CONF=`/bin/cat /etc/default_config/BOOT.conf 2>/dev/null`
USING_RAM1=0
USING_RAM2=0
USING_TMPFS=0
FUNC_SWITCH_CONF="/etc/config/.funcSwitch.conf"
APP_RUNTIME_CONF="/var/.application.conf"
UPDATE_TMP_PARTITION=`/sbin/getcfg "FIRMWARE STORAGE" UPDATE_TMP_PARTITION -f /etc/platform.conf`
UPDATE_TMP_PARTITION_FS=`/sbin/getcfg "FIRMWARE STORAGE" FS_TYPE -f /etc/platform.conf`
FW_NOTFOUND=1                                   # Can not find firmware in update folder
UPDATE_LOCKED=2                                 # System is rebooting or another update is processing
FW_NOFREESPACE=3                                # No enough space on the system volume to decrypt firmware image
FW_FORMAT_ERROR=4                               # System update failed. Firmware file format error
FW_DEGRADE_CHECK_ERROR=5                # System update failed. Firmware degrade check error
FW_EXTRACT_ERROR=6                              # System update failed. Extract firmware failed
FW_DEGRADE_STORAGE2_ERROR=7             # System update failed. Firmware degrade check IS_STORAGE_V2 error
FW_HDA_NOFREESPACE=31                   # No enough space on the system volume to save pkg file.
FW_UPDATE_IMG_ERROR=999                 # Execute update_img failed
PATCH_NUM=
UPDATE_TITLE="[Firmware Update]"
UPDATE_BACKUP_DIRNAME=".sys_update_backup"
FW_UPDATE_ERROR_CODE_FILE="/tmp/update_error_code"

clean_remind_time()
{
    /sbin/setcfg "System" "Update Remind Time" "0" -f /etc/config/uLinux.conf
}

clean_update_pkg()
{
        /bin/rm -f ${UPDATEPKG_DIR}/*.tgz
        /bin/rm -f ${UPDATEPKG_DIR}/qpkg.tar.cksum
        [ ! -f /etc/IS_G ] || /bin/rm -f ${UPDATEPKG_DIR}/*.bin

        # remove SSL QPKG config to allow replacing QPKG with the built-in one
        /bin/echo "/sbin/rmcfg QcloudSSLCertificate -f /etc/config/qpkg.conf" > /etc/rcK.d/QK999QcloudSSLCertificate.remove
        /bin/chmod +x /etc/rcK.d/QK999QcloudSSLCertificate.remove
}

update_twice_prohibited()
{
        cat > /etc/init.d/update_prohibited <<__EOF__
#!/bin/sh
[ ! -f "\$1" ] || /bin/rm -f "\$1"
/bin/echo -9 > /tmp/update_process
/bin/echo -9 > /tmp/update_fx_process
/sbin/write_log "[Firmware Update] System update failed. Please restart the system and try again." 1
if [ -x /sbin/hal_app ]; then
/sbin/hal_app --se_buzzer enc_id=0,mode=100; /sbin/hal_app --se_buzzer enc_id=0,mode=100; /sbin/hal_app --se_buzzer enc_id=0,mode=100
else
/sbin/pic_raw 80; /sbin/pic_raw 80; /sbin/pic_raw 80
fi
__EOF__
        ( sleep 3; /bin/cp -f /etc/init.d/update.sh /etc/init.d/update.sh_ 2>/dev/null; /bin/cp -f /etc/init.d/update_prohibited /etc/init.d/update.sh 2>/dev/null; chmod 755 /etc/init.d/update.sh; )&
}

begin_led()
{
# check if the HAL subsystem exist
    if [ -x /sbin/hal_app ]; then
        /sbin/hal_app --status_led_set enc_id=0,event=64,status=1
        /sbin/hal_app --power_led_blink enc_id=0,enable=1
    else
        ${SET_STATUS_LED} 64 1; ${PIC_RAW} 76
    fi
}
end_led()
{
# check if the HAL subsystem exist
    if [ -x /sbin/hal_app ]; then
        /sbin/hal_app --status_led_set enc_id=0,event=64,status=0
        /sbin/hal_app --power_led enc_id=0,enable=1
    else
        ${SET_STATUS_LED} 64 0; ${PIC_RAW} 77
    fi
}
do_beep()
{

        if [ x`/sbin/getcfg Misc "Buzzer Quiet Enable"` != "xTRUE" ]; then
# check if the HAL subsystem exist
        if [ -x /sbin/hal_app ]; then
                /sbin/hal_app --se_buzzer enc_id=0,mode=101
            sleep 1
                /sbin/hal_app --se_buzzer enc_id=0,mode=101
            sleep 1
                /sbin/hal_app --se_buzzer enc_id=0,mode=101
        else
                ${PIC_RAW} 81; sleep 1; ${PIC_RAW} 81; sleep 1; ${PIC_RAW} 81
        fi
        fi
}

remove_qfix()
{
        [ -d "${UPDATEPKG_DIR}" ] && /bin/rm -f ${UPDATEPKG_DIR}/*.qfix 2>>/dev/null
        [ ! -d "${UPDATEPKG_DIR}/.qfix" ] || /bin/rm -rf ${UPDATEPKG_DIR}/.qfix 2>>/dev/null
        [ ! -f /etc/config/qfix.conf ] || /bin/rm -f /etc/config/qfix.conf 2>>/dev/null
}

remove_update()
{
                /bin/rm -rf ${UPDATE_FOLDER}/*
}

get_new_ver()
{
        local filename=$path_name
        /bin/readlink /usr/bin/du >/dev/null 2>&1
        if [ $? = 0 ] || [ ! -x /usr/bin/du ]; then
                set -- `ls -l "$filename"`
                local pos=`expr $5 - 48`
        else
                set -- `/usr/bin/du -b "$filename"`
                local pos=`expr $1 - 48`
        fi
        /bin/dd if=$filename of=${UPDATE_FOLDER}/newver skip=$pos bs=1 count=16 2>/dev/null
        [ $? = 0 ] && cat ${UPDATE_FOLDER}/newver
        echo -n " "
        pos=`expr $pos + 16`
        /bin/dd if=$filename of=${UPDATE_FOLDER}/newbn skip=$pos bs=1 count=16 2>/dev/null
        [ $? = 0 ] && cat ${UPDATE_FOLDER}/newbn
        echo " "

        pos=`expr $pos + 16`
        PATCH_NUM=`/bin/dd if=$filename skip=$pos bs=1 count=6 2>/dev/null`
}

write_error_log_for_cgi()
{
        /sbin/write_log "${1}" "${2}"
        local filename="/tmp/update_error_log"
        /bin/echo "${1}" > ${filename}
}

write_error_code_for_cgi()
{
        [ -f ${FW_UPDATE_ERROR_CODE_FILE} ] || /bin/echo "${1}" > ${FW_UPDATE_ERROR_CODE_FILE}
}

clean_error_code_for_cgi()
{
        /bin/rm -f ${FW_UPDATE_ERROR_CODE_FILE}
}

md5="0"
cksum="0"

get_md5_cksum()
{
        cksum=`/sbin/cksum "$path_name" | /bin/cut -d ' ' -f 1`
        echo "cksum=${cksum}"
}

set_md5_cksum()
{
        /sbin/setsum cksum ${cksum}
}

remove_helper_shortcut()
{
        /bin/sed -i 's/"appId":"helper"/"appId":"xxxhelperxxx"/g' /etc/config/.qos_config/users/*/config 2>>/dev/null
}

remove_pre_pkg()
{
        if [ -f "${UPDATEPKG_DIR}/antivirus.tgz" ]; then
                /etc/init.d/antivirus.sh stop 2>>/dev/null
                /bin/rm -f "${UPDATEPKG_DIR}/antivirus.tgz"
        fi
        /bin/rm -f "${UPDATEPKG_DIR}/mariadb5.tgz" 2>>/dev/null
        /bin/rm -f "${UPDATEPKG_DIR}/wifi.tgz" 2>>/dev/null
        /bin/rm -f "${UPDATEPKG_DIR}/Python.tgz" 2>>/dev/null
        /bin/rm -f "${UPDATEPKG_DIR}/thintools.tgz" 2>>/dev/null
        /bin/rm -f "${UPDATEPKG_DIR}/mtpBinary.tgz" 2>>/dev/null
        /bin/rm -f "${UPDATEPKG_DIR}/chassisView.tgz" 2>>/dev/null
        /bin/rm -f "${UPDATEPKG_DIR}/ffmpeg.tgz" 2>>/dev/null
        /bin/rm -f "${UPDATEPKG_DIR}/ResourceMonitor.bin" 2>>/dev/null
        /sbin/rmcfg ResourceMonitor -f /etc/config/qpkg.conf 2>>/dev/null
}

downgrade_check()
{
if [ $1 \> $2 ]; then
        echo "Downgrade from $1 to $2"
        #HomeFeature
        if [ "x1" = "x`/sbin/getcfg DISABLE HomeFeature -d 0 -f $APP_RUNTIME_CONF`" ]; then
                /sbin/setcfg DISABLE qdownload 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE musics 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE photos 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE qmultimedia 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE iTunes 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE upnp 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE survielance 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE videos 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE mediaLibrary 1 -f $APP_RUNTIME_CONF
                /sbin/setcfg DISABLE HomeFeature 1 -f $APP_RUNTIME_CONF
                if [ -f $FUNC_SWITCH_CONF ]; then
                        /sbin/setcfg DISABLE qdownload 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE musics 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE photos 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE qmultimedia 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE iTunes 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE upnp 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE survielance 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE videos 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE mediaLibrary 1 -f $FUNC_SWITCH_CONF
                        /sbin/setcfg DISABLE HomeFeature 1 -f $FUNC_SWITCH_CONF
                fi
        fi
fi
if [ $2 \< "4.0.0" ]; then
        /sbin/setcfg "" TRASH_CAN "Network Recycle Bin 1" -f /etc/config/libtrash.conf
fi
if [ $2 \< "4.1.0" ]; then
        remove_pre_pkg
fi
if [ $2 \< "4.3.0" ]; then
        remove_helper_shortcut
        remove_pre_pkg
fi
}

clean_backup_tarball()
{
        [ -f /sbin/hal_app ] || return 1
        [ ! -f /etc/init.d/functions ] || . /etc/init.d/functions
        FindDefVol
        _ret=$?
        if [ $_ret != 0 ]; then
                echo "Default volume not found."
                return 1
        else
                echo "$DEF_VOLMP"
                /bin/rm -rf "$DEF_VOLMP/$UPDATE_BACKUP_DIRNAME"
        fi
}

check_HDA_ROOT_free_size()
{
        local _qnap_tar=${1}
        local _root_part_exist=0
        /bin/mount 2>>/dev/null | /bin/grep "${ROOT_PART}" | /bin/grep rw 1>>/dev/null 2>>/dev/null
        if [ $? = 0 ]; then
                _root_part_exist=1;
        fi
        if [ -x /sbin/hal_app ] && [ -f $_qnap_tar ] && [ ${_root_part_exist} = 1 ]; then
                local _qnap_tar_size=`/usr/bin/du -k "$_qnap_tar" | /bin/cut -f 1`
                local _update_pkg_size=`/usr/bin/du -ck /mnt/HDA_ROOT/update_pkg/*.tgz | /bin/grep total | /bin/cut -f 1`
                local _HDA_ROOT_free_size=`/bin/df -k 2>/dev/null | /bin/grep "${ROOT_PART}" | /bin/awk '{print $4}'`
                local _have_size=$((${_HDA_ROOT_free_size}+${_update_pkg_size}+4096))
                if [ ${_have_size} -gt ${_qnap_tar_size} ]; then
                        echo "Check HDA_ROOT free size for save qpkg.tar: OK."
                else
                        echo "Check HDA_ROOT free size for save qpkg.tar: Fail."
                        /bin/rm -f "$path_name"
                        do_exit $FW_HDA_NOFREESPACE
                fi
        fi
}

do_exit()
{
        local ret=0
        local old_ver=`/sbin/getcfg System Version`
        local old_version=${old_ver}
        local old_number=`/sbin/getcfg System Number -f /etc/default_config/uLinux.conf`
        local old_bn=`/sbin/getcfg System "Build Number"`
        local old_pn=`/sbin/getcfg System "Patch Number" -d "" -f /etc/default_config/uLinux.conf`
        local new_ver=`/bin/cat ${UPDATE_FOLDER}/newver 2>/dev/null`
        local new_version=${new_ver}
        local new_bn=`/bin/cat ${UPDATE_FOLDER}/newbn 2>/dev/null`
        local error_code="FW"
        local fw_info_conf="${UPDATE_FOLDER}/fw_info.conf"
        if [ -f ${fw_info_conf} ]; then
                local new_number=`/sbin/getcfg "System" "Number" -f ${fw_info_conf}`
                [ -z ${new_number} ] || new_ver="${new_version}.${new_number}"
        fi
        [ -z ${old_number} ] || old_ver="${old_version}.${old_number}"
        [ -z $old_bn ] || old_ver="$old_ver($old_bn)"
        [ -z $new_bn ] || new_ver="$new_ver($new_bn)"

        if [ "x${BOOT_CONF}" = "xTS-NASX86" ] && [ "x$USING_RAM1" = "x1" ]; then
                /bin/umount /mnt/ram1 2>/dev/null 1>/dev/null
        elif [ "x$UPDATE_TMP_PARTITION" != "x" ]; then
                if [ "x$UPDATE_TMP_PARTITION_FS" = "xubifs" ]; then
                        /bin/umount /mnt/ubifs 2>/dev/null 1>/dev/null
                        /sbin/ubidetach -m $UPDATE_TMP_PARTITION 2>/dev/null 1>/dev/null
                fi
        fi
        if [ $1 != $UPDATE_LOCKED ]; then
                /sbin/lock_system_update unlock
        fi

        if [ $1x = "0x" ]; then
                ret=0
        else
                ret=1

                if [ $1x != "$FW_UPDATE_IMG_ERROR"x ]; then
                        echo -$1 > ${UPDATE_PROCESS}
                        echo -$1 > ${UPDATE_FW_PROCESS}
                        echo -$1 > ${SYS_UPDATE_PROGRESS}
                fi

                error_code=`printf $error_code%.3d $1`
        fi

        write_error_code_for_cgi ${1}

        case $1 in
                0)                                                              #normal exit
                        set_md5_cksum
                        [ ! -z $new_version ] && [ ! -z $old_version ] && downgrade_check "$old_version" "$new_version"
                                [ ! -z $new_ver ]       \
                                && /sbin/write_log "${UPDATE_TITLE} System updated successfully from $old_ver to $new_ver." 4                   \
                                || /sbin/write_log "${UPDATE_TITLE} System updated successfully." 4
                                [ -f /etc/IS_G ] || /bin/touch /mnt/HDA_ROOT/.QTS.show.whatsnew 2>/dev/null
            clean_remind_time
            clean_update_pkg
                        ;;

                $FW_NOTFOUND)                                   # Can not find firmware in update folder
                        ret=0
                        write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Error code: $error_code" 1
                        echo "${UPDATE_TITLE} System update failed. Error code: $error_code"
                        ;;

                $UPDATE_LOCKED)                                 # System is rebooting or another update is processing
                        write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Maybe the system is rebooting or another update is processing. Error code: $error_code" 1
                        echo "${UPDATE_TITLE} System update failed. Maybe system is rebooting or another update is processing. Error code: $error_code"
                        ;;

                $FW_NOFREESPACE)                                # No enough space on the system volume to decrypt firmware image
                        if [ -f /etc/IS_G ]; then
                                write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Insufficient space on the system volume. Error code: $error_code" 1
                        else
                                write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Insufficient space on the system volume. Please contact QNAP support. Error code: $error_code" 1
                        fi
                        echo "${UPDATE_TITLE} System update failed. Insufficient space on the system volume. Error code: $error_code"
                        ;;

                $FW_HDA_NOFREESPACE)                            # No enough space on the system volume to decrypt firmware image
                        write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Insufficient space on the system volume. Error code: $error_code" 1
                        echo "${UPDATE_TITLE} System update failed. Insufficient space on the system volume. Error code: $error_code"
                        ;;

                $FW_FORMAT_ERROR)                               # System update failed. Firmware file format error
                        ret=0
                        write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Firmware file format error. Error code: $error_code" 1
                        echo "${UPDATE_TITLE} System update failed. Firmware file format error. Error code: $error_code"
                        ;;

                $FW_DEGRADE_CHECK_ERROR)                # System update failed. Firmware degrade check error
                        ret=0
                        write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Error code: $error_code" 1
                        echo "${UPDATE_TITLE} System update failed. Error code: $error_code"
                        ;;

                $FW_EXTRACT_ERROR)                              # System update failed. Extract firmware failed
                        write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Firmware failed to extract. Error code: $error_code" 1
                        echo "${UPDATE_TITLE} System update failed. Firmware failed to extract. Error code: $error_code"
                        ;;

                $FW_DEGRADE_STORAGE2_ERROR)             # System update failed. Firmware degrade check IS_STORAGE_V2 error
                        ret=0
                        write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Error code: $error_code" 1
                        echo "${UPDATE_TITLE} System update failed. Error code: $error_code"
                        ;;

                $FW_UPDATE_IMG_ERROR)                   # Execute update_img failed
                        write_error_log_for_cgi "${UPDATE_TITLE} System update failed. Error code: $error_code" 1
                        echo "${UPDATE_TITLE} System update failed. Error code: $error_code"
                        ;;
        esac

        if [ $ret != 0 ]; then
                remove_update
        fi
        /sbin/setcfg -e System "QPKG CENTER XML"
        end_led
        grep VOLUME ${RAIDMNG_STATUS} 1>>/dev/null 2>>/dev/null
        if [ $? = 0 ]; then
                grep VOLUME ${RAIDMNG_STATUS} | grep "\-1" 1>>/dev/null 2>>/dev/null
                [ $? != 0 ] && exit $ret
        fi

        exit $ret
}

clean_error_code_for_cgi
/sbin/lock_system_update lock
if [ $? != 0 ]; then
        do_exit $UPDATE_LOCKED
fi
path_name=$1
UPDATE_FREE_SPACE=0
begin_led
if [ x`/sbin/getcfg Misc "Buzzer Quiet Enable"` != "xTRUE" ]; then
        if [ "x`/sbin/getcfg 'System IO' VOICE_ALERT_SUPPORT -f /etc/model.conf`" = "x1" ] && [ "x`/sbin/getcfg System Voice`" != "xFALSE" ]; then
                /sbin/user_cmd -t 002 1>/dev/null 2>&1 &
        fi
fi
if [ -n "$2" -a "$2" = "force" ]; then
/bin/rm -f $UPDATE_PROCESS
echo "Force to update."
force=1
else
force=0
fi

if [ -f "$path_name" ]; then
        get_md5_cksum
        _tgz="${path_name}.tgz"
        _imgsize=`/usr/bin/du -k "$path_name" | /bin/cut -f 1`
        freespace_need=$((4096+$_imgsize))
        /bin/grep '/mnt/.fw_update_dir' /proc/mounts 1>>/dev/null 2>>/dev/null
        if [ $? = 0 ]; then
                USING_TMPFS=1
        elif [ "x${BOOT_CONF}" = "xTS-NASX86" ]; then
                UPDATE_FREE_SPACE=`/bin/df -k 2>/dev/null | /bin/grep "/dev/ram2" | /bin/awk '{print $4}'`
                if [ ! -z ${UPDATE_FREE_SPACE} ] && [ ${UPDATE_FREE_SPACE} -gt ${freespace_need} ]; then
                        USING_RAM2=1
                        echo "Check RAM 2 space available for FW update: OK."
                else
                        /sbin/mke2fs -m0 /dev/ram1 2>/dev/null 1>/dev/null
                        [ -d /mnt/ram1 ] || /bin/mkdir /mnt/ram1 > /dev/null
                        /bin/mount /dev/ram1 /mnt/ram1 2>/dev/null 1>/dev/null
                        if [ $? = 0 ]; then
                                UPDATE_FREE_SPACE=`/bin/df -k 2>/dev/null | /bin/grep "/dev/ram1" | /bin/awk '{print $4}'`
                                if [ ! -z ${UPDATE_FREE_SPACE} ] && [ ${UPDATE_FREE_SPACE} -gt ${freespace_need} ]; then
                                        _tgz=/mnt/ram1/update_image.tgz
                                        USING_RAM1=1
                                        echo "Check RAM space available for FW update: OK."
                                        /sbin/write_log "${UPDATE_TITLE} Use additional space to update firmware." 4
                                else
                                        /bin/umount /mnt/ram1 2>/dev/null 1>/dev/null
                                fi
                        fi
                fi
        fi
    if [ -f /etc/IS_TAS ]; then
        _tgz=$TAS_UPDATE_FILE
        USING_RAM1=1
        UPDATE_TMP_PARTITION=""
    fi
        if [ "x$UPDATE_TMP_PARTITION" != "x" ]; then
                if [ "x$UPDATE_TMP_PARTITION_FS" = "xubifs" ]; then
                        update_tmp_dev=`/sbin/getcfg "FIRMWARE STORAGE" DEVICE_NODE -f /etc/platform.conf`
                        /sbin/flash_erase $update_tmp_dev$UPDATE_TMP_PARTITION 0 0 >& /dev/null
                        /sbin/ubiattach -m $UPDATE_TMP_PARTITION -d 1
                        /sbin/ubimkvol /dev/ubi1 -N tmp -m
                        /bin/mkdir -p /mnt/ubifs
                        /bin/mount -t ubifs ubi1:tmp /mnt/ubifs
                        _tgz=/mnt/ubifs/update_image.tgz
                fi
        elif [ "x$USING_RAM1" != "x1" ] && [ "x$USING_RAM2" != "x1" ] && [ "x$USING_TMPFS" != "x1" ]; then
                /bin/mount 2>>/dev/null | /bin/grep "${ROOT_PART}" | /bin/grep rw 1>>/dev/null 2>>/dev/null
                if [ $? = 0 ]; then
                        UPDATE_FREE_SPACE=`/bin/df -k 2>/dev/null | /bin/grep "$ROOT_PART" | /bin/awk '{print $4}'`
                        if [ ! -z ${UPDATE_FREE_SPACE} ] && [ ${UPDATE_FREE_SPACE} -gt ${freespace_need} ]; then
                                echo "Check disk space available for FW update: OK."
                        else
                                /bin/rm -f "$path_name"
                                do_exit $FW_NOFREESPACE
                        fi
                fi
        fi
        #remove existing package
        #remove_pre_pkg
    if [ -f /etc/IS_TAS ]; then
        /sbin/PC1 d QNAPNASVERSION4 "$path_name" "${_tgz}";
    else
        /sbin/PC1 d QNAPNASVERSION4 "$path_name" "${_tgz}"; \
        /bin/tar tzf "${_tgz}" 2>/dev/null
        if [ $? != 0 ]; then
                /bin/rm -f "$path_name"
                /bin/rm -f "${_tgz}"
                do_exit $FW_FORMAT_ERROR
        fi
    fi
        get_new_ver
        /sbin/degrade_check "$path_name"
        if [ $? = 0 ]; then
                /bin/rm -f "$path_name"
                /bin/rm -f "${_tgz}"
                do_exit $FW_DEGRADE_CHECK_ERROR
        fi
        /bin/rm -f "$path_name"
    if [ ! -f /etc/IS_TAS ]; then
                /bin/tar xzf "${_tgz}" -C ${UPDATE_FOLDER}; [ $? != 0 ] && do_exit $FW_EXTRACT_ERROR; \
                /bin/rm -f "${_tgz}"
                /sbin/degrade_check IS_STORAGE_V2
                if [ $? = 0 ]; then
                        /bin/rm -rf ${UPDATE_FOLDER}/*
                        do_exit $FW_DEGRADE_STORAGE2_ERROR
                fi
                check_HDA_ROOT_free_size ${UPDATE_FOLDER}/qpkg.tar
    else
        echo 2 > ${UPDATE_PROCESS}
        echo 2 > ${UPDATE_FW_PROCESS}
        echo 2 > ${SYS_UPDATE_PROGRESS}
    fi
        if [ "x${BOOT_CONF}" = "xTS-NASX86" ] && [ "x$USING_RAM1" = "x1" ]; then
                /bin/umount /mnt/ram1 2>/dev/null 1>/dev/null
        elif [ "x$UPDATE_TMP_PARTITION" != "x" ]; then
                if [ "x$UPDATE_TMP_PARTITION_FS" = "xubifs" ]; then
                        /bin/umount /mnt/ubifs
                        /sbin/ubidetach -m $UPDATE_TMP_PARTITION
                fi
        fi
        [ -f ${UPDATE_FOLDER}/update_img.sh ] && /bin/mv ${UPDATE_FOLDER}/update_img.sh /tmp/update_img.sh

    if [ -f /etc/IS_TAS ]; then
                [ -n "$(ps -ef|grep zygote |grep -v grep)" ] && {
                        [ -d "/android/tmp/factory" ] || /bin/mkdir -p /android/tmp/factory
                        /sbin/recovery Android OTA DATA update_image.tgz
                } || {
                        [ -d "/tmp/factory" ] || /bin/mkdir -p /tmp/factory
                        /sbin/factory load
                        /sbin/recovery QTS OTA DATA update_image.tgz
                }
                if [ $? = 0 ]; then
                        [ ! -x /sbin/lock_system_update ] || /sbin/lock_system_update unlock
                        /bin/touch "$LIVE_UPDATE_DO_REBOOT" 2>/dev/null
                        [ -f /etc/IS_G ] || /bin/touch /mnt/HDA_ROOT/.QTS.show.whatsnew 2>/dev/null
                        /bin/mkdir /tmp/tmp_p7
                        /bin/mount -t ext4 /dev/mmcblk0p7 /tmp/tmp_p7
                        echo "$(/sbin/getcfg System Version)($(/sbin/getcfg System "Build Number")) to $(/bin/cat ${UPDATE_FOLDER}/newver 2>/dev/null)($(/bin/cat ${UPDATE_FOLDER}/newbn 2>/dev/null))" > /tmp/tmp_p7/update_fw
                        /bin/umount /tmp/tmp_p7
                        echo "$(/sbin/getcfg System Version)($(/sbin/getcfg System "Build Number")) to $(/bin/cat ${UPDATE_FOLDER}/newver 2>/dev/null)($(/bin/cat ${UPDATE_FOLDER}/newbn 2>/dev/null))" > /tmp/tmp_p7/update_fw
                        /bin/umount /tmp/tmp_p7
                        /bin/rm /tmp/tmp_p7
                        remove_qfix
                        echo 3 > ${UPDATE_PROCESS}
                        echo 3 > ${UPDATE_FW_PROCESS}
                        echo 3 > ${SYS_UPDATE_PROGRESS}
                        update_twice_prohibited
                        do_beep
                elif [ `/bin/cat $UPDATE_PROCESS`x != -3x ]; then
                        do_exit $FW_UPDATE_IMG_ERROR
                fi
    else
        if [ -f /tmp/update_img.sh ]; then
                /tmp/update_img.sh "$path_name"
        else
                /etc/init.d/update_img.sh "$path_name"
        fi
        if [ $? = 0 ]; then
                [ -f /etc/IS_G ] || /bin/sed -i '/^Live Update XML/d' /etc/config/uLinux.conf
#               do_beep
#               do_beep_check_flag
                clean_backup_tarball
                do_exit 0
        elif [ `/bin/cat $UPDATE_PROCESS`x != -3x ]; then
                do_exit $FW_UPDATE_IMG_ERROR
        fi
    fi
else
        do_exit $FW_NOTFOUND
fi
VeryFastSnail
Starting out
Posts: 14
Joined: Sun Apr 18, 2021 2:00 pm

Re: Firmware error 999 and disk gets forgotten about after initiation

Post by VeryFastSnail »

I did some digginf in update.sh script and found that this code is where it goes shabang. :D

Code: Select all

if [ -f /etc/IS_TAS ]; then
                [ -n "$(ps -ef|grep zygote |grep -v grep)" ] && {
                        [ -d "/android/tmp/factory" ] || /bin/mkdir -p /android/tmp/factory
                        /sbin/recovery Android OTA DATA update_image.tgz
                } || {
                        [ -d "/tmp/factory" ] || /bin/mkdir -p /tmp/factory
                        /sbin/factory load
                        /sbin/recovery QTS OTA DATA update_image.tgz
                }
                if [ $? = 0 ]; then
                 
                        [ ! -x /sbin/lock_system_update ] || /sbin/lock_system_update unlock
                        /bin/touch "$LIVE_UPDATE_DO_REBOOT" 2>/dev/null
                        [ -f /etc/IS_G ] || /bin/touch /mnt/HDA_ROOT/.QTS.show.whatsnew 2>/dev/null
                        /bin/mkdir /tmp/tmp_p7
                        /bin/mount -t ext4 /dev/mmcblk0p7 /tmp/tmp_p7
                        echo "$(/sbin/getcfg System Version)($(/sbin/getcfg System "Build Number")) to $(/bin/cat ${UPDATE_FOLDER}/newver 2>/dev/null)($(/bin/cat ${UPDATE_FOLDER}/newbn 2>/dev/null))" > /tmp/tmp_p7/update_fw
                        /bin/umount /tmp/tmp_p7
                        /bin/rm /tmp/tmp_p7
                        remove_qfix
                        echo 3 > ${UPDATE_PROCESS}
                        echo 3 > ${UPDATE_FW_PROCESS}
                        echo 3 > ${SYS_UPDATE_PROGRESS}
                        update_twice_prohibited
                        do_beep
        
                elif [ `/bin/cat $UPDATE_PROCESS`x != -3x ]; then
                        [b]do_exit $FW_UPDATE_IMG_ERROR[/b]
                fi
    else
        if [ -f /tmp/update_img.sh ]; then
                /tmp/update_img.sh "$path_name"
        else
                /etc/init.d/update_img.sh "$path_name"
        fi
        if [ $? = 0 ]; then
                [ -f /etc/IS_G ] || /bin/sed -i '/^Live Update XML/d' /etc/config/uLinux.conf
#               do_beep
#               do_beep_check_flag
                clean_backup_tarball
                do_exit 0
        elif [ `/bin/cat $UPDATE_PROCESS`x != -3x ]; then
             do_exit $FW_UPDATE_IMG_ERROR
        fi
    fi
so AS I understand correctly this script constantly writes to file update progress and check if it has some value, in this case -3, so code fails at one of those ifs..:/ and there is method do_beep, witch in my case is not called. This script for some unkown reason calls do_exit $FW_UPDATE_IMG_ERROR and kills further progress. Will keep on digging in my spare time, this much more than just a nas anymore, I want to fix it as a challenge to myself.

EDIT: this script calls update_img.sh, so I will dig there too...
Locked

Return to “Turbo Station Installation & Setup”