Operation not permitted

Justin Webb
3 min readMar 21, 2021
Bash with operation not permitted

Hello weary traveler! If you’re reading this document, that more than likely means that you are more than likely working on a Ruby application that keeps giving you an ‘Operation’ error. This blog will walk you through solving the error code, Operation not permitted — bs_fetch:atomic_write_cache_file:chmod (Errno::EPERM). I have only tested this method on my Linux system, so I am unsure of its universal effectiveness. It is also worth mentioning that this method will stall the error, not completely solve the issue.

What is this error?

This error seems to occur mainly on Windows 10 Linux subsystems running Unbuntu. The error commonly manifests in one of two ways:

  1. When trying to use bundler (boot snap)
  2. When trying to run git commands (clone, migrate, or push)
Operation not permitted — bs_fetch:atomic_write_cache_file:chmod (Errno::EPERM)

This error tells you that your system could not access and mutate the permission to a file system needed to complete your command. A single entity controls the entire application we will call Foo while running it in a local environment. The command you are running is attempting to migrate the application to a global usage state but does not have access to files under Foo’s control. While Linux systems can change permissions freely, Unbuntu can not. That is why write issues occur. This is a significantly simplified explanation of the error; I suggest that you do some research on your own to understand this issue better.

Solution Approach.

There are numerous solutions to this problem, but this blog deals with applications and sub-folders under the C drive. This method will unmount a specific drvfs and remount it with the ‘metadata’ flag to use a new file system features to WSL. This will allow access to permission changes.

**Be sure that you are using a terminal that with root access deeper than your current drive**

  1. I moved my Unbuntu Virtual Studios terminal outside of a drive’s scope to obtain that penetration level.
  2. STAY IN THE ROOT!!
  3. Navigate beyond your current drive using
  4. Unmount the drive your application is in
  5. Remount the same drive
  6. Load your application and retry your command.

Code for Solution.

A. Navigate beyond drive

B. Unmount your drive. “sudo umount /mnt/c

If you get the response “umount: /mnt/c: target is busy.”. It would be best if you closed all open applications and terminals.

C. Remount your drive. “sudo mount -t drvfs C: /mnt/c -o metadata

D. Retry using bundler or cloning

I hope that this was informative and helpful to you. Below are links to other solutions people used. Leave a comment if you’re confused and a like if it helped till next time.

--

--

Justin Webb

I am a graduated environmental studies researcher, who began a computer science boot-camp. I will be blogging solutions to what I struggle with most.