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

Upgrade from 1.20.0-rc0 to 1.20.0 fails: Deprecated fallback present #25915

Closed
hkdd opened this issue Jul 16, 2023 · 22 comments
Closed

Upgrade from 1.20.0-rc0 to 1.20.0 fails: Deprecated fallback present #25915

hkdd opened this issue Jul 16, 2023 · 22 comments
Labels
issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea

Comments

@hkdd
Copy link

hkdd commented Jul 16, 2023

Description

I just did a docker pull of :latest and docker-compose down/up the container and I get this. I was able to resolve by pinning it to 1.20.0-rc0 but 1.20.0-rc1 and rc2 failed as well as :latest which is currently 1.20.0.

Attaching to gitea_web
gitea_web | 2023/07/16 22:51:24 ...s/setting/setting.go:180:loadRunModeFrom() [F] Gitea is not supposed to be run a
s root. Sorry. If you need to use privileged TCP ports please instead use setcap and the cap_net_bind_service permission
gitea_web | Server listening on :: port 22.
gitea_web | Server listening on 0.0.0.0 port 22.
gitea_web | 2023/07/16 22:51:24 ...g/config_provider.go:327:deprecatedSettingFatal() [F] Deprecated fallback [serv er] LFS_CONTENT_PATH present. Use [lfs] PATH instead. This fallback will be/has been removed in v1.19.0
gitea_web | Received signal 15; terminating.
gitea_web | 2023/07/16 22:51:24 ...s/setting/setting.go:180:loadRunModeFrom() [F] Gitea is not supposed to be run a
s root. Sorry. If you need to use privileged TCP ports please instead use setcap and the cap_net_bind_service permission
gitea_web | Server listening on :: port 22.
gitea_web | Server listening on 0.0.0.0 port 22.
gitea_web | 2023/07/16 22:51:25 ...g/config_provider.go:327:deprecatedSettingFatal() [F] Deprecated fallback [serv er] LFS_CONTENT_PATH present. Use [lfs] PATH instead. This fallback will be/has been removed in v1.19.0
gitea_web | Received signal 15; terminating.
gitea_web | 2023/07/16 22:51:25 ...s/setting/setting.go:180:loadRunModeFrom() [F] Gitea is not supposed to be run a
s root. Sorry. If you need to use privileged TCP ports please instead use setcap and the cap_net_bind_service permission
gitea_web | Server listening on :: port 22.
gitea_web | Server listening on 0.0.0.0 port 22.
gitea_web | 2023/07/16 22:51:25 ...g/config_provider.go:327:deprecatedSettingFatal() [F] Deprecated fallback [serv er] LFS_CONTENT_PATH present. Use [lfs] PATH instead. This fallback will be/has been removed in v1.19.0
gitea_web | Received signal 15; terminating.
gitea_web | 2023/07/16 22:51:26 ...s/setting/setting.go:180:loadRunModeFrom() [F] Gitea is not supposed to be run a
s root. Sorry. If you need to use privileged TCP ports please instead use setcap and the cap_net_bind_service permission
gitea_web | Server listening on :: port 22.
gitea_web | Server listening on 0.0.0.0 port 22.
gitea_web | 2023/07/16 22:51:26 ...g/config_provider.go:327:deprecatedSettingFatal() [F] Deprecated fallback [serv er] LFS_CONTENT_PATH present. Use [lfs] PATH instead. This fallback will be/has been removed in v1.19.0
gitea_web | Received signal 15; terminating.

Gitea Version

1.20.0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

1.20.0

Operating System

EL8

How are you running Gitea?

docker

Database

None

@hkdd hkdd added the type/bug label Jul 16, 2023
@delvh
Copy link
Member

delvh commented Jul 16, 2023

The error message tells you explicitly what you need to do:

Deprecated fallback [server].LFS_CONTENT_PATH present. Use [lfs].PATH instead. This fallback has been removed in v1.19.0

So, go to your app.ini and change that.

@delvh delvh added issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea and removed type/bug labels Jul 16, 2023
@delvh delvh changed the title Upgrade from 1.20.0-rc0 to 1.20.0 fails Upgrade from 1.20.0-rc0 to 1.20.0 fails: Deprecated fallback present Jul 16, 2023
KN4CK3R added a commit that referenced this issue Jul 17, 2023
Got the same problem as #25915 when updating an instance. The
`log.Fatal` should have been marked as breaking in #23911.

This PR adds a notice that the system is shutting down because of the
deprecated setting.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jul 17, 2023
Got the same problem as go-gitea#25915 when updating an instance. The
`log.Fatal` should have been marked as breaking in go-gitea#23911.

This PR adds a notice that the system is shutting down because of the
deprecated setting.
silverwind pushed a commit that referenced this issue Jul 17, 2023
Backport #25920 by @KN4CK3R

Got the same problem as #25915 when updating an instance. The
`log.Fatal` should have been marked as breaking in #23911.

This PR adds a notice that the system is shutting down because of the
deprecated setting.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
@eallion
Copy link

eallion commented Jul 18, 2023

same

@TWDickson
Copy link

TWDickson commented Jul 18, 2023

The error message tells you explicitly what you need to do:

Deprecated fallback [server].LFS_CONTENT_PATH present. Use [lfs].PATH instead. This fallback has been removed in v1.19.0

So, go to your app.ini and change that.

If you’re just using docker without any sort of config file how would you change it?

Edit: My /data directory exists on a docker volume and the image won't start due to this error, it's a pretty breaking change for users who had their configs from previous installations.

@stoofz
Copy link

stoofz commented Jul 18, 2023

Same issue as above in regards to updated Docker

@x86dev
Copy link

x86dev commented Jul 18, 2023

Just also reproduced this -- pulling the 1.20 container breaks, whereas pinning to 1.20.0-rc0 makes it work again. So something screwed up in the built container.

@ternium1
Copy link

Having the same issue, did this to app.ini solved it:

Old app.ini:

[server]
APP_DATA_PATH=/data/gitea
...
LFS_START_SERVER=true
LFS_CONTENT_PATH=/data/git/lfs
LFS_JWT_SECRET=xxx

New app.ini:

[lfs]
PATH=/data/git/lfs


[server]
APP_DATA_PATH=/data/gitea
...
LFS_START_SERVER=true
LFS_JWT_SECRET=xxx

@realies
Copy link

realies commented Jul 19, 2023

what a weird change

@x86dev
Copy link

x86dev commented Jul 19, 2023

That fix does not work if you use the default container with no custom app.ini.

@GhaziTriki
Copy link

Working after deprecated configuration update.

@hkdd
Copy link
Author

hkdd commented Jul 19, 2023

The error message tells you explicitly what you need to do:

Deprecated fallback [server].LFS_CONTENT_PATH present. Use [lfs].PATH instead. This fallback has been removed in v1.19.0

So, go to your app.ini and change that.

So for anyone else who runs into this, my solution was to just remove LFS_CONTENT_PATH. Creating a [lfs] ini header and a PATH variable doesn't resolve the problem. It will still fail because of the deprecated LFS_CONTENT_PATH, despite the alternative existing. So I ended up just removing the LFS_CONTENT_PATH line from the [server] section and was able to pull/run 1.20.0 successfully.

@x86dev
Copy link

x86dev commented Jul 19, 2023

The cause and the solution is clear, but the container image just isn't up-to-date ;-)

@delvh
Copy link
Member

delvh commented Jul 19, 2023

Yes. This warning is explicitly meant to notify admins that such config options no longer have any effect.
This prevents the situation that settings are no longer in effect that admins thought they set.
That's why this warning is crashing Gitea as intended when the setting is present.

After all, there are three ways to handle breaking config changes (that I see as viable):

  1. Annoy admins slightly whenever they upgrade to fix their now outdated config to keep up to date
  2. Carry old config options for quite a while and annoy admins a lot by removing all legacy options for several releases at once
  3. Carry all old config options forever, and make the code effectively unmaintainable and unpredictable

Gitea currently chooses option 1..
I didn't go into detail about this error message previously in this issue as I thought my previous comment would suffice to let you know what happened, and how you can fix it.
Apparently I was wrong here. Sorry about that.

Regarding the Docker users:
If I've understood it correctly, there seems to be another issue in that the default Docker file comes with an app.ini that still sets a removed setting, right?
If that's the case, then that's a bug we should fix.

@TWDickson
Copy link

Regarding the Docker users:
If I've understood it correctly, there seems to be another issue in that the default Docker file comes with an app.ini that still sets a removed setting, right?
If that's the case, then that's a bug we should fix

That’s my exact scenario, my docker-compose has no app.ini supplied and the /data directory is just set to a docker volume.

@delvh
Copy link
Member

delvh commented Jul 19, 2023

What config option is breaking the docker container exactly?
I can't find [server].LFS_CONTENT_PATH inside https://github.com/go-gitea/gitea/blob/ad4c09b59f1657a5400c92913972e4cca578a4fb/docker/root/etc/templates/app.ini, and the last commit on this file indicated that the setting was renamed, and that commit was 18 months ago.

@stoofz
Copy link

stoofz commented Jul 19, 2023

Was able to update by rolling back to version 1.20.0-rc0 to be able to boot up the docker, then console in to edit the app.ini and added the [lfs] section and moving the PATH there while removing it from the [server] section. Now I am able to update and use the current docker image.

[lfs]
PATH=/data/git/lfs

[server]
APP_DATA_PATH=/data/gitea
...
LFS_START_SERVER=true
LFS_JWT_SECRET=xxx

@KN4CK3R
Copy link
Member

KN4CK3R commented Jul 20, 2023

You can edit the files in the volume even if the container is not running.

@chascode
Copy link

Does LFS_START_SERVER and LFS_JWT_SECRET still belong in the [server] section?

@ternium1
Copy link

ternium1 commented Jul 20, 2023 via email

@timbze
Copy link

timbze commented Jul 25, 2023

What config option is breaking the docker container exactly? I can't find [server].LFS_CONTENT_PATH inside https://github.com/go-gitea/gitea/blob/ad4c09b59f1657a5400c92913972e4cca578a4fb/docker/root/etc/templates/app.ini, and the last commit on this file indicated that the setting was renamed, and that commit was 18 months ago.

The setting is there for containers that have been created before the setting was removed. I finally found /var/lib/docker/volumes/gitea_gitea/_data/gitea/conf/app.ini. I removed the setting and now I can start the container. (my last upgrade where it broke was from 1.19.0 to 1.20.1)

@Peter-Hageman
Copy link

changing app.ini didn't help. going back to 1.18.0 did :(

@delvh
Copy link
Member

delvh commented Jul 26, 2023

Why not?
Were there additional fatal warnings?
Or did you modify the wrong config file?

@lunny
Copy link
Member

lunny commented Jul 26, 2023

I think this could be closed since #26094 merged which will be in the following v1.20.2 after #26154 merge.

lunny added a commit that referenced this issue Jul 26, 2023
… file (#26094) (#26154)

backport #26094 
Temporily resolve #25915
Related #25994

This PR includes #26007 's changes but have a UI to prompt administrator
about the deprecated settings as well as the log or console warning.
Then users will have enough time to notice the problem and don't have
surprise like before.

<img width="1293" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/c33355f0-1ea7-4fb3-ad43-cd23cd15391d">
@lunny lunny closed this as completed Jul 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea
Projects
None yet
Development

No branches or pull requests