Skip to content

gh repo command is slower in wsl2 #7208

Closed

Description

@vikaspoddar

GitHub CLI command "gh repo create" slow to respond in wsl2

gh version 2.24.3

Steps to reproduce the behavior

  1. Type this 'gh repo create '
  2. View the output ' interactive menu do not appear (some time takes up 10 min)'

Expected vs actual behavior

Expected behavior : interactive menu should appear as soon as command is pressed
Actual Behavior : it takes upto 10 min to open interactive menu
While it is not working on wsl2 but it is working perfectly on windows command prompt

Logs

Paste the activity from your command line. Redact if needed.

Activity

  1. added
    bug
    on Mar 21, 2023
  2. added
    needs-triage
    on Mar 21, 2023
  3. samcoe commented on Mar 22, 2023

    @samcoe
    Contributor

    @vikaspoddar Sorry you are having this trouble. We have not had reports in the past of gh being slow inside wsl2. Are you seeing slowness for commands that do not have interactive prompts? Did this issue start recently?

  4. added
    more-info-needed
    and removed
    needs-triage
    on Mar 22, 2023
  5. vilmibm commented on Mar 22, 2023

    @vilmibm
    Contributor

    I use gh on wsl2 daily and can't reproduce this, FWIW. ran in both Alacritty and Windows Terminal.

  6. vikaspoddar commented on Mar 22, 2023

    @vikaspoddar
    Author

    @samcoe This issue started recently in wsl2 environment for interactive command and other commands like

    gh repo list

    But no problem are occurring in powershell environment.
    I have reinstalled gh CLI but this condition occured again

  7. samcoe commented on Mar 22, 2023

    @samcoe
    Contributor

    @vikaspoddar As the team has not been able to reproduce this issue I am not sure there is much else we can do to help without more information to go on. The only idea I have left is to update gh to the latest version as there were a couple bug fixes since version 2.24.3.

  8. vikaspoddar commented on Mar 22, 2023

    @vikaspoddar
    Author

    @samcoe Okay sir, I will reinstall the gh CLI tool
    And will inform you

  9. mislav commented on Mar 28, 2023

    @mislav
    Contributor

    By default, dbus (which gh tries to use to communicate to Secret Service on linux) is not running under WSL2, and an attempt to retrieve an encrypted token should immediately fail and the lookup should fall back to gh's config file instead.

    However, for you and apparently for @mbates and some other users the operation seems to hang for a long time or indefinitely. I'm not sure what circumstances lead to this, but @vilmibm was guessing that this might be affecting users who have taken steps to explicitly enable dbus in their WSL2 instances. Does this describe you?

    In any case, I'm considering adding some debugging to token lookups so that the user at least gets an indication where the gh process is stuck.

  10. benjlevesque commented on Apr 21, 2023

    @benjlevesque
    Contributor

    @vikaspoddar maybe related to #7145?

  11. vikaspoddar commented on Apr 21, 2023

    @vikaspoddar
    Author

    @benjlevesque I will take a look at it. Thank you

  12. wrenna-robson commented on May 3, 2023

    @wrenna-robson

    For what it's worth, I just had this issue and wsl --shutdown followed by wsl fixed it. (It worked the first time - I made an error and had to cancel the auth, then I was getting this problem the second time.)

  13. JayJamieson commented on May 9, 2023

    @JayJamieson

    Can confirm this is slow for me too. I restarted wsl2 and first command is super fast then slows down again.

    • What information about my system will be helpful?
    gh version 2.28.0 (2023-04-25)
    https://github.com/cli/cli/releases/tag/v2.28.0
    
    Linux DESKTOP-TLURRUM 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
    
    NAME="Ubuntu"
    VERSION="20.04.5 LTS (Focal Fossa)"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 20.04.5 LTS"
    VERSION_ID="20.04"
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    VERSION_CODENAME=focal
    UBUNTU_CODENAME=focal
    

    I tried looking at strace output of gh status and found a lot of the following. Waiting to read and then timing out, my assumption is this could be the endless loop somewhere?

    strace -f -o /tmp/strace.log -p <PID>
    
    6690  futex(0x2af3c78, FUTEX_WAIT_PRIVATE, 0, {tv_sec=0, tv_nsec=119772809} <unfinished ...>
    6695  <... read resumed>"\0", 16)       = 1
    6695  epoll_pwait(4, [], 128, 0, NULL, 3724) = 0
    6695  epoll_pwait(4, [], 128, 119, NULL, 3724) = 0
    6690  <... futex resumed>)              = -1 ETIMEDOUT (Connection timed out)
    6695  futex(0x2aed388, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
    6690  epoll_pwait(4,  <unfinished ...>
    6695  <... futex resumed>)              = 1
    6690  <... epoll_pwait resumed>[], 128, 0, NULL, 3724) = 0
    6689  <... futex resumed>) 
    

    By default, dbus (which gh tries to use to communicate to Secret Service on linux) is not running under WSL2, and an attempt to retrieve an encrypted token should immediately fail and the lookup should fall back to gh's config file instead.

    However, for you and apparently for @mbates and some other users the operation seems to hang for a long time or indefinitely. I'm not sure what circumstances lead to this, but @vilmibm was guessing that this might be affecting users who have taken steps to explicitly enable dbus in their WSL2 instances. Does this describe you?

    In any case, I'm considering adding some debugging to token lookups so that the user at least gets an indication where the gh process is stuck.

    Im not a strace exprt but i see a lot of dbus output running sudo strace -p <PID> -s 512 -ewrite 2> /tmp/strace.log and no further progress. I had this running close to 10 minutes with continuous dbus calls and no progress.

  14. samcoe commented on May 9, 2023

    @samcoe
    Contributor

    I think there is enough evidence here that this is related to dbus and encrypted token storage. Right now we are waiting for the dbus process to timeout when we should probably have our own timeout in gh. @mislav what do you think about adding a timeout to the retrieval of encrypted tokens?

  15. Shahaed commented on May 28, 2023

    @Shahaed

    I think there is enough evidence here that this is related to dbus and encrypted token storage. Right now we are waiting for the dbus process to timeout when we should probably have our own timeout in gh. @mislav what do you think about adding a timeout to the retrieval of encrypted tokens?

    @samcoe Can (probably) confirm this is correct since the workaround here: #7145 fixes the issue.

  16. samcoe commented on Jun 7, 2023

    @samcoe
    Contributor

    Is anyone still experiencing this issue with the latest release v2.30.0? We bumped the library we use for accessing secure token storage and it had a couple of bug fixes in it.

  17. RobertGemmaJr commented on Jun 7, 2023

    @RobertGemmaJr

    @samcoe Can confirm this is still an issue with WSL2 (Ubuntu) for me. Followed the linux install instructions and gh auth login is hanging indefinitely.

  18. Arinerron commented on Jun 12, 2023

    @Arinerron

    I'm having this issue on Arch Linux. dbus is running:

    ● dbus.service - D-Bus System Message Bus
         Loaded: loaded (/usr/lib/systemd/system/dbus.service; static)
         Active: active (running) since Tue 2023-06-06 16:15:51 PDT; 5 days ago
    

    It's also hanging here:

    futex(0x55a453487368, FUTEX_WAIT_PRIVATE, 0, NULL
    
  19. simenandre commented on Aug 25, 2025

    @simenandre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmore-info-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions