Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Can't change owner of NFS mounted synced directory error caused in Apache install module. #46

Description

@aramonc

So this is a bit of a weird one.

Scenario:

We're mounting several folders to the vagrant VM via NFS. One of these is mounted on /var/www. When the Apache puphpet::apache::install executes the command to create vhosts, it has a dependency on a command to create & set permissions of the /var/www directory. Which results in the following error:

==> local.dev: Notice: /Stage[main]/Puphpet::Apache::Install/Exec[Create apache webroot]/returns: chown: changing ownership of ‘/var/www’: Operation not permitted
==> local.dev: Error: mkdir -p /var/www &&                 chown root:www-data /var/www &&                 chmod 775 /var/www &&                 touch /.puphpet-stuff/apache-webroot-created returned 1 instead of one of [0]
==> local.dev: 
==> local.dev: Error: /Stage[main]/Puphpet::Apache::Install/Exec[Create apache webroot]/returns: change from notrun to 0 failed: mkdir -p /var/www &&                 chown root:www-data /var/www &&                 chmod 775 /var/www &&                 touch /.puphpet-stuff/apache-webroot-created returned 1 instead of one of [0]

Looking at the comment from that command, this seems to a fix for when the guest OS is CentOS 2.4. We're using Ubuntu 14.04 as a guest OS & on top of that the whole mounting of the folder. Also, the error only happens on Linux, specifically Ubuntu 16.10. A colleague tried it on his Mac & had no issues.

The error seems to be specific to NFS on Linux, but since the command is very specific about what it does, taking little from configuration, there is no way to disable it. Adding a flag for which OS to run on might not be enough and it might cause issues with other OS that were also relying on this fix.

What do you think of adding unless => "mountpoint -q ${www_root}", to the command options?

The command should be available & it returns 0 if the directory is a mount point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions