SonarSource/sonarqube · info
Unable to get mac address, will use a dummy address
Error message
Unable to get mac address, will use a dummy address
What it means
MacAddressProvider builds part of the unique server id from the machine's MAC address. When getMacAddress() throws SocketException (no usable network interface), the code logs this warning and falls back to a dummy multicast address. Server-id generation still succeeds; the id is just derived from random munged bytes instead of a hardware address.
Solutions
- Verify the host has at least one network interface (ip link / ifconfig) and it is up.
- Run the SonarQube process with permission to read network interface info (check seccomp/AppArmor/selinux policies in containers).
- If the server id was already generated with the dummy address, be aware it may differ between hosts — persist and reuse the generated server id instead of regenerating.
- Restart the server once networking is healthy so a real MAC can be used.
- This warning alone is harmless; investigate only if server-id instability or licensing keys depend on it.
Example fix
// before: container started with --network none // after docker run --network bridge ... sonarqube
Defensive patterns
Strategy: fallback
Validate before calling
# verify at least one NIC with a MAC exists before starting the server ip -o link | grep -v lo || echo 'WARNING: no usable network interface for server id generation'
Try / catch
// the code already falls back to a dummy address; callers should persist the generated server id byte[] munged = MacAddressProvider.getSecureMungedAddress(); // store munged/serverId so restarts on NIC-less hosts stay stable
Prevention
- Run SonarQube in networks with at least one up interface.
- Avoid --network none for containers that generate server ids.
- Persist the generated server id and reuse it across restarts.
- Check container security policies blocking interface enumeration.
When it happens
Trigger: Calling getSecureMungedAddress() on a host where enumerating network interfaces throws SocketException — e.g. containers/VMs with no NIC, restricted /sys access, or interfaces removed while enumerating.
Common situations: Minimal Docker/Kubernetes containers without loopback-exposed interfaces; chrooted/jailed environments; hosts where NetworkInterface.getNetworkInterfaces() fails due to permissions; temporary network stack issues during server startup.
Related errors
- Unable to get a valid mac address, will use a dummy address
- Can not resolve host [
- Fail to download
- Fail to execute request
- Failed to publish telemetry event
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/58870b874f5d7bb9.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-server-common/src/main/java/org/sonar/server/platform/serverid/MacAddressProvider.java:51
/**
* Used by {@link UuidFactoryImpl}. Heavily inspired by https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/common/MacAddressProvider.java
*/
class MacAddressProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(MacAddressProvider.class);
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
public static final int BYTE_SIZE = 6;
private MacAddressProvider() {
// only static stuff
}
public static byte[] getSecureMungedAddress() {
byte[] address = null;
try {
address = getMacAddress();
} catch (SocketException se) {
LOGGER.warn("Unable to get mac address, will use a dummy address", se);
// address will be set below
}
if (!isValidAddress(address)) {
LOGGER.warn("Unable to get a valid mac address, will use a dummy address");
address = constructDummyMulticastAddress();
}
byte[] mungedBytes = new byte[BYTE_SIZE];
SECURE_RANDOM.nextBytes(mungedBytes);
for (int i = 0; i < BYTE_SIZE; ++i) {
mungedBytes[i] ^= address[i];
}
return mungedBytes;
}
private static boolean isValidAddress(@Nullable byte[] address) {View on GitHub (pinned to 184c821202)