Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

FATAL -> Failed to fork on Windows subsystem for Linux with Ubuntu

Writer Matthew Harrington

I'm running Windows 10 Pro, version 10.0.17134, enabled the Windows Subsystem for Linux and installed the Ubuntu app from the Microsoft Store. This has been working for a couple of months without problems.

Today I wanted to do another update of the Ubuntu System but I got the following error:

# apt-get update
FATAL -> Failed to fork.

After searching for this error, the only problem I saw was not enough free memory but if I look at my memory, I still have almost 22 GB of memory left:

# cat /proc/meminfo
MemTotal: 33341028 kB
MemFree: 21641608 kB
Buffers: 34032 kB
Cached: 188576 kB
SwapCached: 0 kB
Active: 167556 kB
Inactive: 157876 kB
Active(anon): 103104 kB
Inactive(anon): 17440 kB
Active(file): 64452 kB
Inactive(file): 140436 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 60885884 kB
SwapFree: 60885884 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 102824 kB
Mapped: 71404 kB
Shmem: 17720 kB
Slab: 13868 kB
SReclaimable: 6744 kB
SUnreclaim: 7124 kB
KernelStack: 2848 kB
PageTables: 2524 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 515524 kB
Committed_AS: 3450064 kB
VmallocTotal: 122880 kB
VmallocUsed: 21296 kB
VmallocChunk: 66044 kB
HardwareCorrupted: 0 kB
AnonHugePages: 2048 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 12280 kB
DirectMap4M: 897024 kB

OR

# free -mh total used free shared buff/cache available
Mem: 31G 10G 20G 17M 230M 21G
Swap: 58G 4.8M 58G 

Does anyone know what the problem could be or what a possible solution could be?

Thanks!

Extra info

Limits, running processes, open files

root@somthing# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 40
file size (blocks, -f) unlimited
pending signals (-i) 8041
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 8041
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
root@something# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 16:40 ? 00:00:00 /init ro
root 3 1 0 16:40 tty1 00:00:00 /init ro
kevinho+ 4 3 0 16:40 tty1 00:00:00 -bash
root 26 4 0 16:43 tty1 00:00:00 sudo su
root 27 26 0 16:43 tty1 00:00:00 su
root 28 27 0 16:43 tty1 00:00:00 bash
root 49 28 0 17:03 tty1 00:00:00 ps -ef
root@something# lsof | wc -l
166

Strace of apt-get

See file on pastebin:

4 Answers

Thank you for all your help and input, but after some more searching into the processes on my own computer I found that it was something else.

The Trusted Applications mode of the Kaspersky Total Security application was blocking the apt binaries and others to execute. After I dissabled that mode, everything works, so if you ever have something like this on your Windows Subsystem for Linux, you better check your Host-base IPS (Intrusion Prevention System) or other kind of malware/virus scanner.

Kind Regards

Digihash

Having no "Windows Subsystem for Linux" experience, I can only generalize 'failed to fork'

This may be ( as you debugged ) due to memory, but also too many processes, open files or others.

this is a 'software' limit controlled by ulimit. Use ulimit -a to see all max values.

try ps -ef to check if you have (too) many processes running. lsof can tell you the number of open files.

3

Apart from the fact that "Windows subsystem for Linux" is no better than most other MS products, a quick Google session brings up that:

Generally, this message indicates that the apt process is running out of memory. That virtualmin is down as well is a good sign that the whole system is running low. Most likely the database has crashed. You can look for out of memory messages in /var/log/syslog in order to confirm this.

The first thing I would do (if you haven't done so already) is add a SWAP file to the server.

4

EDIT : As mentioned by @oligofren, this particular link/tutorial will not work for windows subsystem. But, this should work if you're on an Ubuntu system.

It's an old thread and some answers in the comments helped me fix this.@Frank mentioned the correct quote from another forum. I needed to create a SWAP file for the error to go away and things to work smoothly. I followed this guide from DigitalOcean :

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy