1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

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!

amtm step-by-step install guide - L&LD

Discussion in 'Asuswrt-Merlin' started by L&LD, Apr 21, 2019.

  1. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    9,105
    This is a step-by-step guide that will show how to optimally set up a USB drive for Asus’ RMerlin powered routers that will at the very minimum allow for use of a swap file for your supported router. It will optionally install Entware properly too, all with the help of amtm by @thelonelycoder. The world of scripts will soon become child’s-play with these powerful tools and allow to make your network, more your own. :)

    The full power and control this will give you over your network and clients have not fully been understood yet, but do not worry! Time will give to those who wait. In return, please consider any contribution you can to those that create and continue to support these scripts for us. They really and truly deserve our full support, including @RMerlin for providing such a powerful and stable platform for us to fully use and enjoy.

    This guide will make a few assumptions to try to keep it as concise as possible. First, I am assuming that we are using a supported RMerlin Asus router. Second, I am assuming that your router is stable and is in a good/known state. Thirdly, I take no responsibility for what the following steps and scripts may potentially do to your router, your USB drive, or your network. Not that there is anything wrong with the steps or scripts as presented and used correctly, but I have no control over your use of these steps and scripts. Follow the steps closely, please ask questions if you need to ask, but the final decision and responsibilty to go ahead with this guide is yours alone. For support on these scripts, please use the appropriate thread that each developer has created for their script(s).

    Hope this guide leads you a little more gently down the scripting path for some of the same rewarding discoveries I have found on it too. Let's begin.

    Enable JFFS custom scripts and configs
    1. Go to Administration and select the System Tab
    2. Click 'Yes' to the 'Enable JFFS custom scripts and configs' option
    3. Click USB Mode option to use 'USB 2.0'
    4. Enable SSH to 'LAN Only'
    5. Change SSH Port to '51111'. (Example port number)
      1. We want to use a different 'default' than Port '22'
      2. Anything between '49152 - 65535' is allowed for Dynamic and/or Private Ports
    6. Make sure 'Allow Password Login' is 'Yes'
    7. Set 'Enable SSH Brute Force Protection' to 'Yes'
    8. Finally, make sure to hit the Apply Button at the bottom of the screen
    Now, reboot the router, after it has booted up, wait at least 10 minutes for it to settle.
    The CPU cores will be mostly idle when it is ready.

    Okay, PuTTY! Download and install it from here (64bit) or here (32bit), for Windows PC's.
    1. Startup PuTTY
    2. Type in your Router's IP address into the 'Host Name (or IP address)' box
    3. On default installs, this may be 192.168.1.1, or 192.168.50.1
      1. To verify which IP it is, on a Windows computer, open up a file explorer window, click on the 'Network' link in the left side of that window and then find and right-click on your router
      2. Click on the Network Device tab and verify that the IP address is the one you are typing into PuTTY
    4. Change the Port number to the one used above, the example I gave is '51111'
    5. Make sure that the connection type selected is SSH
    6. Type a meaningful name into the Saved Sessions box such as 'RT-AC86U-Home'
    7. Click the Save button on the right-hand side
    8. Click the Open button at the bottom
    When Putty opens up, it should be asking for our user name.
    Type in the user name you chose for the router.​
    Now, it should be asking for our password.
    Type in the password you chose for your router and then hit enter.​
    PuTTY won't show you typing in your password.
    After you finish typing it in 'blind', just hit the Enter key on your keyboard.​

    Tip: If you have your password saved in a text file on the desktop, copy it.
    In the PuTTY screen, which is waiting for your password to be entered,
    Left-Click once to select PuTTY, then, Right-Click to paste your password.
    Hit Enter and you will be logged in.​

    Finally, amtm time! Like hammer time but with more up-to-date scripts.

    Copy the 'curl' command from the Code box below.

    Code:
    curl -Os https://raw.githubusercontent.com/decoderman/amtm/master/amtm && sh amtm
    Try this as a tip to copy the curl command fully without needing to scroll within the Code box:
    In the code box above, or from the amtm home page (I just copied it here for your convenience, it is the same code at this time), don't do a double click on the word 'curl' above, rather, do a triple click. The click-speed isn't too important, but when you do it properly, the whole command in the Code box will be selected.

    Once it is selected, right-click on it and select copy. Then, at the command prompt in the PuTTY window (you're at the command prompt after entering your username and password), simply right-click to paste it. Then, hit Enter to execute the command.

    Congratulations!
    You've installed your first script!
    Prepare the USB Drive for the swap file, Entware, and scripts.
    • If your USB drive is used, make sure to save all files off of it first​
    • Format it in your computer with the NTFS file format​
    • Insert the USB drive into a router USB port​
    • Use your PuTTY skills above to SSH into the router​
    • Type '/jffs/scripts/amtm' without the quotes and hit Enter​
    • Using amtm's 'fd' command, format the USB drive to Ext4 with journaling and​
    • Make sure to also Label the drive too. The router will reboot.​
      • Note: MIPS routers are limited to ext2 and ext3​
    • Create a swap file using amtm's 'sw' command. I recommend the 2GB size​
      • Be patient while this file is created. It will be worth it​
    • Using amtm's 'dc' command, enable the disk checker utility​
    • Reboot the router and make sure to check the disk checker log to ensure the USB drive 'passes'​
    The router is now able to take advantage of the USB drive and the swap file we created on it to better manage the physical RAM it has and to always use as much as possible for the task(s) it is currently focused on.

    But there is so much more to be had!

    Installing Entware via amtm.
    1. SSH into the router with PuTTY
    2. Type '/jffs/scripts/amtm' without the quotes and hit Enter
    3. using amtm, install Entware
    4. Wait for Entware install to be completed
    5. Optionally, if Diversion is also required,
      1. Install Diversion (Lite) and it will properly install Entware or
      2. Install Diversion (Standard) and it will properly install Entware and pixelserv-tls too
    By having amtm install Entware for us, Entware is guaranteed to start when booting up or inserting the USB drive into the router. This specialized behavior is also applied when installing Diversion on a USB drive that contained Entware that was previously installed by other methods than above.
    amtm is still the preferred way to have Entware installed on your router!


    There are many more scripts we can use to enhance our network-experience with our routers.
    The next few posts will describe some of these and also which ones I use and recommend.
    Including, in no particular order, scripts like YazFi, Skynet, spdMerlin,
    FreshJR QOS, ntpMerlin, Diversion, pixelserv-tls, disk check, connmon, and scribe.
    I will do my best to add new scripts in the posts below as I
    discover them, if you don't discover them first!

    Looking forward to hearing how these
    and future scripts help each
    of us manage the
    networks we use daily in easier
    and always more enjoyable ways.

    This has been an
    L&LD
    Time Flies Production
    v2019/04/21
     
    Last edited: Apr 23, 2019
    snapieee, Quoc Huynh, kernol and 24 others like this.
  2. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    9,105
    Reserved!
     
    Swistheater likes this.
  3. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    9,105
    Reserved 2!
     
    Swistheater likes this.
  4. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    9,105
    Reserved 3!
     
    Swistheater likes this.
  5. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    9,105
    Reserved 4!
     
    Swistheater likes this.
  6. martinr

    martinr Very Senior Member

    Joined:
    Nov 27, 2014
    Messages:
    1,809
    Location:
    United Kingdom
    L&LD likes this.
  7. thelonelycoder

    thelonelycoder Part of the Furniture

    Joined:
    Jan 23, 2014
    Messages:
    5,435
    Location:
    Switzerland
    ext2, ext3 and ext4 is only available on arm and aarch64 routers. MIPS routers are limited to ext2 and ext3.
    Good guide though!
     
    Makaveli and L&LD like this.
  8. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    9,105
    Noted and changed.

    Thank you! :)
     
  9. thelonelycoder

    thelonelycoder Part of the Furniture

    Joined:
    Jan 23, 2014
    Messages:
    5,435
    Location:
    Switzerland
    That is not correct.

    Incompatible way to set up Entware:
    Installing Entware through the router built in entware-setup.sh script or following tutorials floating around on the web.
    Though Diversion fixes the old-fashioned way these installers set up the user scripts in /jffs/scripts, I recommend installing Entware through Diversion or amtm.

    amtm and Diversion compatible way of installing Entware:
    Installing it through amtm or Diversion.
    Both use a foolproof way of installing Entware and ensuring it is started during boot up or when plugging in the USB device, irrespective of the devices label or name.
     
    Last edited: Apr 21, 2019
    L&LD likes this.
  10. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    9,105
    I keep learning! Thank you for the feedback on my old (inaccurate) understanding of this. :)

    Going to change this now in post 1.
     
    Swistheater, Dave Parker and martinr like this.
  11. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    9,105
    @RMerlin, @thelonelycoder, @Adamm, @FreshJR, @Jack Yaz, @cmkelley (and all other scriptwriters who I can't recall right now) I was asked this a few days ago and I think I may have answered incorrectly by the new posts and some other webpages I've read since.

    If we have the 'Enable JFFS custom scripts and configs' option set to 'Yes' and are enjoying using the scripts, will we break the scripts or the router's usability if we set this to 'No'?

    The idea was to use this method as a quick way to test how the network and clients may respond without the scripts running?

    Maybe, it depends on the scripts that are actually installed or in use?
     
  12. el pescador

    el pescador Senior Member

    Joined:
    Jan 15, 2016
    Messages:
    221
    I've loaded amtm about 5 times and every time the cpu cores rocket and stay around 100% (AC88U).

    I have just loaded through this method (had USB 3.0 option on now on 2.)
    Got skynet already loaded so will add each individual option and leave it for a few days to monitor.

    Forgot to add i do have JRFresh's script but it is not being used atm although at some point i have turned it on which also may have caused an issue so will monitor this.
     
    L&LD likes this.
  13. thelonelycoder

    thelonelycoder Part of the Furniture

    Joined:
    Jan 23, 2014
    Messages:
    5,435
    Location:
    Switzerland
    Setting it to "No" and rebooting the router will not remove anything scriptwise in /jffs at all. It flags the firmware not to execute or run the scripts found there.
    This is a good way to boot up the router without any scripts interfering.
    Setting it back to "Yes" and rebooting will reinstate the router as a formidable device, the likes other router manufacturers never enjoy...
     
    Swistheater, Dave Parker and L&LD like this.
  14. martinr

    martinr Very Senior Member

    Joined:
    Nov 27, 2014
    Messages:
    1,809
    Location:
    United Kingdom
    Clever! You’re looking at this as a first-step quick, temporary, troubleshooting tool to check if it’s one of the scripts causing the problem, and then switching back to Yes with no harm done?
     
    Dave Parker and L&LD like this.
  15. thelonelycoder

    thelonelycoder Part of the Furniture

    Joined:
    Jan 23, 2014
    Messages:
    5,435
    Location:
    Switzerland
    amtm by itself is a script that detects the presence of others and does nothing at all if installed.
    It's a gateway to install other scripts by using their installer commands.
     
  16. thelonelycoder

    thelonelycoder Part of the Furniture

    Joined:
    Jan 23, 2014
    Messages:
    5,435
    Location:
    Switzerland
    Can you change that to reflect what amtm is capable of?
    Instead of installing Diversion just to have Entware properly installed and then disable it, use amtm's true potential and let IT install Entware.
     
    Makaveli and L&LD like this.
  17. XIII

    XIII Very Senior Member

    Joined:
    Feb 27, 2014
    Messages:
    753
    I doubt NTFS is the preferred file format for a Unix based system.

    Wouldn’t ext3/ext4 be “better”?

    (Though harder to achieve on a Windows PC)
     
  18. thelonelycoder

    thelonelycoder Part of the Furniture

    Joined:
    Jan 23, 2014
    Messages:
    5,435
    Location:
    Switzerland
    Windows cannot format ext* natively.
    Formatting it as NTFS or FAT on Windows allows amtm to recognize it. It can then format it natively on the router to ext*.
     
  19. XIII

    XIII Very Senior Member

    Joined:
    Feb 27, 2014
    Messages:
    753
    Oops, I did not read the text properly apparently; the USB drive is first formatted NTFS on Windows, but then ext3/ext4 by amtm (I missed the second part).
     
    L&LD likes this.
  20. el pescador

    el pescador Senior Member

    Joined:
    Jan 15, 2016
    Messages:
    221
    Yes.
    I suspect its not amtm but either diversion or another issue.