rookie_developer
rookie_developer

Reputation: 1369

error inserting a module in Linux -- 1 Cannot allocate memory

eCryptfs is a POSIX-compliant encrypted filesystem that has been part of the mainline Linux Kernel since version 2.6.19.

When I try to insert the module (ecryptfs.ko), I get the following error:

insmod: error inserting 'ecryptfs.ko': -1 Cannot allocate memory

Can some one please help me out?

below is the dmesg

Failed to allocate one or more kmem_cache objects

kmem_cache_create: duplicate cache ecryptfs_auth_tok_list_item

Pid: 3332, comm: insmod Tainted: G           O 3.2.2+ #1

Call Trace:

[<c102bfe0>] ? printk+0x15/0x17

[<c10878b6>] kmem_cache_create+0x41c/0x458

[<d0ebd038>] ecryptfs_init+0x38/0x1b1 [ecryptfs]

[<c1001071>] do_one_initcall+0x71/0x118

[<d0ebd000>] ? 0xd0ebcfff

[<c1055703>] sys_init_module+0x60/0x18c

[<c12db9b0>] sysenter_do_call+0x12/0x36

ecryptfs_init_kmem_caches: ecryptfs_auth_tok_list_item: kmem_cache_create 
failed

 Failed to allocate one or more kmem_cache objects

Upvotes: 4

Views: 12225

Answers (2)

rookie_developer
rookie_developer

Reputation: 1369

A likely cause of something like this happening is if one recompiles and installs a kernel and its modules but forgets to mount /boot before installing the kernel. After a reboot, one will then run with the old kernel but new modules. In any event, check that the running kernel is current, and reinstall both the kernel and the modules if in doubt:

mount /boot 
cd /usr/src/linux 
make && make install && make modules_install 

I have done the above steps and error was solved

Upvotes: 1

mpe
mpe

Reputation: 2730

Start with the error you are seeing in dmesg:

kmem_cache_create: duplicate cache ecryptfs_auth_tok_list_item

When the ecryptfs module is loaded the first thing it does is create a bunch of memory caches for itself. The error suggests that there is already a cache with that name.

You can check if the cache already exists by looking at sysfs:

$ ls -ld /sys/kernel/slab/ecryptfs*

NB. It may not show up in /proc/slabinfo due to slab merging.

If you see any ecryptfs slabs that suggests the ecryptfs module is already loaded, or it is already built into your kernel.

Normally the module loader would not let you load the same module twice, but perhaps you have done something weird to confuse it.

Upvotes: 1

Related Questions