chage -R <chroot path> ... uses host chage binary and host glibc.
-R parameter switches to chroot as an initial action.
Photon's glibc uses nscd to get user/password structure by connecting
to /var/run/nscd/socket, but there is no such socket in chroot.
Fix for that is to manually go to chroot and then run chage from there.
Change-Id: Ie84f7171a8ef7d9e5cd6e8a285507678fd833139
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6212
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Bo Gan <ganb@vmware.com>
| ... | ... |
@@ -92,7 +92,8 @@ def customizeImage(config, mount_path): |
| 92 | 92 |
"chroot {} /bin/bash -c '/tempscripts/{}'".format(mount_path, script))
|
| 93 | 93 |
shutil.rmtree(mount_path + "/tempscripts", ignore_errors=True) |
| 94 | 94 |
if 'expirepassword' in config and config['expirepassword']: |
| 95 |
- Utils.runshellcommand("chage -R {} -d 0 root".format(mount_path))
|
|
| 95 |
+ # Do not run 'chroot -R' from outside. It will not find nscd socket. |
|
| 96 |
+ Utils.runshellcommand("chroot {} /bin/bash -c 'chage -d 0 root'".format(mount_path))
|
|
| 96 | 97 |
|
| 97 | 98 |
def createOutputArtifact(raw_image_path, config, src_root, tools_bin_path): |
| 98 | 99 |
photon_release_ver = os.environ['PHOTON_RELEASE_VER'] |