Comment 6 for bug 1676504

Revision history for this message
Daniele (danygor) wrote :

Hi again,

I'm really a dumbass at programming, however I pinned out the issue is the carriage return which is inside the replies from VBoxManage.
Let's start everytime with manually removing all Host-Only ethernet adapters using Virtualbox GUI.
The first broken function we will encounter running the launch.sh is the following one:

 functions/network.sh: is_hostonly_interface_present()

in particular, the error resides in the line:

 local found_iface=(`execute VBoxManage list hostonlyifs | egrep "Name: + $name\$" | awk '/Name/ { $1 = ""; print substr($0, 2) }'`)

in fact, it return void, while `execute VBoxManage list hostonlyifs`, stripping the egrep and awk commands, returns:

Name: VirtualBox Host-Only Ethernet Adapter
GUID: 39ad9efd-607e-47d0-82b6-eb0f41221373
DHCP: Disabled
IPAddress: 192.168.130.1
NetworkMask: 255.255.255.0
IPV6Address: fe80:0000:0000:0000:6c61:d4f4:02ed:69aa
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 0a:00:27:00:00:13
MediumType: Ethernet
Status: Up
VBoxNetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter

What's happening?
Let's analyze what "VBoxManage list hostonlyifs" is actually returning, it's enough to add the following line just before the line "local found_iface..."

 echo `execute VBoxManage list hostonlyifs | od -c`

#output:
0000000 N a m e :
0000020 V i r t u a l B o x H o s t
0000040 - O n l y E t h e r n e t A
0000060 d a p t e r \r \n G U I D :
0000100 2 6 c f 5 a d
0000120 e - e 3 9 7 - 4 c c 6 - a 0 b 5
0000140 - e 6 3 b 3 9 9 b e 9 f a \r \n D
0000160 H C P :
0000200 D i s a b l e d \r \n I P A d d r
0000220 e s s : 1 9 2 . 1
0000240 6 8 . 1 0 4 . 1 \r \n N e t w o r
0000260 k M a s k : 2 5 5 . 2
0000300 5 5 . 2 5 5 . 0 \r \n I P V 6 A d
0000320 d r e s s : f e 8 0 :
0000340 0 0 0 0 : 0 0 0 0 : 0 0 0 0 : 9
0000360 1 b c : 5 2 c 5 : 2 4 0 4 : 1 1
0000400 2 6 \r \n I P V 6 N e t w o r k M
0000420 a s k P r e f i x L e n g t h :
0000440 6 4 \r \n H a r d w a r e A d d
0000460 r e s s : 0 a : 0 0 : 2 7 : 0
0000500 0 : 0 0 : 1 3 \r \n M e d i u m T
0000520 y p e : E t h e r n
0000540 e t \r \n S t a t u s :
0000560 U p \r \n V B o x N e t
0000600 w o r k N a m e : H o s t I n
0000620 t e r f a c e N e t w o r k i n
0000640 g - V i r t u a l B o x H o s
0000660 t - O n l y E t h e r n e t
0000700 A d a p t e r \r \n \r \n
0000713

So you can see that every line ends with a \r\n . To remove them just add a proper sed on the above echo line:

 echo `execute VBoxManage list hostonlyifs | sed 's/\r$//' | od -c`

0000000 N a m e :
0000020 V i r t u a l B o x H o s t
0000040 - O n l y E t h e r n e t A
0000060 d a p t e r \n G U I D :
0000100 2 6 c f 5 a d e
0000120 - e 3 9 7 - 4 c c 6 - a 0 b 5 -
0000140 e 6 3 b 3 9 9 b e 9 f a \n D H C
0000160 P : D i
0000200 s a b l e d \n I P A d d r e s s
0000220 : 1 9 2 . 1 6 8 .
0000240 1 0 4 . 1 \n N e t w o r k M a s
0000260 k : 2 5 5 . 2 5 5 . 2
0000300 5 5 . 0 \n I P V 6 A d d r e s s
0000320 : f e 8 0 : 0 0 0 0 :
0000340 0 0 0 0 : 0 0 0 0 : 9 1 b c : 5
0000360 2 c 5 : 2 4 0 4 : 1 1 2 6 \n I P
0000400 V 6 N e t w o r k M a s k P r e
0000420 f i x L e n g t h : 6 4 \n H a
0000440 r d w a r e A d d r e s s : 0
0000460 a : 0 0 : 2 7 : 0 0 : 0 0 : 1 3
0000500 \n M e d i u m T y p e :
0000520 E t h e r n e t \n S t a t u
0000540 s : U p \n V
0000560 B o x N e t w o r k N a m e :
0000600 H o s t I n t e r f a c e N e t
0000620 w o r k i n g - V i r t u a l B
0000640 o x H o s t - O n l y E t h
0000660 e r n e t A d a p t e r \n \n
0000677

Now you can add that sed to the expression as below:

 local found_iface=(`execute VBoxManage list hostonlyifs | sed 's/\r$//' | egrep "Name: + $name\$" | awk '/Name/ { $1 = ""; print substr($0, 2) }'`)

Note that this will fix this particular issue, but the installation will fail on a subsequent step, most likely due to a very similar issue:

...subsequent output:
Interface VirtualBox Host-Only Ethernet Adapter was successfully created
Disabling DHCP server on interface: VirtualBox Host-Only Ethernet Adapter...
Configuring IP address 10.20.0.1 and network mask 255.255.255.0 on interface: VirtualBox Host-Only Ethernet Adapter...
Verifying interface VirtualBox Host-Only Ethernet Adapter has IP 10.20.0.1 and mask 255.255.255.0 properly set.
Checking VirtualBox Host-Only Ethernet Adapter but found settings for

Looks like VirtualBox failed to apply settings for interface VirtualBox Host-Only Ethernet Adapter
Trying to apply network settings for interface VirtualBox Host-Only Ethernet Adapter one more time...
Configuring IP address 10.20.0.1 and network mask 255.255.255.0 on interface: VirtualBox Host-Only Ethernet Adapter...
Verifying interface VirtualBox Host-Only Ethernet Adapter has IP 10.20.0.1 and mask 255.255.255.0 properly set.
Checking VirtualBox Host-Only Ethernet Adapter but found settings for

Looks like VirtualBox failed to apply settings for interface VirtualBox Host-Only Ethernet Adapter
Trying to apply network settings for interface VirtualBox Host-Only Ethernet Adapter one more time...
Configuring IP address 10.20.0.1 and network mask 255.255.255.0 on interface: VirtualBox Host-Only Ethernet Adapter...
Verifying interface VirtualBox Host-Only Ethernet Adapter has IP 10.20.0.1 and mask 255.255.255.0 properly set.
Checking VirtualBox Host-Only Ethernet Adapter but found settings for

Looks like VirtualBox failed to apply settings for interface VirtualBox Host-Only Ethernet Adapter
Trying to apply network settings for interface VirtualBox Host-Only Ethernet Adapter one more time...
Configuring IP address 10.20.0.1 and network mask 255.255.255.0 on interface: VirtualBox Host-Only Ethernet Adapter...
Verifying interface VirtualBox Host-Only Ethernet Adapter has IP 10.20.0.1 and mask 255.255.255.0 properly set.
Checking VirtualBox Host-Only Ethernet Adapter but found settings for
Sometimes such error happens under Windows and CentOS.
Please run launch.sh one more time.
If this error remains after several attempts, then something really went wrong.
Aborting.

Is somebody able to properly fix this on the VirtualBox scripts?