# Address family mismatch - onedb fsck / upgrade

**URL:** <https://forum.opennebula.io/t/address-family-mismatch-onedb-fsck-upgrade/2671>\
**Category:** Product Support\
**Created:** [July 28, 2016, 11:06am UTC](https://forum.opennebula.io/t/address-family-mismatch-onedb-fsck-upgrade/2671 "2016-07-28T11:06:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![opennebula2](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/opennebula2/32/6732_2.png) [@opennebula2](https://forum.opennebula.io/u/opennebula2)\
**Post date:** [July 28, 2016, 11:06am UTC](https://forum.opennebula.io/t/address-family-mismatch-onedb-fsck-upgrade/2671/1 "2016-07-28T11:06:07Z")

</div>

Hi,

i am currently investigating a problem (`address family mismatch`) when `onedb fsck` runs:

```
oneadmin@cloud000-dev-lab:~$ onedb fsck -S localhost -u oneadmin -p XXXXX -d opennebula
MySQL dump stored in /var/lib/one/mysql_localhost_opennebula_2016-7-26_21:0:40.sql
Use 'onedb restore' or restore the DB using the mysql command:
mysql -u user -h server -P port db_name < backup_file

Host 0 CPU_USAGE has 7520 is	7519

address family mismatch
/usr/lib/ruby/2.1.0/ipaddr.rb:500:in `initialize'
/usr/lib/one/ruby/onedb/fsck.rb:1350:in `new'
/usr/lib/one/ruby/onedb/fsck.rb:1350:in `block (3 levels) in fsck'
/usr/lib/one/ruby/onedb/fsck.rb:1337:in `each'
/usr/lib/one/ruby/onedb/fsck.rb:1337:in `block (2 levels) in fsck'
/usr/lib/ruby/vendor_ruby/sequel/dataset/actions.rb:139:in `block in each'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:312:in `block (2 levels) in fetch_rows'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:367:in `yield_rows'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:312:in `block in fetch_rows'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:177:in `_execute'
/usr/lib/ruby/vendor_ruby/sequel/adapters/shared/mysql_prepared_statements.rb:34:in `block in execute'
/usr/lib/ruby/vendor_ruby/sequel/database/connecting.rb:250:in `block in synchronize'
/usr/lib/ruby/vendor_ruby/sequel/connection_pool/threaded.rb:91:in `hold'
/usr/lib/ruby/vendor_ruby/sequel/database/connecting.rb:250:in `synchronize'
/usr/lib/ruby/vendor_ruby/sequel/adapters/shared/mysql_prepared_statements.rb:34:in `execute'
/usr/lib/ruby/vendor_ruby/sequel/dataset/actions.rb:906:in `execute'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:351:in `execute'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:296:in `fetch_rows'
/usr/lib/ruby/vendor_ruby/sequel/dataset/actions.rb:139:in `each'
/usr/lib/one/ruby/onedb/fsck.rb:1328:in `block in fsck'
/usr/lib/ruby/vendor_ruby/sequel/database/transactions.rb:126:in `_transaction'
/usr/lib/ruby/vendor_ruby/sequel/database/transactions.rb:100:in `block in transaction'
/usr/lib/ruby/vendor_ruby/sequel/database/connecting.rb:250:in `block in synchronize'
/usr/lib/ruby/vendor_ruby/sequel/connection_pool/threaded.rb:104:in `hold'
/usr/lib/ruby/vendor_ruby/sequel/database/connecting.rb:250:in `synchronize'
/usr/lib/ruby/vendor_ruby/sequel/database/transactions.rb:89:in `transaction'
/usr/lib/one/ruby/onedb/fsck.rb:1327:in `fsck'
/usr/lib/one/ruby/onedb/onedb.rb:278:in `fsck'
/usr/bin/onedb:317:in `block (2 levels) in <main>'
/usr/lib/one/ruby/cli/command_parser.rb:449:in `call'
/usr/lib/one/ruby/cli/command_parser.rb:449:in `run'
/usr/lib/one/ruby/cli/command_parser.rb:76:in `initialize'
/usr/bin/onedb:210:in `new'
/usr/bin/onedb:210:in `<main>'

Error running fsck version 4.11.80
The database will be restored
MySQL DB opennebula at localhost restored.

```

First i seen this error after planning the change to upgrade One from 4.14.12 to 5.0.2 after upgrading the packages to 5.0.2  
I revert to the original 4.14.12 version by snapshot in my lab environment and there the same error occurs with V 4.14.12.

In `/usr/lib/ruby/2.1.0/ipaddr.rb` i found the following code at line 500:

```
499 if family != Socket::AF_UNSPEC && @family != family
500 raise AddressFamilyError, "address family mismatch"
501 end

```

Any ideas where i had to look for ?

Best regards,

Sebastian

---

<div class="post-metadata">

**Author:** ![cmartin](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/cmartin/32/4278_2.png) [@cmartin](https://forum.opennebula.io/u/cmartin)\
**Post date:** [July 28, 2016, 4:44pm UTC](https://forum.opennebula.io/t/address-family-mismatch-onedb-fsck-upgrade/2671/2 "2016-07-28T16:44:30Z")

</div>

Hi,

Please open a bug ticket at [http://dev.opennebula.org](http://dev.opennebula.org)

Meanwhile, maybe you can try to see what is failing with a ‘puts net\_ar.at\_xpath(“IP”).text’ before this line:

> <https://github.com/OpenNebula/one/blob/release-4.14.2/src/onedb/fsck.rb#L1350>

---

<div class="post-metadata">

**Author:** ![opennebula2](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/opennebula2/32/6732_2.png) [@opennebula2](https://forum.opennebula.io/u/opennebula2)\
**Post date:** [July 29, 2016, 11:13am UTC](https://forum.opennebula.io/t/address-family-mismatch-onedb-fsck-upgrade/2671/3 "2016-07-29T11:13:19Z")

</div>

Hi Carlos,

here`s the new bug ticket: [http://dev.opennebula.org/issues/4695](http://dev.opennebula.org/issues/4695)

I already tried to debug this issue. I checked the sourcecode of `fsck.rb` and found it fails at the following AR:

```
<AR>
  <AR_ID><![CDATA[34]]></AR_ID>
  <IP><![CDATA[212.62.194.47	]]></IP>
  <MAC><![CDATA[02:00:d4:3e:c2:2f]]></MAC>
  <SIZE><![CDATA[1]]></SIZE>
  <TYPE><![CDATA[IP4]]></TYPE>
  <MAC_END><![CDATA[02:00:d4:3e:c2:2f]]></MAC_END>
  <IP_END><![CDATA[212.62.194.47]]></IP_END>
  <USED_LEASES>1</USED_LEASES>
  <LEASES>
    <LEASE>
      <IP><![CDATA[212.62.194.47]]></IP>
      <MAC><![CDATA[02:00:d4:3e:c2:2f]]></MAC>
      <VM><![CDATA[657]]></VM>
    </LEASE>
  </LEASES>
</AR>

```

As you can see, there are whitespaces at the first `<IP>` element. This is not allowed.

The Sunstone shows the AR 34 correct:

 ![](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/5/5718dace62ca7fe5d7a5c11fb3acd35bfc80fc27.png)

In the CLI you can see the whitspaces:

 ![](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/4/4602ded111c5707797b6ae4e61f3fdde1b07f2d4.png)

The AR with ID 34 was created with Sunstone from one of our customers.  
I just tried to create a new AR with an IP which has some whitespaces - Sunstone checks it correctly:

`[VirtualNetworkAddAddressRange] Error modifying network leases. Wrong or empty IP attribute`

So long. I dont think there is a Bug in OpenNebula. Perphaps we can add `.strip` to `IPAddr.new(net_ar.at_xpath("IP").text`

Best regards,

Sebastian
