Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class ConfigurationOverviewBuilder {
private boolean isParallelTxProcessingEnabled = false;
private RocksDBCLIOptions.BlobDBSettings blobDBSettings;
private Long targetGasLimit;
private static final String MINIMUM_GLIBC_VERSION = "2.28";

/**
* Create a new ConfigurationOverviewBuilder.
Expand Down Expand Up @@ -509,6 +510,9 @@ public String build() {

if (SystemInfo.getCurrentPlatform() == PlatformEnum.LINUX) {
final String glibcVersion = PlatformDetector.getGlibc();

checkGlibcVersion(glibcVersion);

Comment on lines +513 to +515
Copy link
Contributor

@garyschulte garyschulte Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR - I hadn't seen it until just now.

besu-native is not required for non-mainnet uses of besu, and that is the root of the glibc requirement. Bouncycastle provides a pure-java implementation of most of the crypto libraries necessary. We should not make a specific version glibc a hard requirement for startup. This could break alpine linux for example, which uses musl rather than glibc.

Ideally, we would make the glibc check in the besu startup script, that way it can be trivially bypassed for non-standard but otherwise valid configurations. Also, it should be only required for ethereum mainnet configurations that have a hard requirement of the besu-native implementation. see NativeRequirement.java

If we want to keep the loading checks in besu java, perhaps we can move this into the ValidateConfigSubcommand and call it from the startup script to assert loading is successful.

It is going to be a bit tricky to make and keep up-to-date the assertion about glibc version, since it is dependent on the platform building besu-native, which at the time of writing is ubuntu-22.04. But I think moving the startup check into a subcommand and modifying the besu startup script to execute the subcommand would be a great place to add this safety/clarity - it is flexible enough to be useful and bypassable, and is open to extension in the future.

Copy link
Contributor

@garyschulte garyschulte Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reiterating comments I made on the issue, I think we should be treating this as an actionable error message enhancement, rather than changing the startup behavior of besu.

We should not hard-require glibc or a specific version of it for besu to startup, but rather should make error messages from NativeRequirement reference a configuration validation subcommand that can provide a more detailed error regarding glibc minimum version, if it is not present, and the native libraries are required by the specified configuration.

if (glibcVersion != null) {
lines.add("glibc: " + glibcVersion);
}
Expand Down Expand Up @@ -565,6 +569,66 @@ private void detectJemalloc(final List<String> lines) {
});
}

/**
* Checks if the glibc version meets the minimum required version.
*
* @param glibcVersion the detected glibc version
*/
private void checkGlibcVersion(final String glibcVersion) {
if (glibcVersion == null) {
logger.warn(
"Unable to determine glibc version. Minimum required version is {}",
MINIMUM_GLIBC_VERSION);
return;
}

if (!isGlibcVersionSufficient(glibcVersion, MINIMUM_GLIBC_VERSION)) {
logger.error(
"Insufficient glibc version detected. Required: {} or higher, Found: {}. Please upgrade your system's glibc.",
MINIMUM_GLIBC_VERSION,
glibcVersion);
throw new RuntimeException(
"Besu requires glibc version "
+ MINIMUM_GLIBC_VERSION
+ " or higher. Found: "
+ glibcVersion);
}
}

/**
* Compares glibc version strings.
*
* @param current the current glibc version
* @param required the required minimum version
* @return true if current version is sufficient, false otherwise
*/
private boolean isGlibcVersionSufficient(final String current, final String required) {
try {
final String[] currentParts = current.split("\\.");
final String[] requiredParts = required.split("\\.");

final int compareLength = Math.max(currentParts.length, requiredParts.length);

for (int i = 0; i < compareLength; i++) {
final int currentNum =
i < currentParts.length ? Integer.parseInt(currentParts[i].trim()) : 0;
final int requiredNum =
i < requiredParts.length ? Integer.parseInt(requiredParts[i].trim()) : 0;

if (currentNum > requiredNum) {
return true;
}
if (currentNum < requiredNum) {
return false;
}
}
return true;
} catch (final NumberFormatException e) {
logger.warn("Unable to parse glibc version: {}", current, e);
return true;
}
}

/**
* Normalize gas string.<br>
* The implemented logic is<br>
Expand Down
Loading