initramfs has no modules - linux-kernel

I have proxmox containers. Host Debian 9, inside container Debian 8.
I made image to migrate into VMWare.
And now I need to build my initranfs. But if i run update-initranfs -u -v -k 4.9.0-0.bpo.8-amd64 it processed but doesn't copy modules. there is an attempt copying "Copying module directory kernel/drivers/ata" in log with no errors but there are no modules copied.
$update-initranfs -u -v -k 4.9.0-0.bpo.8-amd64
Keeping /boot/initrd.img-4.9.0-0.bpo.8-amd64.dpkg-bak
update-initramfs: Generating /boot/initrd.img-4.9.0-0.bpo.8-amd64
Copying module directory kernel/drivers/usb/host
(excluding hwa-hc.ko sl811_cs.ko sl811-hcd.ko u132-hcd.ko whci-hcd.ko)
Copying module directory kernel/drivers/hid
(excluding hid-*ff.ko hid-a4tech.ko hid-cypress.ko hid-dr.ko hid-elecom.ko hid-gyration.ko hid-icade.ko hid-kensington.ko hid-kye.ko hid-lcpower.ko hid-magicmouse.ko hid-multitouch.ko hid-ntrig.ko hid-petalynx.ko hid-picolcd.ko hid-pl.ko hid-ps3remote.ko hid-quanta.ko hid-roccat-ko*.ko hid-roccat-pyra.ko hid-saitek.ko hid-sensor-hub.ko hid-sony.ko hid-speedlink.ko hid-tivo.ko hid-twinhan.ko hid-uclogic.ko hid-wacom.ko hid-waltop.ko hid-wiimote.ko hid-zydacron.ko)
Copying module directory kernel/drivers/gpio
Copying module directory kernel/drivers/i2c/busses
Copying module directory kernel/drivers/net
(excluding appletalk arcnet bonding can dummy.ko hamradio hippi ifb.ko irda macvlan.ko macvtap.ko pcmcia sb1000.ko team tokenring tun.ko usb veth.ko wan wimax wireless xen-netback.ko)
Copying module directory kernel/drivers/scsi
Copying module directory kernel/drivers/block
Copying module directory kernel/drivers/nvme
Copying module directory kernel/drivers/ata
Copying module directory kernel/drivers/mmc
Copying module directory kernel/drivers/usb/storage
Adding binary /usr/share/initramfs-tools/conf.d/compcache
Adding binary /sbin/modprobe
Adding library /lib/x86_64-linux-gnu/libc.so.6
Adding library /lib64/ld-linux-x86-64.so.2
Adding binary /sbin/rmmod
Calling hook busybox
Adding binary /usr/lib/initramfs-tools/bin/busybox
Calling hook casper
Adding binary /sbin/losetup
Adding library /lib/x86_64-linux-gnu/libsmartcols.so.1
Adding binary /sbin/blkid
Adding library /lib/x86_64-linux-gnu/libblkid.so.1
Adding library /lib/x86_64-linux-gnu/libuuid.so.1
Adding binary /usr/share/casper/casper-reconfigure
Adding binary /usr/share/casper/casper-preseed
Adding binary /usr/share/casper/casper-set-selections
Adding binary /lib/udev/cdrom_id
Adding library /lib/x86_64-linux-gnu/libpthread.so.0
Copying module directory kernel/drivers/net
(excluding appletalk arcnet bonding can dummy.ko hamradio hippi ifb.ko irda macvlan.ko macvtap.ko pcmcia sb1000.ko team tokenring tun.ko usb veth.ko wan wimax wireless xen-netback.ko)
Calling hook fsck
Adding binary /sbin/fsck
Adding library /lib/x86_64-linux-gnu/libmount.so.1
Adding library /lib/x86_64-linux-gnu/libselinux.so.1
Adding library /lib/x86_64-linux-gnu/libpcre.so.3
Adding library /lib/x86_64-linux-gnu/libdl.so.2
Adding binary /sbin/logsave
Adding binary /sbin/sulogin
Adding library /lib/x86_64-linux-gnu/libcrypt.so.1
Adding binary /sbin/e2fsck
Adding library /lib/x86_64-linux-gnu/libext2fs.so.2
Adding library /lib/x86_64-linux-gnu/libcom_err.so.2
Adding library /lib/x86_64-linux-gnu/libe2p.so.2
Calling hook keymap
Calling hook klibc
Calling hook kmod
Adding binary /bin/kmod
Calling hook resume
Calling hook thermal
Calling hook udev
Adding binary /lib/systemd/systemd-udevd
Adding library /lib/x86_64-linux-gnu/libkmod.so.2
Adding library /lib/x86_64-linux-gnu/libacl.so.1
Adding library /lib/x86_64-linux-gnu/libattr.so.1
Adding binary /bin/udevadm
Adding binary /lib/udev/ata_id
Adding binary /lib/udev/scsi_id
Calling hook zz-busybox
Adding binary /bin/busybox
Calling hook dmsetup
Adding binary /sbin/dmsetup
Adding library /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1
Adding library /lib/x86_64-linux-gnu/libudev.so.1
Adding library /lib/x86_64-linux-gnu/librt.so.1
/usr/share/initramfs-tools/scripts/init-bottom/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/local-premount/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/init-top/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/casper-premount/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/casper-bottom/ORDER ignored: not executable
Building cpio /boot/initrd.img-4.9.0-0.bpo.8-amd64.new initramfs
and there are no modules i need
$lsinitramfs /boot/initrd.img-4.9.0-0.bpo.8-amd64 | grep modules
lib/modules
lib/modules/4.9.0-0.bpo.8-amd64
lib/modules/4.9.0-0.bpo.8-amd64/modules.alias.bin
lib/modules/4.9.0-0.bpo.8-amd64/modules.order
lib/modules/4.9.0-0.bpo.8-amd64/modules.devname
lib/modules/4.9.0-0.bpo.8-amd64/modules.dep
lib/modules/4.9.0-0.bpo.8-amd64/modules.symbols.bin
lib/modules/4.9.0-0.bpo.8-amd64/modules.alias
lib/modules/4.9.0-0.bpo.8-amd64/modules.symbols
lib/modules/4.9.0-0.bpo.8-amd64/modules.dep.bin
lib/modules/4.9.0-0.bpo.8-amd64/modules.builtin.bin
lib/modules/4.9.0-0.bpo.8-amd64/modules.softdep
lib/modules/4.9.0-0.bpo.8-amd64/modules.builtin
conf/modules
My configs
#initramfs.conf
MODULES=most
BUSYBOX=auto
COMPCACHE_SIZE=""
COMPRESS=gzip
DEVICE=
NFSROOT=auto
#update-initramfs.conf
update_initramfs=yes
backup_initramfs=no
$ls /lib/modules/4.9.0-0.bpo.8-amd64/kernel/drivers/ata/ata_generic*
ata_generic.ko
I tried MODULES=list with lsmod | awk '{print $1}' > /etc/initramfs-tools/modules
Why initramfs has no modules?

My trouble was in a broken package kmod!!!!!
apt-get install --reinstall kmod
mkinitramfs -o /boot/initrd.img-4.9.0-0.bpo.8-amd64 4.9.0-0.bpo.8-amd64

Related

How can I build ghostscript with an alternative zlib?

I'm using ghostscript to generate rather large PDF files, and profiling has lead me to believe that a lot of time is spent compressing data.
For whatever reason, the ghostscript source tree ships with a copy of the zlib 1.2.11 source code, which is then compiled into the resulting gs executable.
I would like to benchmark other zlib implementations, notably Cloudflare's and possibly Intel's.
In ghostscript's Makefile.in, there's an interesting section:
# Define the directory where the zlib sources are stored.
# See zlib.mak for more information.
SHARE_ZLIB=#SHARE_ZLIB#
ZSRCDIR=#ZLIBDIR#
#ZLIB_NAME=gz
ZLIB_NAME=z
ZLIB_CFLAGS=#ZLIBCFLAGS#
And looking in base/zlib.mak:
# makefile for zlib library code.
# Users of this makefile must define the following:
# GSSRCDIR - the GS library source directory
# ZSRCDIR - the source directory
# ZGENDIR - the generated intermediate file directory
# ZOBJDIR - the object directory
# SHARE_ZLIB - 0 to compile zlib, 1 to share
# ZLIB_NAME - if SHARE_ZLIB=1, the name of the shared library
# ZAUXDIR - the directory for auxiliary objects.
So, in theory, one should just compile zlib elsewhere, get an .so file (perhaps?), set SHARE_ZLIB to 1 and ZLIB_name to /foo/bar/zlib_cloudflare/libz.so and everything should be good. Except it doesn't work, and there's zero documentation.

Replace Source Files When Compiling CentOS Kernel with RPM

I am trying to modify one of the CentOS (7.6) kernel source file and recompile all of them for later installation.
I followed the guide on wiki.centos to do customized kernel:
https://wiki.centos.org/HowTos/Custom_Kernel
I found that in step 5, the RPM method always unpacked source files from tar files and replaced my modification in BUILD/.
Therefore, I changed my way. I put my modification at another place and added a line in kernel.spec file under SPECS/ to copy my file into the BUILD/. Namely, one-line with cp command is put before %build in the kernel.spec (after unpacked). However, the compilation went wrong in the %build section:
...
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.Vd6by5
BUILDING A KERNEL FOR x86_64...
USING ARCH=x86_64
...
###
### Now generating an X.509 key pair to be used for signing modules.
###
### If this takes a long time, you might wish to run rngd in the
### background to keep the supply of entropy topped up. It
### needs to be run as root, and uses a hardware random
### number generator if one is available.
###
Generating a 3072 bit RSA private key
....++
......................................................................................................................................................................................++
writing new private key to 'signing_key.priv'
-----
###
### Key pair generated.
###
- Including cert /home/user/rpmbuild/BUILD/kernel-3.10.0-957.12.2.el7/linux-3.10.0-957.12.2.el7.v2.x86_64/centos-kpatch.x509
- Including cert /home/user/rpmbuild/BUILD/kernel-3.10.0-957.12.2.el7/linux-3.10.0-957.12.2.el7.v2.x86_64/centos-ldup.x509
- Including cert signing_key.x509
RPM build errors:
Could somebody suggest me a better way to replace the source file in the compilation procedure?
Thanks.
I found the solution myself. Instead of directly replacing files, we should apply patch within RPM to indicate the differences between modified file and original file.
Firstly, use diff command to build patch. Then, modify spec file, kernel.spec, applying the patch to the building procedure.
This website shows the example when using this way to compile kernel:
https://www.hiroom2.com/2016/05/29/centos-7-rebuild-kernel-with-src-rpm/
A more clear reference for patching files:
https://rpm-packaging-guide.github.io/#patching-software

Unable to use libcurl with cffi on Windows 10

I am playing with the CFFI tutorial on Windows 10 and have installed the libcurl-devel package using msys2. I found a file libcurl.dll.a in the directory c:\msys2\usr\lib\ and added this directory to *foreign-library-directories* using:
(pushnew #P"c:/msys64/usr/lib/" *foreign-library-directories*
:test #'equal)
But if I try (use-foreign-library libcurl) I get the following error:
Unable to load foreign library (LIBCURL).
Error opening shared object "libcurl.dll"
What am I missing? I tried to point to libcurl.dll.a directly but the error stays the same:
(define-foreign-library libcurl
(:darwin (:or "libcurl.3.dylib" "libcurl.dylib"))
(:unix (:or "libcurl.so.3" "libcurl.so"))
(t "libcurl.dll.a"))
Here is the complete code as given in the tutorial:
(asdf:load-system :cffi)
;;; Nothing special about the "CFFI-USER" package. We're just
;;; using it as a substitute for your own CL package.
(defpackage :cffi-user
(:use :common-lisp :cffi))
(in-package :cffi-user)
(pushnew #P"c:/msys64/usr/lib/" *foreign-library-directories*
:test #'equal)
(define-foreign-library libcurl
(:darwin (:or "libcurl.3.dylib" "libcurl.dylib"))
(:unix (:or "libcurl.so.3" "libcurl.so"))
(t (:default "libcurl")))
(use-foreign-library libcurl)
EDIT
I am using SBCL 1.4.16 from the portacle package.
EDIT 2
Just for the sake of completeness. If I change define-foreign-library to
(define-foreign-library libcurl
(:darwin (:or "libcurl.3.dylib" "libcurl.dylib"))
(:unix (:or "libcurl.so.3" "libcurl.so"))
(t "libcurl.dll.a"))
the errors changes:
Unable to load foreign library (LIBCURL).
Error opening shared object "c:\\msys64\\usr\\lib\\libcurl.dll.a":
%1 ist keine zulässige Win32-Anwendung.
As far as I understand at least the file is found but seems not to be in the right format. I didn't find any further information about the difference between dynamic (.dll) and static (.dll.a) files with respect to cffi and don't have the resources at the moment to further investigate this.
Instead of using use-foreign-library, try loading load-foreign-library. It is lower level code, but it will allow you to experiment with files and paths.
Also use cygcheck to figure out what libcurl.dll depends on. Then make sure you have the components installed, and that they are in PATH.
Finally, check where libcurl.dll lives in your MSYS2. On my system it is in /c/msys64/mingw64/bin/libcurl-4.dll

Buildroot gcc headers don't match linux-headers

I'm using Buildroot 2018.02.7 to build a simple Linux system for i386 PC, as a precursor to doing the same thing for an embedded ARM system. I keep running into problems like this one, in building the util-linux module:
CC lib/libcommon_la-path.lo
lib/pager.c:11:17: fatal error: err.h: No such file or directory
#include <err.h>
^
compilation terminated.
Makefile:8596: recipe for target 'lib/libcommon_la-pager.lo' failed
make[3]: *** [lib/libcommon_la-pager.lo] Error 1
When I look in the linux-headers source tree in .../output/build/linux-headers-4.13.8, the file is found. But Buildroot is pointing to a different set of headers, the one built into its GCC:
devuser#3faf730b4a1b:~/pc/buildroot-2018.02.7/output/build/util-linux-2.31.1$ ../../host/bin/i686-buildroot-linux-uclibc-gcc -print-sysroot
/home/devuser/pc/buildroot-2018.02.7/output/host/i686-buildroot-linux-uclibc/sysroot
devuser#3faf730b4a1b:~/pc/buildroot-2018.02.7/output/build/util-linux-2.31.1$
And the two /usr/include subdirectories are significantly different.
Have I missed a configuration setting somewhere in the defconfig file? This is the defconfig:
BR2_x86_core2=y
BR2_SSP_REGULAR=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_13=y
BR2_UCLIBC_CONFIG="board/pc/dsa_pc_i386_uclibc.config"
BR2_TOOLCHAIN_BUILDROOT_USE_SSP=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_GETTY_PORT="tty1"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/pc/genimage-bios.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.13.8"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/pc/linux.config"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_LINUX_KERNEL_EXT_XENOMAI=y
BR2_PACKAGE_BUSYBOX_CONFIG="board/pc/dsa_pc_i386_busybox.config"
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9170=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3160=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3168=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_5000=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_6000G2A=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_6000G2B=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7260=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7265D=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8000C=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8265=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_8169=y
BR2_PACKAGE_ACPID=y
BR2_PACKAGE_DBUS=y
BR2_PACKAGE_ZLIB=y
BR2_PACKAGE_LIBFFI=y
BR2_PACKAGE_PCRE=y
BR2_PACKAGE_PCRE_UCP=y
BR2_PACKAGE_READLINE=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_DBUS_NEW=y
BR2_PACKAGE_KMOD=y
BR2_PACKAGE_UTIL_LINUX=y
BR2_PACKAGE_UTIL_LINUX_LIBMOUNT=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_GENIMAGE=y
Enable UCLIBC_HAS_BSD_ERR in uClibc.
You have a custom uClibc configuration. That falls squarely in the "you know what you are doing" category, since it allows you to remove features that other packages rely on.
In this case, util-linux relies on the non-Posix err.h include. This is only installed if UCLIBC_HAS_BSD_ERR is enabled in the uClibc configuration.
There is a high risk of running into similar issues with a custom uClibc configuration.

unable to build OpenH264.lib for windows

I followed all the instruction mentioned in https://github.com/cisco/openh264 but I am unable to get through. The information is cited in link but its quite confusing.
Alternative Way:
You can build Openh264 using visual studio in windows. Here are the steps..
i) Download OpenH264 source code provided by cisco (that already you
mentioned https://github.com/cisco/openh264).
ii) Now you will find two visual studio compatible projects in
directory /OpenH264/codec/build/win32/dec and
/OpenH264/codec/build/win32/enc.
iii) You will need to download NASM software from http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/
iv) Install NASM software on the directory C:\NASM or wherever you like.
v) Then Add NASM executable path to all these visual studio projects.
vi) Then You can either select static or dynamic library in general
options.
vi) If you are able to perform all these operations successfully, you will have 5 different .lib or .dll files named welsdcore, welsdecplus, welsecore, welsencplus, welsvp and those
are usable in any visual studio projects.
Now if you want to get openh264 features, just add all these libraries to your project and enjoy.
Hope it will help you.. :)
I also had some difficulty building openh264 on Windows using the recommended mingw approach.
In my case make crashed for all configurations I tried:
bash -c "make OS=msvc ARCH=x86_64 USE_ASM=No BUILDTYPE=Debug clean"
bash -c "make OS=msvc ARCH=x86_64 USE_ASM=No BUILDTYPE=Debug"
0 [main] make 3888 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
564 [main] make 3888 open_stackdumpfile: Dumping stack trace to make.exe.stackdump
0 [main] make 5448 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
561 [main] make 5448 open_stackdumpfile: Dumping stack trace to make.exe.stackdump
copying dll files to destination folder...
FullDestDir is E:\projects\openh264\bin\x64\Debug
current dir is:
E:\projects\openh264
DestDir is bin/x64/Debug
cp: cannot stat `openh264.dll': No such file or directory
cp: cannot stat `openh264.lib': No such file or directory
cp: cannot stat `openh264.pdb': No such file or directory
cp: cannot stat `codec_unittest.exe': No such file or directory
cp: cannot stat `h264enc.exe': No such file or directory
cp: cannot stat `h264dec.exe': No such file or directory
BuildDebugFlag =1
BuildReleaseFlag =0
BuildDebugInfo ="build debug--failed"
BuildReleaseInfo =NULL
aBuildFlagList is 1 0
ReturnCode is 1
I resorted to converting the existing solution/projects (VS2008) to VS2013 and linking/building with the created .lib files.
You can find the solutions in {openh264_dir}\codec\build\win32\enc and {openh264_dir}\codec\build\win32\dec.
Building the solution will create .libs and .dlls in {openh264_dir}\bin\Win32\Release
To link to the lib, you need to link to welsenc.lib.
When running, you need to have both the welsenc.dll and welsvp.dll in your application directory. So far it seems to have worked fine for my usage.
I'm assuming that building the decoder will be similar.

Resources