Skip to content

Mongo Completely Broken.

General
  • Hi All,

    I have been running a Gaming Server and Site from home for many years. I have not really touched it in a while and switched on again today for some nostalgia and basically take a look.

    My site uses mongo to store the information and i had one db on there. I updated my system and all seems completely broken. I can no longer see the site. Sorry for the long code text but you can see from when I use sudo apt update then upgrade that it suggests to fix. But I get this.

    I am happy for someone to take dive in and take a look for the price of a coffee or two of course 🙂 I guess it may be something simple but I am far from the level of most of the guys here. I am wondering if my db and data is lost 😞 Any help much appreciated. Thank you in advance.

    smiley@fmjcod4:~$ sudo apt update
    Hit:1 http://fi.archive.ubuntu.com/ubuntu focal InRelease
    Hit:2 http://fi.archive.ubuntu.com/ubuntu focal-updates InRelease
    Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease
    Hit:4 http://fi.archive.ubuntu.com/ubuntu focal-backports InRelease
    Hit:5 http://fi.archive.ubuntu.com/ubuntu focal-security InRelease
    Hit:6 http://ppa.launchpad.net/maxmind/ppa/ubuntu focal InRelease
    Hit:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0 InRelease
    Hit:8 https://downloads.sourceforge.net/project/d-apt d-apt InRelease
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    22 packages can be upgraded. Run 'apt list --upgradable' to see them.
    smiley@fmjcod4:~$ sudo apt upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     mongodb-org-database : Depends: mongodb-org-server but it is not installed
                            Depends: mongodb-org-mongos but it is not installed
     mongodb-org-tools : Depends: mongodb-database-tools but it is not installed
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    smiley@fmjcod4:~$ sudo apt --fix-broken install
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Correcting dependencies... Done
    The following packages were automatically installed and are no longer required:
      libboost-program-options1.71.0 libgoogle-perftools4 libpcrecpp0v5 libphobos2-108 libphobos2-108:i386 libsnappy1v5 libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools mongodb-server-core
    Use 'sudo apt autoremove' to remove them.
    The following additional packages will be installed:
      mongodb-database-tools mongodb-org-mongos mongodb-org-server
    The following NEW packages will be installed:
      mongodb-database-tools mongodb-org-mongos mongodb-org-server
    0 upgraded, 3 newly installed, 0 to remove and 22 not upgraded.
    6 not fully installed or removed.
    Need to get 0 B/114 MB of archives.
    After this operation, 386 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    (Reading database ... 198688 files and directories currently installed.)
    Preparing to unpack .../mongodb-org-server_8.0.4_amd64.deb ...
    Unpacking mongodb-org-server (8.0.4) ...
    dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_8.0.4_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3
    dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    Preparing to unpack .../mongodb-org-mongos_8.0.4_amd64.deb ...
    Unpacking mongodb-org-mongos (8.0.4) ...
    dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_8.0.4_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3
    dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    Preparing to unpack .../mongodb-database-tools_100.10.0_amd64.deb ...
    Unpacking mongodb-database-tools (100.10.0) ...
    dpkg: error processing archive /var/cache/apt/archives/mongodb-database-tools_100.10.0_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.6.3-0ubuntu1
    dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    Errors were encountered while processing:
     /var/cache/apt/archives/mongodb-org-server_8.0.4_amd64.deb
     /var/cache/apt/archives/mongodb-org-mongos_8.0.4_amd64.deb
     /var/cache/apt/archives/mongodb-database-tools_100.10.0_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
  • @Sampo2910 can you try stopping the mongodb service then try the update process again? Either use

    Upstart:

    sudo service mongod stop
    

    Or

    Sysvinit:

    sudo /etc/init.d/mongod stop
    
  • Just for the record after I reboot server I can see my page again. But same errors are there.

    I use the method for it form a friend. Its a bit old but still works.

  • @phenomlab

    smiley@fmjcod4:~$ sudo service mongod stop
    Failed to stop mongod.service: Unit mongod.service not loaded.
    smiley@fmjcod4:~$ sudo /etc/init.d/mongod stop
    sudo: /etc/init.d/mongod: command not found
    
    
    smiley@fmjcod4:~$ sudo service mongod stop
    Failed to stop mongod.service: Unit mongod.service not loaded.
    smiley@fmjcod4:~$ sudo service mongodb stop
    smiley@fmjcod4:~$ sudo service mongodb start
    smiley@fmjcod4:~$ mongo
    
    Command 'mongo' not found, but can be installed with:
    
    sudo apt install mongodb-clients
    
    smiley@fmjcod4:~$ sudo apt install mongodb-clients
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2.23) but 1.1.1f-1ubuntu2 is to be installed
     libssl1.1 : Breaks: libssl1.1:i386 (!= 1.1.1f-1ubuntu2) but 1.1.1f-1ubuntu2.23 is to be installed
     libssl1.1:i386 : Breaks: libssl1.1 (!= 1.1.1f-1ubuntu2.23) but 1.1.1f-1ubuntu2 is to be installed
     mongodb-org : Conflicts: mongodb-clients but 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 is to be installed
     mongodb-org-database : Depends: mongodb-org-server but it is not going to be installed
                            Depends: mongodb-org-mongos but it is not going to be installed
                            Conflicts: mongodb-clients but 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 is to be installed
     mongodb-org-database-tools-extra : Conflicts: mongodb-clients but 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 is to be installed
     mongodb-org-shell : Conflicts: mongodb-clients but 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 is to be installed
     mongodb-org-tools : Depends: mongodb-database-tools but it is not going to be installed
                         Conflicts: mongodb-clients but 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 is to be installed
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    
  • @Sampo2910 sorry. Try with mongodb instead of mongo

  • @phenomlab

    I stopped the mongodb ok. The update goes ok but then to upgrade get the following.

    smiley@fmjcod4:~$ sudo apt upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2.23) but 1.1.1f-1ubuntu2 is installed
     libssl1.1 : Breaks: libssl1.1:i386 (!= 1.1.1f-1ubuntu2) but 1.1.1f-1ubuntu2.23 is installed
     libssl1.1:i386 : Breaks: libssl1.1 (!= 1.1.1f-1ubuntu2.23) but 1.1.1f-1ubuntu2 is installed
     mongodb-org-database : Depends: mongodb-org-server but it is not installed
                            Depends: mongodb-org-mongos but it is not installed
     mongodb-org-tools : Depends: mongodb-database-tools but it is not installed
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    smiley@fmjcod4:~$
    
    

    Trying to fix broken install does not work and gives this.

    smiley@fmjcod4:~$ sudo apt --fix-broken install
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Correcting dependencies... Done
    The following packages were automatically installed and are no longer required:
      libboost-program-options1.71.0 libgoogle-perftools4 libpcrecpp0v5 libphobos2-108 libphobos2-108:i386 libsnappy1v5 libtcmalloc-minimal4
      libyaml-cpp0.6 mongo-tools mongodb-server-core
    Use 'sudo apt autoremove' to remove them.
    The following additional packages will be installed:
      libssl1.1 mongodb-database-tools mongodb-org-mongos mongodb-org-server
    The following NEW packages will be installed:
      mongodb-database-tools mongodb-org-mongos mongodb-org-server
    The following packages will be upgraded:
      libssl1.1
    1 upgraded, 3 newly installed, 0 to remove and 22 not upgraded.
    8 not fully installed or removed.
    Need to get 116 MB of archives.
    After this operation, 386 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://fi.archive.ubuntu.com/ubuntu focal-updates/main amd64 libssl1.1 amd64 1.1.1f-1ubuntu2.23 [1,323 kB]
    Get:2 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0/multiverse amd64 mongodb-org-server amd64 8.0.4 [38.6 MB]
    Get:3 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0/multiverse amd64 mongodb-org-mongos amd64 8.0.4 [29.3 MB]
    Get:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0/multiverse amd64 mongodb-database-tools amd64 100.10.0 [46.5 MB]
    Fetched 116 MB in 3s (43.1 MB/s)
    Preconfiguring packages ...
    (Reading database ... 198688 files and directories currently installed.)
    Preparing to unpack .../libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb ...
    Unpacking libssl1.1:amd64 (1.1.1f-1ubuntu2.23) over (1.1.1f-1ubuntu2) ...
    dpkg: error processing archive /var/cache/apt/archives/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb (--unpack):
     trying to overwrite shared '/usr/share/doc/libssl1.1/changelog.Debian.gz', which is different from other instances of package libssl1.1:amd64
    Preparing to unpack .../mongodb-org-server_8.0.4_amd64.deb ...
    Unpacking mongodb-org-server (8.0.4) ...
    dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_8.0.4_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3
    dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    Preparing to unpack .../mongodb-org-mongos_8.0.4_amd64.deb ...
    Unpacking mongodb-org-mongos (8.0.4) ...
    dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_8.0.4_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3
    dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    Preparing to unpack .../mongodb-database-tools_100.10.0_amd64.deb ...
    Unpacking mongodb-database-tools (100.10.0) ...
    dpkg: error processing archive /var/cache/apt/archives/mongodb-database-tools_100.10.0_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.6.3-0ubuntu1
    No apport report written because MaxReports is reached already
                                                                  dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    Errors were encountered while processing:
     /var/cache/apt/archives/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb
     /var/cache/apt/archives/mongodb-org-server_8.0.4_amd64.deb
     /var/cache/apt/archives/mongodb-org-mongos_8.0.4_amd64.deb
     /var/cache/apt/archives/mongodb-database-tools_100.10.0_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
    

    This is the same output with mongodb started or stopped.

  • @Sampo2910 can you switch to root and try again? Seems like a permissions issue.

  • Same output 😞

    Is it possible that there are two mongo instances installed. I think it tried to update. I was using an old version ( 3 something ) which was fine for my needs.

  • @Sampo2910 quite possible, yes. What is the output of

    sudo dpkg -l | grep mongodb
    

    or

    sudo apt list --installed | grep mongodb
    
  • @phenomlab Here is the output for both.

    smiley@fmjcod4:~$ sudo dpkg -l | grep mongodb
    [sudo] password for smiley:
    iU  mongodb-mongosh                            2.3.7                                         amd64        MongoDB Shell CLI REPL Package
    iU  mongodb-org                                8.0.4                                         amd64        MongoDB open source document-oriented database system (metapackage)
    iU  mongodb-org-database                       8.0.4                                         amd64        MongoDB open source document-oriented database system (metapackage)
    iU  mongodb-org-database-tools-extra           8.0.4                                         amd64        Extra MongoDB database tools
    iU  mongodb-org-shell                          8.0.4                                         amd64        MongoDB shell client
    iU  mongodb-org-tools                          8.0.4                                         amd64        MongoDB tools
    rc  mongodb-server                             1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 all          object/document-oriented database (managed server package)
    ii  mongodb-server-core                        1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 amd64        object/document-oriented database (server binaries package)
    smiley@fmjcod4:~$ ^C
    smiley@fmjcod4:~$ sudo apt list --installed | grep mongodb
    
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    
    mongodb-mongosh/focal/mongodb-org/8.0,now 2.3.7 amd64 [installed,automatic]
    mongodb-org-database-tools-extra/focal/mongodb-org/8.0,now 8.0.4 amd64 [installed,automatic]
    mongodb-org-database/focal/mongodb-org/8.0,now 8.0.4 amd64 [installed,automatic]
    mongodb-org-shell/focal/mongodb-org/8.0,now 8.0.4 amd64 [installed,automatic]
    mongodb-org-tools/focal/mongodb-org/8.0,now 8.0.4 amd64 [installed,automatic]
    mongodb-org/focal/mongodb-org/8.0,now 8.0.4 amd64 [installed]
    mongodb-server-core/focal-updates,focal-security,now 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 amd64 [installed,auto-removable]
    
  • It is running but I still cannot do any updates as mentioned.

    smiley@fmjcod4:~$ sudo service mongodb status
    ● mongodb.service - LSB: An object/document-oriented database
         Loaded: loaded (/etc/init.d/mongodb; generated)
         Active: active (running) since Tue 2024-12-31 02:13:22 EET; 1h 8min ago
           Docs: man:systemd-sysv-generator(8)
        Process: 14698 ExecStart=/etc/init.d/mongodb start (code=exited, status=0/SUCCESS)
          Tasks: 34 (limit: 16594)
         Memory: 149.6M
         CGroup: /system.slice/mongodb.service
                 └─14716 /usr/bin/mongod --config /etc/mongodb.conf
    
    Dec 31 02:13:21 fmjcod4 systemd[1]: Starting LSB: An object/document-oriented database...
    Dec 31 02:13:21 fmjcod4 mongodb[14698]:  * Starting database mongodb
    Dec 31 02:13:22 fmjcod4 mongodb[14698]:    ...done.
    Dec 31 02:13:22 fmjcod4 systemd[1]: Started LSB: An object/document-oriented database.
    
  • @Sampo2910 I can take a look at this today at some point. Can you PM me the login details?

  • Repo problem

  • @DownPW Seems not

    Hit:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0 InRelease
    
  • @Sampo2910 This is in fact the issue. From your server, I see

    db version v3.6.8
    git version: 8e540c0b6db93ce994cc548f000900bdc740f80a
    OpenSSL version: OpenSSL 1.1.1f  31 Mar 2020
    allocator: tcmalloc
    modules: none
    build environment:
        distarch: x86_64
        target_arch: x86_64
    

    This is seriously out of date - the current version of MongoDB is 8.x. MongoDB 3.6 was released in November 2017 and reached end of life in April 2021. To upgrade MongoDB from version 3 to version 8, you first need to perform a series of incremental upgrades through intermediate versions like 4 and 7, as you cannot directly jump from 3 to 8 due to significant compatibility changes.

    My suggestion would be as follows

    1. Dump the existing database as a backup.
    2. Completely remove version 3.6 and install MongoDB 8.x.
    3. Recreate the database.
    4. Restore the backed-up database.

    In theory, this is straightforward, but in practice, not so much. The application you are running is 2 years old and may use statements that no longer exist in MongoDB or have been superseded by others. This means that your application may not work correctly, or at all once MongoDB has been updated.

  • @phenomlab

    Hi and thanks for looking.

    I knew that it was all old and outdated so yeah that makes sense. I will have to Google how to do all that. Its just one db. I could always create a new one once updated as there is not so much on this one ( easier I keep it) but still no guarantee this application will work with latest version anyway.

    Easiest is I just leave it and never update 🙂 Its gaming server and for testing only, so maybe no harm done leaving it.

  • @Sampo2910 my only concern around this route is any vulnerabilities exposed due to the lack of support and updates.

  • @phenomlab Well as you seen it was asking to fix broken install.

    I basically forced that.

    sudo apt -o Dpkg::Options::="--force-overwrite" --fix-broken install
    

    I can see you cringing haha. But it seems to have worked. Update was ok and the upgrade bar 2 all worked.

    smiley@fmjcod4:~$ sudo apt update
    [sudo] password for smiley:
    Hit:1 http://fi.archive.ubuntu.com/ubuntu focal InRelease
    Hit:2 http://fi.archive.ubuntu.com/ubuntu focal-updates InRelease
    Hit:3 http://fi.archive.ubuntu.com/ubuntu focal-backports InRelease
    Hit:4 http://fi.archive.ubuntu.com/ubuntu focal-security InRelease
    Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease
    Hit:6 http://ppa.launchpad.net/maxmind/ppa/ubuntu focal InRelease
    Hit:7 http://ppa.launchpad.net/system76-dev/stable/ubuntu focal InRelease
    Hit:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 InRelease
    Hit:9 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0 InRelease
    Hit:10 https://downloads.sourceforge.net/project/d-apt d-apt InRelease
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    2 packages can be upgraded. Run 'apt list --upgradable' to see them.
    smiley@fmjcod4:~$ sudo apt upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    The following packages were automatically installed and are no longer required:
      mongodb-database-tools mongodb-mongosh
    Use 'sudo apt autoremove' to remove them.
    Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
      node-hosted-git-info python2.7-minimal python2.7 node-tar
      python-pkg-resources node-ip libpython2.7-minimal libpython2.7-stdlib
    Learn more about Ubuntu Pro at https://ubuntu.com/pro
    The following packages have been kept back:
      amd64-microcode linux-firmware
    0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
    

    Of course I am fully aware that this is a mess 🙂 But I am limited skill wise. The website can be seen and the data from the games is getting saved so at the moment its ok 🙂 But i like perfect and this is far from it. Hey Ho.

  • @Sampo2910 said in Mongo Completely Broken.:

    I can see you cringing

    Yes, that does make me slightly uncomfortable 😬 but OK.


Related Topics