       (throw+ {:warning ::no-facter
                :msg "facter cannot be found in PATH"}))))
 
+(defn find-ram-mb
+  "Hack until we can fix our facter versions, or get it to always
+  return memory info"
+  [facts]
+  (if (:memorysize_mb facts)
+    (Float/parseFloat
+     (:memorysize_mb facts))
+    (let [meminfo "/proc/meminfo"]
+      (if (and (= (:kernel facts) "Linux")
+               (.exists (io/file meminfo)))
+        (let [memtotal-raw (:out
+                            (sh/sh "fgrep" "MemTotal" meminfo))
+              [_ kb] (or (re-find #"^MemTotal: +(\d+) kB" memtotal-raw)
+                         (throw+ {:type ::error
+                                  :msg (format
+                                        "can't get memtotal from meminfo:\n%s"
+                                        (with-out-str
+                                          (println memtotal-raw)
+                                          (clojure.pprint/pprint facts)))}))]
+          (float (/ (Integer/parseInt kb) 1024)))
+        (throw+ {:type ::error
+                 :msg (format "can't get memory info from:\n%s"
+                              (with-out-str
+                                (clojure.pprint/pprint facts)))})))))
+
+(defn memory-details [facts]
+  (let [ram-mb (find-ram-mb facts)
+        ram-gb (.setScale
+                (bigdec (/ ram-mb 1024)) 2
+                java.math.BigDecimal/ROUND_HALF_UP)]
+    {:ram-mb ram-mb
+     :ram-gb ram-gb}))
+
 (s/defn inspect-system :- BuildSystem
   ([facter-fn :- clojure.lang.IFn]
    (let [facts (facter-fn)
-         ram-mb (Float/parseFloat (:memorysize_mb facts))
-         ram-gb (.setScale
-                 (bigdec (/ ram-mb 1024)) 2
-                 java.math.BigDecimal/ROUND_HALF_UP)
          ipv6 (:ipaddress6 facts)]
      (merge
       {:arch           (:architecture            facts)

            [schema.core :as s])
  (:require [clj-yaml.core :as yaml]
            [clojure.java.shell :as sh]
            [environ.core :as environ]
            [runbld.opts :as opts]
            [schema.core :as s]

       :model          (:hardwaremodel           facts)
       :os             (:operatingsystem         facts)
       :os-version     (:operatingsystemrelease  facts)
       :timezone       (:timezone                facts)
       :uptime-days    (:uptime_days             facts)
       :uptime-secs    (:uptime_seconds          facts)
       :uptime         (:uptime                  facts)
       :virtual        (:is_virtual              facts)}
      (memory-details facts)
      (when ipv6
        {:ipv6 ipv6})))))

