[opensuse] Q: How to include custom udev rule into initramfs ?
Hi ! How to include custom udev rule into initramfs ? I edited "/usr/lib/dracut/modules.d/95udev-rules/module-setup.sh" added "inst_rules 62-my.rules", yet it doesn't work. Anyone can suggest right way to do this ? Thanks in advance. "dracut -vf" lists all stuff it is including into initramfs, so I can say for sure my mod doesn't work. Dracut copies *some* udev rules from etc/udev/rules.d/ usr/lib/udev/rules.d/ but not *all*, only selected by some config I'm not aware about. Thanks in advance. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
15.09.2018 14:41, Andrei Verovski пишет:
Hi !
How to include custom udev rule into initramfs ? I edited "/usr/lib/dracut/modules.d/95udev-rules/module-setup.sh"
You should never edit files that are part of package.
added "inst_rules 62-my.rules", yet it doesn't work.
Without knowing what exactly you did this statement has no meaning. Where your rule is located, how you called dracut, what is dracut configuration ...
Anyone can suggest right way to do this ?
This depends on whether your rule is needed only in dracut or also in running system and where you want to place this rule. In general, rules under /usr/lib/udev/rules.d should always work, under /etc/udev/rules.d - be skipped in non-hostonly mode. You should then see corresponding message during dracut run. Or you can always use install_items or install_optional_items in configuration that simply unconditionally add corresponding file without any rules magic.
Thanks in advance. "dracut -vf" lists all stuff it is including into initramfs, so I can say for sure my mod doesn't work.
Dracut copies *some* udev rules from etc/udev/rules.d/ usr/lib/udev/rules.d/ but not *all*, only selected by some config I'm not aware about.
Thanks in advance.
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 9/15/18 3:17 PM, Andrei Borzenkov wrote: Thanks for feedback, Andrei.
This depends on whether your rule is needed only in dracut or also in running system and where you want to place this rule. In general, rules under /usr/lib/udev/rules.d should always work, under /etc/udev/rules.d - be skipped in non-hostonly mode. You should then see corresponding message during dracut run.
Or you can always use install_items or install_optional_items in configuration that simply unconditionally add corresponding file without any rules magic. My udev rules must be copied to initrams in order to be invoked at boot time.
From what I found here: https://wiki.voidlinux.eu/Manual_Install_with_encrypted_boot
Dracut has an "install_items" option to inject custom files. We can set it by creating a configuration file /etc/dracut.conf.d/10-crypt.conf with the following content: install_items+="/crypto_keyfile.bin /etc/crypttab"
So, is it enough to create /etc/dracut.conf.d/20-my-udev-rules.conf with that option: install_items+="~/myscripts/add-my-udev.conf /usr/lib/udev/rules.d" -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
15.09.2018 18:20, Andrei Verovski пишет:
On 9/15/18 3:17 PM, Andrei Borzenkov wrote:
Thanks for feedback, Andrei.
This depends on whether your rule is needed only in dracut or also in running system and where you want to place this rule. In general, rules under /usr/lib/udev/rules.d should always work, under /etc/udev/rules.d - be skipped in non-hostonly mode. You should then see corresponding message during dracut run.
Or you can always use install_items or install_optional_items in configuration that simply unconditionally add corresponding file without any rules magic. My udev rules must be copied to initrams in order to be invoked at boot time.
From what I found here: https://wiki.voidlinux.eu/Manual_Install_with_encrypted_boot
Dracut has an "install_items" option to inject custom files. We can set it by creating a configuration file /etc/dracut.conf.d/10-crypt.conf with the following content: install_items+="/crypto_keyfile.bin /etc/crypttab"
So, is it enough to create /etc/dracut.conf.d/20-my-udev-rules.conf with that option: install_items+="~/myscripts/add-my-udev.conf /usr/lib/udev/rules.d"
install_items is a list of absolute filenames. Each file is installed under the same name in initrd; there is no way to relocate file using this dracut parameter. And it must have spaces as delimiters between items in another configuration snippets. And ~ will not work in dracut configuration. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 9/15/18 6:35 PM, Andrei Borzenkov wrote:
install_items is a list of absolute filenames. Each file is installed under the same name in initrd; there is no way to relocate file using this dracut parameter. And it must have spaces as delimiters between items in another configuration snippets.
And ~ will not work in dracut configuration. OK, thanks, will try this on Monday
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
I included my custom udev rules into initramfs. /etc/dracut.conf.d/my-udev-battery.conf install_items+="/etc/udev/rules.d/62-adjust-battery-capacity.rules” its there - "dracut -vf" logs succesful inclusion. /etc/udev/rules.d/62-adjust-battery-capacity.rules ### Rule start ### ACTION=="add|change", KERNEL=="BAT*", SUBSYSTEM=="power_supply", ATTR{energy_full_design}="*", MODE="0664" ACTION=="add|change", KERNEL=="BAT*", SUBSYSTEM=="power_supply", ATTR{energy_full_design}="68000000" ### Rule end ### Unfortunately cat /sys/class/power_supply/BAT1/energy_full still displays old value. Even tried to add grub boot parameter, no luck. power_supply. energy_full_design=68000000
On 15 Sep 2018, at 18:35, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
15.09.2018 18:20, Andrei Verovski пишет:
On 9/15/18 3:17 PM, Andrei Borzenkov wrote:
Thanks for feedback, Andrei.
This depends on whether your rule is needed only in dracut or also in running system and where you want to place this rule. In general, rules under /usr/lib/udev/rules.d should always work, under /etc/udev/rules.d - be skipped in non-hostonly mode. You should then see corresponding message during dracut run.
Or you can always use install_items or install_optional_items in configuration that simply unconditionally add corresponding file without any rules magic. My udev rules must be copied to initrams in order to be invoked at boot time.
From what I found here: https://wiki.voidlinux.eu/Manual_Install_with_encrypted_boot
Dracut has an "install_items" option to inject custom files. We can set it by creating a configuration file /etc/dracut.conf.d/10-crypt.conf with the following content: install_items+="/crypto_keyfile.bin /etc/crypttab"
So, is it enough to create /etc/dracut.conf.d/20-my-udev-rules.conf with that option: install_items+="~/myscripts/add-my-udev.conf /usr/lib/udev/rules.d"
install_items is a list of absolute filenames. Each file is installed under the same name in initrd; there is no way to relocate file using this dracut parameter. And it must have spaces as delimiters between items in another configuration snippets.
And ~ will not work in dracut configuration.
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (2)
-
Andrei Borzenkov
-
Andrei Verovski