User Tools

Site Tools


doc:appunti:linux:sa:if_rename

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:sa:if_rename [2024/04/12 18:01] – [Debian 9 predictable network interface names] niccolodoc:appunti:linux:sa:if_rename [2024/06/21 17:54] (current) – [Beware of initramfs image] niccolo
Line 26: Line 26:
 Name=lan0 Name=lan0
 </file> </file>
 +
 +==== Beware of initramfs image ====
 +
 +:!: If you have some files in **/etc/systemd/network/** to rename network interfaces and you update the **initramfs image** (e.g. by running the **update-initramfs** tool), a copy of these files are placed into the image itself (under the path **usr/lib/systemd/network/**).
 +
 +These files are considered by ''init'' before it considers the content of **/etc/systemd/network/**. When the latter files are processed, some renaming may have already occurred and rules may not longer apply or may fail.
 +
 +So it is always advisable to **update the initramfs** whenever you update the content of **/etc/systemd/network/**.
 +
 +<code>
 +update-initramfs -k all -u
 +</code>
 +
 +=== How to unpack the iniramfs image to inspect its content ===
 +
 +In **Debian 12** the iniramfs image may be composed by two appended cpio archives. The first containing the Intel microcode in //ASCII cpio archive// format, and the second containing the actual initramfs as a //Zstandard compressed cpio archive//. To extract both, do the following:
 +
 +Extract **the microcode part** (take note of the number of blocks printed on stderr):
 +
 +<code>
 +cat /boot/initrd.img-6.1.0-21-amd64 | cpio --extract --make-directories  --no-absolute-filenames
 +14080 blocks
 +</code>
 +
 +Make a copy of **the initramfs part** stripping the microcode and decompress it:
 +
 +<code>
 +dd if=/boot/initrd.img-6.1.0-21-amd64 of=initramfs.img.zst bs=512 skip=14080
 +unzstd initramfs.img.zst --stdout | cpio --extract --make-directories  --no-absolute-filenames
 +</code>
  
 ==== NetworkManager interfering with rename ==== ==== NetworkManager interfering with rename ====
Line 122: Line 152:
 :!: **ATTENZIONE**: Pare che **il file con le regole udev viene ignorato** se manca l'opzione **net.ifnames=0** nella cmdline del kernel! Questo almeno è accaduto con Debian 11.7 e kernel 5.10.0-23-amd64. :!: **ATTENZIONE**: Pare che **il file con le regole udev viene ignorato** se manca l'opzione **net.ifnames=0** nella cmdline del kernel! Questo almeno è accaduto con Debian 11.7 e kernel 5.10.0-23-amd64.
  
-:!: **ATTENZIONE**: Il file con le regole udev viene comunque ignorato in **Debian 11**.+:!: **ATTENZIONE**: Il file con le regole udev viene ignorato comunque in **Debian 11**.
  
 ===== Debian 9 Network Interface Naming ===== ===== Debian 9 Network Interface Naming =====
doc/appunti/linux/sa/if_rename.1712937683.txt.gz · Last modified: 2024/04/12 18:01 by niccolo