Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run librespot-java in a VM #479

Open
iVolt1 opened this issue Mar 16, 2022 · 5 comments
Open

Can't run librespot-java in a VM #479

iVolt1 opened this issue Mar 16, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@iVolt1
Copy link

iVolt1 commented Mar 16, 2022

I will first say that librespot-java works flawlessly for spotify audio and metadata and I appreciate the effort put into the project.

I previously reported this issue at spocon/spocon#46 .

I am running spocon in a virtualbox VM. Initially it took me a day or two to figure out why spotify could not see librespot-java.

It looks like this code excludes running VMs, possibly for no apparent reason. I changed the x08 to x06the MAC in the VM settings and now spotify connects to spocon.

Can this code be removed or modified so that librespot-java works out of the box in a VM? At the very least could a warning/workaround be put into the readme install instructions?

https://github.com/librespot-org/librespot-java/blob/dev/lib/src/main/java/xyz/gianlu/librespot/ZeroconfServer.java

...
public class ZeroconfServer implements Closeable {
public static final String SERVICE = "spotify-connect";
private final static int MAX_PORT = 65536;
private final static int MIN_PORT = 1024;
private static final Logger LOGGER = LoggerFactory.getLogger(ZeroconfServer.class);
private static final byte[] EOL = new byte[]{'\r', '\n'};
private static final JsonObject DEFAULT_GET_INFO_FIELDS = new JsonObject();
private static final JsonObject DEFAULT_SUCCESSFUL_ADD_USER = new JsonObject();
private static final byte[][] VIRTUAL_INTERFACES = new byte[][]{
new byte[]{(byte) 0x00, (byte) 0x0F, (byte) 0x4B}, // Virtual Iron Software, Inc.
new byte[]{(byte) 0x00, (byte) 0x13, (byte) 0x07}, // Paravirtual Corporation
new byte[]{(byte) 0x00, (byte) 0x13, (byte) 0xBE}, // Virtual Conexions
new byte[]{(byte) 0x00, (byte) 0x21, (byte) 0xF6}, // Virtual Iron Software
new byte[]{(byte) 0x00, (byte) 0x24, (byte) 0x0B}, // Virtual Computer Inc.
new byte[]{(byte) 0x00, (byte) 0xA0, (byte) 0xB1}, // First Virtual Corporation
new byte[]{(byte) 0x00, (byte) 0xE0, (byte) 0xC8}, // Virtual access, ltd.
new byte[]{(byte) 0x54, (byte) 0x52, (byte) 0x00}, // Linux kernel virtual machine (kvm)
new byte[]{(byte) 0x00, (byte) 0x21, (byte) 0xF6}, // Oracle Corporation
new byte[]{(byte) 0x18, (byte) 0x92, (byte) 0x2C}, // Virtual Instruments
new byte[]{(byte) 0x3C, (byte) 0xF3, (byte) 0x92}, // VirtualTek. Co. Ltd.
new byte[]{(byte) 0x00, (byte) 0x05, (byte) 0x69}, // VMWare 1
new byte[]{(byte) 0x00, (byte) 0x0C, (byte) 0x29}, // VMWare 2
new byte[]{(byte) 0x00, (byte) 0x50, (byte) 0x56}, // VMWare 3
new byte[]{(byte) 0x00, (byte) 0x1C, (byte) 0x42}, // Parallels
new byte[]{(byte) 0x00, (byte) 0x03, (byte) 0xFF}, // Microsoft Virtual PC
new byte[]{(byte) 0x00, (byte) 0x16, (byte) 0x3E}, // Red Hat Xen, Oracle VM, Xen Source, Novell Xen
new byte[]{(byte) 0x08, (byte) 0x00, (byte) 0x27}, // VirtualBox
new byte[]{(byte) 0x00, (byte) 0x15, (byte) 0x5D}, // Hyper-V
};
...

Thanks,

iVolt

@iVolt1 iVolt1 added the bug Something isn't working label Mar 16, 2022
@jpgrovy
Copy link

jpgrovy commented Apr 22, 2022

Hello,

Are you still able to capture metadata, etc as of yesterday?

@iVolt1
Copy link
Author

iVolt1 commented Apr 22, 2022

I haven't updated or changed anything in quite a while, but librespot-java is working and sending metadata.

@jpgrovy
Copy link

jpgrovy commented Apr 22, 2022 via email

@iVolt1
Copy link
Author

iVolt1 commented Feb 4, 2024

Hi devgianlu,

This issue still exists even in the latest releases of librespot-java. I have gotten stuck in a troubleshooting loop a few times when after many months I have had to move my librespot-java/owntone environment to a different vm and the librespot-java server device doesn't appear in spotify. I eventually remember that the code excludes those mac addresses and have to go into the vm settings and fake the mac address.

Is there a reason to exclude librespot-java from running in a vm such as a spotify licensing issue? librespot-java runs runs great for me in hyper-v and VirtualBox so it would be nice if that code could be removed in the future.

I currently run the librespot-java/owntone environment in the HomePod Connect addon on Home Assistant and works Home Assistant dashboard which is probably the best whole house audio arrangement anywhere, even in a vm.

It looks like this code excludes running VMs, possibly for no apparent reason. I changed the x08 to x06the MAC in the VM settings and now spotify connects to spocon.

Thanks for the great project,

ivolt1

@jpgrovy I think you posted in the wrong thread, but your project looks promising.

@iVolt1
Copy link
Author

iVolt1 commented Feb 4, 2024

I think this issue reported by @dolanjp was also a vm exclusion issue:

#716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants