diff --git a/CHANGELOG b/CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,9 @@
+propellor (4.7.5) unstable; urgency=medium
+
+  * Avoid crashing when getTerminalName fails due to eg, being in a chroot.
+
+ -- Joey Hess <id@joeyh.name>  Tue, 01 Aug 2017 15:28:58 -0400
+
 propellor (4.7.4) unstable; urgency=medium
 
   * Set GPG_TTY when run at a terminal, so that gpg can do password
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+propellor (4.7.5) unstable; urgency=medium
+
+  * Avoid crashing when getTerminalName fails due to eg, being in a chroot.
+
+ -- Joey Hess <id@joeyh.name>  Tue, 01 Aug 2017 15:28:58 -0400
+
 propellor (4.7.4) unstable; urgency=medium
 
   * Set GPG_TTY when run at a terminal, so that gpg can do password
diff --git a/propellor.cabal b/propellor.cabal
--- a/propellor.cabal
+++ b/propellor.cabal
@@ -1,5 +1,5 @@
 Name: propellor
-Version: 4.7.4
+Version: 4.7.5
 Cabal-Version: >= 1.20
 License: BSD2
 Maintainer: Joey Hess <id@joeyh.name>
diff --git a/src/Propellor/Gpg.hs b/src/Propellor/Gpg.hs
--- a/src/Propellor/Gpg.hs
+++ b/src/Propellor/Gpg.hs
@@ -20,6 +20,7 @@
 import Utility.Env
 import Utility.Directory
 import Utility.Split
+import Utility.Exception
 
 -- | When at a tty, set GPG_TTY to point to the tty device. This is needed
 -- so that when gpg is run with stio connected to a pipe, it is still able
@@ -35,9 +36,12 @@
 		isterm <- queryTerminal h
 		if isterm
 			then do
-				ttyname <- getTerminalName h
-				-- do not overwrite
-				setEnv "GPG_TTY" ttyname False
+				v <- tryNonAsync $ getTerminalName h
+				case v of
+					Right ttyname -> 
+						-- do not overwrite
+						setEnv "GPG_TTY" ttyname False
+					Left _ -> checkhandles hs
 			else checkhandles hs
 
 type KeyId = String
