-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
Updating breaks Lychee #1192
Comments
Hi, Sorry for the break :( Is there any way you can send us the dump of your database so we can figure out what is wrong ? |
Yes, I can send the database. Is it possible to create some kind of 'trace' for you while I rerun the update? |
I assume you did the migration via the UI, if so there is no possible trace. However, if you have access to command line, you may want to try to run the update manually via: |
Yes, I have command line access. (oh before I forget: no worries about the breaking. I really like Lychee, and these things can happen) |
This is also why this is only released on master and not an official release zip yet. :) See more of the change log here: https://lycheeorg.github.io/docs/releases.html#master-branch |
sudo -u www php artisan migrate Nothing to migrate. |
O.o This does not match with your diagnostics: while it should be :
|
I have rolled back to a working system. But I guess you know that. diagnostics still says:
|
hummmm. Not normal. |
If I now run the command, I get: sudo -u www php artisan migrate Migrating: 2021_12_04_181200_refactor_models In Connection.php line 705: SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'lychee.sym_links' (SQL: drop table In Connection.php line 494: SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'lychee.sym_links' |
That is definitively NOT normal. |
in 4.4 there should be admin in the database. |
should there be a 'admin' user in the users-table? there are 2 users there. id 0, wih a 'hashed' username and id 1 (a guest user) |
user with id 0 with hashed username is the admin user. |
Is there anything else I can try or run to give you more insight? |
@nagmat84 :/ |
Honestly, I hate that whole "update from the webinterface" thing; if it works, it works, but if it fails, who knows why? Since you have the commandline access, can you do all of it that way please and send us the logs? That will be much more useful... Basically, revert the Lychee tree to the last working state (I assume that's commit a7de020 for you; check with |
sudo -u www git log --oneline -1 sudo -u www git status Untracked files: nothing added to commit but untracked files present (use "git add" to track) git pull --rebase
Discovered Package: bepsvpt/secure-headers
Migrating: 2021_12_04_181200_refactor_models In 2021_12_04_181200_refactor_models.php line 1116: Undefined array key 15023691398618 \n\033[38;5;010mpost merge hook finish\033[0m\n |
That is bad. That part there, that's why it is crashing. |
I might have an idea, why it fails, but it is a guess. Please follow the following steps again (sorry for your taking your time).
If it still fails, then please provide me with a copy of your database. I am happy to help out. But I assume, that the problem stems from a missing step 5 or 6. An ID-related problem smells like that. @ildyria Does the web installer ensures step 5 and 6? I am not sure about that. |
|
|
@oblomow Can you check if you have an album with id |
No, it isn't. The important part is actually |
@kamil4 select * from albums where id=15023691398618 \G |
@oblomow As I suspected. So now do this (on a DB instance before updating to the latest version):
Hopefully that's the only such offender, but if not, you may need to do it repeatedly for the album IDs that fail... |
sudo -u www git pull
Discovered Package: bepsvpt/secure-headers
Migrating: 2021_12_04_181200_refactor_models In 2021_12_04_181200_refactor_models.php line 1116: Undefined array key 15023691398618 \n\033[38;5;010mpost merge hook finish\033[0m\n |
will do that. I will first restore the working situation. |
It seems that there are more users than I expected which fiddled with their database manually and - as we had no foreign constraints until now - broke it. Given my previous post, I start working on an improved version of the migration which first checks, whether there are any inconsistencies and which will terminate the migration with an error if it finds inconsistencies. |
@nagmat84 It makes me wonder if we should add such sanity check to the DB migration file and either delete the offenders or bail out early before leaving the DB in an (even more) inconsistent state? |
@kamil4 this should be added in the Diagnostic page. |
I never fiddled with my database. However I am a long term Lychee user, enduring many updates, upgrades and migrations. Perhaps migrating to the 'new' Lychee introduced an error. |
SELECT * FROM user_album WHERE album_id NOT IN (SELECT id FROM albums); |
No, but it is quite possible you shared album with id 15023691398618 to user 1, and then deleted said album and the database did not update. |
the last update didn't crash it. Thanks guys for all your quick support! If you're in the neighbourhood and the pubs are open again I will you buy you a beer!
|
I think @ildyria is in Nijmegen. The rest of us are all over the world 😃. Glad to hear it worked! |
HA! That's easy. I'm in Nijmegen as well. |
@oblomow Out of curiousity how old is your DB instance? I'm wondering about those album IDs like @ildyria Don't we have some DB magic in place that deletes said records form |
@kamil4 I don't know. Quite old. That's for sure. If you really want to know, I can start digging. |
I am not ildyria, but no, we had not. This was also fixed with my huge PR. Before that there was a comment which said basically something like "oh, oh, I wonder what happens with the albums owned by this user" above the line which deleted a user. I think, we know the answer. |
@oblomow No worries, don't bother. I simply thought at first that you generated those short IDs while manually editing the database but when you denied I remembered that I've seen such short album IDs before -- on our home page no less! We really should regenerate our screenshots -- what we have there is museum-grade at this point 😉. They are pretty pictures though... |
@oblomow then you should know that there bar and restaurants are still closed. :'D |
@ildyria " If you're in the neighbourhood and the pubs are open again I will you buy you a beer!" |
read too fast. |
* Checks DB consistency * add checks and don't break check on old version * fix bug * remove commented code * synch front while we are at it. * remove corruption check from diagnostics, it is done in the migration. * Added auto-fix. Co-authored-by: ildyria <[email protected]>
Sorry to rain on you parade, but I have the exact same problem while trying to update today. I'm comming from the exact same git revision. I read this whole thread, but have no orphaned album entries. My install is also very old, comming from before the fork (version 2.x maybe ?) and switch to laravel. The query Here are my diagnostic, and git pull output. `
`git pull --rebase
post merge hook start --no-dev mode detected composer install --no-dev --prefer-dist --no-suggest Deprecated: Required parameter $path follows optional parameter $schema in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php on line 62 Deprecated: Required parameter $path follows optional parameter $schema in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php on line 108 Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84 In 2021_12_04_181200_refactor_models.php line 2076: Interface "Kalnoy\Nestedset\Node" not found post merge hook finish Current branch master is up to date.` |
Your problem seems to have a complete different cause. Migration fails not due your DB being inconsistent, but because
Unfortunately, I am not a composer expert. But I would recommend
|
Must have missed running it as www-data user on a previous update and it seems to have broken. I do a backup and will run the commands you said, while being careful of the user. Thanks for your hellp, I will report soon. |
Seems like the composer verion on debian 10, in repositories is version 1.x and we need 2.x. Can you please confirm that ? If that's the case, I'll need to update that, and maybe you'll need to put checks on composer version in Leechy. |
Yes, I can confirm. Generally, it is not recommended to use a system-wide composer executable. Even on a rolling-release system like mine (Gentoo), these packages are ridiculously out-dated. Usually, you should use a local, project-specific composer installation. I try to provide you the necessary steps. If this still does not help, we should take this conversation to Gitter. We should stop to hijack this thread. Your problem has nothing to do with the problem of the OP. In particular it is not a Lychee issue, but your personal problem due to an ancient server installation ;-) |
No worries, I updated Composer myself and doing tests. I should be ok. If you have no news from me, assume, it went nicely. Sorry for the thread hijack. |
I assume that your installation resides in
|
Thanks for the guide. I updated composer manualy and updated components. then ran the update and all went well at first glance. Thanks for your time ! If I have other problems i'll create a new issue. |
Thank you @nagmat84 - can you please add this fix to the Wiki or main Doc site as it affected me and probably others as well? |
Detailed description of the problem
Updating breaks Lychee. ( thank $deity for backups and databasedumps)
Steps to reproduce the issue
Steps to reproduce the behavior:
Screenshots
If applicable, add screenshots to help explain your problem.
Output of the diagnostics
Diagnostics
Info: Latest version of PHP is 8.1
System Information
Lychee Version (git): master (a7de020) - Up to date (13 hours ago).
DB Version: 4.4.0
composer install: --no-dev
APP_ENV: local
APP_DEBUG: false
System: FreeBSD
PHP Version: 8
PHP User agent: Lychee/4 (https://lycheeorg.github.io/)
Max uploaded file size: 100M
Max post size: 100M
Max execution time: 0
MySQL Version: 8.0.27
Imagick: 1
Imagick Active: 1
Imagick Version: 1692
GD Version: 2.3.1
Config Information
version: 040400
check_for_updates: 1
sorting_Photos_col: taken_at
sorting_Photos_order: ASC
sorting_Albums_col: title
sorting_Albums_order: DESC
imagick: 1
skip_duplicates: 0
small_max_width: 0
small_max_height: 360
medium_max_width: 1920
medium_max_height: 1080
lang: en
layout: 1
image_overlay_type: date
default_license: none
compression_quality: 90
full_photo: 1
delete_imported: 0
Mod_Frame: 1
Mod_Frame_refresh: 30
thumb_2x: 1
small_2x: 1
medium_2x: 1
landing_page_enable: 1
landing_owner: Marc
landing_title: Marc
landing_subtitle: Why stop now?
landing_facebook:
landing_flickr:
landing_twitter:
landing_instagram:
landing_youtube:
landing_background: dist/finland.jpg
site_title: fotos
site_copyright_enable: 1
site_copyright_begin: 1984
site_copyright_end: 2021
additional_footer_text:
display_social_in_gallery: 0
public_search: 0
SL_enable: 0
SL_for_admin: 0
public_recent: 0
recent_age: 1
public_starred: 0
downloadable: 0
photos_wraparound: 1
map_display: 0
zip64: 1
map_display_public: 0
map_provider: OpenStreetMap.org
force_32bit_ids: 0
map_include_subalbums: 0
update_check_every_days: 3
has_exiftool: 1
share_button_visible: 0
import_via_symlink: 0
has_ffmpeg: 0
location_decoding: 0
location_decoding_timeout: 30
location_show: 0
location_show_public: 0
rss_enable: 0
rss_recent_days: 7
rss_max_items: 100
prefer_available_xmp_metadata: 0
editor_enabled: 1
lossless_optimization: 0
swipe_tolerance_x: 150
swipe_tolerance_y: 250
local_takestamp_video_formats: .avi|.mov
log_max_num_line: 1000
unlock_password_photos_with_url_param: 0
nsfw_visible: 1
nsfw_blur: 0
nsfw_warning: 0
nsfw_warning_admin: 0
map_display_direction: 1
album_subtitle_type: oldstyle
upload_processing_limit: 4
public_photos_hidden: 1
new_photos_notification: 0
Browser and system
Browser: Firefox 96.0
The text was updated successfully, but these errors were encountered: