On Wed, Nov 15, 2023 at 01:40:10PM +0800, Dave Young wrote:
It seems dracut "inst" will automatically install the
original file
and the target symlink, if so as you said we do not need to add the
dns=none for this case and it will just work?
Not sure about 'inst "$(readlink -f "$_resolv_conf")"
"$_resolv_conf"', at least 'inst "$_resolv_conf"
"$_resolv_conf"'
works fine for me.
I forgot to mention I was mislead by one experiment where
/etc/resolv.conf
was linked to ../run/systemd/resolve/stub-resolv.conf. After using
"inst /etc/resolv.conf", this file doesn't exist when booting into the
initrd
sh-5.2# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Nov 15 10:10 /etc/resolv.conf ->
../run/systemd/resolve/stub-resolv.conf
sh-5.2# cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
Later I linked /etc/custom-resolv.conf to /etc/resolv.conf. Then it
works as expected.
>
> >
> >> + echo "[main]\ndns=none" >
"$_nm_conf_dir"/90-dns-none.conf
> >
> >BTW, would this be better to add in dracut hostonly code?
>
> dns=none is strongly coupled with the code before, so it doesn't seem to
> ake sense to fragment the code? Btw, I'm not sure if dracut wants this
> code because currently the only user is the kdump dracut module which is
> still out of tree.
Hostonly exists before the kdump dracut module created, so there are
more users who will manually generate the initrd with host only mode
to do something although we can not have an example for this specific
case. I previously always tried to move code to dracut as much as
possible. But since you guys are maintaining the code now, I have no
strong opinion on this. Please just take what you think is better if
no any other objections.
Thanks for sharing you experience! I'll try adding the code to dracut if
it's also needed for other use cases.
--
Best regards,
Coiby