FOGProject / fogproject

An open source computer cloning & management system
https://fogproject.org
GNU General Public License v3.0
1.14k stars 222 forks source link

Install in a LXC cotnainer under proxmox VE 6 - detection of ethernet interface failure #367

Closed dethegeek closed 4 years ago

dethegeek commented 4 years ago

Hi

I'm trying to install FOG v1.5.7 in a LXC container.

My container is running Debian 10.

First issue - route is not installed yet in the system

First issue : route is not available in my fresh install, maybe the installer should check if it exists before calling it and install net-tools if needed ?

../lib/common/input.sh: line 39: route: command not found
   +------------------------------------------+
   |     ..#######:.    ..,#,..     .::##::.  |
   |.:######          .:;####:......;#;..     |
   |...##...        ...##;,;##::::.##...      |
   |   ,#          ...##.....##:::##     ..:: |
   |   ##    .::###,,##.   . ##.::#.:######::.|
   |...##:::###::....#. ..  .#...#. #...#:::. |
   |..:####:..    ..##......##::##  ..  #     |
   |    #  .      ...##:,;##;:::#: ... ##..   |
   |   .#  .       .:;####;::::.##:::;#:..    |
   |    #                     ..:;###..       |
   |                                          |
   +------------------------------------------+
   |      Free Computer Imaging Solution      |
   +------------------------------------------+
   |  Credits: http://fogproject.org/Credits  |
   |       http://fogproject.org/Credits      |
   |       Released under GPL Version 3       |
   +------------------------------------------+

   Version: 1.5.7 Installer/Updater

../lib/common/input.sh: line 39: route: command not found
  What version of Linux would you like to run the installation for?

          1) Redhat Based Linux (Redhat, CentOS, Mageia)
          2) Debian Based Linux (Debian, Ubuntu, Kubuntu, Edubuntu)
          3) Arch Linux

  Choice: [2] 

Second issue - interface detection

Next, no matter route is available in the system, it fails to find the network interface

  What type of installation would you like to do? [N/s (Normal/Storage)] N

  We found the following interfaces on your system:
      * eth0 - 192.168.0.13/24
Device "@if42" does not exist.
      * @if42 - 

  Would you like to change the default network interface from eth0 @if42?
  If you are not sure, select No. [y/N] 

I investigated a bit in the scripts and I found the error is here :

getAllNetworkInterfaces() {
    gatewayif=$(ip -4 route show | grep "^default via" | awk '{print $5}')
    interfaces="$gatewayif $(ip -4 link | grep -v LOOPBACK | grep UP | awk -F': ' '{print $2}' | tr '\n' ' ' | sed "s/${gatewayif}//g")"
    echo -n $interfaces
}
gatewayif=$(ip -4 route show | grep "^default via" | awk '{print $5}')
echo $gatewayif
eth0

The error is then in the 2nd line of the function

ip -4 link | grep -v LOOPBACK | grep UP
41: eth0@if42: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000

Adding some more commands from the script

ip -4 link | grep -v LOOPBACK | grep UP | awk -F': ' '{print $2}'
eth0@if42

I believe that the @if42 should be cleaned up

Sebastian-Roth commented 4 years ago

@dethegeek Thanks for your post on this issue. I did a bit of testing. Though I don't have LXC at hand I have played with the commands:

ip -4 route show | grep "^default via"
default via 192.168.24.1 dev eth0

Ok, I have a normal route on eth0. Though if I just run the awk command on a string I see that it wouldn't cut of the @if42.

echo "default via 192.168.24.1 dev eth0@if42" | awk '{print $5}'
eth0@if42

So my guess is your route is set to use eth0 but your interface is named different. I am not exactly sure as I don't have access to LXC. Can you please run the following two commands and post full output here?

ip -4 route show
ip -4 link | grep -v LOOPBACK | grep UP

Using that information I should be able to fix the scripts.

PS: The route: command not found error is related to it not finding the correct route information in the first place. Shouldn't happen.

dethegeek commented 4 years ago

Hi

Here are the results:

root@srv-fog-01:~# ip -4 route show
default via 192.168.0.3 dev eth0 onlink 
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.13 
root@srv-fog-01:~# ip -4 link | grep -v LOOPBACK | grep UP
55: eth0@if56: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000

About the route: command not found my container did not had the binary. I checked with which route and I had to install the package containing it (which was reported not installed in aptitude). As I installed my container from a template available from internet, it is usual that the templates are reduced to the smallest size and several tools are not installed.

Sebastian-Roth commented 4 years ago

@dethegeek Thanks. I pushed a change to the development branch that should take care of this. Please try again using dev-branch.

Sebastian-Roth commented 4 years ago

Closing this as we haven't heard anything back and I don't expect this to be an issue anymore. FOG 1.5.8 is released with that fix included.

dethegeek commented 4 years ago

I'm sorry, i'm quite busy. I don't forget to feedbaack. Just a matter of time. As the fix is included in the release, I'll test directly this release.

dethegeek commented 4 years ago

HI

Late feedback : It works ! Thank you !