Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up my first ever VPS on CentOS 5.6 (128 MB RAM) and was following some tutorials found online, but I've ran into a problem I can't fix. The VPS is bought from a hoster, so I can't give myself more memory :)

Running yum -y update gives me

[root@vps ~]# yum -y update
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package glibc.i686 0:2.5-58.el5_6.4 set to be updated
---> Package glibc-common.i386 0:2.5-58.el5_6.4 set to be updated
---> Package nscd.i386 0:2.5-58.el5_6.4 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================================
 Package                                       Arch                                  Version                                            Repository                                Size
=======================================================================================================================================================================================
Updating:
 glibc                                         i686                                  2.5-58.el5_6.4                                     updates                                  5.3 M
 glibc-common                                  i386                                  2.5-58.el5_6.4                                     updates                                   16 M
 nscd                                          i386                                  2.5-58.el5_6.4                                     updates                                  167 k

Transaction Summary
=======================================================================================================================================================================================
Install       0 Package(s)
Upgrade       3 Package(s)

Total size: 22 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
memory alloc (12 bytes) returned NULL.

I've found that it may be connected to insufficient memory, but it doesn't seem to be the case:

[root@vps ~]# cat /proc/meminfo
MemTotal:       131072 kB
MemFree:        110356 kB

[root@vps ~]# free -m
             total       used       free     shared    buffers     cached
Mem:           128         20        107          0          0          0
-/+ buffers/cache:         20        107
Swap:            0          0          0

After trying TiZon's suggestion:

[root@vps ~]# dd if=/dev/zero of=/swapfile bs=1024 count=65536
65536+0 records in
65536+0 records out
67108864 bytes (67 MB) copied, 0.222831 seconds, 301 MB/s
[root@vps ~]# mkswap /swapfile
Setting up swapspace version 1, size = 67104 kB
[root@vps ~]# swapon /swapfile
swapon: /swapfile: Operation not permitted
share|improve this question
    
Can you post the result from free -m? –  Bart De Vos Aug 4 '11 at 14:29
    
@TiZon, sure, see updated question –  Fluffy Aug 4 '11 at 14:33

3 Answers 3

up vote 1 down vote accepted

Yum is a hungry sun-of-gun when it comes to memory. You are going to need more memory than this. This is one of the reasons to make sure you get burstable ram when renting a VM from a third party.

It has been a while since I used openvz, but I think you need to increase the privvmpages memory parameter (i.e. if your vz is id 100 you run the following from the host machine (not the vz):

vzctl set 100 --privvmpages 512m:1024m --save

Then you can verify that it has taken effect with by looking at the counters, /proc/user_beancounters on the host machine.

Update:
Since you are getting this from a 3rd party you need to look into burstable ram or more memory. Since this is a rented VZ, they generally won't give you swap space -- so 128 is a hard limit on the amount of memory you can allocate at a time.

share|improve this answer
    
[root@vps ~]# vzctl set 100 --privvmpages 512m:1024m --save -bash: vzctl: command not found –  Fluffy Aug 4 '11 at 14:39
    
You run that from outside of the VZ, not with in it. Can't remember if requires a restart of the vz or not. –  Kyle Brandt Aug 4 '11 at 14:40
    
Btw, I'm buying VPS from other guys, don't know if that's relevant though) –  Fluffy Aug 4 '11 at 14:40
    
Yes, it means you can't increase the memory. What you need to do is either buy one with more memory, or get one with burstable ram. 128M doesn't compare to your normal machine because the vz generally won't have any swap. –  Kyle Brandt Aug 4 '11 at 14:44
1  
Thanks. I'm going to try to ask the hoster to temporarily give me more space –  Fluffy Aug 4 '11 at 14:56

128MB is not much for a centOS (and Yum), but possible. First of all, have you tried rebooting it? This will clear a lot of RAM. If that doesn't work, why don't you try to make a swap-file?

It's easy, it just takes 3 commands:

dd if=/dev/zero of=/swapfile bs=1024 count=65536
mkswap /swapfile
swapon /swapfile

The size of the swapfile is 67108864b (1024*65536). Feel free to make this larger as 64MB won't get you very far.

If you want to mount it on reboot, add this to /etc/fstab

/swapfile          swap            swap    defaults        0 0
share|improve this answer
    
tried to run it, updated the question with what I got –  Fluffy Aug 4 '11 at 14:43
    
So, OpenVZ I see. You can't do this on OpenVZ. Sorry. –  Bart De Vos Aug 4 '11 at 14:48

could you try

# ulimit -m unlimited 
# ulimit -v unlimited

and re-run yum again ?

share|improve this answer
    
Didn't help - everything is the same –  Fluffy Aug 4 '11 at 14:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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