Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 366779

Summary: sys-apps/openrc - "cannot allocate memory" when overcommit is disabled
Product: Gentoo Hosted Projects Reporter: cilly <cilly>
Component: OpenRCAssignee: OpenRC Team <openrc>
Status: RESOLVED WONTFIX    
Severity: minor CC: bug
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: meminfo

Description cilly 2011-05-10 18:01:45 UTC
If in /etc/sysctl.conf is set:

vm.overcommit_memory = 2
vm.overcommit_ratio = 0
vm.swappiness = 0

system does not boot and error message "cannot allocate memory" is returned.

It seems, sysctl values are set at a false point.

With baselayout 1, these values worked perfectly.
Comment 1 cilly 2011-05-11 09:47:40 UTC
rc-status -a
Runlevel: nonetwork
 local                                                                       [  started  ]
Runlevel: sysinit
 dmesg                                                                       [  started  ]
 udev                                                                        [  started  ]
 devfs                                                                       [  started  ]
Runlevel: single
Runlevel: shutdown
 killprocs                                                                   [  stopped  ]
 savecache                                                                   [  stopped  ]
 mount-ro                                                                    [  stopped  ]
Runlevel: boot
 hwclock                                                                     [  started  ]
 sysctl                                                                      [  started  ]
 modules                                                                     [  started  ]
 lvm                                                                         [  started  ]
 device-mapper                                                               [  started  ]
 fsck                                                                        [  started  ]
 root                                                                        [  started  ]
 mtab                                                                        [  started  ]
 localmount                                                                  [  started  ]
 urandom                                                                     [  started  ]
 bootmisc                                                                    [  started  ]
 termencoding                                                                [  started  ]
 keymaps                                                                     [  started  ]
 procfs                                                                      [  started  ]

 procfs                                                                      [  started  ]
 hostname                                                                    [  started  ]
 net.lo                                                                      [  started  ]
 quota                                                                       [  started  ]
 consolefont                                                                 [  started  ]
 swap                                                                        [  started  ]
Runlevel: default
 syslog-ng                                                                   [  started  ]
 iptables                                                                    [  started  ]
 net.eth0                                                                    [  started  ]
 net.br0                                                                     [  started  ]
 net.eth1                                                                    [  started  ]
 net.ppp0                                                                    [  started  ]
 courier-authlib                                                             [  started  ]
 courier-imapd-ssl                                                           [  started  ]
 named                                                                       [  started  ]
 ntp-client                                                                  [  started  ]
 nfs                                                                         [  started  ]
 racoon                                                                      [  started  ]
 netmount                                                                    [  started  ]
 mysql                                                                       [  started  ]
 sshd                                                                        [  started  ]
 apache2                                                                     [  started  ]
 atd                                                                         [  started  ]
 courier-imapd                                                               [  started  ]
 ddclient                                                                    [  started  ]
 dhcpd                                                                       [  started  ]
 fail2ban                                                                    [  started  ]
 fakeidentd                                                                  [  started  ]
 hostapd                                                                     [  started  ]
 igmpproxy                                                                   [  started  ]
 lm_sensors                                                                  [  started  ]
 mrtg                                                                        [  started  ]
 ntpd                                                                        [  started  ]
 saslauthd                                                                   [  started  ]
 postfix                                                                     [  started  ]
 privoxy                                                                     [  started  ]

 privoxy-tor                                                                 [  started  ]
 rngd                                                                        [  started  ]
 smartd                                                                      [  started  ]
 snmpd                                                                       [  started  ]
 tor                                                                         [  started  ]
 trafficshaper                                                               [  started  ]
 udev-postmount                                                              [  started  ]
 vixie-cron                                                                  [  started  ]
 xl2tpd                                                                      [  started  ]
 local                                                                       [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed
 rpc.pipefs                                                                  [  started  ]
 udev-mount                                                                  [  started  ]
 sysfs                                                                       [  started  ]
 net.wlan0                                                                   [  started  ]
 rpc.idmapd                                                                  [  started  ]
 rpc.statd                                                                   [  started  ]
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2011-05-12 23:58:19 UTC
sys-apps/openrc actually owns /etc/init.d/sysctl
Comment 3 SpanKY gentoo-dev 2011-05-16 05:48:44 UTC
disabling overcommit doesnt really make much sense ...

how much memory exactly do your system actually have ?  post /proc/meminfo as an attachment

post the actual boot output as an attachment as well.  we really need to know *which* program is hitting the alloc failure.
Comment 4 cilly 2011-05-16 15:49:49 UTC
Created attachment 273451 [details]
meminfo

This is meminfo with default overcommit values, since with vm set, the system does not boot.
Comment 5 cilly 2011-05-16 15:57:42 UTC
Right after configuring kernel settings, the boot process throws errors about:

agetty cannot allocate memory

Sorry, can't provide any logs about it, since system even does not remount fs rw, too.

In my opinion sysctl values are set too early.

Workaround:

put vm sysctl values in local.start

or: use baselayout 1

PS: In my opinion the above vm-settings do make sense if you don't want a sshd server to be committed, i.e. a user does a fork bomb. Of course, proper limits should be set, too.
Comment 6 SpanKY gentoo-dev 2011-05-16 19:06:14 UTC
trying to "prevent" forkbombs via disabling overcommit makes no sense at all

feel free to debug this further, but i dont plan on looking at it