2

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: https://pastebin.com/zbjLbkGd

1

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.

https://www.digitalocean.com/community/questions/etc-cron-daily-apt-fatal-failed-to-fork

  • As you can see in the # free -mh command, I already have 58GB of swap enabled. Shouldn't this be enough? – Digihash Jul 12 '18 at 14:43
  • Offhand, yes. However, looking into swap usage may point you into the right direction. A fork problem is, in practice, either a response to a real memory allocation problem or, an OS problem. In this case that would a problem with the underlying hardware abstraction layer which has come out of Microsoft, so, with all due respect, anything's possible. – Frank van Wensveen Jul 13 '18 at 7:56
  • 1
    creating swap following this guide solved my issue: digitalocean.com/community/tutorials/… – crypdick Jun 25 at 12:54
1

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

0

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.

  • I've added the output of these commands in my first question, but I don't see anything out of the ordinary, do you? – Digihash Jul 12 '18 at 15:01
  • Looks good to me; Iam out of ideas. You could try (sudo ) strace [-f] apt-get update. - it might give you a hint as to what system call it called, before dying... ( not hopeful ...) – Holger Morgen Jul 13 '18 at 7:02
  • Thank for the tip, I tried it, but I don't see much, though I could miss something of course since it's the first time I look at the strace of apt-get. I added the output in my question above. – Digihash Jul 13 '18 at 10:02
0

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 : https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.