-
Notifications
You must be signed in to change notification settings - Fork 58
Description
When switching the sandbox project to deploy ubuntu jammy, running apt update with the cexec action fails due to not having permission to write to /dev/null
Expected Behaviour
Being able to run apt update when deploying the ubuntu jammy image, permissions on /dev/null need to be 666 for apt update to work.
Current Behaviour
apt update in cexec action fails when deploying the ubuntu jammy image because it can't write to /dev/null, permissions on /dev/null are 660 and apt update doesn't work
Possible Solution
First I updated cexec container to mount /dev as rw so I could update the permissions from the template. Then I switched to a more general approach where I updated hook-docker to set the correct permissions:
hook-docker/main.go
────────────────────────────────────────────────────────────────────────────────────────────────────────────
──────────────────┐
31: func main() { │
──────────────────┘
31 ⋮ 31 │ fmt.Println("Starting Tink-Docker")
32 ⋮ 32 │ go rebootWatch()
33 ⋮ 33 │
⋮ 34 │ fmt.Println("Make /dev/null writeable for all users!")
⋮ 35 │ cmd := exec.Command("chmod", "666", "/dev/null")
⋮ 36 │ cmd.Stdout = os.Stdout
⋮ 37 │ cmd.Stderr = os.Stderr
⋮ 38 │ err := cmd.Run()
⋮ 39 │ if err != nil {
⋮ 40 │ panic(err)
⋮ 41 │ }
⋮ 42 │
34 ⋮ 43 │ // Parse the cmdline in order to find the urls for the repository and path to the cert
35 ⋮ 44 │ content, err := ioutil.ReadFile("/proc/cmdline")
36 ⋮ 45 │ if err != nil {
──────────────────┐
74: func main() { │
──────────────────┘
65 ⋮ 74 │ }
66 ⋮ 75 │
67 ⋮ 76 │ // Build the command, and execute
68 ⋮ │ cmd := exec.Command("/usr/local/bin/docker-init", "/usr/local/bin/dockerd")
⋮ 77 │ cmd = exec.Command("/usr/local/bin/docker-init", "/usr/local/bin/dockerd")
69 ⋮ 78 │ cmd.Stdout = os.Stdout
70 ⋮ 79 │ cmd.Stderr = os.Stderr
71 ⋮ 80 │ err = cmd.Run()
While I got it working I don't know if there are better ways to solve this problem.
Steps to Reproduce (for bugs)
- Try deploying ubuntu jammy image with the sandbox
Context
Your Environment
-
Operating System and version (e.g. Linux, Windows, MacOS): Linux
-
How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details: Sandbox & docker-compose deploying on bare-metal
-
Link to your project or a code example to reproduce issue: