Ubuntu – Unable to install Firefox using Ubuntu Software Center

firefoxsoftware-center

When I try to install Firefox through the Ubuntu Software Center, it starts applying changes without downloading the packages first and then I get this message:

Package Operation Failed

The installation or removal of the package failed

Details:

 installArchives() failed: perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_IN.ISO8859-1"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_IN.ISO8859-1"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_IN.ISO8859-1"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_IN.ISO8859-1"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package firefox.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 225197 files and directories currently installed.)
Unpacking firefox (from .../firefox_20.0+build1-0ubuntu0.12.10.3_i386.deb) ...
Selecting previously unselected package firefox-globalmenu.
Unpacking firefox-globalmenu (from .../firefox-globalmenu_20.0+build1-0ubuntu0.12.10.3_i386.deb) ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for man-db ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up firefox (20.0+build1-0ubuntu0.12.10.3) ...
update-alternatives: error: alternative path /usr/bin/firefox doesn't exist
dpkg: error processing firefox (--configure):
 subprocess installed post-installation script returned error exit status 2
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of firefox-globalmenu:
 firefox-globalmenu depends on firefox (= 20.0+build1-0ubuntu0.12.10.3); however:
  Package firefox is not configured yet.

dpkg: error processing firefox-globalmenu (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Errors were encountered while processing:
 firefox
 firefox-globalmenu
Error in function: 
Setting up firefox (20.0+build1-0ubuntu0.12.10.3) ...
update-alternatives: error: alternative path /usr/bin/firefox doesn't exist
dpkg: error processing firefox (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of firefox-globalmenu:
 firefox-globalmenu depends on firefox (= 20.0+build1-0ubuntu0.12.10.3); however:
  Package firefox is not configured yet.

dpkg: error processing firefox-globalmenu (--configure):
 dependency problems - leaving unconfigured

Note : I had tried to install firefox earlier, but it gave an error while downloading, so I downloaded firefox from its official website, and followed instructions I found on https://help.ubuntu.com/community/FirefoxNewVersion/MozillaBuilds
That let me use firefox, but I then thought that using the one from USC would be better, as it would update itself. So I deleted the mozilla build and tried to install again from USC, after which I got the above error. I suspect that my attempt to use the mozilla build might be the cause of the error.

Ok, When I entered 'sudo apt-get install firefox' in the terminal, I got this:

sudo apt-get install firefox
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  freegish-data gir1.2-gconf-2.0 gir1.2-unique-3.0 libunique-3.0-0
  ndiswrapper-common ndiswrapper-utils-1.9 python-compizconfig
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  firefox-globalmenu
Suggested packages:
  latex-xft-fonts firefox-gnome-support
The following NEW packages will be installed:
  firefox firefox-globalmenu
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/24.6 MB of archives.
After this operation, 51.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously unselected package firefox.
(Reading database ... 225197 files and directories currently installed.)
Unpacking firefox (from .../firefox_20.0+build1-0ubuntu0.12.10.3_i386.deb) ...
Selecting previously unselected package firefox-globalmenu.
Unpacking firefox-globalmenu (from .../firefox-globalmenu_20.0+build1-0ubuntu0.12.10.3_i386.deb) ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for man-db ...
Setting up firefox (20.0+build1-0ubuntu0.12.10.3) ...
update-alternatives: error: alternative path /usr/bin/firefox doesn't exist
dpkg: error processing firefox (--configure):
 subprocess installed post-installation script returned error exit status 2
E: Sub-process /usr/bin/dpkg returned an error code(1)'

after which I got a crash report.

Best Answer

Hit Ctrl+Alt+T to open terimanal and run following commands:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install firefox

If doesn't solve the problem then try following solutions:

  • Reinstall/install the language pack:

    sudo apt-get install --reinstall language-pack-en
    
  • (Re-)Generate and reconfigure locales:

    sudo locale-gen
    sudo dpkg-reconfigure locales
    
  • The Final solution is to manually set LANG variable by modifying /etc/default/locale.
    Open /etc/default/locale in your favorite editor:

    gksudo gedit /etc/default/locale
    

    and set the LANG= to en_US.UTF-8 or whatever language you're using, like:

    LANG=en_US.UTF-8
    

    Changes will take effect after reboot.

After the additional information provided by OP, problem got solved by running:

sudo apt-get clean
sudo apt-get install firefox

Sources: Ubuntu documentation, Ubuntu forums, Super User

Related Question