[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: update-initramfs



On Tue, 11 Apr 2023 Michel Verdier wrote:
Le 11 avril 2023 davidson a écrit :

The first experiment simply tried to replicate your observations (as I
understood them). Basically, I added "-kg" suffix to all the files in
/boot corresponding to latest installed kernel, so that I had
unsuffixed copies and "*-kg" ("knowngood") copies, and then tried

 # update-initramfs -u

I don't understand a point.

Hi Michel.

To be clear, I am not the OP.

On my system I compiled kernel and thus build a linux-image-...deb
with a specific tag.

That is much more work than I did. I compiled no custom kernel. I just
made copies of the files in /boot installed from package
linux-image-5.10.0-21-amd64, and the corresponding initrd.

Here is a run of my Experiment #1, in full:

# knowngood=( /boot/*-$(uname -r) )
# for ((i=0; i<${#knowngood[@]}; i+=1)) ; do cp -a "${knowngood[i]}" "${knowngood[i]/%/-kg}" ; done
# ls -l "${knowngood[@]}"
-rw-r--r-- 1 root root   236452 21 janv. 09:35 /boot/config-5.10.0-21-amd64
-rw-r--r-- 1 root root 29199065 10 avril 21:58 /boot/initrd.img-5.10.0-21-amd64
-rw-r--r-- 1 root root       83 21 janv. 09:35 /boot/System.map-5.10.0-21-amd64
-rw-r--r-- 1 root root  7019136 21 janv. 09:35 /boot/vmlinuz-5.10.0-21-amd64
# ls -l "${knowngood[@]/%/-kg}"
-rw-r--r-- 1 root root   236452 21 janv. 09:35 /boot/config-5.10.0-21-amd64-kg
-rw-r--r-- 1 root root 29199065 10 avril 21:58 /boot/initrd.img-5.10.0-21-amd64-kg
-rw-r--r-- 1 root root       83 21 janv. 09:35 /boot/System.map-5.10.0-21-amd64-kg
-rw-r--r-- 1 root root  7019136 21 janv. 09:35 /boot/vmlinuz-5.10.0-21-amd64-kg

# update-initramfs -u
# update-initramfs: Generating /boot/initrd.img-5.10.0-21-amd64-kg
W: missing /lib/modules/5.10.0-21-amd64-kg
W: Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/5.10.0-21-amd64-kg: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
cat: /var/tmp/mkinitramfs_9UHxvD/lib/modules/5.10.0-21-amd64-kg/modules.builtin: Aucun fichier ou dossier de ce type
find: ‘/var/tmp/mkinitramfs_9UHxvD/lib/modules/5.10.0-21-amd64-kg/kernel’: Aucun fichier ou dossier de ce type
W: Can't find modules.builtin.modinfo (for locating built-in drivers' firmware, supported in Linux >=5.2)
depmod: WARNING: could not open modules.order at /var/tmp/mkinitramfs_9UHxvD/lib/modules/5.10.0-21-amd64-kg: No such file or directory
depmod: WARNING: could not open modules.builtin at /var/tmp/mkinitramfs_9UHxvD/lib/modules/5.10.0-21-amd64-kg: No such file or directory
# ls -l "${knowngood[@]}"
-rw-r--r-- 1 root root   236452 21 janv. 09:35 /boot/config-5.10.0-21-amd64
-rw-r--r-- 1 root root 29199065 10 avril 21:58 /boot/initrd.img-5.10.0-21-amd64
                       ^^^^^^^^
-rw-r--r-- 1 root root       83 21 janv. 09:35 /boot/System.map-5.10.0-21-amd64
-rw-r--r-- 1 root root  7019136 21 janv. 09:35 /boot/vmlinuz-5.10.0-21-amd64
# ls -l "${knowngood[@]/%/-kg}"
-rw-r--r-- 1 root root  236452 21 janv. 09:35 /boot/config-5.10.0-21-amd64-kg
-rw-r--r-- 1 root root 5924752 10 avril 22:07 /boot/initrd.img-5.10.0-21-amd64-kg
                       ^^^^^^^
-rw-r--r-- 1 root root      83 21 janv. 09:35 /boot/System.map-5.10.0-21-amd64-kg
-rw-r--r-- 1 root root 7019136 21 janv. 09:35 /boot/vmlinuz-5.10.0-21-amd64-kg

I install package so I have kernel and initram in /boot with the
tag. Same as your system I think ?

You didn't make backup copies of your most recent kernel, *give them
funny names*, and keep them in /boot. That is the distinction here, I
think.

 And when I update-initramfs it generate right files with right
names. And never break anything on further updates.

That makes sense, of course.

So why change only filenames and not rebuild a package with a
different tag ?

I believe the OP just wants an extra entry in his grub menu that will
boot a redundant copy of his latest working kernel. (But that is only
my understanding, which might be wrong. OP can speak for himself on
this point.)

It seems to me that building and packaging like you suggest is more
work than warranted, just to make a backup copy. According to OP's
report, that simple practice used to work for him.

Myself, I was only curious to do

  Experiment #1: replicate the OP's observations

and

  Experiment #2: see if I could tweak OP's practice enough so that
    update-grub would not care.

--
Hackers are free people. They are like artists. If they are in a good
mood, they get up in the morning and begin painting their pictures.
-- Vladimir Putin

Reply to: