apt update报错E: Dynamic MMap ran out of room
在FreeBSD jail 里安装启动Ubuntu jammy系统,每次装好执行jexec ubjammy sh进入Ubuntu系统后,执行apt update报错。
apt update报错信息:
Fetched 11.7 MB in 8s (1525 kB/s)
E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. Current value: 25165824. (man 5 apt.conf)
Reading package lists... Error!
E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. Current value: 25165824. (man 5 apt.conf)
E: Error occurred while processing libsurgescript0.5.4.4 (NewVersion1)
E: Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_universe_binary-amd64_Packages
E: The package lists or status file could not be parsed or opened.
根据提示,使用
man 5 apt.conf 查看帮助,发现:
Cache-Start, Cache-Grow, Cache-LimitAPT uses since version 0.7.26 a resizable memory mapped cache fileto store the available information. Cache-Start acts as a hint ofthe size the cache will grow to, and is therefore the amount ofmemory APT will request at startup. The default value is 20971520bytes (~20 MB). Note that this amount of space needs to beavailable for APT; otherwise it will likely fail ungracefully, sofor memory restricted devices this value should be lowered while onsystems with a lot of configured sources it should be increased.Cache-Grow defines in bytes with the default of 1048576 (~1 MB) howmuch the cache size will be increased in the event the spacedefined by Cache-Start is not enough. This value will be appliedagain and again until either the cache is big enough to store allinformation or the size of the cache reaches the Cache-Limit. Thedefault of Cache-Limit is 0 which stands for no limit. IfCache-Grow is set to 0 the automatic growth of the cache isdisabled.
那就增大限制,使用Cache-Grow没有成功,那就直接增大Cache-start,设为64M。因为当前系统里没有vi,所以直接使用了echo 重定向:
echo 'APT::Cache-Start "67108864";' > /etc/apt/apt.conf.d/99cachelimit
再次执行apt update,成功!
# apt update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
16 packages can be upgraded. Run 'apt list --upgradable' to see them.