PC Speaker Passthrough

Discussions related to using VirtualBox on Linux hosts.

PC Speaker Passthrough

Postby torourke55 » 19. Sep 2021, 07:48

I'm running an old Linux (Valhalla kernel 2.4.18) virtual machine on a Linux Mint 20.2 (Uma). I want to passthrough the pc speaker from the virtual machine to the host. I looked at the documentation:

2.31. PC Speaker Passthrough
/dev/tty - Uses the terminal association of the VM process. VM needs to be started on a virtual console.

I'm not sure how to start the VM on a virtual console. I run a script to start the virtual machine:
VBoxManage setextradata global GUI/Input/MachineShortcuts "SeamlessMode=None"
VBoxManage setextradata AKCSC1 "GUI/Fullscreen" true
VBoxManage setextradata AKCSC1 "VBoxInternal/Devices/i8254/0/Config/PassthroughSpeaker" 100
VBoxManage startvm AKCSC1

The program on the virtual machine is trying to use /dev/tty on boot but can't open it. How do I start the VM on a virtual console and what do I need to do passthrough the PC speaker to the host?

Tim
torourke55
 
Posts: 3
Joined: 19. Sep 2021, 07:37

Re: PC Speaker Passthrough

Postby birdie » 19. Sep 2021, 08:46

torourke55 wrote:VM needs to be started on a virtual console.


The documentation tells you need to start VirtualBox not from the start menu but in any console application (which is capable of using the speaker), e.g. Gnome Terminal, xfce4-terminal, Konsole, etc.
birdie
 
Posts: 330
Joined: 2. May 2010, 14:19
Location: Artem S. Tashkinov
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes

Re: PC Speaker Passthrough

Postby fth0 » 19. Sep 2021, 09:51

torourke55 wrote:VM needs to be started on a virtual console.

birdie wrote:The documentation tells you need to start VirtualBox not from the start menu but in any console application

No. An X11- or Wayland-based terminal application is not a Virtual console.
fth0
Volunteer
 
Posts: 2455
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...

Re: PC Speaker Passthrough

Postby torourke55 » 19. Sep 2021, 10:02

Hi, thanks for the reply. I have started the VM from the terminal and also from a launcher with terminal=true and I see no difference. The VM still can't open the /dev/tty device and I get no bell tone. The Host terminal gets a bell tone if I echo -e \\a or even if I hit backspace with no chars entered.

I also tried running it directly in the terminal window and ran my script in the terminal window with and & at the end to spawn it (./Start-AKCSC1-Windowed &).

This is what I get in the log for the virtual machine for the PIT: lines after launching it a terminal:
00:00:01.210720 PIT: speaker: cannot open "/dev/input/by-path/platform-pcspkr-event-spkr", errno=13
00:00:01.210751 PIT: speaker: cannot open "/dev/tty", errno=6
00:00:01.210760 PIT: speaker: cannot open "/dev/tty0", errno=13
00:00:01.210770 PIT: speaker: cannot open "/dev/vc/0", errno=2
00:00:01.210779 PIT: speaker: cannot open "/dev/tty", errno=6
00:00:01.210784 PIT: speaker: no emulation possible
torourke55
 
Posts: 3
Joined: 19. Sep 2021, 07:37

Re: PC Speaker Passthrough

Postby torourke55 » 19. Sep 2021, 10:19

No. An X11- or Wayland-based terminal application is not a Virtual console

I think you're right but I'm trying to figure out how to run the VM in this virtual console. I wonder if the output needs to be redirected to /dev/tty?
torourke55
 
Posts: 3
Joined: 19. Sep 2021, 07:37

Re: PC Speaker Passthrough

Postby birdie » 19. Sep 2021, 10:29

fth0 wrote:
torourke55 wrote:VM needs to be started on a virtual console.

birdie wrote:The documentation tells you need to start VirtualBox not from the start menu but in any console application

No. An X11- or Wayland-based terminal application is not a Virtual console.


Should probably work regardless. Have you actually tested to be so confident?
birdie
 
Posts: 330
Joined: 2. May 2010, 14:19
Location: Artem S. Tashkinov
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes

Re: PC Speaker Passthrough

Postby fth0 » 19. Sep 2021, 12:16

birdie wrote:Should probably work regardless. Have you actually tested to be so confident?

Did I say anything about what works and what doesn't? ;)

I just wanted to point out that your statement is either not correct or at least misleading (if you're talking about 9.30. PC Speaker Passthrough in the VirtualBox User Manual), to make the OP try the documented method first. When it works from within a virtual console, the OP can try it from within a terminal application later on.

In hindsight, instead of "No" I should have written "I don't think so", sounds more polite. ;)
fth0
Volunteer
 
Posts: 2455
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...

Re: PC Speaker Passthrough

Postby fth0 » 19. Sep 2021, 13:16

On a second thought, after re-reading 9.30. PC Speaker Passthrough, the VirtualBox User Manual isn't clear enough:

If using a virtual console would be the only use case, you could only start a VM headless, since the GUI (X11, Wayland) is not available there. That would have been worth mentioning IMO.

Regarding the errno values:
Code: Select all   Expand viewCollapse view
#define ENOENT   2   /* No such file or directory */
#define ENXIO    6   /* No such device or address */
#define EACCES  13   /* Permission denied         */

Permission denied usually indicates that the device exists, so I'd suggest to concentrate on the permissions.
fth0
Volunteer
 
Posts: 2455
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 9 guests