diff --git a/src/linux/get_distro.cpp b/src/linux/get_distro.cpp
index 77cd662c45f2689bd7f8096c501eff8b868ee649..5932fd84eb8d2696a538ffda4be7d67e5860367d 100644
--- a/src/linux/get_distro.cpp
+++ b/src/linux/get_distro.cpp
@@ -62,6 +62,8 @@ std::string get_distro() {
             }
         }
 
+        throw "Release file empty or incomplete.";
+
     // openSuSE
     } else if (open_file("/etc/os-release", release_file)) {
 
@@ -97,27 +99,38 @@ std::string get_distro() {
             }
         }
 
-        if (name.length()) {
+        if (name.length())
             return name;
-        } else {
-            return "unknown";
-        }
+
+        throw "Release file empty or incomplete.";
 
     } else if (open_file("/etc/novell-release", release_file)) {
 
         getline(release_file, line);
-        return line;
+
+        if (line.length())
+            return line;
+
+        throw "Release file empty.";
 
     } else if (open_file("/etc/sles-release", release_file)) {
 
         getline(release_file, line);
-        return line;
+
+        if (line.length())
+            return line;
+
+        throw "Release file empty.";
 
     // fedora
     } else if (open_file("/etc/redhat-release", release_file)) {
 
         getline(release_file, line);
-        return line;
+
+        if (line.length())
+            return line;
+
+        throw "Release file empty.";
 
     // debian -- leave this at the end, otherwise debian-based distros
     //           will find the debian_version file instead of the actual
@@ -125,14 +138,22 @@ std::string get_distro() {
     } else if (open_file("/etc/debian-release", release_file)) {
 
         getline(release_file, line);
-        return line;
+
+        if (line.length())
+            return line;
+
+        throw "Release file empty.";
 
     } else if (open_file("/etc/debian-version", release_file)) {
 
         getline(release_file, line);
-        return line;
+
+        if (line.length())
+            return line;
+
+        throw "Release file empty.";
 
     }
 
-    return "unknown";
+    throw "No release file found.";
 }
diff --git a/src/linux/get_macaddr.cpp b/src/linux/get_macaddr.cpp
index 8070215b18a9f23fe955561fc83bc2da7bf970e8..86275647fddd4ab653445357899f0f159b2d288c 100644
--- a/src/linux/get_macaddr.cpp
+++ b/src/linux/get_macaddr.cpp
@@ -31,7 +31,7 @@ std::string get_macaddr() {
     if (!file.is_open()) {
         file.open("/sys/class/net/eth1/address", std::ifstream::in);
         if (!file.is_open()) {
-            return "unknown";
+            throw "No address file found.";
         }
     }
 
diff --git a/src/linux/get_machine_type.cpp b/src/linux/get_machine_type.cpp
index aa1faca9b19eab9995bbbb8d257583caee29b7df..7141a3a626f7e62f3f4c3c11c9c0989fa2bc473a 100644
--- a/src/linux/get_machine_type.cpp
+++ b/src/linux/get_machine_type.cpp
@@ -37,8 +37,9 @@ std::string get_machine_type() {
     gai_result = getaddrinfo(hostname, "http", &hints, &info);
 
     if (gai_result) {
-        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(gai_result));
-        return "unknown";
+        std::string key("getaddrinfo: ");
+        std::string error(gai_strerror(gai_result));
+        throw key + error;
     }
 
     for (p = info; p; p = p->ai_next) {
diff --git a/src/linux/get_user_count.cpp b/src/linux/get_user_count.cpp
index f58a2ea097ee9212d0facb5ac81b8d025209e7bb..33af3ca09894abd277ab262db0ea0f254f08dfff 100644
--- a/src/linux/get_user_count.cpp
+++ b/src/linux/get_user_count.cpp
@@ -218,7 +218,7 @@ static struct user_log *list(struct utmp *p, time_t t, int what) {
     time_t tmp;
     struct user_log * u = (struct user_log *)malloc(sizeof(struct user_log));
     char login[25], logout[25];
-    
+
     /*
      *  Calculate times
      */
@@ -295,11 +295,11 @@ static struct user_log * last_modified() {
      */
     if ((fp = fopen(ufile, "r")) == NULL) {
         x = errno;
-        fprintf(stderr, "ERROR: %s: %s\n", ufile, strerror(errno));
         if (x == ENOENT)
-            fprintf(stderr, "Perhaps this file was removed by the "
-                "operator to prevent logging info.\n");
-        return NULL;
+            // file not found
+            throw std::string(ufile) + std::string(": ") +
+                  std::string(strerror(errno));
+        throw strerror(errno);
     }
 
     /*
@@ -432,8 +432,7 @@ static struct user_log * last_modified() {
 
                 p = (struct utmplist *)malloc(sizeof(struct utmplist));
                 if (p == NULL) {
-                    fprintf(stderr, "ERROR: out of memory\n");
-                    return NULL;
+                    throw "ERROR: out of memory";
                 }
 
                 memcpy(&p->ut, &ut, sizeof(struct utmp));
@@ -551,8 +550,7 @@ static struct user_log * last_modified() {
                     break;
                 p = (struct utmplist *)malloc(sizeof(struct utmplist));
                 if (p == NULL) {
-                    fprintf(stderr, "ERROR: out of memory\n");
-                    return NULL;
+                    throw "ERROR: out of memory";
                 }
                 memcpy(&p->ut, &ut, sizeof(struct utmp));
                 p->next  = utmplist;
diff --git a/src/linux/inventory.cpp b/src/linux/inventory.cpp
index bab587c5fc8cfbfdd62d66a7631af432256bf22f..01e821f1a2181c80cf3cfd0cff5fc769ef45024d 100644
--- a/src/linux/inventory.cpp
+++ b/src/linux/inventory.cpp
@@ -34,10 +34,18 @@ Json::Value get_inventory() {
     struct utsname sysinfo;
     uname(&sysinfo);
 
-    inv["os_type"] = "Linux";
-    inv["os_distro"] = get_distro();
-    inv["os_kernel"] = sysinfo.release;
-    inv["mirror_timestamp"] = sysinfo.version;
+    inv["data"]["os_type"] = "Linux";
+
+    try {
+        inv["data"]["os_distro"] = get_distro();
+    }
+    catch ( std::string err ) {
+        inv["data"]["os_distro"] = Json::nullValue;
+        inv["error"]["os_distro"] = err;
+    }
+
+    inv["data"]["os_kernel"] = sysinfo.release;
+    inv["data"]["mirror_timestamp"] = sysinfo.version;
 
     // hw info
     /*
@@ -58,9 +66,29 @@ Json::Value get_inventory() {
     inv["contact_date"] =
     */
 
-    inv["machine_type"] = get_machine_type();
-    inv["amount_users"] = get_user_count();
-    inv["mac_address"] = get_macaddr();
+    try {
+        inv["data"]["machine_type"] = get_machine_type();
+    }
+    catch ( std::string err ) {
+        inv["data"]["machine_type"] = Json::nullValue;
+        inv["error"]["machine_type"] = err;
+    }
+
+    try {
+        inv["data"]["amount_users"] = get_user_count();
+    }
+    catch ( std::string err ) {
+        inv["data"]["amount_users"] = Json::nullValue;
+        inv["error"]["amount_users"] = err;
+    }
+
+    try {
+        inv["data"]["mac_address"] = get_macaddr();
+    }
+    catch ( std::string err ) {
+        inv["data"]["mac_address"] = Json::nullValue;
+        inv["error"]["mac_address"] = err;
+    }
 
     return inv;