Skip to content

Commit f226880

Browse files
authored
Merge pull request #5 from cozystack/recursive-bind-mount
Recursive bind for /sys
2 parents 57b3948 + e9fcba5 commit f226880

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ func mountBind(src, dst string) {
5757
must("bind "+src, unix.Mount(src, dst, "", unix.MS_BIND, ""))
5858
}
5959

60+
func mountBindRecursive(src, dst string) {
61+
os.MkdirAll(dst, 0o755)
62+
must("bind recursive "+src, unix.Mount(src, dst, "", unix.MS_BIND|unix.MS_REC, ""))
63+
}
64+
6065
func overrideCmdline(root, content string) {
6166
tmp := filepath.Join(root, "tmp", "cmdline")
6267
os.MkdirAll(filepath.Dir(tmp), 0o755)
@@ -402,7 +407,7 @@ func main() {
402407
}()
403408

404409
mountBind("/proc", filepath.Join(instDir, "proc"))
405-
mountBind("/sys", filepath.Join(instDir, "sys"))
410+
mountBindRecursive("/sys", filepath.Join(instDir, "sys"))
406411
mountBind("/dev", filepath.Join(instDir, "dev"))
407412
overrideCmdline(instDir, "talos.platform=metal "+strings.Join(extra, " "))
408413

0 commit comments

Comments
 (0)