Ubuntu 14.04.5 iscsitarget-dkms error: too many arguments to function ‘sock_recvmsg’

Дано:
Ubuntu 14.04.5 LTS
iscsitarget-dkms_1.4.20.3+svn499-0ubuntu2.3_all
4.4.0-116-generic #140~14.04.1-Ubuntu SMP Fri Feb 16 09:25:20 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

После обыкновенного обновления apt-get dist-upgrade не стартует iscsitarget:
Starting iSCSI enterprise target service:FATAL: Module iscsi_trgt not found.

Причина: пакет iscsitarget-dkms не может установить модуль для ядра (dpkg-reconfigure iscsitarget-dkms):

Building module:
cleaning build area….
make KERNELRELEASE=4.4.0-116-generic -C /lib/modules/4.4.0-116-generic/build M=/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build….(bad exit status: 2)
ERROR: Cannot create report: [Errno 17] File exists: ‘/var/crash/iscsitarget-dkms.0.crash’
Error! Bad return status for module build on kernel: 4.4.0-116-generic (x86_64)
Consult /var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/make.log for more information.

Подробный лог:

ProblemType: Package
DKMSBuildLog:
DKMS make.log for iscsitarget-1.4.20.3+svn499 for kernel 4.4.0-116-generic (x86_64)
Tue Mar 27 13:22:09 MSK 2018
make: Entering directory `/usr/src/linux-headers-4.4.0-116-generic'
LD /var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/built-in.o
LD /var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/built-in.o
CC [M] /var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/tio.o
CC [M] /var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/iscsi.o
CC [M] /var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/nthread.o
/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/nthread.c: In function ‘forward_iov’:
/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/nthread.c:94:6: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
iov = msg->msg_iter.iov;
^
/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/nthread.c: In function ‘do_recv’:
/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/nthread.c:129:2: error: too many arguments to function ‘sock_recvmsg’
res = sock_recvmsg(conn->sock, &msg, len, MSG_DONTWAIT | MSG_NOSIGNAL);
^
In file included from include/linux/skbuff.h:29:0,
from include/linux/if_ether.h:23,
from include/uapi/linux/ethtool.h:17,
from include/linux/ethtool.h:17,
from include/linux/netdevice.h:42,
from include/net/sock.h:51,
from /var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/iscsi.h:19,
from /var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/nthread.c:16:
include/linux/net.h:220:5: note: declared here
int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags);
^
make[2]: *** [/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/nthread.o] Error 1
make[1]: *** [/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel] Error 2
make: *** [_module_/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build] Error 2
make: Leaving directory `/usr/src/linux-headers-4.4.0-116-generic'
DKMSKernelVersion: 4.4.0-116-generic
Date: Tue Mar 27 13:22:13 2018
DuplicateSignature: dkms:iscsitarget-dkms:1.4.20.3+svn499-0ubuntu2.3:/var/lib/dkms/iscsitarget/1.4.20.3+svn499/build/kernel/nthread.c:129:2: error: too many arguments to function ‘sock_recvmsg’
Package: iscsitarget-dkms 1.4.20.3+svn499-0ubuntu2.3
PackageVersion: 1.4.20.3+svn499-0ubuntu2.3
SourcePackage: iscsitarget
Title: iscsitarget-dkms 1.4.20.3+svn499-0ubuntu2.3: iscsitarget kernel module failed to build

Оказалось что в ядре 4.4.0-116 у функции sock_recvmsg отсутствует параметр size. При чём если распотрошить пакет /var/cache/apt/archives/iscsitarget-dkms_1.4.20.3+svn499-0ubuntu2.3_all.deb видно, что есть отдельный патч для ядра 4.4.0-83, добавляющий данный параметр в вызов функции.

Для временного решения проблемы можно «исправить» пакет:
apt-get remove iscsitarget-dkms
mkdir /tmp/iscsitarget-dkms
dpkg-deb -R /iscsitarget-dkms_1.4.20.3+svn499-0ubuntu2.3_all.deb /tmp/iscsitarget-dkms/

Убрать упоминание о патче в /tmp/iscsitarget-dkms/usr/src/iscsitarget-1.4.20.3+svn499/dkms.conf (последние две строки) и удалить сам патч из /tmp/iscsitarget-dkms/usr/src/iscsitarget-1.4.20.3+svn499/patches

dpkg-deb -b /tmp/iscsitarget-dkms /iscsitarget-dkms_1.4.20.3+svn499-0ubuntu2.3_all_PATCHED.deb
dpkg -i /iscsitarget-dkms_1.4.20.3+svn499-0ubuntu2.3_all_PATCHED.deb
service iscsitarget restart
service iscsitarget status

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *