diff --git a/salt/config.py b/salt/config.py
index <HASH>..<HASH> 100644
--- a/salt/config.py
+++ b/salt/config.py
@@ -1722,6 +1722,8 @@ def get_id(root_dir=None, minion_id=False, cache=True):
         with salt.utils.fopen('/etc/hosts') as hfl:
             for line in hfl:
                 names = line.split()
+                if not names:
+                    continue # empty line in hosts
                 ip_ = names.pop(0)
                 if ip_.startswith('127.'):
                     for name in names:
Added /etc/host check for empty lines