0

I built a kernel module fc.ko on Ubuntu 16.04 for kernel 4.4.0-1016-aws. The I copied the kernel module to a Ubuntu 14.04 running the same kernel version 4.4.0-1016-aws but got error:

insmod: ERROR: could not insert module /opt/fc/agent/modules/4.4.0-1016-aws/fc.ko: Invalid module format

Does that mean the same kernel version 4.4.0-1016-aws is different for Ubuntu 16 and 14?

Update: I tried building my code on Ubuntu 14 against the 4.4.0-1016-aws kernel headers but the code failed to compile because kernel definition of the sock_recvmsg() function prototype is different from Ubuntu 16's 4.4.0-1016-aws kernel. Here is the difference:

Ubuntu 16:/usr/src/linux-aws-headers-4.4.0-1016/include/linux/net.h:

int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
                 int flags);

Ubuntu 14:/usr/src/linux-aws-headers-4.4.0-1016/include/linux/net.h:

int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags);

It looks like the same kernel version on Ubuntu 16 and 14 are indeed different.

  • 1
    A different libc6 and a different gcc version will cause "Invalid module format". – Knud Larsen Apr 9 '18 at 21:12
  • Thanks. It seems not just the gcc or libc could be different, some kernel function prototypes are also different. – Jack Apr 10 '18 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.