diff --git a/pkg/specgen/generate/config_linux.go b/pkg/specgen/generate/config_linux.go index 1b2a2ac32d..f4cf0c7048 100644 --- a/pkg/specgen/generate/config_linux.go +++ b/pkg/specgen/generate/config_linux.go @@ -72,13 +72,17 @@ func addPrivilegedDevices(g *generate.Generator) error { newMounts = append(newMounts, devMnt) } g.Config.Mounts = append(newMounts, g.Config.Mounts...) - g.Config.Linux.Resources.Devices = nil + if g.Config.Linux.Resources != nil { + g.Config.Linux.Resources.Devices = nil + } } else { for _, d := range hostDevices { g.AddDevice(Device(d)) } // Add resources device - need to clear the existing one first. - g.Config.Linux.Resources.Devices = nil + if g.Config.Linux.Resources != nil { + g.Config.Linux.Resources.Devices = nil + } g.AddLinuxResourcesDevice(true, "", nil, nil, "rwm") }