Skip to content

Commit 93feed9

Browse files
authored
Merge pull request #294 from crazy-max/binfmt-touch
touch binfmt_misc once before registering emulators
2 parents 69cedb8 + 7a3a1dc commit 93feed9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

cmd/binfmt/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"runtime"
1111
"strings"
1212
"syscall"
13+
"time"
1314

1415
"github.com/containerd/platforms"
1516
"github.com/moby/buildkit/util/archutil"
@@ -225,6 +226,14 @@ func run() error {
225226
installArchs = parseArch(toInstall)
226227
}
227228

229+
// best effort workaround for kernels that do not immediately expose new
230+
// binfmt_misc entries after register writes until the mountpoint is touched:
231+
// https://github.com/amazonlinux/amazon-linux-2023/issues/479#issuecomment-2707623971
232+
if len(installArchs) > 0 {
233+
now := time.Now()
234+
_ = os.Chtimes(mount, now, now)
235+
}
236+
228237
for _, name := range installArchs {
229238
err := install(name)
230239
if err == nil {

0 commit comments

Comments
 (0)