Package php7.2-mbstring unmet dependencies in Ubuntu 18.04

19,107

You are missing some necessary channels from sources.list. Do sudo gedit /etc/apt/sources.list and make it look like this:

deb http://archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe

Save and exit. Then update your repository:

sudo apt update

Then install php-mbstring:

sudo apt install php7.2-mbstring
Share:
19,107
TiloBunt
Author by

TiloBunt

I'm currently blank :-)

Updated on September 18, 2022

Comments

  • TiloBunt
    TiloBunt over 1 year

    Try to install php-mbstring for mediawiki setup.

    already added after first attempt universe repository: Package php7.2-mbstring missing in Ubuntu 18.04

    But gives me hard time Here details:

    usertilo@myserver4:~$ sudo apt-get install php-mbstring
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     php-mbstring : Depends: php7.2-mbstring but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    
    usertilo@myserver4:~$ sudo apt-get install php7.2-mbstring
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     php7.2-mbstring : Depends: php7.2-common (= 7.2.3-1ubuntu1) but 7.2.7-0ubuntu0.18.04.2 is to be installed
    E: Unable to correct problems, you have held broken packages.
    
    usertilo@myserver4:~$ uname -a
    Linux myserver4 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    
    usertilo@myserver4:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 18.04.1 LTS
    Release:        18.04
    Codename:       bionic
    
    usertilo@myserver4:~$ sudo apt-get install -f
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    
    usertilo@server4:~$ sudo apt-get install php7.2-common
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    php7.2-common is already the newest version (7.2.7-0ubuntu0.18.04.2).
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    
    • update add info requested from comments
    usertilo@myserver4:~$ sudo apt-cache policy php7.2-common php7.2-mbstring
    php7.2-common:
      Installed: 7.2.7-0ubuntu0.18.04.2
      Candidate: 7.2.7-0ubuntu0.18.04.2
      Version table:
     *** 7.2.7-0ubuntu0.18.04.2 500
            500 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages
            500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
            100 /var/lib/dpkg/status
         7.2.3-1ubuntu1 500
            500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
    php7.2-mbstring:
      Installed: (none)
      Candidate: 7.2.3-1ubuntu1
      Version table:
         7.2.3-1ubuntu1 500
            500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
    
    usertilo@myserver4:~$ cat /etc/apt/sources.list
    deb http://archive.ubuntu.com/ubuntu bionic main universe
    deb http://archive.ubuntu.com/ubuntu bionic-security main
    # deb-src http://archive.ubuntu.com/ubuntu bionic universe
    deb http://archive.ubuntu.com/ubuntu bionic-updates main
    
    usertilo@myserver4:~$ cat /etc/apt/sources.list.d/*
    cat: '/etc/apt/sources.list.d/*': No such file or directory
    
    • Thomas Ward
      Thomas Ward almost 6 years
      Show us the output of the following, please, I'd like to see whether having different repositories enabled or disabled may be the cause of your problems, and this will help shed some light: apt-cache policy php7.2-common php7.2-mbstring (Also, FYI, Universe is enabled by default on Ubuntu 18.04)
    • Socrates
      Socrates almost 6 years
      @TiloBunt What sources do you have in /etc/apt/sources.list? And same question for the sources in /etc/apt/sources.list.d/*. Those are the sources you get all your packages from. So make sure, that all looks alright. Get the repository of the package you want to install and check whether you have its source within the mentioned lists.
    • TiloBunt
      TiloBunt almost 6 years
      @ThomasWard and Socrates, added info to my question. let me know if I should check anything else. It's a brand new install
  • TiloBunt
    TiloBunt almost 6 years
    tried this but same result.
  • Thomas Ward
    Thomas Ward almost 6 years
    Sounds like your system is not configured properly then. Show us the apt-cache policy output from the same command I asked about in comments as an edit to your question again, because it looks like your repos are not getting updated
  • TiloBunt
    TiloBunt almost 6 years
    appreciate your help. The adding of the restricted fixed it for now and I'm good. The system was a new install on VM so not sure how I can mess up the configuration that quick but might have been. Cheers
  • Redbob
    Redbob about 5 years
    These commands doesn't worked for me. The error is the same. I had to download http://security.ubuntu.com/ubuntu/pool/universe/p/php7.2/php‌​7.2-mbstring_7.2.15-‌​0ubuntu0.18.04.1_amd‌​64.deb and install it by dpkg -i command
  • Jeff Lange
    Jeff Lange almost 5 years
    Thank you for this fix, it only took me a few hours to figure out this was the solution.