website/docs/guide/module-config.md
KernelSU provides a built-in configuration system that allows modules to store persistent or temporary key-value settings. Configurations are stored in a binary format at /data/adb/ksu/module_configs/<module_id>/ with the following characteristics:
persist.config): Survives reboots and persists until explicitly deleted or the module is uninstalledtmp.config): Automatically cleared during the post-fs-data stage on every bootWhen reading configurations, temporary values take priority over persistent values for the same key.
All module scripts (post-fs-data.sh, service.sh, boot-completed.sh, etc.) run with the KSU_MODULE environment variable set to the module ID. You can use the ksud module config commands to manage your module's configuration:
# Get a configuration value
value=$(ksud module config get my_setting)
# Set a persistent configuration value
ksud module config set my_setting "some value"
# Set a temporary configuration value (cleared on reboot)
ksud module config set --temp runtime_state "active"
# Set value from stdin (useful for multiline or complex data)
ksud module config set my_key <<EOF
multiline
text value
EOF
# Or pipe from command
echo "value" | ksud module config set my_key
# Explicit stdin flag
cat file.json | ksud module config set json_data --stdin
# List all configuration entries (merged persist + temp)
ksud module config list
# Delete a configuration entry
ksud module config delete my_setting
# Delete a temporary configuration entry
ksud module config delete --temp runtime_state
# Clear all persistent configurations
ksud module config clear
# Clear all temporary configurations
ksud module config clear --temp
The configuration system enforces the following limits:
^[a-zA-Z][a-zA-Z0-9._-]+$ (same as module ID)
.), underscores (_), or hyphens (-)0x4b53554d ("KSUM") and version validationThe configuration system is ideal for:
::: tip BEST PRACTICES
ksud module config list command to debug configuration issues
:::The module configuration system provides special configuration keys for advanced use cases:
You can dynamically override the description field from module.prop by setting the override.description configuration key:
# Override module description
ksud module config set override.description "Custom description shown in the manager"
When the module list is retrieved, if the override.description config exists, it will replace the original description from module.prop. This is useful for:
Modules can declare which KernelSU features they manage using the manage.<feature> configuration pattern. The supported features correspond to KernelSU's internal FeatureId enum:
Supported Features:
su_compat - SU compatibility modekernel_umount - Kernel automatic unmount# Declare that this module manages SU compatibility and enables it
ksud module config set manage.su_compat true
# Declare that this module manages kernel unmount and disables it
ksud module config set manage.kernel_umount false
# Remove feature management (module no longer controls this feature)
ksud module config delete manage.su_compat
How it works:
manage.<feature> key indicates the module is managing that featuretrue/1 for enabled, false/0 (or any other value) for disabledManaged features are exposed through the module list API as a managedFeatures field (comma-separated string). This allows:
::: warning SUPPORTED FEATURES ONLY
Only use the predefined feature names listed above (su_compat, kernel_umount). These correspond to actual KernelSU internal features. Using other feature names will not cause errors but serves no functional purpose.
:::