1

Code used from github: https://github.com/opencontainers/runc/blob/master/libcontainer/rootfs_linux.go#L59

This is the if block to debug for our interest....

if err := mountToRootfs(m, config.Rootfs, config.MountLabel, hasCgroupns); err != nil {
  return newSystemErrorWithCausef(err, "mounting %q to rootfs at %q", m.Source, m.Destination)
}

Here in the if condition, there is an error generated thru newSystemErrorWithCausef function and which internally uses generic_error.go, fmt.Sprintf to format the error string. In our integration, only once it hit this if block. And in the process of getting more details, I wanted to troubleshoot and understand why this happened.

As of now tried using fmt.Printf(........) in line 55 and also just before if block of line 59. And also tried putting above statement in very first line of prepareRootfs function. And then tried newSystemErrorWithCause(err, "some other message") in the first line of prepareRootfs function. Overall I dont see any information generated with my messages.

Please provide any information to understand more of this issue. Please note I am not looking for why this error might have been caused. I am looking for how to get more information from that function of prepareRootfs.

  • A more specific question with a code sample might be easier to answer. The particular line you point to calls `mountCmd`, which calls `("os/exec").Command`, and returns its error. This is a class of error that's usually in the container setup (for example, invalid main container command) and shouldn't involve poking around in the Go code. – David Maze Jan 31 '21 at 17:10
  • @DavidMaze: Edited the main question with the if block of our interest to debug. Here we are looking to add more logs in that function or the if block, like fmt.Printf or some other way. Let us know if you need more information to answer. – shahabuddin Jan 31 '21 at 18:31

0 Answers0