ifroute-xxx files lost

I found that when I add ifaces more than 17 will cause ifroute files lost, reproduce steps as below:

  1. There are eth0, eth1 in my os, add extra 14 vlan (vlan11-vlan24)
  2. run “yast lan”, change some routes setting, press “F10” to save configuration,
    files under /etc/sysconfig/network:

localhost:/etc/sysconfig/network # ls ifcfg*
ifcfg-eth0 ifcfg-lo ifcfg-vlan12 ifcfg-vlan14 ifcfg-vlan16 ifcfg-vlan18 ifcfg-vlan20 ifcfg-vlan22 ifcfg-vlan24
ifcfg-eth1 ifcfg-vlan11 ifcfg-vlan13 ifcfg-vlan15 ifcfg-vlan17 ifcfg-vlan19 ifcfg-vlan21 ifcfg-vlan23

localhost:/etc/sysconfig/network # ls ifroute*
ifroute-eth0 ifroute-vlan11 ifroute-vlan13 ifroute-vlan15 ifroute-vlan17 ifroute-vlan19 ifroute-vlan21 ifroute-vlan23
ifroute-eth1 ifroute-vlan12 ifroute-vlan14 ifroute-vlan16 ifroute-vlan18 ifroute-vlan20 ifroute-vlan22 ifroute-vlan24

  1. cp ifcfg-vlan24 ifcfg-vlan25, and change VLAN-ID in ifcfg-vlan25 to 25

  2. run yast lan again, press “F10” directly, then Yast will “Saving Network Configuration”

  3. now files under the directory :

localhost:/etc/sysconfig/network # ls ifcfg*
ifcfg-eth0 ifcfg-lo ifcfg-vlan12 ifcfg-vlan14 ifcfg-vlan16 ifcfg-vlan18 ifcfg-vlan20 ifcfg-vlan22 ifcfg-vlan24
ifcfg-eth1 ifcfg-vlan11 ifcfg-vlan13 ifcfg-vlan15 ifcfg-vlan17 ifcfg-vlan19 ifcfg-vlan21 ifcfg-vlan23 ifcfg-vlan25

localhost:/etc/sysconfig/network # ls ifroute*
ifroute-vlan11.YaST2save

Now all ifroute files were lost

After tracing yast log I find the code in /usr/share/YaST2/lib/y2network/sysconfig/Config_writer.rb , function name: write_interface_changes .
Add more logs as below:
86 file.routes = routes
87 log.info “route file name #{file.file_path}”
88 file.save
89 log.info “save done”
90 end
91
*** 92 log.info “current config size: #{config.interfaces.size}”***
*** 93 log.info “old config size: #{old_config.interfaces.size}”***
94
95 # Actions needed for removed interfaces
96 removed_ifaces = old_config ? old_config.interfaces.to_a - config.interfaces.to_a : ]
*** 97 log.info “removed ifaces size: #{removed_ifaces.size}”***
*** 98 log.info “#{removed_ifaces}”***
99 removed_ifaces.each do |iface|
100 file = routes_file_for(iface)
101 log.info “remove route file #{file.file_path}”
102 file.remove
103 end

do the test again and look at logs in /var/log/YaST2/y2log
Deleting ifcfg-vlan25:
2021-05-15 13:11:57 <1> localhost(10438) [Ruby] sysconfig/config_writer.rb:92 current config size: 16
2021-05-15 13:11:57 <1> localhost(10438) [Ruby] sysconfig/config_writer.rb:93 old config size: 16
2021-05-15 13:11:57 <1> localhost(10438) [Ruby] sysconfig/config_writer.rb:97 removed ifaces size: 0
2021-05-15 13:11:57 <1> localhost(10438) [Ruby] sysconfig/config_writer.rb:98 ]
2021-05-15 13:11:57 <1> localhost(10438) [Ruby] lib/cheetah.rb:160 Executing “/bin/cp /etc/sysconfig/network/routes /etc/sysconfig/network/routes.YaST2save”.
2021-05-15 13:11:57 <1> localhost(10438) [Ruby] lib/cheetah.rb:180 Status: 0

After add ifcfg-vlan25:
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:77 aaaaaa devname: vlan25
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:87 route file name /etc/sysconfig/network/ifroute-vlan25
2021-05-15 13:13:16 <3> localhost(12448) [Interpreter] sysconfig/routes_file.rb:87 Wrong value for path .
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:89 save done
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:92 current config size: 17
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:93 old config size: 17
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:97 removed ifaces size: 17
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:98 #<Y2Network::PhysicalInterface:0x000055f4c50c4670 @name=“eth0”, @description=“eth0”, @type=#<Y2Network::InterfaceType:0x000055f4c486a218 @my_textdomain=“network”], @name=“Ethernet”, @short_name=“eth”>, …
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-eth0
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-eth1
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan11
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan12
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan13
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan14
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan15
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan16
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan17
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan18
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan19
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan20
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan21
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan22
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan23
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan24
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] sysconfig/config_writer.rb:101 remove route file /etc/sysconfig/network/ifroute-vlan25
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] lib/cheetah.rb:160 Executing “/bin/cp /etc/sysconfig/network/routes /etc/sysconfig/network/routes.YaST2save”.
2021-05-15 13:13:16 <1> localhost(12448) [Ruby] lib/cheetah.rb:180 Status: 0

My system information:
uname -a
Linux localhost 5.3.18-lp152.19-default #1 SMP Tue Jun 9 20:59:24 UTC 2020 (960cb00) x86_64 x86_64 x86_64 GNU/Linux

Using wicked as network service.

I don’t know whether it is a bug of Yast or a bug of ruby. Is there any patch for this?

Thanks in advance.

Open bug report.

P.S. and your post is unreadable, instead of computer output we see smileys. That is what tags [noparse]

...

[/noparse] are for.

To explain:
There is an important, but not easy to find feature on the forums.

Please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

An example is here: Using CODE tags Around your paste.

Thank you for your tips at first.
I cannot find the edit button on my post, it seems that the post is readonly now.
I’ll be keep in mind next time. :slight_smile: