-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Bug: quickstart generates invalid smartd.conf with missing -n parameter
Description
The quickstart binary generates an invalid /etc/smartd.conf configuration file. The -n directive is missing its required POWERMODE argument, causing smartd to fail on startup.
Error Message
smartd 7.5 2025-04-30 r5714 [aarch64-linux-6.12.67] (localbuild)
File /etc/smartd.conf line 3 (drive DEFAULT): Missing argument to -n Directive
Valid arguments to -n Directive are: never[,N][,q], sleep[,N][,q], standby[,N][,q], idle[,N][,q]
Configuration file /etc/smartd.conf has fatal syntax errors.
smartd is exiting (exit status 2)
Generated Config (Invalid)
# Autogenerated, do not edit!
# smartd state false
DEFAULT -n
Expected Config
# Autogenerated, do not edit!
# smartd state false
DEFAULT -n standby
Root Cause
Found in binary via strings /usr/sbin/quickstart:
printf "DEFAULT -n %v
" >> %v
The Go format string %v should contain a POWERMODE value (never, sleep, standby, or idle), but the variable appears to be empty when the config is generated.
Environment
- Platform: aarch64 (RK3576)
- OpenWrt: ImmortalWrt SNAPSHOT r37561
- quickstart version: 0.11.13
Suggested Fix
In the Go source code, ensure the POWERMODE variable has a default value (e.g., standby) when it's empty:
// Pseudocode
powerMode := config.PowerMode
if powerMode == "" {
powerMode = "standby" // Default value
}
fmt.Fprintf(file, "DEFAULT -n %v\n", powerMode)Workaround
Create a uci-defaults script to fix the config after generation:
#!/bin/sh
if [ -f /etc/smartd.conf ] && grep -q "^DEFAULT -n$" /etc/smartd.conf; then
sed -i 's/^DEFAULT -n$/DEFAULT -n standby/' /etc/smartd.conf
fiReferences
man smartd.conf- The-ndirective requires a POWERMODE argument- smartmontools documentation: https://www.smartmontools.org/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels