Issue with wsl-integration.sh script causing slow start of Ubuntu shell with WSL2

Bug #1855520 reported by Jeff Strome
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
wslu (Ubuntu)
Fix Released
High
Unassigned
Xenial
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned
Disco
Fix Released
Undecided
Unassigned
Eoan
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

 * Users of Ubuntu on WSL experience long delay in starting the Ubuntu shell when the Windows Firewall is turned on.

[Test Case 1]

 * Install Ubuntu in a WSL2 instance
 * Enable Windows Firewall for Pubic Network
 * (rm -f $HOME/.config/wsl/integration-cache if LP: #1855898 is also fixed)
 * run time . /etc/profile.s/wsl-integration.sh

[Test Case 2] ()

(This should be run for (WSL1,WSL2) x (X and PA server running, X and PA server not running) combinations)
 * Install Ubuntu in a WSL2/WSL1 instance
 * Disable Windows Firewall
 * (rm -f $HOME/.config/wsl/integration-cache if LP: #1855898 is also fixed)
 * run:
  $ unset DISPLAY
  $ unset PULSE_SERVER
  $ time . /etc/profile.s/wsl-integration.sh
  $ echo $DISPLAY $PULSE_SERVER

[Regression Potential]

 * The added timeout may be too low for slow/loaded systems making X/PA server auto detection fail. I've picked the timeout value by testing the successful detection attempts in a KVM VM.
Pactl commands are consistently slower than xvinfo and WSL1 is consistently slower than WSL2:

   max. | WSL1 | WSL2
----------+-------+------
pactl info| ~0.5s |~0.1s
----------+-------+------
xvinfo | ~0.3s |~0.07s

The CPU used in testing: i5-7300U CPU @ 2.60GHz

[Original Bug Text]

$lsb_release -rd
Description: Ubuntu 18.04.3 LTS
Release: 18.04

Today I ran an apt update of my WSL2 Ubuntu 18.04.2 LTS installation on Windows 10 insider build 19037.1. I then noticed when I launched the WSL2 Ubuntu shell that it took about 38 seconds to get a shell prompt. This was not an issue until after I did the update. After some troubleshooting I found out this delay was because of wsl-integration.sh, that the wslu update appears to have added. The following two commands:

env DISPLAY=${WSL_HOST}:0 xvinfo
env PULSE_SERVER=tcp:${WSL_HOST} pactl info

in this script are both timing out on my computer. Because both commands are timing out, that accounted for the 38 seconds it took to get a shell prompt.

In my case, my WSL_HOST IP was 172.24.144.1 and so I ran these two commands:

env DISPLAY=172.24.144.1:0 xvinfo
env PULSE_SERVER=tcp:172.24.144.1 pactl info

and sure enough it took a combined time of about 38 seconds for them to timeout. This is only an issue when running Ubuntu in WSL2, not WSL1. WSL1 launches fine. In the case of the my WSL1 instance, the WSL_HOST appears to be null when running your script, so it assigns localhost to WSL_HOST, and both of these commands timeout without delay.

Revision history for this message
Jeff Strome (eagle007) wrote :

I should also point out that the IP of 172.24.144.1 was pingable from the shell.

Balint Reczey (rbalint)
Changed in wslu (Ubuntu):
status: New → In Progress
importance: Undecided → High
Balint Reczey (rbalint)
description: updated
Balint Reczey (rbalint)
description: updated
Balint Reczey (rbalint)
tags: added: regression-update
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Jeff, or anyone else affected,

Accepted wslu into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/wslu/2.3.2-0ubuntu2~16.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in wslu (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed verification-needed-xenial
Revision history for this message
Robie Basak (racb) wrote :

Hello Jeff, or anyone else affected,

Accepted wslu into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/wslu/2.3.2-0ubuntu2~18.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in wslu (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed-bionic
Changed in wslu (Ubuntu Disco):
status: New → Fix Committed
tags: added: verification-needed-disco
Revision history for this message
Robie Basak (racb) wrote :

Hello Jeff, or anyone else affected,

Accepted wslu into disco-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/wslu/2.3.2-0ubuntu2~19.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-disco to verification-done-disco. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-disco. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in wslu (Ubuntu Eoan):
status: New → Fix Committed
tags: added: verification-needed-eoan
Revision history for this message
Robie Basak (racb) wrote :

Hello Jeff, or anyone else affected,

Accepted wslu into eoan-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/wslu/2.3.2-0ubuntu2~19.10.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Balint Reczey (rbalint) wrote :

I have verified the reverts with WSL1 and WSL2. In both cases the detection checks localhost only which fails quickly (hence the regression is gone) on WSL 1 and WSL2 when X and PulseAudio servers are not running.

X and PulseAudio are still detected quickly on WSL1 and not detected on WSL2, like before fixing LP: #1853343, the fix that was reverted.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu2~19.10.2

---------------
wslu (2.3.2-0ubuntu2~19.10.2) eoan; urgency=medium

  * Revert previous SRU (LP: #1855520):
    - Revert "debian/wsl-integration.sh: Use type instead of which for faster execution"
    - Revert "Detect X and PulseAudio in WSL2, too"

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 08:57:49 +0100

Changed in wslu (Ubuntu Eoan):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu2~19.04.2

---------------
wslu (2.3.2-0ubuntu2~19.04.2) disco; urgency=medium

  * Revert previous SRU (LP: #1855520):
    - Revert "debian/wsl-integration.sh: Use type instead of which for faster execution"
    - Revert "Detect X and PulseAudio in WSL2, too"

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 08:57:49 +0100

Changed in wslu (Ubuntu Disco):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu2~18.04.2

---------------
wslu (2.3.2-0ubuntu2~18.04.2) bionic; urgency=medium

  * Revert previous SRU (LP: #1855520):
    - Revert "debian/wsl-integration.sh: Use type instead of which for faster execution"
    - Revert "Detect X and PulseAudio in WSL2, too"

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 08:57:49 +0100

Changed in wslu (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu2~16.04.2

---------------
wslu (2.3.2-0ubuntu2~16.04.2) xenial; urgency=medium

  * Revert previous SRU (LP: #1855520):
    - Revert "debian/wsl-integration.sh: Use type instead of which for faster execution"
    - Revert "Detect X and PulseAudio in WSL2, too"

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 08:57:49 +0100

Changed in wslu (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu4

---------------
wslu (2.3.2-0ubuntu4) focal; urgency=medium

  * debian/wsl-integration.sh: Set timeouts for X and PulseAudio detection.
    This fixes long startup time when detection fails after waiting for long.
    (LP: #1855520)
  * Cache results of detecting X and sound server in $HOME/.config/wsl/integration-cache.
    Reuse results when starting new shells in the same runnig WSL Ubuntu instance.
    (LP: #1855898)
  * debian/wsl-integration.sh: Use pactl stat instead of pactl info in detection.
    Pactl stat is slightly faster, ~0.3s vs. ~0.45s with pactl info when running
    on WSL1.

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 15:45:09 +0100

Changed in wslu (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Jeff Strome (eagle007) wrote :

I have installed the released fix (wslu 2.3.2-0ubuntu2~18.04.2) and I have confirmed this bug is fixed on my Ubuntu 18.04 LTS WSL2 install. Thank you for your quick response and help regarding this issue.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Jeff, or anyone else affected,

Accepted wslu into eoan-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/wslu/2.3.2-0ubuntu2~19.10.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in wslu (Ubuntu Eoan):
status: Fix Released → Fix Committed
Changed in wslu (Ubuntu Disco):
status: Fix Released → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Jeff, or anyone else affected,

Accepted wslu into disco-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/wslu/2.3.2-0ubuntu2~19.04.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-disco to verification-done-disco. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-disco. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in wslu (Ubuntu Bionic):
status: Fix Released → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Jeff, or anyone else affected,

Accepted wslu into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/wslu/2.3.2-0ubuntu2~18.04.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Jeff, or anyone else affected,

Accepted wslu into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/wslu/2.3.2-0ubuntu2~16.04.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in wslu (Ubuntu Xenial):
status: Fix Released → Fix Committed
Revision history for this message
Jeff Strome (eagle007) wrote :

I installed the bionic-proposed fix (wslu 2.3.2-0ubuntu2~18.04.3) for my WSL2 bionic installation, and it's working just fine. I'm not experiencing any delayed starting of the Ubuntu shell. Thanks for the fix.

Revision history for this message
Geert Eltink (xtreamwayz) wrote :

I have installed 2.3.2-0ubuntu2~18.04.2 and it fixed the startup delay.
Same goes for 2.3.2-0ubuntu2~18.04.3, works without a delay. Thanx for the fix.

Revision history for this message
Balint Reczey (rbalint) wrote :

Verification of test case 1 on all releases.

Verification of test case 2 is the same as verification of LP: #1853343 and the screenshots are attached there.

tags: added: verification-done verification-done-bionic verification-done-disco verification-done-eoan verification-done-xenial
removed: verification-needed verification-needed-bionic verification-needed-disco verification-needed-eoan verification-needed-xenial
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu2~19.10.3

---------------
wslu (2.3.2-0ubuntu2~19.10.3) eoan; urgency=medium

  * Detect X and PulseAudio in WSL2, too (LP: #1853343)
  * debian/wsl-integration.sh: Use type instead of which for faster execution.
    Also skip all detection steps when pactl and xvinfo are not installed.
  * debian/wsl-integration.sh: Set timeouts for X and PulseAudio detection.
    This fixes long startup time when detection fails after waiting for long.
    (LP: #1855520)
  * Cache results of detecting X and sound server in
    $HOME/.cache/wslu/integration. (LP: #1855898)
    Reuse results when starting new shells in the same running
    WSL Ubuntu instance.

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 21:33:12 +0100

Changed in wslu (Ubuntu Eoan):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for wslu has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu2~19.04.3

---------------
wslu (2.3.2-0ubuntu2~19.04.3) disco; urgency=medium

  * Detect X and PulseAudio in WSL2, too (LP: #1853343)
  * debian/wsl-integration.sh: Use type instead of which for faster execution.
    Also skip all detection steps when pactl and xvinfo are not installed.
  * debian/wsl-integration.sh: Set timeouts for X and PulseAudio detection.
    This fixes long startup time when detection fails after waiting for long.
    (LP: #1855520)
  * Cache results of detecting X and sound server in
    $HOME/.cache/wslu/integration. (LP: #1855898)
    Reuse results when starting new shells in the same running
    WSL Ubuntu instance.

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 21:33:12 +0100

Changed in wslu (Ubuntu Disco):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu2~18.04.3

---------------
wslu (2.3.2-0ubuntu2~18.04.3) bionic; urgency=medium

  * Detect X and PulseAudio in WSL2, too (LP: #1853343)
  * debian/wsl-integration.sh: Use type instead of which for faster execution.
    Also skip all detection steps when pactl and xvinfo are not installed.
  * debian/wsl-integration.sh: Set timeouts for X and PulseAudio detection.
    This fixes long startup time when detection fails after waiting for long.
    (LP: #1855520)
  * Cache results of detecting X and sound server in
    $HOME/.cache/wslu/integration. (LP: #1855898)
    Reuse results when starting new shells in the same running
    WSL Ubuntu instance.

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 21:33:12 +0100

Changed in wslu (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.2-0ubuntu2~16.04.3

---------------
wslu (2.3.2-0ubuntu2~16.04.3) xenial; urgency=medium

  * Detect X and PulseAudio in WSL2, too (LP: #1853343)
  * debian/wsl-integration.sh: Use type instead of which for faster execution.
    Also skip all detection steps when pactl and xvinfo are not installed.
  * debian/wsl-integration.sh: Set timeouts for X and PulseAudio detection.
    This fixes long startup time when detection fails after waiting for long.
    (LP: #1855520)
  * Cache results of detecting X and sound server in
    $HOME/.cache/wslu/integration. (LP: #1855898)
    Reuse results when starting new shells in the same running
    WSL Ubuntu instance.

 -- Balint Reczey <email address hidden> Wed, 11 Dec 2019 21:33:12 +0100

Changed in wslu (Ubuntu Xenial):
status: Fix Committed → Fix Released
tags: added: id-5def8ed4ce54f7142244d331
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.