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

'Failed to change ownership of the home directory' in PHP container #703

Closed
3 of 7 tasks
Venorcis opened this issue Apr 28, 2020 · 6 comments
Closed
3 of 7 tasks
Assignees
Labels

Comments

@Venorcis
Copy link

Venorcis commented Apr 28, 2020

ISSUE TYPE

  • Bug Report

Checklist

OS / ENVIRONMENT

  1. Host operating system and version: Windows 10
  2. (Windows) Native Docker or Docker Toolbox: Docker Toolbox
  3. Docker version: 19.03.1
  4. Docker Compose version: 1.24.1
  5. (Linux) Is SELinux enabled?: n/a
  6. What git commit hash are you on?: 8c931cd

SUMMARY

Trying to start the PHP (7.4) container for the first time fails. A work-around is to start it a second time, and then it works again.

STEPS TO REPRODUCE

  • Start from scratch (or execute 'docker-compose down' first)
  • Call 'docker-compose up php' (with PHP_SERVER set to 7.4)

EXPECTED BEHAVIOUR

The php server starts without issue.

ACTUAL BEHAVIOUR

The following output is reported:

php_1               | [INFO] Debug level: 2
php_1               | [INFO] Changing user 'devilbox' uid to: 197610
php_1               | root $ usermod -u 197610 devilbox
php_1               | usermod: Failed to change ownership of the home directory
docker_php_1 exited with code 12

Execution is halted at this point; the php server does not start correctly.

OTHER INFORMATION

If this error occurs, these steps are a work-around to allow the php server to start anyway:

  • docker-compose stop
  • docker-compuse up php

The output is then:

php_1               | [INFO] Debug level: 2
php_1               | [INFO] Changing user 'devilbox' uid to: 197610
php_1               | root $ usermod -u 197610 devilbox
php_1               | usermod: no changes

So in summary, the second start (when uninterrupted by a 'down' or a full toolbox restart) always works.

@Venorcis Venorcis added the bug label Apr 28, 2020
@stale
Copy link

stale bot commented Jul 27, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue:stale This issue has become stale and is marked for auto-close label Jul 27, 2020
@Venorcis
Copy link
Author

This issue still occurs...

@stale stale bot removed the issue:stale This issue has become stale and is marked for auto-close label Jul 27, 2020
@stale
Copy link

stale bot commented Oct 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue:stale This issue has become stale and is marked for auto-close label Oct 25, 2020
@cytopia
Copy link
Owner

cytopia commented Nov 12, 2020

@Venorcis I finally figure out the issue and will provide a fix shortly:

grep -E '^(U|G)ID_M(IN|AX)' /etc/login.defs
UID_MIN                  1000
UID_MAX                 60000
GID_MIN                  1000
GID_MAX                 60000

It turns out, that the given user id was above the acceptable threshhold value.

@stale stale bot removed the issue:stale This issue has become stale and is marked for auto-close label Nov 12, 2020
@cytopia cytopia self-assigned this Nov 12, 2020
@cytopia
Copy link
Owner

cytopia commented Nov 14, 2020

@Venorcis I finally figure out the issue and will provide a fix shortly:

grep -E '^(U|G)ID_M(IN|AX)' /etc/login.defs
UID_MIN                  1000
UID_MAX                 60000
GID_MIN                  1000
GID_MAX                 60000

It turns out, that the given user id was above the acceptable threshhold value.

Turns out it is totally unrelated. The actual fix is to run usermod twice in case it fails during the first try. The second run always succeeds. Found this issue in a lot of other docker projects. It is a bit messy, but it does the job

@cytopia
Copy link
Owner

cytopia commented Nov 14, 2020

Fixed here: #750

@cytopia cytopia closed this as completed Nov 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants