#89 Issue closed: Not a valid file /mnt/local/etc/sysconfig/network/routes [on RHEL]

Labels: bug

gdha opened issue at 2012-05-31 14:14:

When we defined a /etc/rear/mappings/routes file, e.g.

# cat routes
# destination   router  device
default 193.74.130.254 eth1

then at recovery time we get an error like:

2012-03-08 16:19:42 Including finalize/GNU/Linux/42_migrate_network_configuration_files.sh
2012-03-08 16:19:42 SED_SCRIPT: ';s/00:21:5A:9B:00:20/00:17:a4:51:4c:94/g;s/00:21:5A:9B:00:20/00:17:A4:51:4C:94/g;s/00:21:5A:9B:00:22/00:16:35:3e:92:71/g;s/00:21:5A:9B:00:22/00:16:35:3E:92:71/g;s/00:22:64:02:5F:32/00:17:a4:51:4c:95/g;s/00:22:64:02:5F:32/00:17:A4:51:4C:95/g;s/00:22:64:02:5F:33/00:16:35:3e:92:8b/g;s/00:22:64:02:5F:33/00:16:35:3E:92:8B/g'
2012-03-08 16:19:42 SED_SCRIPT: 's#^IPADDR=.*#IPADDR='193.74.130.7/24'#g;s#^NETM
ASK=.*#NETMASK=''#g;s#^NETWORK=.*#NETWORK=''#g;s#^BROADCAST=.*#BROADCAST=''#g;s#
^BOOTPROTO=.*#BOOTPROTO='static'#g;s#STARTMODE='[mo].*#STARTMODE='auto'#g;/^IPAD
DR_/d;/^LABEL_/d;/^NETMASK_/d'
2012-03-08 16:19:42 SED_SCRIPT: 's#^IPADDR=.*#IPADDR='193.74.130.9/24'#g;s#^NETM
ASK=.*#NETMASK=''#g;s#^NETWORK=.*#NETWORK=''#g;s#^BROADCAST=.*#BROADCAST=''#g;s#
^BOOTPROTO=.*#BOOTPROTO='static'#g;s#STARTMODE='[mo].*#STARTMODE='auto'#g;/^IPAD
DR_/d;/^LABEL_/d;/^NETMASK_/d'
/usr/share/rear/finalize/GNU/Linux/42_migrate_network_configuration_files.sh: line 73: /mnt/local/etc/sysconfig/network/routes: Not a directory

The destination file on RHEL should not be /etc/sysconfig/network/routes but /etc/sysconfig/network-scripts/route-<eth#> instead I guess.

dagwieers commented at 2012-05-31 16:02:

I see /etc/routes being mentioned inside the scripts. But beware, it might be for "backward compatibility" only ?

gdha commented at 2012-06-01 11:08:

/etc/routes : cannot think of any GNU/Linux OS using that - have no clue where that came from, but it is wrong.
I've change 42_migrate_network_configuration_files.sh script - see diff

# diff finalize/GNU/Linux/42_migrate_network_configuration_files.sh /tmp/gratien/42_migrate_network_configuration_files.sh
72a73,74
>       > /mnt/local/etc/sysconfig/network/routes
>       StopIfError "Could not write to '/mnt/local/etc/sysconfig/network/routes'"
74,87c76
<       #       echo "$destination $gateway - $device" >> /mnt/local/etc/sysconfig/network/routes
<               if [[ "$destination" = "default" ]]; then
<                       for network_file in /mnt/local/etc/sysconfig/*/ifcfg-*${device}* /mnt/local/etc/sysconfig/network ; do
<                               SED_SCRIPT="s#^GATEWAY=.*#GATEWAY='$gateway'#g;s#^GATEWAYDEV=.*#GATEWAYDEV='$device'#g"
<                               Log "SED_SCRIPT: '$SED_SCRIPT'"
<                               sed -i -e "$SED_SCRIPT" "$network_file"
<                               LogPrintIfError "WARNING! There was an error patching the network configuration files!"
<                       done
<               else
<                       # static-routes or route-<device> settings?
<                       for network_file in /mnt/local/etc/sysconfig/*/route-*${device}* /mnt/local/etc/sysconfig/static-routes ; do
<                               LogPrint "WARNING! Change entries in $network_file manually please!"
<                       done
<               fi
---
>               echo "$destination $gateway - $device" >> /mnt/local/etc/sysconfig/network/routes

still need to test...

gdha commented at 2012-06-08 13:54:

it works fine now (did the test)


[Export of Github issue for rear/rear.]