Pregenerating ConTeXt MarkIV format. This may take some time... takes forever

Hey there I tried to install latex using the follwing commands in ubuntu 16.04:

sudo apt-get install texlive-full texstudio

Then I finally came to the point with the following output:

Setting up thunderbird-locale-en (1:52.3.0+build1-0ubuntu0.16.04.1) ... 
Setting up thunderbird-locale-en-us (1:52.3.0+build1-0ubuntu0.16.04.1) ... 
Setting up context (2015.05.18.20150601-2) ... 
Running mtxrun --generate. This may take some time... done. 
Pregenerating ConTeXt MarkIV format. This may take some time...

And after waiting for 5 hours I closed the process. Unfortunately now my certain packages seem to be broken. e.g when I try to install a new package or try sudo apt-get dist-upgrade I get the following error:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure
-a' to correct the problem.

And If I try

sudo dpkg --configure -a

I came again to the endless waiting point....

Any Ideas what I can do?

Notes:

  • I also have installed Miktex before does that cause some troubles?
  • I unfortunately cannot remove any package cause I also get:

     sudo apt-get remove tex-common
     E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 
    

Solution 1:

I have also faced the similar issue. What have I done is :

  1. Run sudo dpkg --configure -a
  2. Got the following response and it stuck for a long time.

    Setting up context (2018.04.04.20180416-1~18.04.york1)...
    Running mtxrun --generate. This may take some time...`

  3. I entered ctr-c
  4. Got the following response.

    Errors were encountered while processing:
    context
    context-modules
    texlive-full

  5. removed these packages using dpkg -r.

    sudo dpkg -r context-modules.
    sudo dpkg -r context.
    sudo dpkg -r texlive-full.

  6. Now again I run dpkg --configure -a
  7. This time it does not get stuck .