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

db corruption, after aptly serve PC crash #25

Closed
erickeller opened this Issue Apr 4, 2014 · 6 comments

Comments

Projects
None yet
2 participants
@erickeller
Copy link

erickeller commented Apr 4, 2014

I was running aptly serve and froze my PC with another executable, had to do a hard reboot of my machine, but as a result, I get the following error with any aptly call:

aptly mirror update debian-main
ERROR: can't open database: leveldb/storage: corrupted or incomplete CURRENT file

Is there a simple way to fix this?

@smira

This comment has been minimized.

Copy link
Member

smira commented Apr 4, 2014

@erickeller, could you please compile following program (please change path to point to your database) and try running it. If it fixes DB correctly, I would include it back in aptly as a command:

https://gist.github.com/smira/9977194

I can precompile it for you as well (are you running Linux?)

@smira

This comment has been minimized.

Copy link
Member

smira commented Apr 4, 2014

In order to build it, you need go 1.1+ and GOPATH setup (just create ~/go and export GOPATH=~/go), then put recover.go in any directory and run inside:

go get -d .
go build -o recover recover.go
./recover
@erickeller

This comment has been minimized.

Copy link

erickeller commented Apr 4, 2014

Thanks fort tout answers, indeed i am working under Linux. As my project was experimental I tried to resolve the problem on my own moving the LOCK and CURRENT files, it ended with an empty database ☺so I started over with aptly create mirror which reconstructed the database from the existing files.
Unfortunately I cannot test the command, but will try to reproduce the corruption state in a virtual box...

Cheers

@smira

This comment has been minimized.

Copy link
Member

smira commented Apr 4, 2014

I've tried reproducing that: without CURRENT file database seems to start up in normal way. Next I've corrupted CURRENT file and db was able to recover.

Strange thing is that aptly serve is closing db after startup. So it should be clean.

Anyway, adding aptly db recover seems reasonable enough.

@erickeller

This comment has been minimized.

Copy link

erickeller commented Apr 4, 2014

actually, aptly serve did not close the usual way I guess the hard reset did not leave the db in a clean state!
Thanks for adding the command, I will try it out in case I have the same effect.

@smira smira added this to the v0.5 milestone Apr 4, 2014

@smira smira added the enhancement label Apr 4, 2014

smira added a commit that referenced this issue Apr 5, 2014

smira added a commit that referenced this issue Apr 5, 2014

smira added a commit that referenced this issue Apr 6, 2014

@smira

This comment has been minimized.

Copy link
Member

smira commented Apr 6, 2014

Command aptly db recover implemented in master.

@smira smira closed this Apr 6, 2014

smira added a commit that referenced this issue Apr 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment