Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Having trouble installing ghc6.

Here's what seems to be the relevant error that comes up when I try to (apt-get|aptitude) install ghc6:

A package failed to install.  Trying to recover:
Setting up ghc6 (6.12.1-13ubuntu1) ...
ghc-pkg: /home/opm/.ghc/i386-linux-6.12.1/package.conf.d/unix-compat-0.2-edefa7bced91ebe610d455bab466e200.conf: hGetContents: invalid argument (invalid UTF-8 byte sequence)

(Here's the full output, if you're interested: )

This still happens after apt-get clean and apt-get update.

My searching around has not really helped me understand what's going on, except that it might be caused by a mismatch in locale. So, here's the output of locale too:


Any ideas?

Additional background: this all seems very strange to me, because I used to have ghc6 installed correctly--I use XMonad as my main window manager most of the time. I tried to install haskell-platform (through apt), which failed and told me that there was something wrong with ghc6, and so I reinstalled ghc6 and began to get the above error message.

(Originally posted here to SuperUser, until I remembered today that this SE site existed.)

share|improve this question
I was getting same message - "my-prog: fd:6: hGetContents: invalid argument (invalid byte sequence)" and running it with LANG=en_US.utf8 helped me. – yaccz Aug 12 '14 at 18:51
up vote 7 down vote accepted

Check the output of ghc-pkg list. I had the same problem, and in my case it was due to an old ~/.ghc/i386-linux-6.12.1/package.conf.d. Deleting ~/.ghc solved the problem for me.

share|improve this answer
That fixed things. Thanks! – olimay Mar 4 '11 at 22:04
@olimay Please accept the answer (and vote it up) if it has solved your problem. – belacqua Apr 2 '11 at 0:41
I had the same problem, and your solution fixed it. Thanks a lot! – gphilip Apr 6 '11 at 8:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.