I think the real win from this endeavor will be to prove that we can interact with the GUI-only features via script and imagine new features from there. iOS shortcuts, PowerShell scripts, shell scripts, or even an unofficial Merlin app.
Sorry, I was too busy yesterday to finish my test.Start by unzipping at your computer, and copy it via SCP to home/root. The same way you did with the zip the first time successfully. Make sure there is no zip, if there is delete it first.
I tested the zip file again today and I got the same error when uploading, "No space left on device". I don't understand why at all since there was clearly over 100MB of /tmp storage available before uploading.The different between the two in size is negligible (91MB vs 93MB)
Curl gets the cookie, and openssl generates the base64 encoding of the password. There is no problem with these. But I can't test updating the firmware using curl because I don't have a chance to upload the firmware to /tmp/home/root at all, nor is it possible with jffs since jffs is only 62MB.Put the firmware file as the only file in home/root and test the curl commands manually?
Sorry, I was too busy yesterday to finish my test.
But I tested it several times this morning and I couldn't even upload the unzipped firmware to the router.
Testing the router, I cold rebooted each time to make sure the RAM didn't contain the previous firmware.
When I upload using scp it immediately tells me "No space left on device" and then everything crashes.
View attachment 53537
At the time of the crash I was unable to get any information on available memory via GUI/SSH because the shell also crashed. After the reboot nothing was logged and I had no idea what was going on, the only useful message was "No space left on device".
In order to identify the problem, I provide the following screenshot, but it doesn't give a lot of useful information.
Before uploading firmware to $HOME, the router’s available memory status:
View attachment 53538
View attachment 53540
View attachment 53541
Because after uploading, I lost the valid response to the ssh commands, so I don't get any useful information about the memory status. So I had to do a cold reboot, and after the reboot, as I said, nothing was logged.
I tested the zip file again today and I got the same error when uploading, "No space left on device". I don't understand why at all since there was clearly over 100MB of /tmp storage available before uploading.
Curl gets the cookie, and openssl generates the base64 encoding of the password. There is no problem with these. But I can't test updating the firmware using curl because I don't have a chance to upload the firmware to /tmp/home/root at all, nor is it possible with jffs since jffs is only 62MB.
No, no luck.Can you confirm the .zip still works via SCP? if not maybe the router needs a full reset to test again.
After updating to 386.12, before I did a factory reset, I then tested uploading the same .zip to the router, and this time it worked. I will restore the settings next and conduct more tests. I cannot rule out that this is a bug of 386.7.
View attachment 53543
I just did a factory reset on 386.12.Very good discovery, please keep me/us informed as you re-run the tests on the newer firmware
The strangest thing happened. Despite insufficient /tmp storage space, I still cannot reproduce the error that occurred on 386.7.I hope I can reproduce the error.
There is a lot of overreaction in this thread. I may be under reacting myself, but where is the forum’s sense of adventure and “let’s try it” mentality?
Does anyone wonder why it gets so dull around here these days? Not many people want to take risks or have fun trying new things.
Odds are very high that this project will die for one valid reason or another. But “not trying” shouldn’t be one of them.
Frankly I'm tired of trying to convince people who will never use this script. I'm tired of replying to their points.So so so agreed with every single line.
This method will never be as 'safe' as if doing it via the GUI.
ASUSWRT-Merlin RT-AC68U 386.12_0 Mon Sep 4 15:47:31 UTC 2023
admin@RT-AC68U-****:/tmp/home/root# free
total used free shared buffers cached
Mem: 255716 61968 193748 0 860 10124
-/+ buffers/cache: 50984 204732
Swap: 0 0 0
admin@RT-AC68U-****:/tmp/home/root# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 32.8M 32.8M 0 100% /
devtmpfs 124.8M 0 124.8M 0% /dev
tmpfs 124.9M 768.0K 124.1M 1% /tmp
/dev/mtdblock4 62.8M 1.7M 61.0M 3% /jffs
/dev/sda 7.5G 91.3M 7.4G 1% /tmp/mnt/sda
admin@RT-AC68U-****:/tmp/home/root# cd /tmp/mnt/sda
admin@RT-AC68U-****:/tmp/mnt/sda# ls -lah
drwxrwxrwx 1 admin root 4.0K Dec 31 1969 .
drwxrwxrwx 3 admin root 60 May 5 01:09 ..
-rwxrwxrwx 1 admin root 6 May 5 01:09 .___var.txt
-rwxrwxrwx 1 admin root 0 May 5 01:09 .___var.txt.6
-rwxrwxrwx 1 admin root 6 May 5 01:09 .__admin_var.txt
-rwxrwxrwx 1 admin root 0 May 5 01:09 .__admin_var.txt.6
-rwxrwxrwx 1 admin root 9 May 5 01:09 .__folder_list.txt
-rwxrwxrwx 1 admin root 0 May 5 01:09 .__folder_list.txt.9
-rwxrwxrwx 1 admin root 91.3M Oct 7 2023 RT-AC68U_386.12_0.zip
drwxrwxrwx 1 admin root 4.0K Oct 7 2023 System Volume Information
admin@RT-AC68U-****:/tmp/mnt/sda# unzip -o "RT-AC68U_386.12_0.zip" -d "/home/root/" -x README*
Archive: RT-AC68U_386.12_0.zip
inflating: RT-AC68U_386.12_0.trx
inflating: Changelog-386.txt
inflating: sha256sum.sha256
admin@RT-AC68U-****:/tmp/mnt/sda# free
total used free shared buffers cached
Mem: 255716 223468 32248 0 912 171484
-/+ buffers/cache: 51072 204644
Swap: 0 0 0
admin@RT-AC68U-****:/tmp/mnt/sda# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 32.8M 32.8M 0 100% /
devtmpfs 124.8M 0 124.8M 0% /dev
tmpfs 124.9M 94.8M 30.0M 76% /tmp
/dev/mtdblock4 62.8M 1.7M 61.1M 3% /jffs
/dev/sda 7.5G 91.3M 7.4G 1% /tmp/mnt/sda
admin@RT-AC68U-****:/tmp/mnt/sda# cd /home/root/
admin@RT-AC68U-****:/tmp/home/root# ls -lah
drwx------ 3 admin root 140 May 5 01:53 .
drwxr-xr-x 3 admin root 60 Dec 31 1969 ..
-rw------- 1 admin root 130 May 5 01:53 .ash_history
drwx------ 2 admin root 60 May 5 01:05 .ssh
-rw-rw-rw- 1 admin root 91.7K May 5 01:53 Changelog-386.txt
-rw-rw-rw- 1 admin root 93.9M May 5 01:53 RT-AC68U_386.12_0.trx
-rw-rw-rw- 1 admin root 88 May 5 01:53 sha256sum.sha256
admin@RT-AC68U-****:/tmp/home/root# openssl sha256 RT-AC68U_386.12_0.trx
SHA256(RT-AC68U_386.12_0.trx)= a07830f1dd3fa816c25c7b76263cbb13e4268fac3447fe623b048f66067deaf4
admin@RT-AC68U-****:/tmp/home/root# cat sha256sum.sha256
a07830f1dd3fa816c25c7b76263cbb13e4268fac3447fe623b048f66067deaf4 RT-AC68U_386.12_0.trx
admin@RT-AC68U-****:/tmp/home/root# pass="$(echo -n '*********' | openssl base64)"
admin@RT-AC68U-****:/tmp/home/root# curl "http://192.168.50.1/login.cgi" \
> --referer http://192.168.50.1/Main_Login.asp \
> --user-agent 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' \
> -H 'Accept-Language: en-US,en;q=0.5' \
> -H 'Content-Type: application/x-www-form-urlencoded' \
> -H "Origin: http://192.168.50.1/" \
> -H 'Connection: keep-alive' \
> --data-raw "group_id=&action_mode=&action_script=&action_wait=5¤t_page=Main_Login.asp&next_page=index.asp&login_authorization=${pass}" \
> --cookie-jar /tmp/home/root/cookie.txt
<HTML><HEAD>
<meta http-equiv="refresh" content="0; url=index.asp">
</HEAD></HTML>
admin@RT-AC68U-****:/tmp/home/root# nohup curl "http://192.168.50.1/upgrade.cgi" \
> --referer http://192.168.50.1/Advanced_FirmwareUpgrade_Content.asp \
> --user-agent 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' \
> -H 'Accept-Language: en-US,en;q=0.5' \
> -H "Origin: http://192.168.50.1/" \
> -F 'current_page=Advanced_FirmwareUpgrade_Content.asp' \
> -F 'next_page=' \
> -F 'action_mode=' \
> -F 'action_script=' \
> -F 'action_wait=' \
> -F 'preferred_lang=EN' \
> -F 'firmver=3.0.0.4' \
> -F "file=@/tmp/home/root/RT-AC68U_386.12_0.trx" \
> --cookie /tmp/home/root/cookie.txt > /jffs/upload_response.txt 2>&1 &
#############
After reboot
#############
admin@RT-AC68U-****:/jffs# cat upload_response.txt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 93.8M 0 1735 100 93.8M 78 4350k 0:00:22 0:00:22 --:--:-- 4664k
<html>
<head>
<title>ASUS Wireless Router Web Manager</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="-1">
<link rel="shortcut icon" href="images/favicon.png">
<link rel="icon" href="images/favicon.png">
</head>
<body>
<script>
var reboottime = eval("140");
var upgrade_fw_status = '4';
if(upgrade_fw_status == 2 || upgrade_fw_status == 4){
parent.document.getElementById("hiddenMask").style.visibility = "hidden";
parent.document.getElementById('loading_block2').innerHTML = "Firmware upgrade unsuccessful. This may result from incorrect image or error transmission. Please check the version of firmware and try again.";
parent.document.getElementById('loading_block3').style.display = "none";
parent.showLoadingBar(reboottime);
setTimeout("parent.detect_httpd();", reboottime*1000);
}
else if(upgrade_fw_status == 6){
parent.document.getElementById("hiddenMask").style.visibility = "hidden";
parent.document.getElementById('loading_block2').innerHTML = "To comply with regulatory amendments, we have modified our certificate rule to ensure better firmware quality. This version is not compatible with all previously released ASUS firmware and uncertified third party firmware. Please check our official websites for the certified firmware.";
parent.document.getElementById('loading_block3').style.display = "none";
parent.showLoadingBar(reboottime);
setTimeout("parent.detect_httpd();", reboottime*1000);
}
else{
aler("Firmware upgrade unsuccessful. This may result from incorrect image or error transmission. Please check the version of firmware and try again.");
parent.location.reload();
}
</script>
</body>
</html>
Yes, you're proving the point.
I think I have just fully verified the update of RT-AC68U on 386.12. The update went smoothly. I saw that the router automatically restarted during the update process, and the output of curl was also normal.
Below are the complete terminal commands and output without personal information:
Bash:ASUSWRT-Merlin RT-AC68U 386.12_0 Mon Sep 4 15:47:31 UTC 2023 admin@RT-AC68U-****:/tmp/home/root# free total used free shared buffers cached Mem: 255716 61968 193748 0 860 10124 -/+ buffers/cache: 50984 204732 Swap: 0 0 0 admin@RT-AC68U-****:/tmp/home/root# df -h Filesystem Size Used Available Use% Mounted on /dev/root 32.8M 32.8M 0 100% / devtmpfs 124.8M 0 124.8M 0% /dev tmpfs 124.9M 768.0K 124.1M 1% /tmp /dev/mtdblock4 62.8M 1.7M 61.0M 3% /jffs /dev/sda 7.5G 91.3M 7.4G 1% /tmp/mnt/sda admin@RT-AC68U-****:/tmp/home/root# cd /tmp/mnt/sda admin@RT-AC68U-****:/tmp/mnt/sda# ls -lah drwxrwxrwx 1 admin root 4.0K Dec 31 1969 . drwxrwxrwx 3 admin root 60 May 5 01:09 .. -rwxrwxrwx 1 admin root 6 May 5 01:09 .___var.txt -rwxrwxrwx 1 admin root 0 May 5 01:09 .___var.txt.6 -rwxrwxrwx 1 admin root 6 May 5 01:09 .__admin_var.txt -rwxrwxrwx 1 admin root 0 May 5 01:09 .__admin_var.txt.6 -rwxrwxrwx 1 admin root 9 May 5 01:09 .__folder_list.txt -rwxrwxrwx 1 admin root 0 May 5 01:09 .__folder_list.txt.9 -rwxrwxrwx 1 admin root 91.3M Oct 7 2023 RT-AC68U_386.12_0.zip drwxrwxrwx 1 admin root 4.0K Oct 7 2023 System Volume Information admin@RT-AC68U-****:/tmp/mnt/sda# unzip -o "RT-AC68U_386.12_0.zip" -d "/home/root/" -x README* Archive: RT-AC68U_386.12_0.zip inflating: RT-AC68U_386.12_0.trx inflating: Changelog-386.txt inflating: sha256sum.sha256 admin@RT-AC68U-****:/tmp/mnt/sda# free total used free shared buffers cached Mem: 255716 223468 32248 0 912 171484 -/+ buffers/cache: 51072 204644 Swap: 0 0 0 admin@RT-AC68U-****:/tmp/mnt/sda# df -h Filesystem Size Used Available Use% Mounted on /dev/root 32.8M 32.8M 0 100% / devtmpfs 124.8M 0 124.8M 0% /dev tmpfs 124.9M 94.8M 30.0M 76% /tmp /dev/mtdblock4 62.8M 1.7M 61.1M 3% /jffs /dev/sda 7.5G 91.3M 7.4G 1% /tmp/mnt/sda admin@RT-AC68U-****:/tmp/mnt/sda# cd /home/root/ admin@RT-AC68U-****:/tmp/home/root# ls -lah drwx------ 3 admin root 140 May 5 01:53 . drwxr-xr-x 3 admin root 60 Dec 31 1969 .. -rw------- 1 admin root 130 May 5 01:53 .ash_history drwx------ 2 admin root 60 May 5 01:05 .ssh -rw-rw-rw- 1 admin root 91.7K May 5 01:53 Changelog-386.txt -rw-rw-rw- 1 admin root 93.9M May 5 01:53 RT-AC68U_386.12_0.trx -rw-rw-rw- 1 admin root 88 May 5 01:53 sha256sum.sha256 admin@RT-AC68U-****:/tmp/home/root# openssl sha256 RT-AC68U_386.12_0.trx SHA256(RT-AC68U_386.12_0.trx)= a07830f1dd3fa816c25c7b76263cbb13e4268fac3447fe623b048f66067deaf4 admin@RT-AC68U-****:/tmp/home/root# cat sha256sum.sha256 a07830f1dd3fa816c25c7b76263cbb13e4268fac3447fe623b048f66067deaf4 RT-AC68U_386.12_0.trx admin@RT-AC68U-****:/tmp/home/root# pass="$(echo -n '*********' | openssl base64)" admin@RT-AC68U-****:/tmp/home/root# curl "http://192.168.50.1/login.cgi" \ > --referer http://192.168.50.1/Main_Login.asp \ > --user-agent 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' \ > -H 'Accept-Language: en-US,en;q=0.5' \ > -H 'Content-Type: application/x-www-form-urlencoded' \ > -H "Origin: http://192.168.50.1/" \ > -H 'Connection: keep-alive' \ > --data-raw "group_id=&action_mode=&action_script=&action_wait=5¤t_page=Main_Login.asp&next_page=index.asp&login_authorization=${pass}" \ > --cookie-jar /tmp/home/root/cookie.txt <HTML><HEAD> <meta http-equiv="refresh" content="0; url=index.asp"> </HEAD></HTML> admin@RT-AC68U-****:/tmp/home/root# nohup curl "http://192.168.50.1/upgrade.cgi" \ > --referer http://192.168.50.1/Advanced_FirmwareUpgrade_Content.asp \ > --user-agent 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' \ > -H 'Accept-Language: en-US,en;q=0.5' \ > -H "Origin: http://192.168.50.1/" \ > -F 'current_page=Advanced_FirmwareUpgrade_Content.asp' \ > -F 'next_page=' \ > -F 'action_mode=' \ > -F 'action_script=' \ > -F 'action_wait=' \ > -F 'preferred_lang=EN' \ > -F 'firmver=3.0.0.4' \ > -F "file=@/tmp/home/root/RT-AC68U_386.12_0.trx" \ > --cookie /tmp/home/root/cookie.txt > /jffs/upload_response.txt 2>&1 & ############# After reboot ############# admin@RT-AC68U-****:/jffs# cat upload_response.txt % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 93.8M 0 1735 100 93.8M 78 4350k 0:00:22 0:00:22 --:--:-- 4664k <html> <head> <title>ASUS Wireless Router Web Manager</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> <meta HTTP-EQUIV="Expires" CONTENT="-1"> <link rel="shortcut icon" href="images/favicon.png"> <link rel="icon" href="images/favicon.png"> </head> <body> <script> var reboottime = eval("140"); var upgrade_fw_status = '4'; if(upgrade_fw_status == 2 || upgrade_fw_status == 4){ parent.document.getElementById("hiddenMask").style.visibility = "hidden"; parent.document.getElementById('loading_block2').innerHTML = "Firmware upgrade unsuccessful. This may result from incorrect image or error transmission. Please check the version of firmware and try again."; parent.document.getElementById('loading_block3').style.display = "none"; parent.showLoadingBar(reboottime); setTimeout("parent.detect_httpd();", reboottime*1000); } else if(upgrade_fw_status == 6){ parent.document.getElementById("hiddenMask").style.visibility = "hidden"; parent.document.getElementById('loading_block2').innerHTML = "To comply with regulatory amendments, we have modified our certificate rule to ensure better firmware quality. This version is not compatible with all previously released ASUS firmware and uncertified third party firmware. Please check our official websites for the certified firmware."; parent.document.getElementById('loading_block3').style.display = "none"; parent.showLoadingBar(reboottime); setTimeout("parent.detect_httpd();", reboottime*1000); } else{ aler("Firmware upgrade unsuccessful. This may result from incorrect image or error transmission. Please check the version of firmware and try again."); parent.location.reload(); } </script> </body> </html>
Of course, that could also include the weird memory issue I'm currently having on the 386.7, but I'm trying to understand the cause and provide a solution.
Yes, I would downgrade to 386.7 and see what's going on, and upgrade the firmware one by one to see in which version the issue is fixed.So can we narrow down the original cause of your storage issues?
- FIXED: Some SSH clients would end up with an incorrect PATH
value for the default search path.
Yes, while this error may not affect us, I would like to know more about it to ensure we know how to respond if something like this happens in the future.Keep in mind that 386.7 is below our hard coded check for 386.11, so if this is a firmware bug as you suspect, the script wouldn't encounter this, you did running the commands manually to test the update on 386.7
Thread starter | Title | Forum | Replies | Date |
---|---|---|---|---|
F | seeking help with bridge mode | Asuswrt-Merlin | 28 | |
Looking for feedback: Anyone considering AiCloud important to them? | Asuswrt-Merlin | 246 |
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!