Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll: Operation not permitted @ apply2files

I am using Windows 10's Linux subsystem where I installed Jekyll but when I run bundle exec jekyll serve it gives me:

jekyll 3.8.6 | Error: Operation not permitted @ apply2files - /mnt/e/Work/project/_site/images/banner.jpg

I know there are some incompatibilities with Windows and Linux permissions, because all my files are owned by root for some reason, but there is a fix to this issue?

I found an answer here https://scottdorman.blog/2019/02/27/running-jekyll-on-wsl/ where the author says I have to close and reopen the bash, but it doesn't work.

like image 512
Ionel Lupu Avatar asked Jul 28 '19 17:07

Ionel Lupu


2 Answers

These "operation not permitted" errors seem to be related to user rights or ownership.

I have seen strange errors on colleagues' MAC computers. The command ls -al showed that certain folders were owned by root.

If this applies to you, try to change/transfer ownership to your user with these commands:

  • sudo chmod -R 777 /mnt/e/Work/project/
  • sudo chown -R youruser /mnt/e/Work/project/

The difference between chmod and chown is simple:

  • chmod changes modes
  • chown changes ownership

Note: This is explained in detail on unixtutorial.org.

For the Windows Linux Subsystem, I have found this old blogpost devblogs.microsoft.com from January 2018:

How did permissions work in the past?
Prior to Build 17063, all files/folders list “root” as the owner and belonged to the group “root”. The permission bits on each file/folder was derived from Windows permissions–no write bit checked for Windows meant no write bit set in WSL.
Additionally, attempting to chmod or chown on a file/folder resulted in a no-op (they wouldn’t do anything!)

How do permissions work now?
For files that don’t have metadata, we apply the same approach as what is described in pre-17063 builds. But now, chmod/chown can assign metadata to the file or folder. Newly created files in WSL will be created with metadata by default and will respect the mount options you’ve set (discussed later) or the permissions you pass when executing a mkdir/open.

And, I have found this SO post: chmod WSL (Bash) doesn't work, which states that it's enough to unmount and re-mount the drive to make chmod and chown work (after the mentioned WSL update).

like image 120
Christian Avatar answered Oct 20 '22 04:10

Christian


As @Mike Cole mentioned above in the comments: If you are using wsl this can happen. I resolved this by restarting my machine and magically it works now.

like image 34
kicksent Avatar answered Oct 20 '22 04:10

kicksent