mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [PATCH] write-ifcfg.sh: Don't overwrite network config in root filesystem
@ 2014-06-21 10:40 Gerhard Wiesinger
       [not found] ` <alpine.LFD.2.02.1406211239250.1876-GinJ0NHkz1PSbTvUbH3RCA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Gerhard Wiesinger @ 2014-06-21 10:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

This patch adds the possibility to keep the original
network configuration specified in the root filesystem.
This is necessary in situations with dual stack IPv4 and
IPv6 configurations or different kind on nameservers
(e.g. public ones at boot time, running a dns server
on localhost later on).

Keeping original configuration can be activated by:
networkstatic=yes
on the kernel boot command line.

Signed-off-by: Gerhard Wiesinger <lists-tcxHB8FAk+J54TAoqtyWWQ@public.gmane.org>
---
  modules.d/45ifcfg/write-ifcfg.sh | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index 803ae8e..033abe5 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -277,7 +277,10 @@ echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
  echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
  {
      cp /tmp/net.* /run/initramfs/
-    cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
-    copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
+    networkstatic="$(getarg networkstatic=)"
+    if [ -z "${networkstatic}" ]; then
+        cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
+        copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
+    fi
      cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
  } > /dev/null 2>&1
-- 
1.9.3

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

* Re: [PATCH] write-ifcfg.sh: Don't overwrite network config in root filesystem
       [not found] ` <alpine.LFD.2.02.1406211239250.1876-GinJ0NHkz1PSbTvUbH3RCA@public.gmane.org>
@ 2014-06-25  9:51   ` Harald Hoyer
       [not found]     ` <53AA9B8E.7020801-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Harald Hoyer @ 2014-06-25  9:51 UTC (permalink / raw)
  To: Gerhard Wiesinger, initramfs-u79uwXL29TY76Z2rM5mHXA

On 21.06.2014 12:40, Gerhard Wiesinger wrote:
> This patch adds the possibility to keep the original
> network configuration specified in the root filesystem.
> This is necessary in situations with dual stack IPv4 and
> IPv6 configurations or different kind on nameservers
> (e.g. public ones at boot time, running a dns server
> on localhost later on).
> 
> Keeping original configuration can be activated by:
> networkstatic=yes
> on the kernel boot command line.
> 
> Signed-off-by: Gerhard Wiesinger <lists-tcxHB8FAk+J54TAoqtyWWQ@public.gmane.org>
> ---
>  modules.d/45ifcfg/write-ifcfg.sh | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
> index 803ae8e..033abe5 100755
> --- a/modules.d/45ifcfg/write-ifcfg.sh
> +++ b/modules.d/45ifcfg/write-ifcfg.sh
> @@ -277,7 +277,10 @@ echo "files /etc/sysconfig/network-scripts" >>
> /run/initramfs/rwtab
>  echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
>  {
>      cp /tmp/net.* /run/initramfs/
> -    cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
> -    copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
> +    networkstatic="$(getarg networkstatic=)"
> +    if [ -z "${networkstatic}" ]; then
> +        cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
> +        copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
> +    fi
>      cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
>  } > /dev/null 2>&1

I don't understand this. It only copies to /run/initramfs. If you want to keep
your original network configuration, just don't copy over the files from
/run/initramfs to your root filesystem.

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

* Re: [PATCH] write-ifcfg.sh: Don't overwrite network config in root filesystem
       [not found]     ` <53AA9B8E.7020801-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2014-06-25 11:07       ` Gerhard Wiesinger
       [not found]         ` <53AAAD6E.9010207-tcxHB8FAk+J54TAoqtyWWQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Gerhard Wiesinger @ 2014-06-25 11:07 UTC (permalink / raw)
  To: Harald Hoyer, initramfs-u79uwXL29TY76Z2rM5mHXA

On 25.06.2014 11:51, Harald Hoyer wrote:
> On 21.06.2014 12:40, Gerhard Wiesinger wrote:
>> This patch adds the possibility to keep the original
>> network configuration specified in the root filesystem.
>> This is necessary in situations with dual stack IPv4 and
>> IPv6 configurations or different kind on nameservers
>> (e.g. public ones at boot time, running a dns server
>> on localhost later on).
>>
>> Keeping original configuration can be activated by:
>> networkstatic=yes
>> on the kernel boot command line.
>>
>>
>> I don't understand this. It only copies to /run/initramfs. If you want to keep
>> your original network configuration, just don't copy over the files from
>> /run/initramfs to your root filesystem.

Hello Harald,

The topic is: /etc/sysconfig/network-scripts/ifcfg-eth0 is overwritten 
by dracut when network config is specified on boot command line (e.g. 
grub config). As normal config is different and more complex (e.g. IPv6 
setup) boot config is different.

I found, that this patch doesn't overwrite the network config in 
/etc/sysconfig/network-scripts/ifcfg-eth0 when you specify network 
config on the boot command line.

I didn't debug into details and I'm not familiar with dracut in detail 
so I can't say why it works but it works. I think that some other code 
parts copy the initramfs afterwards to /etc/sysconfig/....

But maybe you can clarify it.

Ciao,
Gerhard

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

* Re: [PATCH] write-ifcfg.sh: Don't overwrite network config in root filesystem
       [not found]         ` <53AAAD6E.9010207-tcxHB8FAk+J54TAoqtyWWQ@public.gmane.org>
@ 2014-06-25 12:45           ` Harald Hoyer
  0 siblings, 0 replies; 4+ messages in thread
From: Harald Hoyer @ 2014-06-25 12:45 UTC (permalink / raw)
  To: Gerhard Wiesinger, initramfs-u79uwXL29TY76Z2rM5mHXA

On 25.06.2014 13:07, Gerhard Wiesinger wrote:
> On 25.06.2014 11:51, Harald Hoyer wrote:
>> On 21.06.2014 12:40, Gerhard Wiesinger wrote:
>>> This patch adds the possibility to keep the original
>>> network configuration specified in the root filesystem.
>>> This is necessary in situations with dual stack IPv4 and
>>> IPv6 configurations or different kind on nameservers
>>> (e.g. public ones at boot time, running a dns server
>>> on localhost later on).
>>>
>>> Keeping original configuration can be activated by:
>>> networkstatic=yes
>>> on the kernel boot command line.
>>>
>>>
>>> I don't understand this. It only copies to /run/initramfs. If you want to keep
>>> your original network configuration, just don't copy over the files from
>>> /run/initramfs to your root filesystem.
> 
> Hello Harald,
> 
> The topic is: /etc/sysconfig/network-scripts/ifcfg-eth0 is overwritten by
> dracut when network config is specified on boot command line (e.g. grub
> config). As normal config is different and more complex (e.g. IPv6 setup) boot
> config is different.
> 
> I found, that this patch doesn't overwrite the network config in
> /etc/sysconfig/network-scripts/ifcfg-eth0 when you specify network config on
> the boot command line.
> 
> I didn't debug into details and I'm not familiar with dracut in detail so I
> can't say why it works but it works. I think that some other code parts copy
> the initramfs afterwards to /etc/sysconfig/....
> 
> But maybe you can clarify it.
> 
> Ciao,
> Gerhard

On Fedora, this is fedora-import-state.service, which calls
/lib/systemd/fedora-import-state.

You could disable/mask that with:
$ sudo systemctl mask fedora-import-state.service





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

end of thread, other threads:[~2014-06-25 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-21 10:40 [PATCH] write-ifcfg.sh: Don't overwrite network config in root filesystem Gerhard Wiesinger
     [not found] ` <alpine.LFD.2.02.1406211239250.1876-GinJ0NHkz1PSbTvUbH3RCA@public.gmane.org>
2014-06-25  9:51   ` Harald Hoyer
     [not found]     ` <53AA9B8E.7020801-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-06-25 11:07       ` Gerhard Wiesinger
     [not found]         ` <53AAAD6E.9010207-tcxHB8FAk+J54TAoqtyWWQ@public.gmane.org>
2014-06-25 12:45           ` Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox