Project

General

Profile

Bug #612

hdactl broke my ifcfg-eth0 file

Added by gboudreau almost 12 years ago. Updated almost 12 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
08/19/2010
Due date:
% Done:

0%


Description

(I think hdactl is to blame anyway...)

My / partition was filled, and I think this is what caused my /etc/sysconfig/network-scripts/ifcfg-eth0 to become unusable.

When I looked at it the first time, when I had no eth0 interface anymore, it looked like this:

IPADDR=192.168.155.88
NETMASK=255.255.255.0
GATEWAY=192.168.155.1
DNS1=192.168.155.88
DNS2=192.168.155.88
SEARCH=home.com
DOMAIN=home.com
# generated by hdactl on [...]

That file didn't work, because it's missing a DEVICE=eth0 line.
I added it manually, and a reboot fixed it.

But now, if I look at the file, I see this:

1:04:39 / 1
IPADDR=192.168.155.88
NETMASK=255.255.255.0
GATEWAY=192.168.155.1
DNS1=192.168.155.88
DNS2=192.168.155.88
SEARCH=home.com
DOMAIN=home.com
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
# generated by hdactl on 2010-08-18 21:05:10 / 1

Not only is my DEVICE=eth0 line gone again, but now, we see that the file actually begins with what looks like the end of the previous version of the file... Which make me think hdactl has a bug that makes it break this file somehow.

The last timestamp (2010-08-18 21:05:10) is probably the time when I rebooted the server after adding the DEVICE=eth0 line.

I remember someone coming in the IRC channel, who had the exact same problem. i.e. he was missing his eth0 interface, and we traced it to a ifcfg-eth0 file that was missing some lines, when compared to my working copy.

History

#1 Updated by gboudreau almost 12 years ago

Looking at hdactl code, I think what happened is that $temp_fh could not be written to, because the drive was full, so when you later write that into $ifcfg_fh, followed by IPADDR etc., the end result was that I ended up with a file with only IPADDR etc. and not anything else.

Instead of writing 'custom' lines into a file, if you just store them in a Perl array, that would prevent this issue.

Or, you could verify that the writes into $temp_fh work before continuing. An empty $temp_fh, when you're about to use it to write a new $ifcfg file means you'll end up with a broken file, because it will at least be missing the DEVICE=... line.

#2 Updated by cpg almost 12 years ago

ok, we can add more safety checks in hdactl.

wonder why only device got omitted, however.

#3 Updated by gboudreau almost 12 years ago

DEVICE wasn't the only missing line; all the lines I had there before, except the lines hdactl adds, were missing.
BOOTPROTO, NM_CONTROLLED, ONBOOT were all missing too, maybe others I don't remember.
But only DEVICE is mandatory, so re-adding only this one fixed the issue.

Also available in: Atom