Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: RAM won't overallocate, easily fixed, but considering options! #188

Closed
sickcodes opened this issue Mar 14, 2021 · 10 comments · Fixed by #189
Closed

BUG: RAM won't overallocate, easily fixed, but considering options! #188

sickcodes opened this issue Mar 14, 2021 · 10 comments · Fixed by #189
Labels
bug Something isn't working

Comments

@sickcodes
Copy link
Owner

I'm trying to run but i got this error Unable to init server: Could not connect: Connection refused qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory QEMU 5.2.0 monitor - type 'help' for more information (qemu)
Can anyone help me?
I am trying the start OSX with this command
sudo docker run --device /dev/kvm --device /dev/snd -v /tmp/X11-unix:/tmp/X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:latest

Originally posted by @C9-Dev in #131 (comment)

@sickcodes
Copy link
Owner Author

I'm trying to run but i got this error Unable to init server: Could not connect: Connection refused qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory QEMU 5.2.0 monitor - type 'help' for more information (qemu)
Can anyone help me?
I am trying the start OSX with this command
sudo docker run --device /dev/kvm --device /dev/snd -v /tmp/X11-unix:/tmp/X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:latest

@C9-Dev I am also getting this Issue, it is because the default RAM is 8GB, and in this case, the server has BELOW that amount and kills.

I am updating the image now, perhaps 90% of MemTotal's 8152908 kB?

[arch@40a8c6c0937c OSX-KVM]$ cat /proc/meminfo
MemTotal:        8152908 kB
MemFree:         5208916 kB
MemAvailable:    7394820 kB
Buffers:           55608 kB
Cached:          2309448 kB
SwapCached:            0 kB
Active:          1202276 kB
Inactive:        1496992 kB
Active(anon):     337280 kB
Inactive(anon):      584 kB
Active(file):     864996 kB
Inactive(file):  1496408 kB
Unevictable:       18460 kB
Mlocked:           18460 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:              1160 kB
Writeback:             0 kB
AnonPages:        352432 kB
Mapped:           311224 kB
Shmem:              1572 kB
KReclaimable:      87824 kB
Slab:             175728 kB
SReclaimable:      87824 kB
SUnreclaim:        87904 kB
KernelStack:        6660 kB
PageTables:         8404 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4076452 kB
Committed_AS:    3280588 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       19568 kB
VmallocChunk:          0 kB
Percpu:             2944 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      167916 kB
DirectMap2M:     2977792 kB
DirectMap1G:     5242880 kB
[arch@40a8c6c0937c OSX-KVM]$ 


@sickcodes sickcodes added the bug Something isn't working label Mar 14, 2021
@sickcodes sickcodes changed the title I'm trying to run but i got this error `Unable to init server: Could not connect: Connection refused BUG: RAM won't overallocate, easily fixed, but considering options! Mar 14, 2021
@sickcodes
Copy link
Owner Author

sickcodes commented Mar 14, 2021

user 100% of ram

echo $(("$(head -n1 /proc/meminfo | tr -dc '[:digit:]') / 900000"))

90% ram

echo $(("$(head -n1 /proc/meminfo | tr -dc '[:digit:]') / 900000"))
RAM=${RAM:-$(("$(head -n1 /proc/meminfo | tr -dc '[:digit:]') / 900000"))}000 \
exec qemu-system-x86_64 -m ${RAM} \

Or shall I set the default RAM to 2000 as that's the bare minimum anyway?

@yansigit
Copy link

yansigit commented Mar 18, 2021

Hi, I'm still getting same issue

user@pc:~$ docker run -it \
>     --device /dev/kvm \
>     -p 50922:10022 \
>     -v /tmp/.X11-unix:/tmp/.X11-unix \
>     -e "DISPLAY=${DISPLAY:-:0.0}" \
>     sickcodes/docker-osx:latest
touch: cannot touch '': No such file or directory
chown: cannot access '': No such file or directory
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 
nohup: appending output to 'nohup.out'
qemu-system-x86_64: warning: dbind: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-TT9MRS7Axy: Connection refused
QEMU 5.2.0 monitor - type 'help' for more information
(qemu) qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory

I've checked /dev/kvm permissions, xhost +, and if user in groups of libvirt, docker and kvm groups.
I'm not running in root account either.

I'm using these images

user@pc:~$ docker images
REPOSITORY             TAG       IMAGE ID       CREATED        SIZE
sickcodes/docker-osx   big-sur   24f7759e905b   21 hours ago   3.25GB
sickcodes/docker-osx   latest    45c4d709ad41   21 hours ago   3.08GB

@sickcodes
Copy link
Owner Author

How much RAM do you have

@yansigit
Copy link

@sickcodes i have 16GB size rams

@sickcodes
Copy link
Owner Author

Try now since I changed f6e0bfa

Default RAM is 3GB, you can change to something like 5 or 10 because it will use all of it

-e RAM=5 \

@sickcodes
Copy link
Owner Author

Another suitable candidate for increasing available RAM:

sync; echo 3 > /proc/sys/vm/drop_caches

Which clears your memory cache.

@sickcodes sickcodes reopened this Mar 19, 2021
@sickcodes
Copy link
Owner Author

I removed RAM=max and changed the default to 3

export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 1000000"))"'

^This causes RAM creep. I left an idling machine on for 10 hours and I used about 16 of RAM by the end of it.

2GB is also slightly too small and causes mouse freezes (personally experienced, and seen in #207)

From the following reddit comment:
https://www.reddit.com/r/Proxmox/comments/8sy4sd/unable_to_start_vm/e13ghrz/?utm_source=reddit&utm_medium=web2x&context=3

@sickcodes
Copy link
Owner Author

sudo tee /proc/sys/vm/drop_caches <<< 3

@gspagoni
Copy link

Try now since I changed f6e0bfa

Default RAM is 3GB, you can change to something like 5 or 10 because it will use all of it

-e RAM=5 \

How can i specify 16GB, can you post the full command please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants