Unable to disable bash audible bell when connected to a remote server via ssh #13182

Closed
opened 2026-01-31 03:36:00 +00:00 by claunia · 6 comments
Owner

Originally created by @thistlillo on GitHub (Mar 25, 2021).

I disabled the audible bell of the bash ( version 5.0.17(1)-release) in WSL2 by adding the usual set bell-style none. When I run it "directly" (I mean: I click on its icon), I have no problems:

  • the bell does not ring when I am working locally
  • the bell does not ring when I am connected to a remote server.

However, when the same bash shell is run inside of a Windows Terminal (1.6.10571.0 on Windows 10 Pro) the behaviour changes:

  • the bell does not ring when I work locally
  • the bell DOES RING when I am connected to a remote (linux) server via ssh.

I disabled the audible bell also on the remote server, but Windows Terminal ignores the settings and just plays the bell.

I think this is a bug.

Originally created by @thistlillo on GitHub (Mar 25, 2021). I disabled the audible bell of the bash ( version 5.0.17(1)-release) in WSL2 by adding the usual `set bell-style none`. When I run it "directly" (I mean: I click on its icon), I have no problems: - the bell does not ring when I am working locally - the bell does not ring when I am connected to a remote server. However, when the same bash shell is run inside of a Windows Terminal (1.6.10571.0 on Windows 10 Pro) the behaviour changes: - the bell does not ring when I work locally - the bell DOES RING when I am connected to a remote (linux) server via ssh. I disabled the audible bell also on the remote server, but Windows Terminal ignores the settings and just plays the bell. I think this is a bug.
Author
Owner

@skyline75489 commented on GitHub (Mar 25, 2021):

the bell DOES RING when I am connected to a remote (linux) server via ssh.

So this is basically the only thing you didn't expect and think is a bug, right?

I disabled the audible bell also on the remote server

How do you do this, exactly?

@skyline75489 commented on GitHub (Mar 25, 2021): > the bell DOES RING when I am connected to a remote (linux) server via ssh. So this is basically the only thing you didn't expect and think is a bug, right? > I disabled the audible bell also on the remote server How do you do this, exactly?
Author
Owner

@zadjii-msft commented on GitHub (Mar 25, 2021):

That sure is strange. If the bell isn't playing in conhost (i.e. "opened WSL directly") when connected via ssh, then there's no reason that the Terminal should be. The Terminal uses a hidden conhost to process all the output from the client application, so if the conhost isn't ever getting the BEL, then there's no reason for the Terminal to bell (because conhost won't be sending one to the Terminal).

What are you doing in the remote server to cause the bell to be emitted?

@zadjii-msft commented on GitHub (Mar 25, 2021): That sure is strange. If the bell isn't playing in conhost (i.e. "opened WSL directly") when connected via ssh, then there's no reason that the Terminal should be. The Terminal uses a hidden conhost to process all the output from the client application, so if the conhost isn't ever getting the BEL, then there's no reason for the Terminal to bell (because conhost won't be sending one to the Terminal). What are you doing in the remote server to cause the bell to be emitted?
Author
Owner

@thistlillo commented on GitHub (Mar 25, 2021):

Sorry, you are right.
I was expecting the terminal not to beep also when connected to a remote server (as it behaves when working on the local machine).

When I say that I disabled the audible bell also on the remote server, I mean that I added set bell-style none for the remote shell too (bash shell).

The bell is played by, for example, using tab to auto-complete filenames.

@thistlillo commented on GitHub (Mar 25, 2021): Sorry, you are right. I was expecting the terminal not to beep also when connected to a remote server (as it behaves when working on the local machine). When I say that I disabled the audible bell also on the remote server, I mean that I added `set bell-style none` for the remote shell too (bash shell). The bell is played by, for example, using `tab` to auto-complete filenames.
Author
Owner

@thistlillo commented on GitHub (Mar 25, 2021):

Sorry, I made some other attempts and I was wrong.
This is the behaviour:

  • shell run on its own window. The ubuntu (bash) shell behaves correctly both locally and remotely. After set bell-style none, I see no 'signs' when, for example, I ask the auto-completion of ambiguous names.

  • shell run inside of windows terminal. The set bell-style none is ignored. The shell does not play any sound, but there is the visible bell locally (window flashes). When connected to the remote server, a sound is played.

Sorry for the confusion.

The command set bell-style none is in ~/.profile. I tried 1) to add it to ~/.bashrc and 2) to both of them, but this behaviour stays the same.

@thistlillo commented on GitHub (Mar 25, 2021): Sorry, I made some other attempts and I was wrong. This is the behaviour: - shell run on its own window. The ubuntu (bash) shell behaves correctly both locally and remotely. After `set bell-style none`, I see no 'signs' when, for example, I ask the auto-completion of ambiguous names. - shell run inside of windows terminal. The `set bell-style none` is ignored. The shell does not play any sound, but there is the `visible` bell locally (window flashes). When connected to the remote server, a sound is played. Sorry for the confusion. The command `set bell-style none` is in `~/.profile`. I tried 1) to add it to `~/.bashrc` and 2) to both of them, but this behaviour stays the same.
Author
Owner

@zadjii-msft commented on GitHub (Mar 25, 2021):

The command set bell-style none is in ~/.profile. I tried 1) to add it to ~/.bashrc and 2) to both of them, but this behaviour stays the same.

Uh, that's not the right place to put that - you need to add that to /etc/inputrc.

Check https://stackoverflow.com/a/36726662 - I know it mentions WSL specifically, but that applies to pretty much any linux install.

@zadjii-msft commented on GitHub (Mar 25, 2021): > The command `set bell-style none` is in `~/.profile`. I tried 1) to add it to `~/.bashrc` and 2) to both of them, but this behaviour stays the same. Uh, that's not the right place to put that - you need to add that to `/etc/inputrc`. Check https://stackoverflow.com/a/36726662 - I know it mentions WSL specifically, but that applies to pretty much any linux install.
Author
Owner

@thistlillo commented on GitHub (Mar 25, 2021):

Ok, so I solved setting it in ~/.inputrc on the remote server. There is no need to modify /etc/inputrc since it contains global configuration values that can be overridden by the users.

Basically the two shells (the local and the remote) read the user configuration files in a different order: in the remote one, the .profile is read before the .inputrc (that did not exist, so the shell read /etc/inputrc).

Thank you for your help!

@thistlillo commented on GitHub (Mar 25, 2021): Ok, so I solved setting it in `~/.inputrc` on the remote server. There is no need to modify `/etc/inputrc` since it contains global configuration values that can be overridden by the users. Basically the two shells (the local and the remote) read the user configuration files in a different order: in the remote one, the .profile is read before the .inputrc (that did not exist, so the shell read /etc/inputrc). Thank you for your help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13182