Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerized BaGet Failing to Open Database File #729

Open
jorge-barreto opened this issue Mar 24, 2022 · 2 comments
Open

Dockerized BaGet Failing to Open Database File #729

jorge-barreto opened this issue Mar 24, 2022 · 2 comments

Comments

@jorge-barreto
Copy link

Describe the bug

First time user here. I ran through the steps outlined in the Docker installation steps, but was unable to get BaGet running.

To Reproduce

A full bash log follows:

[jbarreto@fedora baget]$ ls
baget-data  baget.env
[jbarreto@fedora baget]$ cat baget.env
# The following config is the API Key used to publish packages.
# You should change this to a secret value to secure your server.
ApiKey=NUGET-SERVER-API-KEY

Storage__Type=FileSystem
Storage__Path=/var/baget/packages
Database__Type=Sqlite
Database__ConnectionString=Data Source=/var/baget/baget.db
Search__Type=Database
[jbarreto@fedora baget]$ docker pull loicsharma/baget
Using default tag: latest
latest: Pulling from loicsharma/baget
Digest: sha256:7ed7bdc3d29bb5145d69d1ca73b7c5fd4a34f72dd8b2810c907a6703b172b8ba
Status: Image is up to date for loicsharma/baget:latest
docker.io/loicsharma/baget:latest
[jbarreto@fedora baget]$ docker run --rm --name nuget-server -p 5555:80 --env-file baget.env -v "$(pwd)/baget-data:/var/baget" loicsharma/baget:latest
fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
      An error occurred using the connection to database 'main' on server '/var/baget/baget.db'.
Unhandled exception. Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 14: 'unable to open database file'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteConnection.Open()
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
   at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteDatabaseCreator.Create()
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.CreateAsync(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.MigrateAsync(String targetMigration, CancellationToken cancellationToken)
   at BaGet.Core.AbstractContext`1.RunMigrationsAsync(CancellationToken cancellationToken) in /src/BaGet.Core/Entities/AbstractContext.cs:line 36
   at BaGet.Web.IHostExtensions.RunMigrationsAsync(IHost host, CancellationToken cancellationToken) in /src/BaGet.Web/Extensions/IHostExtensions.cs:line 35
   at BaGet.Program.<>c__DisplayClass0_0.<<Main>b__1>d.MoveNext() in /src/BaGet/Program.cs:line 52
--- End of stack trace from previous location where exception was thrown ---
   at McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.<>c__DisplayClass9_0.<<OnExecuteAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at BaGet.Program.Main(String[] args) in /src/BaGet/Program.cs:line 55
   at BaGet.Program.<Main>(String[] args)

Expected behavior

I expected BaGet to run :)

Additional context

OS: Fedora release 35 (Thirty Five) x86_64 
Kernel: 5.16.16-200.fc35.x86_64 

Please let me know if there are any other details I can include.

@RiftDay
Copy link

RiftDay commented Apr 4, 2022

Hi Jorge,

Seems like I ran into the same problem (but on Rocky Linux).

You probably installed docker with dnf install docker as I previously did.

Removing it with dnf rm docker (beware, I had no images I wanted to keep at the time, I have no idea if they will get permanently deleted) then installing it from the docker repository solved all my problems.

I followed the instructions here:

  • sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
  • sudo dnf update
  • sudo dnf install docker-ce docker-ce-cli containerd.io
  • sudo systemctl enable docker
  • sudo systemctl start docker

Doing so solved our problems and other random ones that I had with other images. I guess a lot of errors could pop in our initial configuration with no clue leading to this “bad” installation, making this problem quite hard to troubleshoot…

Hoping it solves your problems and other’s!

@jorge-barreto
Copy link
Author

Hey @RiftDay, thanks for the response. There seem to be similar instructions on Docker's official install docs for Fedora.

This is strange because I use Docker on a day-to-day basis w/out any other sort of issue. I will attempt the quoted instructions soon, but just want to note that these are the packages which dnf bids me to remove (plus dependencies):

container-selinux - noarch - 2:2.180.0-1.fc35
moby-engine       - x86_64 - 20.10.12-1.fc35

It makes me wonder if there is a bug in the moby-engine package, which I thought was the upstream to Docker's official repos. I do notice, eg, that moby-engine is still on 20.10.12-1, whereas the official repo is up to 20.10.14.

Will update when I know more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants