Botched upgrade--dpkg hangs on 'Started Braille Device Support'

Screwed up an upgrade from 14.10->15.04->15.10 badly. I've been messing around in recovery mode and am confidentish that I managed to get all the broken packages/dependencies removed and reinstalled, but now I'm running into this queer issue. Aptitude won't run, it says I need to do stuff with dpkg. dpkg will do stuff, but always gets hung up on

Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
[  OK  ] Started Braille Device Support.

This Braille hang has been plaguing me for a while, but I've finally reached an impasse. The first part, with the errors, seems to be an obscure error relating to screwed up hard drives, and after some log digging, it seems as though it may me pointing to the Windows partition on this HD, which is fine. That seems like a dead end, and I can't find anything else on it online.

I'd really like to not have to backup, reformat, and reinstall. Does anybody have a lead?


Solution 1:

I just got into a similar situation with a botched upgrade and subsequent messing around in recovery mode, where a certain subset of packages (namely apport) were hanging on dpkg --configure -a with that same Started Braille Device Support. message. The hack that got me through this was:

  1. If you're currently staring at a hung apt-get command, press Ctrl+C to stop. If that doesn't work (as it did for me), press Ctrl+Z, then run kill -9 %1 a couple times to kill it off for good. Then run rm /var/lib/dpkg/lock, since you murdered the process that usually does that.
  2. Run screen (in order to get more than one prompt).
  3. Press Ctrl+A and then c to open a different prompt.
  4. Run dpkg --configure -a and wait for the process to hang.
  5. Press Ctrl+A and then a to switch back to the other prompt.
  6. Run killall systemctl
  7. Press Ctrl+A and then a to switch back to the dpkg --configure -a command.
  8. Note that the last package should have finished configuring, and dpkg has moved on to the next package and hung in the same fashion, or completed.
  9. If dpkg is hanging again, goto step 5.
  10. Once dpkg --configure -a is finally done, proceed mucking around in recovery mode, possibly running apt-get upgrade until the system seems in a rebootable state.

As for why this worked (for me at least), my debug process was as follows:

  1. apt-get upgrade was hanging. Run the Ctrl+Z and kill -9 %1 thing above to get back to the prompt.
  2. Run dpkg --configure -a, and observe it hangs with the same Started Braille Device Support. message as apt-get upgrade. However, Ctrl+C works this time to return to prompt.
  3. Search around for "ubuntu started braille device support". Find out from this debian accessibility page that it has to do with brltty.
  4. Run apt-get remove brltty, maybe it'll make the problem go away.
  5. Rerun dpkg --configure -a and notice that it still hangs, but this time, there's no message about Started Braille Device Support. OK.
  6. Run strace dpkg --configure -a, and observe that the process is stuck on a wait4(...) call to a subprocess.
  7. A couple strace lines upwards, note that the process writes the file /var/lib/dpkg/info/apport.postinst (or something similar, IIRC).
  8. less the above file, and see it's attempting to restart a boot service. Posit that since we're in recovery mode and the init system hasn't run to completion, that's going to be awkward.
  9. Run pstree, and see that dpkg --reconfigure -a did indeed fork to a bash thing, which then forks to perl, and finally systemctl, which does restart boot services, and may be confused.
  10. Note that the postinst script doesn't have set -e in it, so maybe we can kill the hung command inside of it, so the shell script finishes and dpkg moves on.
  11. Open another screen prompt, run killall systemctl, switch back, and see that dpkg did indeed move on. Great. It's stuck in the same place again though, on a different package.
  12. Run killall systemctl again until dpkg exits.
  13. Run apt-get dist-upgrade again, see that it says everything is up to date.
  14. Cross my fingers, and reboot.

Miraculously, the system recovered, and so far has no issues.

So, it's not a complete reduction (why does systemctl hang in recovery mode?), nor is it likely generally applicable, but this hack and the process to discover it may help somebody who arrives at this page through a web search like I did.

Solution 2:

An improvement to the previous answers when you cannot use the command `screen':

dpkg --configure -a & (sleep 2m; killall systemctl)

Change the sleep time to a minimum time interval after which you are quite certain that dpkg gets stuck. (In my case I, in fact, used 10s). Worked for me!

Solution 3:

I encountered this issue when I tried upgrading 15.10 to 16.04 and I fixed using below steps.

  1. Boot in command line by pressing E when highlight the first entry to edit it.

  2. Cursor to the end of the linux line. Remove quiet splash vt.handoff=7 and add single.

  3. Press Ctrl+X to boot.

  4. Run screen (in order to get more than one prompt).

  5. Press Ctrl+A and then C to open a different prompt.

  6. Run dpkg --configure -a and wait to finish.

  7. Reboot