‘Failed to fork on WSL with Ubuntu’ Solve this error in 2 minutes

WSL (Windows Subsystem for Linux) is a compatibility layer that is used to run Linux binary executables in Windows 10. The program was introduced in Windows 10 and Windows Server 2019 and has allowed a lot of developers the ease of using Linux based executables on Windows. However, quite recently, a lot of reports have been coming in of a “# apt-get update FATAL  -> Failed to fork” error while trying to update the Ubuntu system.

Failed to fork on WSL with Ubuntu Error
Failed to fork on WSL with Ubuntu Error Fix

What Causes the “Failed to Fork” Error With Ubuntu in Windows 10?

After receiving numerous reports from multiple users, we decided to investigate the issue and devised a set of solutions to fix it completely. Also, we looked into the reasons due to which it is triggered and listed them as follows:

  • Insufficient Swap Memory: In some cases, there might be insufficient SWAP memory that is accessible by the application due to which this error is being triggered. The application requires a considerable amount of memory to be free in order to work properly.
  • Antivirus/Firewall: It was seen that a third-party antivirus or firewall might be blocking certain elements of the application from making contact with the server. The application requires a good internet connection to be established in order for it to work properly.

Now that you have a basic understanding of the nature of the problem, we will move on towards the solutions. Make sure to implement these in the specific order in which they are presented to avoid conflicts.

Solution 1: Disabling Antivirus

If you have a third party antivirus or Firewall installed it is recommended to completely disable it or add an exclusion for the Ubuntu application since it might be disabling some components of the application due to which the error might be triggered. In order to add an exclusion:

  1. Rightclick on the application in the system tray.
  2. Select “Open” and click on the settings option.
  3. Select “Add an Exclusion” button and point to the direction of the Ubuntu application.

Solution 2: Creating New Swap File

It is possible that the Storage on the Swap File was running out due to which the error was being triggered. Therefore, in this step, we will be creating a new Swap file. For that:

  1. Launch Ubuntu.
    Launching Ubuntu
  2. Type in the following command and press “Enter“.
    sudo fallocate -1 4G /swapfile
  3. The swap file has now been created but it still needs to be activated.
  4. In order to make the file more secure, type in the following command and press “Enter”.
    sudo chmod 600 /swapfile
  5. Now, type in the following command to set up the swap space and press “Enter”.
    sudo mkswap /swapfile
  6. In order to enable the swap space, type in the following command and press “Enter“.
    sudo swapon /swapfile
  7. Check to see if the issue persists after executing these commands.

Kevin Arrows

Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.