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

error: Initializing container: Child ["mount" "--bind" "/host/home/<user>" "/home/<user>"] #3

Open
juhp opened this issue May 2, 2019 · 11 comments

Comments

@juhp
Copy link

juhp commented May 2, 2019

In Fedora 29 and also Silverblue 30 when I initially run coretoolbox, I see:

$ git clone https://github.com/cgwalters/coretoolbox
$ cd coretoolbox
$ cargo build
$ ./target/debug/coretoolbox 
Trying to pull docker://registry.fedoraproject.org/f30/fedora-toolbox:30...Getting image source signatures
Copying blob 934966bfd3bd done
Copying blob cd73137bf7d1 done
Copying config dbfb7129d3 done
Writing manifest to image destination
Storing signatures
dbfb7129d38b39508dab2878f108ff50759087100bfd9b08d0539e7a3de7cce3
coreos-toolbox
mount: /home/petersen: wrong fs type, bad option, bad superblock on /host/home/petersen, missing codepage or helper program, or other error.
error: Initializing container: Child ["mount" "--bind" "/host/home/petersen" "/home/petersen"] exited: exit code: 32
Error: exit status 1

Second run of coretoolbox gives:

$ ./target/debug/coretoolbox 
12b97d1dd6bd74d7550a0b89a3b9398512dab200701d54fb95e9d9caa83a709e
error: Initializing container: Opening statefile: No such file or directory (os error 2)
Error: exit status 1
@juhp
Copy link
Author

juhp commented May 3, 2019

(I don't have a home partition if that makes a difference.)

@cgwalters
Copy link
Owner

Hmm, probably the bug is around how we're passing --volume for podman. Will look.

@juhp
Copy link
Author

juhp commented May 29, 2019

I don't see that any more with the latest code.

@juhp juhp closed this as completed May 29, 2019
@juhp juhp reopened this Jun 12, 2019
@juhp
Copy link
Author

juhp commented Jun 12, 2019

So actually this issue seems to be the real problem I hit.

Using --rbind seems to fix/workaround the problem for me.

diff --git a/src/coretoolbox.rs b/src/coretoolbox.rs
index 943d275..aa43e81 100644
--- a/src/coretoolbox.rs
+++ b/src/coretoolbox.rs
@@ -374,7 +374,7 @@ mod entrypoint {
         nix::unistd::chown(state.home.as_str(), Some(uid), Some(gid))?;
         let host_home = format!("/host{}", state.home);
         Command::new("mount")
-            .args(&["--bind", host_home.as_str(), state.home.as_str()])
+            .args(&["--rbind", host_home.as_str(), state.home.as_str()])
             .run()?;
         Ok(())
     }

@juhp juhp changed the title "mount --bind /host/home/USER /home/USER" failed error: Initializing container: Child ["mount" "--bind" "/host/home/<user>" "/home/<user>"] Jun 12, 2019
@cgwalters
Copy link
Owner

Using --rbind seems to fix/workaround the problem for me.

Thanks! Indeed as a general rule we should use rbind. Mind doing a PR so you get credit?

@cgwalters
Copy link
Owner

Although, I think what we're doing here with /home and /var/home on the host/container is still messy. We probably need to ensure the container matches up with whether the homedir is /home or /var/home on the host.

@cgwalters
Copy link
Owner

(But that can be fixed separately)

juhp added a commit to juhp/coretoolbox that referenced this issue Jun 12, 2019
@HarryMichal
Copy link

Hi, just tried to run coretoolbox and I'm hitting an issue very similar to this one. Here's what I've got:

omichal@harry-work debug ±(master) $ ./coretoolbox create -I fedora-toolbox:30
omichal@harry-work debug ±(master) $ ./coretoolbox run
mount: /var/home/omichal: special device /host/home/omichal does not exist.
error: Initializing container (static): Child ["mount" "--rbind" "/host/home/omichal" "/home/omichal"] exited: exit code: 32
Error: non zero exit code: 1: OCI runtime error
omichal@harry-work debug ±(master) $ ./coretoolbox run
error: Initializing container (static): Not a directory (os error 20)
Error: non zero exit code: 1: OCI runtime error
omichal@harry-work debug ±(master) $

@debarshiray
Copy link

I'm hitting an issue very similar to this one. Here's what I've got:

omichal@harry-work debug ±(master) $ ./coretoolbox create -I fedora-toolbox:30
omichal@harry-work debug ±(master) $ ./coretoolbox run
mount: /var/home/omichal: special device /host/home/omichal does not exist.
error: Initializing container (static): Child ["mount" "--rbind" "/host/home/omichal" "/home/omichal"] exited: exit code: 32
Error: non zero exit code: 1: OCI runtime error
omichal@harry-work debug ±(master) $ ./coretoolbox run
error: Initializing container (static): Not a directory (os error 20)
Error: non zero exit code: 1: OCI runtime error
omichal@harry-work debug ±(master) $

Yes, I am getting the same with podman-1.7.0-0.4.rc2.fc31.x86_64

@cgwalters
Copy link
Owner

Can you paste the output of:

echo $HOME
ls -al $HOME
findmnt $HOME

@Siosm
Copy link

Siosm commented Feb 26, 2020

I am hitting the same issue on a Fedora Workstation 31 with podman-1.8.0-2.fc31.x86_64:

$ coretoolbox run
mount: /home/tim: special device /host/home/tim does not exist.
error: Initializing container (static): Child ["mount" "--rbind" "/host/home/tim" "/home/tim"] exited: exit code: 32
Error: non zero exit code: 1: OCI runtime error
$ echo $HOME
/home/tim
$ ls -alhd $HOME
drwx------. 28 tim tim 4.0K Feb 24 12:31 /home/tim
$ findmnt $HOME
<no output here>
$ findmnt /home
TARGET SOURCE         FSTYPE OPTIONS
/home  /dev/nvme0n1p4 ext4   rw,relatime,seclabel

I have not yet investigated further.

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

Successfully merging a pull request may close this issue.

5 participants