Don't autoload unneeded modules
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Confirmed
|
Medium
|
Unassigned |
Bug Description
Every time the kernel is upgraded and initrd is regenerated, some modules are loaded. These modules are not necessary for the system to run, take up memory and may even enlarge the attack surface when (security-)issues were to be found in these modules.
How to reproduce on this Amazon EC2 instance:
-------
# lsmod
[nothing]
# dpkg-reconfigure linux-image-
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/
run-parts: executing /etc/kernel/
run-parts: executing /etc/kernel/
update-initramfs: Generating /boot/initrd.
run-parts: executing /etc/kernel/
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-
Updating /boot/grub/menu.lst ... done
run-parts: executing /etc/kernel/
Generating grub.cfg ...
cat: /boot/grub/
/usr/sbin/
Found linux image: /boot/vmlinuz-
Found initrd image: /boot/initrd.
/usr/sbin/
/usr/sbin/
/usr/sbin/
/usr/sbin/
/usr/sbin/
done
# lsmod
Module Size Used by
btrfs 638248 0
zlib_deflate 26622 1 btrfs
libcrc32c 12543 1 btrfs
ufs 78131 0
vfat 17308 0
msdos 17132 0
fat 55605 2 vfat,msdos
xfs 747494 0
ext2 67987 0
# grep -r ^[a-zA-Z] /etc/modules /etc/initramfs-
/etc/initramfs-
/etc/initramfs-
/etc/initramfs-
/etc/initramfs-
/etc/initramfs-
/etc/initramfs-
/etc/initramfs-
/etc/initramfs-
/etc/initramfs-
# grep ^b /etc/modprobe.
blacklist btrfs
blacklist zlib_deflate
blacklist libcrc32c
blacklist crc32c
blacklist ufs
blacklist qnx4
blacklist hfsplus
blacklist hfs
blacklist minix
blacklist ntfs
blacklist vfat
blacklist msdos
blacklist fat
blacklist dm_crypt
-------
Interestingly, none of these modules are included in the resulting initrd:
# gzip -dc /boot/initrd* | cpio -it | grep kernel/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
lib/modules/
10837 blocks
Note: executing "update-initramfs -u -k `uname -r`" alone does NOT load these modules!
Workaround:
Running "rmmod btrfs zlib_deflate libcrc32c ufs vfat msdos fat xfs ext2" after every kernel upgrade.
---
AcpiTables:
AlsaDevices:
total 0
crw-rw---T 1 root audio 116, 1 Feb 8 15:01 seq
crw-rw---T 1 root audio 116, 33 Feb 8 15:01 timer
AplayDevices: Error: [Errno 2] No such file or directory
ApportVersion: 2.0.1-0ubuntu17.1
Architecture: i386
ArecordDevices: Error: [Errno 2] No such file or directory
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
CRDA: Error: [Errno 2] No such file or directory
DistroRelease: Ubuntu 12.04
IwConfig: Error: [Errno 2] No such file or directory
Lspci: Error: [Errno 2] No such file or directory
Lsusb: Error: [Errno 2] No such file or directory
MarkForUpload: True
Package: linux (not installed)
PciMultimedia:
ProcEnviron:
TERM=xterm-color
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
ProcFB:
ProcKernelCmdLine: root=UUID=
ProcModules:
ProcVersionSign
RelatedPackageV
linux-
linux-
linux-firmware 1.79.2
RfKill: Error: [Errno 2] No such file or directory
Tags: precise
Uname: Linux 3.2.0-38-virtual i686
UpgradeStatus: Upgraded to precise on 2012-08-21 (177 days ago)
UserGroups:
WifiSyslog:
description: | updated |
description: | updated |
Changed in linux (Ubuntu): | |
importance: | Undecided → Medium |
This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:
apport-collect 1125597
and then change the status of the bug to 'Confirmed'.
If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.
This change has been made by an automated script, maintained by the Ubuntu Kernel Team.