[dnf] 메모리를 할당하지 못함 (Cannot allocate memory)
램 용량이 적은 저사양 서버에 MariaDB-server를 새 판으로 올려 깔려는데, 메모리를 할당하지 못해서 "Cannot allocate memory"라는 문구가 떴다.
[root@test ~]# dnf update MariaDB-server
MariaDB Server 8.1 kB/s | 3.4 kB 00:00
MariaDB Server 638 kB/s | 607 kB 00:00
MariaDB MaxScale 6.5 kB/s | 2.5 kB 00:00
MariaDB Tools 5.6 kB/s | 3.0 kB 00:00
Dependencies resolved.
=====================================================================================
Package Architecture Version Repository Size
=====================================================================================
Upgrading:
MariaDB-server x86_64 10.11.7-1.el9 mariadb-main 18 M
Transaction Summary
=====================================================================================
Upgrade 1 Packages
Total download size: 18 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): MariaDB-server-10.11.7-1.el9.x86_64.rpm 16 MB/s | 18 MB 00:01
-------------------------------------------------------------------------------------
Total 24 MB/s | 28 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: MariaDB-server-10.11.7-1.el9.x86_64 1/2
usermod: no changes
Upgrading : MariaDB-server-10.11.7-1.el9.x86_64 1/2
Running scriptlet: MariaDB-server-10.11.7-1.el9.x86_64 1/2
SELinux: Could not load policy file /etc/selinux/targeted/policy/policy.33: Cannot allocate memory
/sbin/load_policy: Can't load policy: Cannot allocate memory
libsemanage.semanage_reload_policy: load_policy returned error code 2. (No such file or directory).
SELinux: Could not load policy file /etc/selinux/targeted/policy/policy.33: Cannot allocate memory
/sbin/load_policy: Can't load policy: Cannot allocate memory
libsemanage.semanage_reload_policy: load_policy returned error code 2. (No such file or directory).
/usr/sbin/semodule: Failed!
Running scriptlet: MariaDB-server-10.11.6-1.el9.x86_64 2/2
Cleanup : MariaDB-server-10.11.6-1.el9.x86_64 2/2
Running scriptlet: MariaDB-server-10.11.6-1.el9.x86_64 2/2
active
Verifying : MariaDB-server-10.11.7-1.el9.x86_64 1/2
Verifying : MariaDB-server-10.11.6-1.el9.x86_64 2/2
Upgraded:
MariaDB-server-10.11.7-1.el9.x86_64
Complete!
SELinux(보안 강화 리눅스) 설정에 혹시 문제가 있을지 몰라서 다시 깔려고 한다.
스왚 파일을 적극적으로 만드는 정도를 조절하는 vm.swappiness 값을 확인해 본다.
[root@test ~]# sysctl vm.swappiness
vm.swappiness = 1
실제 메모리 용량이 모자랄 때는 vm.swappiness이 0이면 dnf가 실행되지 않을 수 있다(Killed). vm.swappiness 값이 낮아도 위처럼 메모리 할당이 잘 되지 않을 수 있다.
vm.swappiness 값을 기본값인 60으로 바꾸어 준다.
[root@test ~]# sysctl vm.swappiness=60
vm.swappiness = 60
'dnf downgrade'로 MariaDB-server를 먼저 깔았던 판으로 되돌린다.
[root@test ~]# dnf downgrade MariaDB-server
Last metadata expiration check: 0:10:40 ago on Fri 09 Feb 2024 05:11:39 AM UTC.
Dependencies resolved.
=====================================================================================
Package Architecture Version Repository Size
=====================================================================================
Downgrading:
MariaDB-server x86_64 10.11.6-1.el9 mariadb-main 18 M
Transaction Summary
=====================================================================================
Downgrade 1 Package
Total download size: 18 M
Is this ok [y/N]: y
Downloading Packages:
MariaDB-server-10.11.6-1.el9.x86_64.rpm 14 MB/s | 18 MB 00:01
-------------------------------------------------------------------------------------
Total 14 MB/s | 18 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: MariaDB-server-10.11.6-1.el9.x86_64 1/2
usermod: no changes
Downgrading : MariaDB-server-10.11.6-1.el9.x86_64 1/2
Running scriptlet: MariaDB-server-10.11.6-1.el9.x86_64 1/2
Running scriptlet: MariaDB-server-10.11.7-1.el9.x86_64 2/2
Cleanup : MariaDB-server-10.11.7-1.el9.x86_64 2/2
Running scriptlet: MariaDB-server-10.11.7-1.el9.x86_64 2/2
Running scriptlet: MariaDB-server-10.11.6-1.el9.x86_64 2/2
active
Running scriptlet: MariaDB-server-10.11.7-1.el9.x86_64 2/2
Verifying : MariaDB-server-10.11.6-1.el9.x86_64 1/2
Verifying : MariaDB-server-10.11.7-1.el9.x86_64 2/2
Downgraded:
MariaDB-server-10.11.6-1.el9.x86_64
Complete!
MariaDB-server를 10.11.7판으로 다시 깔아 보았고 이상 없이 잘 되었다.
[root@test ~]# dnf update MariaDB-server
Last metadata expiration check: 0:12:17 ago on Fri 09 Feb 2024 05:11:39 AM UTC.
Dependencies resolved.
=====================================================================================
Package Architecture Version Repository Size
=====================================================================================
Upgrading:
MariaDB-server x86_64 10.11.7-1.el9 mariadb-main 18 M
Transaction Summary
=====================================================================================
Upgrade 1 Package
Total download size: 18 M
Is this ok [y/N]: y
Downloading Packages:
[MIRROR] MariaDB-server-10.11.7-1.el9.x86_64.rpm: Status code: 500 for https://dlm.mariadb.com/repo/mariadb-server/10.11/yum/rhel/9/x86_64/rpms/MariaDB-server-10.11.7-1.el9.x86_64.rpm (IP: 2606:4700::6811:bf0e)
MariaDB-server-10.11.7-1.el9.x86_64.rpm 4.6 MB/s | 18 MB 00:03
-------------------------------------------------------------------------------------
Total 4.6 MB/s | 18 MB 00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: MariaDB-server-10.11.7-1.el9.x86_64 1/2
usermod: no changes
Upgrading : MariaDB-server-10.11.7-1.el9.x86_64 1/2
Running scriptlet: MariaDB-server-10.11.7-1.el9.x86_64 1/2
Running scriptlet: MariaDB-server-10.11.6-1.el9.x86_64 2/2
Cleanup : MariaDB-server-10.11.6-1.el9.x86_64 2/2
Running scriptlet: MariaDB-server-10.11.6-1.el9.x86_64 2/2
Running scriptlet: MariaDB-server-10.11.7-1.el9.x86_64 2/2
active
Running scriptlet: MariaDB-server-10.11.6-1.el9.x86_64 2/2
Verifying : MariaDB-server-10.11.7-1.el9.x86_64 1/2
Verifying : MariaDB-server-10.11.6-1.el9.x86_64 2/2
Upgraded:
MariaDB-server-10.11.7-1.el9.x86_64
Complete!
덧글을 달아 주세요