apt update报错E: Dynamic MMap ran out of room

在FreeBSD jail 里安装启动Ubuntu jammy系统,每次装好执行jexec ubjammy sh进入Ubuntu系统后,执行apt update报错。

报错E: Dynamic MMap ran out of room

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-Limit
           APT uses since version 0.7.26 a resizable memory mapped cache file
           to store the available information.  Cache-Start acts as a hint of
           the size the cache will grow to, and is therefore the amount of
           memory APT will request at startup. The default value is 20971520
           bytes (~20 MB). Note that this amount of space needs to be
           available for APT; otherwise it will likely fail ungracefully, so
           for memory restricted devices this value should be lowered while on
           systems with a lot of configured sources it should be increased.
           Cache-Grow defines in bytes with the default of 1048576 (~1 MB) how
           much the cache size will be increased in the event the space
           defined by Cache-Start is not enough. This value will be applied
           again and again until either the cache is big enough to store all
           information or the size of the cache reaches the Cache-Limit. The
           default of Cache-Limit is 0 which stands for no limit. If
           Cache-Grow is set to 0 the automatic growth of the cache is
           disabled.

那就增大限制,使用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.

但是后面apt upgrade还是报错:

Preparing to unpack .../bash_5.1-6ubuntu1.1_amd64.deb ...
dpkg (subprocess): unable to execute old bash package pre-removal script (/var/l
ib/dpkg/info/bash.prerm): No such file or directory
dpkg: warning: old bash package pre-removal script subprocess returned error exi
t status 2
dpkg: trying script from the new package instead ...
dpkg (subprocess): unable to execute new bash package pre-removal script (/var/l
ib/dpkg/tmp.ci/prerm): No such file or directory
dpkg: error processing archive /var/cache/apt/archives/bash_5.1-6ubuntu1.1_amd64
.deb (--unpack):
 new bash package pre-removal script subprocess returned error exit status 2
dpkg (subprocess): unable to execute installed bash package post-installation sc
ript (/var/lib/dpkg/info/bash.postinst): No such file or directory
dpkg: error while cleaning up:
 installed bash package post-installation script subprocess returned error exit 
status 2
Errors were encountered while processing:
 /var/cache/apt/archives/bash_5.1-6ubuntu1.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

目前为止第二个问题还没有解决。

解决问题apt upgrade 或apt install 报错的问题

使用很多办法都没有解决,

  1. 修复损坏的依赖:

    sudo apt-get -f install

    这个命令会尝试自动修复损坏的依赖。

    没搞定。

  2. 清理可能损坏的包:

    sudo dpkg --remove --force-remove-reinstreq libssl3:amd64

    这个命令强制移除 libssl3:amd64 包,并尝试重新安装它。

    不行。

  3. 更新软件包列表并尝试重新安装:

    sudo apt-get update

    sudo apt-get install libssl3:amd64

    这将更新可用软件包的列表并尝试重新安装有问题的包。

不管用。

最后这下面三句话解决:

# mv /var/lib/dpkg/info/ /var/lib/dpkg/info_old/
# mkdir /var/lib/dpkg/info/
# apt update

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值