Skip to content

resolve symlink when making log dir writable#4658

Merged
boegel merged 2 commits intoeasybuilders:developfrom
jfgrimm:read-only-local-symlink
Sep 26, 2024
Merged

resolve symlink when making log dir writable#4658
boegel merged 2 commits intoeasybuilders:developfrom
jfgrimm:read-only-local-symlink

Conversation

@jfgrimm
Copy link
Copy Markdown
Member

@jfgrimm jfgrimm commented Sep 26, 2024

When installing EB as a module with EB on Ubuntu 24.04, with read only installdirs, I run into the following crash:

ERROR: Traceback (most recent call last):
  File "/usr/lib/python3.12/shutil.py", line 886, in move
    os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/tmp/eb-tjbo67c2/reprod_20240926154625_739643' -> '/opt/york/easybuild/software/EasyBuild/4.9.4/easybuild/reprod'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/tools/filetools.py", line 2803, in move_file
    shutil.move(path, target_path)
  File "/usr/lib/python3.12/shutil.py", line 902, in move
    copytree(src, real_dst, copy_function=copy_function,
  File "/usr/lib/python3.12/shutil.py", line 600, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/shutil.py", line 498, in _copytree
    os.makedirs(dst, exist_ok=dirs_exist_ok)
  File "<frozen os>", line 225, in makedirs
PermissionError: [Errno 13] Permission denied: '/opt/york/easybuild/software/EasyBuild/4.9.4/easybuild/reprod'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/main.py", line 137, in build_and_install_software
    (ec_res['success'], app_log, err) = build_and_install_one(ec, init_env)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/framework/easyblock.py", line 4360, in build_and_install_one
    raise error
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/framework/easyblock.py", line 4354, in build_and_install_one
    move_file(reprod_dir, archive_reprod_dir)
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/tools/filetools.py", line 2806, in move_file
    raise EasyBuildError("Failed to move %s to %s: %s", path, target_path, err)
easybuild.tools.build_log.EasyBuildError: "Failed to move /tmp/eb-tjbo67c2/reprod_20240926154625_739643 to /opt/york/easybuild/software/EasyBuild/4.9.4/easybuild/reprod: [Errno 13] Permission denied: '/opt/york/easybuild/software/EasyBuild/4.9.4/easybuild/reprod'"

This is due to <installdir>/easybuild actually being a symbolic link to <installdir>/local/easybuild thanks to the posix_local debian workaround symlinking (see easybuilders/easybuild-easyblocks#2977). Thus, when the write permissions are changed they end up trying to change the permissions of the symlink itself, not the target of the link.

@jfgrimm jfgrimm added this to the release after 4.9.4 milestone Sep 26, 2024
@jfgrimm
Copy link
Copy Markdown
Member Author

jfgrimm commented Sep 26, 2024

I believe this should trigger on any system that uses the posix_local scheme when combined with read-only-installdir

Comment thread easybuild/framework/easyblock.py Outdated
Copy link
Copy Markdown
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

lgtm

@boegel boegel merged commit 8ff6ba0 into easybuilders:develop Sep 26, 2024
@boegel boegel modified the milestones: release after 4.9.4, release after 5.0.0, 5.0.0 Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants