fix(ldconfig): suppress /proc mount error for non-root users

Non-root users are not permitted to mount /proc, which causes `mountProc`
to fail and abort `prepareRoot`. To prevent this, the error is now printed
to stderr instead of causing a failure, allowing continued execution.
This commit is contained in:
Ho Kim 2025-06-26 10:59:32 +00:00
parent 178348b782
commit f3d3746f72
No known key found for this signature in database
GPG Key ID: 92D99E8FE190A578

View File

@ -130,7 +130,8 @@ func (l *Ldconfig) prepareRoot() (string, error) {
// To prevent leaking the parent proc filesystem, we create a new proc mount // To prevent leaking the parent proc filesystem, we create a new proc mount
// in the specified root. // in the specified root.
if err := mountProc(l.inRoot); err != nil { if err := mountProc(l.inRoot); err != nil {
return "", fmt.Errorf("error mounting /proc: %w", err) // Non-root users cannot mount /proc; print the error but continue execution
fmt.Fprintf(os.Stderr, "error mounting /proc: %s\n", err)
} }
// We mount the host ldconfig before we pivot root since host paths are not // We mount the host ldconfig before we pivot root since host paths are not