Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imaginator "expected integer" error while building the bootstrap image #448

Open
masiulaniec opened this issue May 21, 2018 · 1 comment

Comments

@masiulaniec
Copy link
Contributor

# cat /var/log/imaginator/2018-05-21:15:16:13.994
2018/05/21 15:16:14 Building new image for stream: bootstrap/Debian-9
2018/05/21 15:21:30 Error building image: bootstrap/Debian-9: expected integer
# 

The following patch works around it:

diff -purN imagebuilder/builder/bootstrapImage.go imagebuilder/builder/bootstrapImage.go
--- imagebuilder/builder/bootstrapImage.go	2018-05-21 15:50:22.388786285 +0000
+++ imagebuilder/builder/bootstrapImage.go	2018-05-21 15:50:59.807545192 +0000
@@ -117,8 +117,8 @@ func (packager *packagerType) writePacka
 func (packager *packagerType) writePackageInstallerContents(writer io.Writer) {
 	fmt.Fprintln(writer, "#! /bin/sh")
 	fmt.Fprintln(writer, "# Created by imaginator.")
-	fmt.Fprintln(writer, "mount -n none -t proc /proc")
-	fmt.Fprintln(writer, "mount -n none -t sysfs /sys")
+	fmt.Fprintln(writer, "mount -n none -t proc /proc 2>/dev/null")
+	fmt.Fprintln(writer, "mount -n none -t sysfs /sys 2>/dev/null")
 	for _, line := range packager.Verbatim {
 		fmt.Fprintln(writer, line)
 	}

The error is due to fmt.Fscanf in (*bootstrapStream).build:

	output := new(bytes.Buffer)
	err := runInTarget(nil, output, rootDir, packagerPathname,
		"show-size-multiplier")
	if err != nil {
		return nil, err
	}
	sizeMultiplier := uint64(1)
	nScanned, err := fmt.Fscanf(output, "%d", &sizeMultiplier)

... trying to parse the following error from mount as an integer:

mount: none is already mounted or /sys busy
       none is already mounted on /proc
       none is already mounted on /sys
       none is already mounted on /proc
@rgooch
Copy link
Contributor

rgooch commented May 22, 2018

Can you please debug some more? Why are file-systems already mounted in this fresh chroot mount namespace?
What happens if you put mount --make-rprivate / before the other calls to mount?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants