Discussion:
Bug#934589: udev: net.ifnames is wrongly imported as a property for any/all devices
Add Reply
quidame
2019-08-12 11:10:02 UTC
Reply
Permalink
Package: udev
Version: 241-7
Severity: normal

Dear Maintainer,

When running a command such as:

udevadm info --query property --export --name /dev/dm-2

I expect to get a list of properties of the device (/dev/dm-2) in a
shell-parsable format - that is the purpose of the --export option.

So I could do, in a shell script:

eval $(udevadm info --query property --export --name /dev/dm-2)


This works fine, except when net.ifnames is set as a kernel commandline
parameter. In that case, net.ifnames is added as a property for the
devicei, and the same udevadm command gives...

DEVPATH='/devices/virtual/block/dm-2'
DEVNAME='/dev/dm-2'
DEVTYPE='disk'
MAJOR='253'
MINOR='2'
SUBSYSTEM='block'
USEC_INITIALIZED='2145169'
DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG='1'
DM_UDEV_PRIMARY_SOURCE_FLAG='1'
DM_UDEV_RULES='1'
DM_UDEV_RULES_VSN='2'
DM_NAME='test1_vg-var'
DM_UUID='LVM-JDjOejCnj59z49qRaUFXieNPfyeJvWmzfVc31bebpEfCIHd3H3aJmgJbt9od0QGf'
DM_SUSPENDED='0'
DM_VG_NAME='test1_vg'
DM_LV_NAME='var'
ID_FS_UUID='1acc2657-541f-4226-97aa-58183b5e38dc'
ID_FS_UUID_ENC='1acc2657-541f-4226-97aa-58183b5e38dc'
ID_FS_VERSION='1.0'
ID_FS_TYPE='ext4'
ID_FS_USAGE='filesystem'
=> net.ifnames='1'
DEVLINKS='/dev/test1_vg/var /dev/disk/by-uuid/1acc2657-541f-4226-97aa-58183b5e38dc /dev/disk/by-id/dm-name-test1_vg-var /dev/mapper/test1_vg-var /dev/disk/by-id/dm-uuid-LVM-JDjOejCnj59z49qRaUFXieNPfyeJvWmzfVc31bebpEfCIHd3H3aJmgJbt9od0QGf'
TAGS=':systemd:'

...making the output unparsable, due to the invalid format of the
variable: in shell, a dot (.) is not a valid character for a variable
name !

This is due to the udev rules file
/usr/lib/udev/rules.d/73-usb-net-by-mac.rules, in which net.ifnames is
blindly imported as a property for any device, even /dev/null !!!

$ udevadm info --query property --export --name /dev/null
DEVPATH='/devices/virtual/mem/null'
DEVNAME='/dev/null'
DEVMODE='0666'
MAJOR='1'
MINOR='3'
SUBSYSTEM='mem'
USEC_INITIALIZED='844981'
=> net.ifnames='1'

I think the mistake comes from the first line of the rules file:

IMPORT{cmdline}="net.ifnames"

The rules file should start with some filters instead, to not import a
property that is irrelevant for almost all devices. For example:

SUBSYSTEM=="mem|block", GOTO="usb_net_by_mac_end"

See also:
https://bugs.debian.org/929893

Thanks,
quidame


-- Package-specific info:

-- System Information:
Debian Release: bullseye/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages udev depends on:
ii adduser 3.118
ii dpkg 1.19.7
ii libacl1 2.2.53-4
ii libblkid1 2.34-0.1
ii libc6 2.28-10
ii libkmod2 26-1
ii libselinux1 2.9-2+b2
ii libudev1 241-7
ii lsb-base 10.2019051400
ii systemd-sysv 241-7
ii util-linux 2.34-0.1

udev recommends no packages.

udev suggests no packages.

Versions of packages udev is related to:
ii systemd 241-7

-- no debconf information
Michael Biebl
2019-08-12 11:20:02 UTC
Reply
Permalink
Control: tags -1 + moreinfo unreproducible
Post by quidame
udevadm info --query property --export --name /dev/dm-2
I don't use LVM, but running that e.g. on /dev/sda5, I get

$ udevadm info --query property --export --name /dev/sda5
DEVPATH='/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda5'
DEVNAME='/dev/sda5'
DEVTYPE='partition'
PARTN='5'
MAJOR='8'
MINOR='5'
SUBSYSTEM='block'
USEC_INITIALIZED='6094411'
ID_ATA='1'
ID_TYPE='disk'
ID_BUS='ata'
ID_MODEL='CT500MX500SSD1'
ID_MODEL_ENC='CT500MX500SSD1\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'
ID_REVISION='M3CR023'
ID_SERIAL='CT500MX500SSD1_1845E1D550A5'
ID_SERIAL_SHORT='1845E1D550A5'
ID_ATA_WRITE_CACHE='1'
ID_ATA_WRITE_CACHE_ENABLED='1'
ID_ATA_FEATURE_SET_PM='1'
ID_ATA_FEATURE_SET_PM_ENABLED='1'
ID_ATA_FEATURE_SET_SECURITY='1'
ID_ATA_FEATURE_SET_SECURITY_ENABLED='0'
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN='2'
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN='2'
ID_ATA_FEATURE_SET_SECURITY_FROZEN='1'
ID_ATA_FEATURE_SET_SMART='1'
ID_ATA_FEATURE_SET_SMART_ENABLED='1'
ID_ATA_FEATURE_SET_APM='1'
ID_ATA_FEATURE_SET_APM_ENABLED='1'
ID_ATA_FEATURE_SET_APM_CURRENT_VALUE='254'
ID_ATA_DOWNLOAD_MICROCODE='1'
ID_ATA_SATA='1'
ID_ATA_SATA_SIGNAL_RATE_GEN2='1'
ID_ATA_SATA_SIGNAL_RATE_GEN1='1'
ID_ATA_ROTATION_RATE_RPM='0'
ID_WWN='0x500a0751e1d550a5'
ID_WWN_WITH_EXTENSION='0x500a0751e1d550a5'
ID_PATH='pci-0000:00:1f.2-ata-1'
ID_PATH_TAG='pci-0000_00_1f_2-ata-1'
ID_PART_TABLE_UUID='7e87c7df-833f-4505-ab45-917f9c6e49e0'
ID_PART_TABLE_TYPE='gpt'
ID_FS_LABEL='Home'
ID_FS_LABEL_ENC='Home'
ID_FS_UUID='7652cf98-e671-47ea-80d6-02be15580bb5'
ID_FS_UUID_ENC='7652cf98-e671-47ea-80d6-02be15580bb5'
ID_FS_VERSION='1.0'
ID_FS_TYPE='ext4'
ID_FS_USAGE='filesystem'
ID_PART_ENTRY_SCHEME='gpt'
ID_PART_ENTRY_UUID='8c1b660c-0ef2-4b79-92b3-571d978c80de'
ID_PART_ENTRY_TYPE='0fc63daf-8483-4772-8e79-3d69d8477de4'
ID_PART_ENTRY_NUMBER='5'
ID_PART_ENTRY_OFFSET='193253376'
ID_PART_ENTRY_SIZE='122880000'
ID_PART_ENTRY_DISK='8:0'
DEVLINKS='/dev/disk/by-uuid/7652cf98-e671-47ea-80d6-02be15580bb5
/dev/disk/by-id/wwn-0x500a0751e1d550a5-part5
/dev/disk/by-partuuid/8c1b660c-0ef2-4b79-92b3-571d978c80de
/dev/disk/by-path/pci-0000:00:1f.2-ata-1-part5
/dev/disk/by-id/ata-CT500MX500SSD1_1845E1D550A5-part5
/dev/disk/by-label/Home'
TAGS=':systemd:'


Looks all ok to me.

What do you get if you run
grep ifnames /etc/udev/rules.d/* /lib/udev/rules.d/*

Can you tar up all files in /etc/udev/rules.d and /lib/udev/rules.d and
attach it to this bug report.
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
Loading...