TL-WR841N v7 - Going back to original firmware

i have a tl-wr841n v7, it is a 4mb flash device. so.. i insalled openwrt without luci, so from client i tried to install luci with opkg install luci, to get luci back and revert back to original firmware. but it got issues now on access my router ip it says

/usr/lib/lua/luci/dispatcher.lua:319: No valid theme found
stack traceback:
	[C]: in function 'assert'
	/usr/lib/lua/luci/dispatcher.lua:319: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:127: in function </usr/lib/lua/luci/dispatcher.lua:126>

trying wget to download original firmware it gives error:

Writing to 'wr841nv7_en_3_13_9_up.bin'
Cannot open output file: No space left on device

and the logs of everything is here

root@Blohsh:~# opkg install luci
Installing luci (git-20.356.64372-1259bb1-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/luci_git-20.356.64372-1259bb1-1_all.ipk
Installing uhttpd (2020-02-12-2ee323c0-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/base/uhttpd_2020-02-12-2ee323c0-1_mips_24kc.ipk
Installing liblua (5.1.5-2) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/base/liblua_5.1.5-2_mips_24kc.ipk
Installing lua (5.1.5-2) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/base/lua_5.1.5-2_mips_24kc.ipk
Installing luci-lib-nixio (git-20.356.64372-1259bb1-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/luci-lib-nixio_git-20.356.64372-1259bb1-1_mips_24kc.ipk
Installing luci-lib-ip (git-20.356.64372-1259bb1-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/luci-lib-ip_git-20.356.64372-1259bb1-1_mips_24kc.ipk
Installing rpcd (2020-05-26-7be1f171-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/base/rpcd_2020-05-26-7be1f171-1_mips_24kc.ipk
Installing libubus-lua (2018-10-06-221ce7e7-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/base/libubus-lua_2018-10-06-221ce7e7-1_mips_24kc.ipk
Installing luci-lib-jsonc (git-20.356.64372-1259bb1-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/luci-lib-jsonc_git-20.356.64372-1259bb1-1_mips_24kc.ipk
Installing liblucihttp (2019-07-05-a34a17d5-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/liblucihttp_2019-07-05-a34a17d5-1_mips_24kc.ipk
Installing liblucihttp-lua (2019-07-05-a34a17d5-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/liblucihttp-lua_2019-07-05-a34a17d5-1_mips_24kc.ipk
Installing luci-base (git-20.356.64372-1259bb1-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/luci-base_git-20.356.64372-1259bb1-1_mips_24kc.ipk
Installing luci-mod-admin-full (git-20.356.64372-1259bb1-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/luci-mod-admin-full_git-20.356.64372-1259bb1-1_mips_24kc.ipk
Configuring rpcd.
ln: /etc/rc.d/S12rpcd: No space left on device
Configuring liblua.
Configuring luci-lib-ip.
Configuring libubus-lua.
Configuring lua.
Configuring luci-lib-nixio.
Configuring luci-lib-jsonc.
Configuring liblucihttp.
Configuring liblucihttp-lua.
Configuring luci-base.
ln: /etc/rc.d/S80ucitrack: No space left on device
Configuring uhttpd.
ln: /etc/rc.d/S50uhttpd: No space left on device
Collected errors:
 * resolve_conffiles: Existing conffile /etc/config/luci is different from the conffile in the new package. The new conffile will be placed at /etc/config/luci-opkg.
 * wfopen: /usr/lib/lua/luci/view/admin_network/iface_status.htm: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_network/lease_status.htm: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_network/switch_status.htm: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_network/wifi_assoclist.htm: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_network/wifi_join.htm: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_network/wifi_overview_status.htm: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_network/wifi_status.htm: No space left on device.
 * extract_archive: Cannot make dir /usr/lib/lua/luci/view/admin_status/: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_status/bandwidth.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_status/connections.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_status/dmesg.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_status/index.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_status/iptables.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_status/load.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_status/routes.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_status/syslog.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_status/wireless.htm: No such file or directory.
 * extract_archive: Cannot make dir /usr/lib/lua/luci/view/admin_system/: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_system/applyreboot.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_system/backupfiles.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_system/clock_status.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_system/flashops.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_system/ipkg.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_system/packages.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_system/reboot.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_system/upgrade.htm: No such file or directory.
 * extract_archive: Cannot make dir /usr/lib/lua/luci/view/admin_uci/: No space left on device.
 * wfopen: /usr/lib/lua/luci/view/admin_uci/changelog.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_uci/changes.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/admin_uci/revert.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/cbi/wireless_modefreq.htm: No space left on device.
 * wfopen: /www/luci-static/resources/bandwidth.svg: No space left on device.
 * wfopen: /www/luci-static/resources/connections.svg: No space left on device.
 * wfopen: /www/luci-static/resources/load.svg: No space left on device.
 * wfopen: /www/luci-static/resources/wifirate.svg: No space left on device.
 * wfopen: /www/luci-static/resources/wireless.svg: No space left on device.
 * pkg_write_filelist: Failed to open //usr/lib/opkg/info/luci-mod-admin-full.list: No space left on device.
 * opkg_install_pkg: Failed to extract data files for luci-mod-admin-full. Package debris may remain!
 * opkg_install_cmd: Cannot install package luci.
 * opkg_conf_write_status_files: Can't open status file //usr/lib/opkg/status: No space left on device.
root@Blohsh:~# opkg uninstall luci
opkg: unknown sub-command uninstall
usage: opkg [options...] sub-command [arguments...]
where sub-command is one of:

Package Manipulation:
        update                  Update list of available packages
        upgrade <pkgs>          Upgrade packages
        install <pkgs>          Install package(s)
        configure <pkgs>        Configure unpacked package(s)
        remove <pkgs|regexp>    Remove package(s)
        flag <flag> <pkgs>      Flag package(s)
         <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)

Informational Commands:
        list                    List available packages
        list-installed          List installed packages
        list-upgradable         List installed and upgradable packages
        list-changed-conffiles  List user modified configuration files
        files <pkg>             List files belonging to <pkg>
        search <file|regexp>    List package providing <file>
        find <regexp>           List packages whose name or description matches <regexp>
        info [pkg|regexp]       Display all info for <pkg>
        status [pkg|regexp]     Display all status for <pkg>
        download <pkg>          Download <pkg> to current directory
        compare-versions <v1> <op> <v2>
                            compare versions using <= < > >= = << >>
        print-architecture      List installable package architectures
        depends [-A] [pkgname|pat]+
        whatdepends [-A] [pkgname|pat]+
        whatdependsrec [-A] [pkgname|pat]+
        whatrecommends[-A] [pkgname|pat]+
        whatsuggests[-A] [pkgname|pat]+
        whatprovides [-A] [pkgname|pat]+
        whatconflicts [-A] [pkgname|pat]+
        whatreplaces [-A] [pkgname|pat]+

Options:
        -A                      Query all packages not just those installed
        -V[<level>]             Set verbosity level to <level>.
        --verbosity[=<level>]   Verbosity levels:
                                        0 errors only
                                        1 normal messages (default)
                                        2 informative messages
                                        3 debug
                                        4 debug level 2
        -f <conf_file>          Use <conf_file> as the opkg configuration file
        --conf <conf_file>
        --cache <directory>     Use a package cache
        -d <dest_name>          Use <dest_name> as the the root directory for
        --dest <dest_name>      package installation, removal, upgrading.
                                <dest_name> should be a defined dest name from
                                the configuration file, (but can also be a
                                directory name in a pinch).
        -o <dir>                Use <dir> as the root directory for
        --offline-root <dir>    offline installation of packages.
        --add-arch <arch>:<prio>        Register architecture with given priority
        --add-dest <name>:<path>        Register destination with given path

Force Options:
        --force-depends         Install/remove despite failed dependencies
        --force-maintainer      Overwrite preexisting config files
        --force-reinstall       Reinstall package(s)
        --force-overwrite       Overwrite files from other package(s)
        --force-downgrade       Allow opkg to downgrade packages
        --force-space           Disable free space checks
        --force-postinstall     Run postinstall scripts even in offline mode
        --force-remove  Remove package even if prerm script fails
        --force-checksum        Don't fail on checksum mismatches
        --no-check-certificate Don't validate SSL certificates
        --noaction              No action -- test only
        --download-only No action -- download only
        --nodeps                Do not follow dependencies
        --nocase                Perform case insensitive pattern matching
        --size                  Print package size when listing available packages
        --force-removal-of-dependent-packages
                                Remove package and all dependencies
        --autoremove            Remove packages that were installed
                                automatically to satisfy dependencies
        -t                      Specify tmp-dir.
        --tmp-dir               Specify tmp-dir.
        -l                      Specify lists-dir.
        --lists-dir             Specify lists-dir.

 regexp could be something like 'pkgname*' '*file*' or similar
 e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'
root@Blohsh:~# opkg remove luci
No packages removed.
root@Blohsh:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1792      1792         0 100% /rom
tmpfs                    13908       984     12924   7% /tmp
/dev/mtdblock3             768       704        64  92% /overlay
overlayfs:/overlay         768       704        64  92% /
tmpfs                      512         0       512   0% /dev
root@Blohsh:~# opkg --autoremove
opkg must have one sub-command argument
usage: opkg [options...] sub-command [arguments...]
where sub-command is one of:

Package Manipulation:
        update                  Update list of available packages
        upgrade <pkgs>          Upgrade packages
        install <pkgs>          Install package(s)
        configure <pkgs>        Configure unpacked package(s)
        remove <pkgs|regexp>    Remove package(s)
        flag <flag> <pkgs>      Flag package(s)
         <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)

Informational Commands:
        list                    List available packages
        list-installed          List installed packages
        list-upgradable         List installed and upgradable packages
        list-changed-conffiles  List user modified configuration files
        files <pkg>             List files belonging to <pkg>
        search <file|regexp>    List package providing <file>
        find <regexp>           List packages whose name or description matches <regexp>
        info [pkg|regexp]       Display all info for <pkg>
        status [pkg|regexp]     Display all status for <pkg>
        download <pkg>          Download <pkg> to current directory
        compare-versions <v1> <op> <v2>
                            compare versions using <= < > >= = << >>
        print-architecture      List installable package architectures
        depends [-A] [pkgname|pat]+
        whatdepends [-A] [pkgname|pat]+
        whatdependsrec [-A] [pkgname|pat]+
        whatrecommends[-A] [pkgname|pat]+
        whatsuggests[-A] [pkgname|pat]+
        whatprovides [-A] [pkgname|pat]+
        whatconflicts [-A] [pkgname|pat]+
        whatreplaces [-A] [pkgname|pat]+

Options:
        -A                      Query all packages not just those installed
        -V[<level>]             Set verbosity level to <level>.
        --verbosity[=<level>]   Verbosity levels:
                                        0 errors only
                                        1 normal messages (default)
                                        2 informative messages
                                        3 debug
                                        4 debug level 2
        -f <conf_file>          Use <conf_file> as the opkg configuration file
        --conf <conf_file>
        --cache <directory>     Use a package cache
        -d <dest_name>          Use <dest_name> as the the root directory for
        --dest <dest_name>      package installation, removal, upgrading.
                                <dest_name> should be a defined dest name from
                                the configuration file, (but can also be a
                                directory name in a pinch).
        -o <dir>                Use <dir> as the root directory for
        --offline-root <dir>    offline installation of packages.
        --add-arch <arch>:<prio>        Register architecture with given priority
        --add-dest <name>:<path>        Register destination with given path

Force Options:
        --force-depends         Install/remove despite failed dependencies
        --force-maintainer      Overwrite preexisting config files
        --force-reinstall       Reinstall package(s)
        --force-overwrite       Overwrite files from other package(s)
        --force-downgrade       Allow opkg to downgrade packages
        --force-space           Disable free space checks
        --force-postinstall     Run postinstall scripts even in offline mode
        --force-remove  Remove package even if prerm script fails
        --force-checksum        Don't fail on checksum mismatches
        --no-check-certificate Don't validate SSL certificates
        --noaction              No action -- test only
        --download-only No action -- download only
        --nodeps                Do not follow dependencies
        --nocase                Perform case insensitive pattern matching
        --size                  Print package size when listing available packages
        --force-removal-of-dependent-packages
                                Remove package and all dependencies
        --autoremove            Remove packages that were installed
                                automatically to satisfy dependencies
        -t                      Specify tmp-dir.
        --tmp-dir               Specify tmp-dir.
        -l                      Specify lists-dir.
        --lists-dir             Specify lists-dir.

 regexp could be something like 'pkgname*' '*file*' or similar
 e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'
root@Blohsh:~# opkg remove 'luci'
No packages removed.
root@Blohsh:~# opkg remove luci
No packages removed.
root@Blohsh:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1792      1792         0 100% /rom
tmpfs                    13908       984     12924   7% /tmp
/dev/mtdblock3             768       704        64  92% /overlay
overlayfs:/overlay         768       704        64  92% /
tmpfs                      512         0       512   0% /dev
root@Blohsh:~# vdir
-ash: vdir: not found
root@Blohsh:~# cd /tmp
root@Blohsh:/tmp# cd /tmp
root@Blohsh:/tmp# opkg list luci-app-\*
Collected errors:
 * pkg_hash_add_from_file: Failed to open /var/opkg-lists/openwrt_telephony: Out of memory.
root@Blohsh:/tmp# /etc/init.d/uhttpd restart
root@Blohsh:/tmp#  opkg --autoremove remove luci
No packages removed.
root@Blohsh:/tmp# cd ~
root@Blohsh:~#  opkg --autoremove remove luci
No packages removed.
root@Blohsh:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1792      1792         0 100% /rom
tmpfs                    13908       984     12924   7% /tmp
/dev/mtdblock3             768       704        64  92% /overlay
overlayfs:/overlay         768       704        64  92% /
tmpfs                      512         0       512   0% /dev
root@Blohsh:~# opkg install luci-theme-bootstrap
Installing luci-theme-bootstrap (git-20.356.64372-1259bb1-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.8/packages/mips_24kc/luci/luci-theme-bootstrap_git-20.356.64372-1259bb1-1_all.ipk
Collected errors:
 * wfopen: //usr/lib/opkg/info/luci-theme-bootstrap.control: No space left on device.
 * wfopen: //usr/lib/opkg/info/luci-theme-bootstrap.postinst: No space left on device.
 * wfopen: //usr/lib/opkg/info/luci-theme-bootstrap.postinst-pkg: No space left on device.
 * wfopen: //usr/lib/opkg/info/luci-theme-bootstrap.prerm: No space left on device.
 * wfopen: /etc/uci-defaults/30_luci-theme-bootstrap: No space left on device.
 * extract_archive: Cannot make dir /usr/lib/lua/luci/view/themes/: No space left on device.
 * extract_archive: Cannot make dir /usr/lib/lua/luci/view/themes/bootstrap/: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/themes/bootstrap/footer.htm: No such file or directory.
 * wfopen: /usr/lib/lua/luci/view/themes/bootstrap/header.htm: No such file or directory.
 * extract_archive: Cannot make dir /www/luci-static/bootstrap/: No space left on device.
 * wfopen: /www/luci-static/bootstrap/cascade.css: No such file or directory.
 * wfopen: /www/luci-static/bootstrap/favicon.ico: No such file or directory.
 * wfopen: /www/luci-static/bootstrap/mobile.css: No such file or directory.
 * pkg_write_filelist: Failed to open //usr/lib/opkg/info/luci-theme-bootstrap.list: No space left on device.
 * opkg_install_pkg: Failed to extract data files for luci-theme-bootstrap. Package debris may remain!
 * opkg_install_cmd: Cannot install package luci-theme-bootstrap.
 * opkg_conf_write_status_files: Can't open status file //usr/lib/opkg/status: No space left on device.
root@Blohsh:~#  opkg --autoremove remove luci
No packages removed.
root@Blohsh:~#  opkg --autoremove luci
opkg: unknown sub-command luci
usage: opkg [options...] sub-command [arguments...]
where sub-command is one of:

Package Manipulation:
        update                  Update list of available packages
        upgrade <pkgs>          Upgrade packages
        install <pkgs>          Install package(s)
        configure <pkgs>        Configure unpacked package(s)
        remove <pkgs|regexp>    Remove package(s)
        flag <flag> <pkgs>      Flag package(s)
         <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)

Informational Commands:
        list                    List available packages
        list-installed          List installed packages
        list-upgradable         List installed and upgradable packages
        list-changed-conffiles  List user modified configuration files
        files <pkg>             List files belonging to <pkg>
        search <file|regexp>    List package providing <file>
        find <regexp>           List packages whose name or description matches <regexp>
        info [pkg|regexp]       Display all info for <pkg>
        status [pkg|regexp]     Display all status for <pkg>
        download <pkg>          Download <pkg> to current directory
        compare-versions <v1> <op> <v2>
                            compare versions using <= < > >= = << >>
        print-architecture      List installable package architectures
        depends [-A] [pkgname|pat]+
        whatdepends [-A] [pkgname|pat]+
        whatdependsrec [-A] [pkgname|pat]+
        whatrecommends[-A] [pkgname|pat]+
        whatsuggests[-A] [pkgname|pat]+
        whatprovides [-A] [pkgname|pat]+
        whatconflicts [-A] [pkgname|pat]+
        whatreplaces [-A] [pkgname|pat]+

Options:
        -A                      Query all packages not just those installed
        -V[<level>]             Set verbosity level to <level>.
        --verbosity[=<level>]   Verbosity levels:
                                        0 errors only
                                        1 normal messages (default)
                                        2 informative messages
                                        3 debug
                                        4 debug level 2
        -f <conf_file>          Use <conf_file> as the opkg configuration file
        --conf <conf_file>
        --cache <directory>     Use a package cache
        -d <dest_name>          Use <dest_name> as the the root directory for
        --dest <dest_name>      package installation, removal, upgrading.
                                <dest_name> should be a defined dest name from
                                the configuration file, (but can also be a
                                directory name in a pinch).
        -o <dir>                Use <dir> as the root directory for
        --offline-root <dir>    offline installation of packages.
        --add-arch <arch>:<prio>        Register architecture with given priority
        --add-dest <name>:<path>        Register destination with given path

Force Options:
        --force-depends         Install/remove despite failed dependencies
        --force-maintainer      Overwrite preexisting config files
        --force-reinstall       Reinstall package(s)
        --force-overwrite       Overwrite files from other package(s)
        --force-downgrade       Allow opkg to downgrade packages
        --force-space           Disable free space checks
        --force-postinstall     Run postinstall scripts even in offline mode
        --force-remove  Remove package even if prerm script fails
        --force-checksum        Don't fail on checksum mismatches
        --no-check-certificate Don't validate SSL certificates
        --noaction              No action -- test only
        --download-only No action -- download only
        --nodeps                Do not follow dependencies
        --nocase                Perform case insensitive pattern matching
        --size                  Print package size when listing available packages
        --force-removal-of-dependent-packages
                                Remove package and all dependencies
        --autoremove            Remove packages that were installed
                                automatically to satisfy dependencies
        -t                      Specify tmp-dir.
        --tmp-dir               Specify tmp-dir.
        -l                      Specify lists-dir.
        --lists-dir             Specify lists-dir.

 regexp could be something like 'pkgname*' '*file*' or similar
 e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'
root@Blohsh:~#  opkg remove luci
No packages removed.
root@Blohsh:~#  opkg --force-remove remove luci
No packages removed.
root@Blohsh:~#

This image will fit your device, and comes with luci:
https://openwrt.ashus.net/19.07.6-targets-ath79-tiny-luci/
source: OpenWrt 19.07.1 ath79 tiny LuCI

v7 recovery: https://openwrt.org/toh/tp-link/tl-wr841nd#v7

ok i managed to download tplink firmware in tmp, now i should use
mtd -r write /tmp/original_firmware.bin firmware
or mtd -r write /tmp/original_firmware.bin linux?

I'm pretty sure the image contains more than that, check using binwalk.

i don't understand what you said, can you explain a bit please? binwalk command not found.

the image probably contains more than just linux, but you can find out using binwalk.

https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320793

Sysupgrade works fine with these ROMs.

2 Likes

Yup,

I guess the problem is/was he didn't store it in /tmp and ran out of space.

thanks this better worked, the tftpd was not writing firmware, but i tried to install from the tmp.

thanks for the 19 version link. that also helped me.

1 Like

This topic was automatically closed 0 minutes after the last reply. New replies are no longer allowed.