All of lore.kernel.org
 help / color / mirror / Atom feed
* udev rule in /etc/udev/rules.d/ FAILS to exec on boot; but OK exec @ shell after boot ?
@ 2023-12-21  0:33 pgnd
  2023-12-21  8:17 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: pgnd @ 2023-12-21  0:33 UTC (permalink / raw)
  To: linux-hotplug

hi,

on

	lsb_release -rd
		Description:    Fedora release 39 (Thirty Nine)
		Release:        39
	uname -rm
		6.6.6-200.fc39.x86_64 x86_64

i have this net device

	lspci | grep Ethernet | grep 05:00
		05:00.0 Ethernet controller: Intel Corporation I211 Gigabit Network Connection (rev 03)

i enable persistent naming; in kernel cmdline,

	"... net.ifnames=1 ..."


the interface is renamed/created during boot

	dmesg | grep "renamed from eth"
		[    6.945108] igb 0000:05:00.0 enp5s0: renamed from eth0

i've created a udev rule to set IPv6 params

	cat /etc/udev/rules.d/01-enp5s0-sysctl.rules
		ACTION=="add|bind|change", SUBSYSTEM=="net", KERNEL=="enp5s0", \
		 RUN+="/sbin/sysctl -qw \
		  net.ipv6.conf.enp5s0.forwarding=0 \
		  net.ipv6.conf.enp5s0.accept_ra=1 \
		  net.ipv6.conf.enp5s0.use_tempaddr=1 \
		 "

but, immediately after boot, exec

	sysctl \
	 net.ipv6.conf.enp5s0.forwarding \
	 net.ipv6.conf.enp5s0.accept_ra \
	 net.ipv6.conf.enp5s0.use_tempaddr

returns the values, unchanged,

	net.ipv6.conf.enp5s0.forwarding = 0
	net.ipv6.conf.enp5s0.accept_ra = 0
	net.ipv6.conf.enp5s0.use_tempaddr = 0

otoh, if i exec at shell,

	udevadm trigger
	sysctl \
	 net.ipv6.conf.enp5s0.forwarding \
	 net.ipv6.conf.enp5s0.accept_ra \
	 net.ipv6.conf.enp5s0.use_tempaddr

the values are changed

	net.ipv6.conf.enp5s0.forwarding = 0
	net.ipv6.conf.enp5s0.accept_ra = 1
	net.ipv6.conf.enp5s0.use_tempaddr = 1

what's keeping my udev rule from setting up the interface sysctls on boot?

-pgnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: udev rule in /etc/udev/rules.d/ FAILS to exec on boot; but OK exec @ shell after boot ?
  2023-12-21  0:33 udev rule in /etc/udev/rules.d/ FAILS to exec on boot; but OK exec @ shell after boot ? pgnd
@ 2023-12-21  8:17 ` Greg KH
  2023-12-21 12:25   ` pgnd
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2023-12-21  8:17 UTC (permalink / raw)
  To: pgnd; +Cc: linux-hotplug

On Wed, Dec 20, 2023 at 07:33:06PM -0500, pgnd wrote:
> i've created a udev rule to set IPv6 params
> 
> 	cat /etc/udev/rules.d/01-enp5s0-sysctl.rules
> 		ACTION=="add|bind|change", SUBSYSTEM=="net", KERNEL=="enp5s0", \
> 		 RUN+="/sbin/sysctl -qw \
> 		  net.ipv6.conf.enp5s0.forwarding=0 \
> 		  net.ipv6.conf.enp5s0.accept_ra=1 \
> 		  net.ipv6.conf.enp5s0.use_tempaddr=1 \
> 		 "
> 
> but, immediately after boot, exec
> 
> 	sysctl \
> 	 net.ipv6.conf.enp5s0.forwarding \
> 	 net.ipv6.conf.enp5s0.accept_ra \
> 	 net.ipv6.conf.enp5s0.use_tempaddr
> 
> returns the values, unchanged,
> 
> 	net.ipv6.conf.enp5s0.forwarding = 0
> 	net.ipv6.conf.enp5s0.accept_ra = 0
> 	net.ipv6.conf.enp5s0.use_tempaddr = 0
> 
> otoh, if i exec at shell,
> 
> 	udevadm trigger
> 	sysctl \
> 	 net.ipv6.conf.enp5s0.forwarding \
> 	 net.ipv6.conf.enp5s0.accept_ra \
> 	 net.ipv6.conf.enp5s0.use_tempaddr
> 
> the values are changed
> 
> 	net.ipv6.conf.enp5s0.forwarding = 0
> 	net.ipv6.conf.enp5s0.accept_ra = 1
> 	net.ipv6.conf.enp5s0.use_tempaddr = 1
> 
> what's keeping my udev rule from setting up the interface sysctls on boot?

Are you sure that your rule is running after the interface is renamed?

Try running 'udevadm monitor' to watch the events to ensure they are
what you think they are.

Anyway, try asking on the systemd mailing list, which is where udev help
can be found, this list really isn't alive anymore at all, sorry.

good luck!

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: udev rule in /etc/udev/rules.d/ FAILS to exec on boot; but OK exec @ shell after boot ?
  2023-12-21  8:17 ` Greg KH
@ 2023-12-21 12:25   ` pgnd
  2023-12-21 13:21     ` pgnd
  2023-12-21 13:22     ` Andrei Borzenkov
  0 siblings, 2 replies; 5+ messages in thread
From: pgnd @ 2023-12-21 12:25 UTC (permalink / raw)
  To: linux-hotplug; +Cc: gregkh, jeisom


> Anyway, try asking on the systemd mailing list, which is where udev help
> can be found, this list really isn't alive anymore at all, sorry.

np, thx. i've posted in systemd:matrix.org; we'll see what pops up there.

> Try running 'udevadm monitor' to watch the events to ensure they are
> what you think they are.

just to close/comment here before moving on, @ shell after boot

	udevadm monitor | grep enp5s0
		KERNEL[40344.410195] change   /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:05.0/0000:05:00.0/net/enp5s0 (net)
		UDEV  [40344.529849] change   /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:05.0/0000:05:00.0/net/enp5s0 (net)

and, checking boot logs,

	journalctl -b | grep systemd-udevd  | grep /etc
		Dec 20 19:24:16 dev systemd-udevd[522]: Trying to open "/etc/systemd/hwdb/hwdb.bin"...
		Dec 20 19:24:16 dev systemd-udevd[522]: Trying to open "/etc/udev/hwdb.bin"...
		Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/11-dm.rules
		Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/59-persistent-storage-dm.rules
		Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/59-persistent-storage-md.rules
		Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/59-persistent-storage.rules
		Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/61-persistent-storage.rules
		Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/64-lvm.rules
		Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/65-md-incremental-imsm.rules

seemingly missing/ignoring,

	ls -al /etc/udev/rules.d/
		-rw-r--r--  1 root root 2.2K Dec 20 18:47 99-enp5s0-sysctl.rules


where

	find /usr/lib/dracut/modules.d -type f \
	 -iname 11-dm.rules \
	 -o -iname 59-persistent-storage-dm.rules \
	 -o -iname 59-persistent-storage-md.rules \
	 -o -iname 59-persistent-storage.rules \
	 -o -iname 61-persistent-storage.rules \
	 -o -iname 64-lvm.rules \
	 -o -iname 65-md-incremental-imsm.rules

		/usr/lib/dracut/modules.d/90dm/11-dm.rules
		/usr/lib/dracut/modules.d/90dm/59-persistent-storage-dm.rules
		/usr/lib/dracut/modules.d/90mdraid/59-persistent-storage-md.rules
		/usr/lib/dracut/modules.d/90mdraid/65-md-incremental-imsm.rules
		/usr/lib/dracut/modules.d/95udev-rules/59-persistent-storage.rules
		/usr/lib/dracut/modules.d/95udev-rules/61-persistent-storage.rules
		/usr/lib/dracut/modules.d/90lvm/64-lvm.rules


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: udev rule in /etc/udev/rules.d/ FAILS to exec on boot; but OK exec @ shell after boot ?
  2023-12-21 12:25   ` pgnd
@ 2023-12-21 13:21     ` pgnd
  2023-12-21 13:22     ` Andrei Borzenkov
  1 sibling, 0 replies; 5+ messages in thread
From: pgnd @ 2023-12-21 13:21 UTC (permalink / raw)
  To: linux-hotplug

>  i've posted in systemd:matrix.org; we'll see what pops up there.

for those interested, mv'd to systemd mailing list

   https://lists.freedesktop.org/archives/systemd-devel/2023-December/049866.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: udev rule in /etc/udev/rules.d/ FAILS to exec on boot; but OK exec @ shell after boot ?
  2023-12-21 12:25   ` pgnd
  2023-12-21 13:21     ` pgnd
@ 2023-12-21 13:22     ` Andrei Borzenkov
  1 sibling, 0 replies; 5+ messages in thread
From: Andrei Borzenkov @ 2023-12-21 13:22 UTC (permalink / raw)
  To: pgnd; +Cc: linux-hotplug, gregkh, jeisom

On Thu, Dec 21, 2023 at 3:26 PM pgnd <pgnd@dev-mail.net> wrote:
>
>
> > Anyway, try asking on the systemd mailing list, which is where udev help
> > can be found, this list really isn't alive anymore at all, sorry.
>
> np, thx. i've posted in systemd:matrix.org; we'll see what pops up there.
>
> > Try running 'udevadm monitor' to watch the events to ensure they are
> > what you think they are.
>
> just to close/comment here before moving on, @ shell after boot
>
>         udevadm monitor | grep enp5s0
>                 KERNEL[40344.410195] change   /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:05.0/0000:05:00.0/net/enp5s0 (net)
>                 UDEV  [40344.529849] change   /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:05.0/0000:05:00.0/net/enp5s0 (net)
>
> and, checking boot logs,
>
>         journalctl -b | grep systemd-udevd  | grep /etc
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Trying to open "/etc/systemd/hwdb/hwdb.bin"...
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Trying to open "/etc/udev/hwdb.bin"...
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/11-dm.rules
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/59-persistent-storage-dm.rules
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/59-persistent-storage-md.rules
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/59-persistent-storage.rules
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/61-persistent-storage.rules
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/64-lvm.rules
>                 Dec 20 19:24:16 dev systemd-udevd[522]: Reading rules file: /etc/udev/rules.d/65-md-incremental-imsm.rules
>
> seemingly missing/ignoring,
>
>         ls -al /etc/udev/rules.d/
>                 -rw-r--r--  1 root root 2.2K Dec 20 18:47 99-enp5s0-sysctl.rules
>

Your udevd runs in initrd and this rule is not included there.

>
> where
>
>         find /usr/lib/dracut/modules.d -type f \
>          -iname 11-dm.rules \
>          -o -iname 59-persistent-storage-dm.rules \
>          -o -iname 59-persistent-storage-md.rules \
>          -o -iname 59-persistent-storage.rules \
>          -o -iname 61-persistent-storage.rules \
>          -o -iname 64-lvm.rules \
>          -o -iname 65-md-incremental-imsm.rules
>
>                 /usr/lib/dracut/modules.d/90dm/11-dm.rules
>                 /usr/lib/dracut/modules.d/90dm/59-persistent-storage-dm.rules
>                 /usr/lib/dracut/modules.d/90mdraid/59-persistent-storage-md.rules
>                 /usr/lib/dracut/modules.d/90mdraid/65-md-incremental-imsm.rules
>                 /usr/lib/dracut/modules.d/95udev-rules/59-persistent-storage.rules
>                 /usr/lib/dracut/modules.d/95udev-rules/61-persistent-storage.rules
>                 /usr/lib/dracut/modules.d/90lvm/64-lvm.rules
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-21 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21  0:33 udev rule in /etc/udev/rules.d/ FAILS to exec on boot; but OK exec @ shell after boot ? pgnd
2023-12-21  8:17 ` Greg KH
2023-12-21 12:25   ` pgnd
2023-12-21 13:21     ` pgnd
2023-12-21 13:22     ` Andrei Borzenkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.