执行update-initramfs -c -k 6.4.0-rt8
发现生成的initrd非常大,有470M,以至于重启后显示:error: out of memory
。我怎么解决这个问题?
我想删除一些由initrd提取的文件并重新压缩它们,但我不知道要删除哪些文件?
解压后的文件信息:
debian12@gyz:~/initrd/temp/test$ sudo unmkinitramfs initrd.img-6.4.0-rt8 .
debian12@gyz:~/initrd/temp/test$ ls
early main initrd.img-6.4.0-rt8
debian12@gyz:~/initrd/temp/test$ ls main/
bin conf etc init lib lib32 lib64 libx32 run sbin scripts usr var
debian12@gyz:~/initrd/temp/test$ ls early/
kernel
debian12@gyz:~/initrd/temp/test$
再压缩的方法是否正确?
find . | cpio -H newc -o > ../new_initrd
gzip -9 ../new_initrd
mv ../new_initrd.gz ../new_initrd
猫 /etc/initramfs-tools/initramfs.conf
#
# initramfs.conf
# Configuration file for mkinitramfs(8). See initramfs.conf(5).
#
# Note that configuration options from this file can be overridden
# by config files in the /etc/initramfs-tools/conf.d directory.
#
# MODULES: [ most | netboot | dep | list ]
#
# most - Add most filesystem and all harddrive drivers.
#
# dep - Try and guess which modules to load.
#
# netboot - Add the base modules, network modules, but skip block devices.
#
# list - Only include modules from the 'additional modules' list
#
MODULES=most
#
# BUSYBOX: [ y | n | auto ]
#
# Use busybox shell and utilities. If set to n, klibc utilities will be used.
# If set to auto (or unset), busybox will be used if installed and klibc will
# be used otherwise.
#
BUSYBOX=auto
#
# KEYMAP: [ y | n ]
#
# Load a keymap during the initramfs stage.
#
KEYMAP=n
#
# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz | zstd ]
#
COMPRESS=zstd
#
# COMPRESSLEVEL: ...
#
# Set a compression level for the compressor.
# Defaults vary by compressor.
#
# Valid values are:
# 1 - 9 for gzip|bzip2|lzma|lzop
# 0 - 9 for lz4|xz
# 0 - 19 for zstd
#
# COMPRESSLEVEL=3
#
# DEVICE: ...
#
# Specify a specific network interface, like eth0
# Overridden by optional ip= or BOOTIF= bootarg
#
DEVICE=
#
# NFSROOT: [ auto | HOST:MOUNT ]
#
NFSROOT=auto
#
# RUNSIZE: ...
#
# The size of the /run tmpfs mount point, like 256M or 10%
# Overridden by optional initramfs.runsize= bootarg
#
RUNSIZE=10%
#
# FSTYPE: ...
#
# The filesystem type(s) to support, or "auto" to use the current root
# filesystem type
#
FSTYPE=auto
添加du -sch /etc/initramfs-tools/
:
debian12@gyz:~/initrd/temp$ du -sch /etc/initramfs-tools/
72K /etc/initramfs-tools/
72K 总计
添加du -h
debian12@gyz:~/initrd/temp/test$ find . -type f -size +20M -exec du -h {} +
44M ./main/usr/lib/modules/6.4.0-rt8/kernel/fs/xfs/xfs.ko
35M ./main/usr/lib/modules/6.4.0-rt8/kernel/fs/btrfs/btrfs.ko
30M ./main/usr/lib/modules/6.4.0-rt8/kernel/drivers/net/ethernet/intel/ice/ice.ko
29M ./main/usr/lib/modules/6.4.0-rt8/kernel/drivers/net/ethernet/netronome/nfp/nfp.ko
90M ./main/usr/lib/modules/6.4.0-rt8/kernel/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko
354M ./main/usr/lib/modules/6.4.0-rt8/kernel/drivers/gpu/drm/amd/amdgpu/amdgpu.ko
135M ./main/usr/lib/modules/6.4.0-rt8/kernel/drivers/gpu/drm/i915/i915.ko
51M ./main/usr/lib/modules/6.4.0-rt8/kernel/drivers/gpu/drm/radeon/radeon.ko
192M ./main/usr/lib/modules/6.4.0-rt8/kernel/drivers/gpu/drm/nouveau/nouveau.ko
debian12@gyz:~/initrd/temp/test$ ls initrd.img-6.4.0-rt8 -ltr
-rw-r--r-- 1 root root 483166934 8月29日 19:55 initrd.img-6.4.0-rt8