Bug 42322 - make-initrd failure with custom kernel
Summary: make-initrd failure with custom kernel
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: make-initrd (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Alexey Gladkov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-04 10:52 MSK by Elijah Zarezky
Modified: 2022-07-06 21:05 MSK (History)
10 users (show)

See Also:


Attachments
ALT environment (9.95 KB, image/png)
2022-04-04 17:31 MSK, Elijah Zarezky
no flags Details
ALT make-initrd (29.84 KB, image/png)
2022-04-04 18:10 MSK, Elijah Zarezky
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elijah Zarezky 2022-04-04 10:52:02 MSK
Trying to install custom kernel, all the packages installed succeffully:

/root/wget_TMP/selfgz319610330/kernel/rpm/kernel-5.10.107-1.x86_64.rpm /root/wget_TMP/selfgz319610330/kernel/rpm/kernel-devel-5.10.107-1.x86_64.rpm /root/wget_TMP/selfgz319610330/kernel/rpm/kernel-headers-5.10.107-1.x86_64.rpm
 # rpm -Uvh --noscripts --nodeps /root/wget_TMP/selfgz319610330/kernel/rpm/kernel-5.10.107-1.x86_64.rpm /root/wget_TMP/selfgz319610330/kernel/rpm/kernel-devel-5.10.107-1.x86_64.rpm /root/wget_TMP/selfgz319610330/kernel/rpm/kernel-headers-5.10.107-1.x86_64.rpm
Подготовка...                           ################################# [100%]
Обновление / установка...
1: kernel-headers-5.10.107-1            ################################# [ 33%]
2: kernel-devel-5.10.107-1              ################################# [ 67%]
3: kernel-5.10.107-1                    ################################# [100%]
Running /usr/lib/rpm/posttrans-filetriggers
[00:00:00] Config file: /etc/initrd.mk
[00:00:06] Generating module dependencies on host ...
[00:03:59] Used features: add-modules add-udev-rules buildinfo cleanup compress depmod-image gpu-drm kbd locales network plymouth qemu rdshell rootfs system-glibc ucode
[00:03:59] Packed modules: 8139cp ahci ata_generic ata_piix cdrom crc32c-intel crc-t10dif crct10dif_common crct10dif_generic crct10dif-pclmul drm drm_kms_helper e1000 ext4 failover fb_sys_fops jbd2 libahci libata mbcache mii net_failover pata_acpi pcnet32 sd_mod serio_raw sr_mod syscopyarea sysfillrect sysimgblt t10-pi virtio virtio_balloon virtio_blk virtio_console virtio_dma_buf virtio-gpu virtio_input virtio_mem virtio_net virtio_pci virtio_ring virtio-rng virtio_scsi vmw_vsock_virtio_transport vmw_vsock_virtio_transport_common vsock 
[00:03:59] Unpacked size: 175M
[00:03:59] Image size: 42M
[00:03:59] Image is saved as /boot/initrd-5.10.107.img

Then calling

/sbin/installkernel 5.10.107

and got the following error:

[00:00:00] Config file: /etc/initrd.mk
[00:00:03] Generating module dependencies on host ...
/usr/share/make-initrd/tools/initrd-release: строка 8: cd: .//make-initrd.iph3cJUdj/5.10.107.initrd/img: Нет такого файла или каталога
make[2]: *** [/usr/share/make-initrd/mk/make-initrd.mk:118: create] Ошибка 1
make[1]: *** [/usr/share/make-initrd/mk/make-initrd.mk:182: process-config] Ошибка 2
make: *** [/usr/share/make-initrd/mk/make-initrd.mk:172: all] Ошибка 1
Comment 1 Alexey Gladkov 2022-04-04 15:36:06 MSK
As far as I can tell, make-initrd is not the problem. The utility runs correctly when called from /usr/lib/rpm/posttrans-filetriggers. As you can see the initramfs has been created.

The problem is in the environment of /sbin/installkernel.

Please show the output:

$ rpm -q --scripts kernel-5.10.107-1
Comment 2 Elijah Zarezky 2022-04-04 16:04:59 MSK
postinstall scriptlet (using /bin/sh):
if [ -x /sbin/installkernel -a -r /boot/vmlinuz-5.10.107 -a -r /boot/System.map-5.10.107 ]; then
cp /boot/vmlinuz-5.10.107 /boot/.vmlinuz-5.10.107-rpm
cp /boot/System.map-5.10.107 /boot/.System.map-5.10.107-rpm
rm -f /boot/vmlinuz-5.10.107 /boot/System.map-5.10.107
/sbin/installkernel 5.10.107 /boot/.vmlinuz-5.10.107-rpm /boot/.System.map-5.10.107-rpm
rm -f /boot/.vmlinuz-5.10.107-rpm /boot/.System.map-5.10.107-rpm
fi
preuninstall scriptlet (using /bin/sh):
if [ -x /sbin/new-kernel-pkg ]; then
new-kernel-pkg --remove 5.10.107 --rminitrd --initrdfile=/boot/initramfs-5.10.107.img
elif [ -x /usr/bin/kernel-install ]; then
kernel-install remove 5.10.107
fi
postuninstall scriptlet (using /bin/sh):
if [ -x /sbin/update-bootloader ]; then
/sbin/update-bootloader --remove 5.10.107
fi
Comment 3 Alexey Gladkov 2022-04-04 16:30:46 MSK
(Ответ для Elijah Zarezky на комментарий #2)
> postinstall scriptlet (using /bin/sh):
> if [ -x /sbin/installkernel -a -r /boot/vmlinuz-5.10.107 -a -r
> /boot/System.map-5.10.107 ]; then
> cp /boot/vmlinuz-5.10.107 /boot/.vmlinuz-5.10.107-rpm
> cp /boot/System.map-5.10.107 /boot/.System.map-5.10.107-rpm
> rm -f /boot/vmlinuz-5.10.107 /boot/System.map-5.10.107
> /sbin/installkernel 5.10.107 /boot/.vmlinuz-5.10.107-rpm
> /boot/.System.map-5.10.107-rpm
> rm -f /boot/.vmlinuz-5.10.107-rpm /boot/.System.map-5.10.107-rpm
> fi

Ok. I saw that the trigger created the image. Image creation is also available in postinstall of rpm package.

(Ответ для Elijah Zarezky на комментарий #0)
> Then calling
> 
> /sbin/installkernel 5.10.107

You are calling installkernel by hand. Why ?

The problem, regardless of your answer, is in the installkernel environment. The make-initrd allows you to change the configuration using environment variables. This cannot be changed.

Perhaps installkernel should be more specific to the environment in which the make-inintrd is executed.
Comment 4 Elijah Zarezky 2022-04-04 16:37:13 MSK
I am calling installkernel by hand only to make this newly installed kernel to be default choice in the GRUB menu. Is this unnecessary?
Comment 5 Gleb F-Malinovskiy 2022-04-04 16:52:13 MSK
Does your environment set TMPDIR=./ ?
I bet such a definition breaks a lot of software!
Comment 6 Alexey Gladkov 2022-04-04 16:54:03 MSK
(Ответ для Elijah Zarezky на комментарий #4)
> I am calling installkernel by hand only to make this newly installed kernel
> to be default choice in the GRUB menu. Is this unnecessary?

The /usr/lib/rpm/boot_kernel.filetrigger is responsible for this. But honestly I don't think it will switch the default kernel in your case.

On the table is still the question of how such an environment came about.
Comment 7 Gleb F-Malinovskiy 2022-04-04 16:58:08 MSK
(In reply to Alexey Gladkov from comment #6)
> (Ответ для Elijah Zarezky на комментарий #4)
> > I am calling installkernel by hand only to make this newly installed kernel
> > to be default choice in the GRUB menu. Is this unnecessary?
> 
> The /usr/lib/rpm/boot_kernel.filetrigger is responsible for this. But
> honestly I don't think it will switch the default kernel in your case.

Calling installkernel is the right way to make a certain kernel default.
But that's what already happens for any installed kernel package, AFAIR.
Comment 8 Elijah Zarezky 2022-04-04 16:58:53 MSK
No, my environment does NOT set TMPDIR=./
Comment 9 Gleb F-Malinovskiy 2022-04-04 17:15:43 MSK
(In reply to Elijah Zarezky from comment #8)
> No, my environment does NOT set TMPDIR=./

May be you have INITRD_WORKDIR variable in your environment or in the /etc/sysconfig/installkernel config?
Comment 10 Alexey Gladkov 2022-04-04 17:19:28 MSK
(Ответ для Elijah Zarezky на комментарий #8)
> No, my environment does NOT set TMPDIR=./

env |grep WORKDIR

?
Comment 11 Elijah Zarezky 2022-04-04 17:31:25 MSK
Created attachment 10500 [details]
ALT environment
Comment 12 Elijah Zarezky 2022-04-04 17:31:57 MSK
(In reply to Alexey Gladkov from comment #10)
> (Ответ для Elijah Zarezky на комментарий #8)
> > No, my environment does NOT set TMPDIR=./
> 
> env |grep WORKDIR
> 
> ?

https://bugzilla.altlinux.org/attachment.cgi?id=10500
Comment 13 Gleb F-Malinovskiy 2022-04-04 17:58:51 MSK
Please, try these two commands:

make-initrd -k 5.10.107
env -i /usr/sbin/make-initrd -k 5.10.107
Comment 14 Elijah Zarezky 2022-04-04 18:10:50 MSK
Created attachment 10501 [details]
ALT make-initrd
Comment 15 Elijah Zarezky 2022-04-04 18:11:10 MSK
(In reply to Gleb F-Malinovskiy from comment #13)
> Please, try these two commands:
> 
> make-initrd -k 5.10.107
> env -i /usr/sbin/make-initrd -k 5.10.107

https://bugzilla.altlinux.org/attachment.cgi?id=10501
Comment 16 Gleb F-Malinovskiy 2022-04-04 19:29:38 MSK
(In reply to Elijah Zarezky from comment #14)
> Created attachment 10501 [details]
> ALT make-initrd

Ok, but I don't see how it's even possible.  Are you sure that
installkernel 5.10.107
command doesn't work in this environment?
Comment 17 Elijah Zarezky 2022-04-04 19:51:06 MSK
(In reply to Gleb F-Malinovskiy from comment #16)
> Ok, but I don't see how it's even possible.  Are you sure that
> installkernel 5.10.107
> command doesn't work in this environment?

Hm-m-m... it's looks like a mircacle. I've just successfully performed
export KV="5.10.107"
/sbin/installkernel ${KV}
But it was succeeded after previously executed 
make-initrd -k 5.10.107
env -i /usr/sbin/make-initrd -k 5.10.107
So tomorrow I will try to do this on the clear VM. Thanks for your support!
Comment 18 Alexey Gladkov 2022-04-04 21:03:07 MSK
The next time it doesn't work, try looking at your environment variables.
Comment 19 Elijah Zarezky 2022-04-05 11:08:36 MSK
You're right guys! I've dumped "env | sort" just before "installkernel" call on the our testing VM - and surprise-surprise, there is "TMPDIR=./" :-D
Comment 20 Alexey Gladkov 2022-04-05 14:00:44 MSK
Although the environment is erroneous, make-initrd could take this situation into account and be more tolerant of such an error.
Comment 21 Repository Robot 2022-07-06 21:05:30 MSK
make-initrd-2.27.0-alt1 -> sisyphus:

 Wed Jul 06 2022 Alexey Gladkov <legion@altlinux.ru> 2.27.0-alt1
 - New version (2.27.0).
 - Feature luks:
   + Add crypttab support (ALT#43056).
   + Try to remember the uuid of the luks device and automatically add it
     to crypttab.
   + Use luks.keys if the file is already in the initramfs (ALT#42987).
 - Feature kickstart:
   + Use /proc/devices to detect sd and virtblk block devices.
 - Feature locales:
   + Read system-wide locales.
 - Utilities:
   + initrd-ls: Fix infinite loop when unpacking zstd.
   + initrd-put: Add option to exclude files by pattern.
   + initrd-scanmod: module must satisfy all the rules from the ruleset.
   + mkinitrd-make-initrd: Fixed misprint, make-initrd can be found now.
   + make-initrd: Enforce absolute path in TMPDIR (ALT#42322).
 - Misc:
   + Check bzip2 library as the last chance for detection if there is no
     bzip2.pc.