Gentoo Archives: gentoo-user

From: Matthias Gerstner <Matthias.Gerstner@×××××.com>
To: Alan Mackenzie <acm@×××.de>
Cc: "gentoo-user@l.g.o" <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Can I suppress the bleep when shutting down?
Date: Tue, 20 Oct 2015 17:23:26
Message-Id: 20151020172248.GA32751@mgpc.ncp.de
In Reply to: Re: [gentoo-user] Can I suppress the bleep when shutting down? by Alan Mackenzie
1 Hi Alan,
2
3 > I simply want to disable that one particular beeping at shutdown time.
4
5 well this topic made me curious where the beep is coming from.
6
7 It does originate from the shutdown command itself which is part of the
8 sys-apps/sysvinit package. In this package's source you find can a file
9 "src/dowall.c", where you will in turn find a function "wall(...)".
10
11 This is the function where the warning messages will be produced that
12 show up in the terminal and the message is produced like this:
13
14 snprintf(line, sizeof(line),
15 "\007\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n",
16 user, hostname, tty, date);
17
18 The "\007" is the beep you're getting. It's a bell character that you
19 can produce manually by doing this, too:
20
21 echo -e "\007"
22
23 Unfortunately the bell character is hard coded into the warning message.
24 Also there seems to be no way to suppress the warning message.
25
26 But you could still try is to disable the interpretation of the bell
27 character by your terminal. Then you could make an alias or wrapper
28 around the original shutdown command that does this.
29
30 According to Arch Linux docs here:
31
32 https://wiki.archlinux.org/index.php/Disable_PC_speaker_beep
33
34 You can locally disable the bell in the terminal by calling "setterm
35 -blength 0". But this doesn't work with my terminals. Says it's
36 unsupported.
37
38 Then you can put this in your ~/.inputrc: "set bell-style none". This
39 works for me. Then, however, all terminals stop beeping. The pcspkr is
40 still loaded though and can be used.
41
42 As you only want to stop the beep only during shutdown you might also be
43 able to call "xset -b", disabling the bell on the X-server (globally?).
44 This is not persistent across reboots and you won't have any beeps until
45 the machine shuts down.
46
47 Regards
48
49 Matthias

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies