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

bugfix: failed to start container when /etc/mtab is symbol link #2035

Merged
merged 1 commit into from
Aug 2, 2018

Conversation

rudyfly
Copy link
Collaborator

@rudyfly rudyfly commented Aug 2, 2018

Ⅰ. Describe what this PR did

In some images, /etc/mtab is symbol link file, such as:
/etc/mtab -> /proc/mounts, when use /bin/cp -f to overwrite
/etc/mtab, it will cause error, because it will link to /proc/mounts
file on the host.

So we use the option of --remove-destination to remove the symbol file
before overwrite it.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

run testcase TestRunWithMtab

Ⅴ. Special notes for reviews

Signed-off-by: Rudy Zhang [email protected]

@pouchrobot pouchrobot added kind/bug This is bug report for project size/S labels Aug 2, 2018
@allencloud allencloud added the priority/P1 this is high priority that all maintainers should stop to handle this issue label Aug 2, 2018
@@ -145,7 +145,7 @@ func setMountTab(ctx context.Context, c *Container, spec *SpecWrapper) error {

mtabPrestart := specs.Hook{
Path: "/bin/cp",
Args: []string{"-f", hostmtabPath, mtabPath},
Args: []string{"-f", "--remove-destination", hostmtabPath, mtabPath},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

greate work !!!

In some images, `/etc/mtab` is symbol link file, such as:
`/etc/mtab -> /proc/mounts`, when use `/bin/cp -f` to overwrite
`/etc/mtab`, it will cause error, because it will link to `/proc/mounts`
file on the host.

So we use the option of `--remove-destination` to remove the symbol file
before overwrite it.

Signed-off-by: Rudy Zhang <[email protected]>
Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fail case is known issue and it will be fixed in other PR. LGTM

@fuweid fuweid merged commit 04b5951 into AliyunContainerService:master Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project priority/P1 this is high priority that all maintainers should stop to handle this issue size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants