All Products
Search
Document Center

:What do I do when stuttering occurs during the connection to a Linux instance?

Last Updated:Apr 17, 2025

This topic provides a solution to the stuttering issue that occurs when you connect to a Linux Elastic Compute Service (ECS) instance over SSH.

Problem description

After you enter the username and password, stuttering occurs before you can access the system. During this stuttering period, you can press Ctrl+C to bypass the stuttering and enter the instance.

Causes

The stuttering may be caused by exceptions or updates in the following files, which cause the system to load environment variables for an extended period of time:

  • Global environment variable configuration file: /etc/profile

  • Personal environment variable configuration files:

    • $HOME/.bash_profile

    • $HOME/.bashrc

Note
  • The $HOME environment variable is automatically set to the home directory of the current logon user. For example, the value of the environment variable is /home/ecs-user for the ecs-user user and /root for the root user.

  • To view the value of $HOME, run the echo $HOME command on the terminal.

Solution

  1. Use Workbench to connect to a Linux instance over SSH.

  2. Run the following commands to view the revision times of the environment variable configuration files and determine whether the files have been updated recently:

    ls -l $HOME/.bash_profile
    ls -l $HOME/.bashrc
    ls -l /etc/profile

    If the revision time of a file is recent, the file may have been updated recently. We recommend that you view the file content.

  3. Run the following commands to view the file content and find the abnormal content that may cause the stuttering:

    cat $HOME/.bash_profile
    cat $HOME/.bashrc
    sudo cat /etc/profile
    • If a file contains complex scripts such as loops and conditional statements, network requests such as curl and wget, or dynamic path loading such as export PATH=$(some_command), proceed to the next step.

    • If the file content is normal (for example, if the files contain only simple environment variable settings), proceed to Step 7 to reload the files.

  4. Run the following commands to open the environment variable configuration files.

    • Personal configuration files:

      vi $HOME/.bash_profile
      vi $HOME/.bashrc
    • Global configuration file:

      sudo vi /etc/profile
  5. Comment out the updated content.

    Press the I key to edit the file content and add a number sign (#) before the updated content to comment it out. Example:

    # export PATH=$PATH:/some/path
    # curl https://example.com
  6. Press the Esc key, enter :wq, and then press the Enter key to save and exit the configuration files.

  7. Run the following commands to reload the configuration files for the environment variables to take effect.

    • Personal configuration files:

      source $HOME/.bash_profile
      source $HOME/.bashrc
    • Global configuration file:

      1. Switch to the root user.

        sudo -i
      2. Reload the global configuration file.

        source /etc/profile
      3. Exit from the root user.

        exit
  8. Reconnect to the ECS instance to verify that the stuttering issue is resolved.

  9. Uncomment the lines that you commented out one by one to restore them.

    1. Each time you uncomment a line, repeat Step 7, reload the corresponding configuration file, and then reconnect to the ECS instance to check whether the stuttering issue recurs.

    2. If the stuttering issue recurs after you uncomment a line, the content in the line causes the issue. Recommended optimizations or solutions:

      • Remove unnecessary network requests.

      • Optimize complex scripts.

      • Modify dynamic path loading settings.