LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   MongoDB gpg and repository not working full [Dumb question but needed] (https://www.linuxquestions.org/questions/debian-26/mongodb-gpg-and-repository-not-working-full-%5Bdumb-question-but-needed%5D-4175726039/)

naarter 06-15-2023 09:46 AM

MongoDB gpg and repository not working full [Dumb question but needed]
 
I am trying to install and set up mongodb which you probably already know is difficult as it is. I am running Debian 12 and decided to use it as my main driver whether I like it or not until Debian 13 comes out because I am sick of switching distro's. I ran the following:

Code:

root@mia:/home/noach# sudo apt-get install gnupg
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gnupg is already the newest version (2.2.40-1.1).
0 upgraded, 0 newly installed, 0 to remove and 67 not upgraded.
root@mia:/home/noach# curl -fsSL https://pgp.mongodb.com/server-6.0.asc | \
  sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \
  --dearmor
root@mia:/home/noach# sudo apt-get install -y mongodb-org

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package mongodb-org
root@mia:/home/noach# echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
deb [ signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main
root@mia:/home/noach# sudo apt-get update
Hit:1 https://deb.nodesource.com/node_20.x bookworm InRelease
Ign:2 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 InRelease   
Hit:3 http://plug-mirror.rcac.purdue.edu/debian bookworm InRelease           
Hit:4 http://plug-mirror.rcac.purdue.edu/debian bookworm-updates InRelease   
Get:5 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 Release [2,036 B]
Get:6 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 Release.gpg [801 B]
Hit:7 http://apt.postgresql.org/pub/repos/apt bookworm-pgdg InRelease         
Hit:8 https://packages.microsoft.com/repos/vscode stable InRelease           
Get:9 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0/main amd64 Packages [23.9 kB]
Ign:10 http://security.debian.org/debian-security bookworm-security InRelease 
Ign:10 http://security.debian.org/debian-security bookworm-security InRelease
Ign:10 http://security.debian.org/debian-security bookworm-security InRelease
Err:10 http://security.debian.org/debian-security bookworm-security InRelease
  Connection failed [IP: 199.232.162.132 80]
Fetched 26.8 kB in 2min 37s (170 B/s)
Reading package lists... Done
W: Failed to fetch http://security.debian.org/debian-security/dists/bookworm-security/InRelease  Connection failed [IP: 199.232.162.132 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
N: Repository 'Debian bookworm' changed its 'firmware component' value from 'non-free' to 'non-free-firmware'
N: More information about this can be found online in the Release notes at: https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.html#non-free-split
root@mia:/home/noach# sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree... Done
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:
 mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.1) but it is not installable
 mongodb-org-server : Depends: libssl1.1 (>= 1.1.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
root@mia:/home/noach#

I created a small guide to follow and tell me if it is correct but I suppose:

1. **Import the MongoDB public GPG Key:**

MongoDB packages are signed with the MongoDB public GPG Key. GPG keys ensure that the packages are authentic and have not been tampered with. You need to import this key. Run the following command:

```bash
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
```

This command retrieves the MongoDB GPG key and adds it to your apt sources.

2. **Create a list file for MongoDB:**

You need to point apt to the official MongoDB repository. Do this by creating a new source list file for MongoDB. Issue the following command:

```bash
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
```

Here, we're telling apt that we want to use the MongoDB repository. This command creates a new source list file for MongoDB at `/etc/apt/sources.list.d/mongodb-org-4.4.list`.

3. **Reload local package database:**

Now you need to reload the local package database to include the MongoDB repository. You do this with the following command:

```bash
sudo apt-get update
```

4. **Install MongoDB:**

Now, you can install MongoDB. To do so, run the following command:

```bash
sudo apt-get install -y mongodb-org
```

This command installs the latest stable version of MongoDB. If you want to install a specific version, replace `mongodb-org` with `mongodb-org=4.4.10` (or your desired version).

5. **Start MongoDB:**

MongoDB doesn't start automatically after it's installed. To start it, use the following command:

```bash
sudo systemctl start mongod
```

If you also want MongoDB to start when your system boots, use this command:

```bash
sudo systemctl enable mongod
```

6. **Verify MongoDB is running:**

You can verify that MongoDB has started successfully by checking the status:

```bash
sudo systemctl status mongod
```

If MongoDB started successfully, the `mongod` status message displays `active (running)`.

7. **Issues that could arise:**

- If the MongoDB GPG key does not get imported properly, you will get an error when you try to reload the package database or install MongoDB. Always ensure that the key import command does not return any errors.

- If MongoDB does not start, or it fails to enable at boot, check the MongoDB logs for any error messages. The logs are typically located in `/var/log/mongodb/`.

- When installing MongoDB, if you get an error that the package `mongodb-org` could not be found, it could mean that the MongoDB repository is not in your source list, or the package database has not been updated.

By following these steps, you should have MongoDB installed and running on your Debian system.


This is not the first time I got errors related to gpg keys and the repository and I think with Debian 12 being very new it may pose an issue. What is your opinion on why this isn't working?

boughtonp 06-15-2023 10:00 AM


 
What's with all the bold text, asterisks, and triple backticks?

The documentation one should follow for installing MongoDB on Debian is:
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian

The key bit of that page is:
Quote:

MongoDB 6.0 Community Edition supports the following 64-bit Debian releases on x86_64 architecture:

Debian 11 "Bullseye"

Debian 10 "Buster"
i.e. Debian 12 is not supported.

You need to raise an issue with MongoDB Inc and ask them to provide Debian 12 support.

(Or switch to software that comes native with Debian.)


naarter 06-15-2023 03:04 PM

Quote:

Originally Posted by boughtonp (Post 6436662)
What's with all the bold text, asterisks, and triple backticks?

The documentation one should follow for installing MongoDB on Debian is:
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian

The key bit of that page is:


i.e. Debian 12 is not supported.

You need to raise an issue with MongoDB Inc and ask them to provide Debian 12 support.

(Or switch to software that comes native with Debian.)


Ugh, do you honestly think mongodb won't be supported in Debian lol? Debian is only a few days old. From a technical point of view what do you think? Like, idk,

boughtonp 06-16-2023 08:34 AM


 
I did not say it wont be supported.

The documentation states that MongoDB 6 is supported in Debian 10 and Debian 11. It does not list Debian 12. I have no idea whether that will change.

Your attempt to install it from Mongo's Buster or Bullseye packages fails because, as the error text states, those packages have dependencies that do not exist in Debian 12. MongoDB Inc have chosen not to release a MongoDB package for Bookworm (Debian 12).

Debian is not only a few days old. Debian Bookworm has been available for testing for close to two years, it was frozen six months ago to give plenty of time for those wanting to support it to test their software and finalize any necessary changes regarding package versions. The June release date was confirmed back in April.

In other words, there has been enough opportunity for MongoDB Inc to prepare a Bookworm package before Debian 12 was released, but they have not done that.

Will they do it eventually? Who knows? The developers of the software know. If you want to know too, you should ask the developers of the software. i.e. Mongo Inc.


Ultimately there are three options:
* Do nothing and hope the situation changes.
* Try to accelerate things, by making sure the developer is aware of the issue, and that people care about it.
* Use alternative software.

Putting the error into a search engine shows the same failed dependency occurred when Ubuntu 22.04 LTS was released - it was about six months before an updated package was released for that. (I wonder what proportion of that time was because nobody reported the issue...?)



All times are GMT -5. The time now is 01:15 AM.