Skip to content

SSH keeps restarting / receiving signal 15 (and DISABLE_SSH does not work) #12592

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

Closed
Piscator74 opened this issue Aug 24, 2020 · 9 comments
Closed

Comments

@Piscator74
Copy link

I've just setup the latest gitea version (and version 1.12.3) with a docker image following the instructions at:
https://docs.gitea.io/en-us/install-with-docker/. All the mapped data folders / mysql folders are created from scratch (so no prior data)

I have used the following docker compose:

version: "2"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:1.12.3
    environment:
      - USER_UID=0
      - USER_GID=0
      - DB_TYPE=mysql
      - DB_HOST=db:3306
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=XXXXXXXXXX
      - DOMAIN=mydomain
      - ROOT_URL=http://mydomain:3000/
    restart: always
    networks:
      - gitea
    volumes:
      - /share/docker/gitea/data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
       - "3000:3000"
       - "20122:22"
    depends_on:
      - db

  db:
    image: mysql:5.7
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=XXXXXXXXXX
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=XXXXXXXXXX
      - MYSQL_DATABASE=gitea
    networks:
      - gitea
    volumes:
      - /share/docker/gitea/mysql:/var/lib/mysql

The log shows the following (ssh keeps restarting, sometimes signal 15)

server_1  | Received signal 15; terminating.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Received signal 15; terminating.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Received signal 15; terminating.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Received signal 15; terminating.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Received signal 15; terminating.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | Received signal 15; terminating.
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.

I have tried plenty of things, but the following does not make any difference.

  • Signal 15? #10422. Deleted /data/queues, no difference.
  • I started out with an account that had limited permissions (different UID / GID), so I also did retry with root UID, no difference.
  • I tried disabling the SSH server with DISABLE_SSH=true, no difference.
  • I tried different versions (latest and 1.12.3)

Any suggestions how I can debug where this problem is coming from or how I can fix it?

Thanks

@zeripath
Copy link
Contributor

What does your app.ini look like?

The default docker runs opensshd and should not have START_SSH_SERVER set.

@Piscator74
Copy link
Author

Piscator74 commented Aug 24, 2020

I did not make any changes to app.ini. It is generated from the docker yml file.
Setting START_SSH_SERVER to false (which is the default) makes no difference.

APP_NAME = Gitea: Git with a cup of tea
RUN_MODE = dev

[repository]
ROOT = /data/git/repositories

[repository.local]
LOCAL_COPY_PATH = /data/gitea/tmp/local-repo

[repository.upload]
TEMP_PATH = /data/gitea/uploads

[server]
APP_DATA_PATH    = /data/gitea
DOMAIN           = mydomain
SSH_DOMAIN       = localhost
HTTP_PORT        = 3000
ROOT_URL         = http://mydomain:3000/
DISABLE_SSH      = true
SSH_PORT         = 22
SSH_LISTEN_PORT  = 22
LFS_START_SERVER = false
LFS_CONTENT_PATH = /data/git/lfs

[database]
PATH    = /data/gitea/gitea.db
DB_TYPE = mysql
HOST    = db:3306
NAME    = gitea
USER    = gitea
PASSWD  = jDHq8uMU2EE5sLP8sZW1

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

[session]
PROVIDER_CONFIG = /data/gitea/sessions

[picture]
AVATAR_UPLOAD_PATH            = /data/gitea/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars

[attachment]
PATH = /data/gitea/attachments

[log]
ROOT_PATH = /data/gitea/log

[security]
INSTALL_LOCK   = false
SECRET_KEY     = 
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1OTgzMDU4OTJ9.bBjvyLcMlEuwrMWwlsY2s1Bf57yRsBVwPzXbtoz0aAU

[service]
DISABLE_REGISTRATION = false
REQUIRE_SIGNIN_VIEW  = false

[oauth2]
JWT_SECRET = WAOLClE59XVbgY0jqD4b0tYnQVn5V-tOMYbj409xkQQ

@zeripath
Copy link
Contributor

Ok so the issue is that the opensshd server cannot open port 22 on the docker.

Presumably there is something else listening on that port or it is being mapped to it? Or you have some other setting preventing it from working

Try setting the SSH_LISTEN_PORT environment variable to something above 1024 (perhaps even 20122) and see if then things can start.

@Piscator74
Copy link
Author

That is one of the things I already tried, but did not mention. That makes unfortunately no difference (except that is is being killed on port 20122)

    environment:
      - SSH_PORT=20122
      - SSH_LISTEN_PORT=20122
    ports:
       - "3000:3000"
       - "20122:20122"

Is 'DISABLE_SSH=true' not supposed to prevent the SSH server from starting?

@sardaukar
Copy link

Having the same issue now after an upgrade - is there a fix for this?

@zeripath
Copy link
Contributor

@sardaukar We need logs.

@sardaukar
Copy link

Fixed it by replacing latest with 1.14.2 in the Docker tag for the gitea image in my docker-compose file

@fredericrous
Copy link

the signal 15 message is really not helpful, if it said go see the logs, it would be more interesting. I got the same signal 15 error and understood that I did a config mistake only when I read the log file under gitea/log/gitea.log

@sguter90
Copy link

For me this was related to #13588
The actual error in the gitea log was:

2021/05/26 14:32:19 ...s/migrations/v159.go:33:updateReactionConstraint() [I] [SQL] CREATE UNIQUE INDEX `UQE_tmp_recreate__reaction_s` ON `tmp_recreate__reaction` (`type`,`issue_id`,`comment_id`,`user_id`,`original_author_id`,`original_author`) [] - 152.581µs
2021/05/26 14:32:19 ...ations/migrations.go:447:recreateTable() [E] Unable to create uniques for table tmp_recreate__reaction. Error: Error 1071: Specified key was too long; max key length is 767 bytes
2021/05/26 14:32:19 ...ations/migrations.go:397:Migrate() [I] [SQL] ROLLBACK [] - 75.388µs
2

I've fixed this by upgrading from mysql 5.6 to mysql 5.7 and finally to version 8.0.
The steps for my docker-compose setup were:

  1. mysqldump: docker-compose exec db mysqldump -u myuser -pmypassword mydb > gitea.sql
  2. switch image to 5.7 & docker-compose up -d
  3. upgrade: docker-compose exec mycontainername mysql_upgrade -uroot -p
  4. switch image to 8.0
  5. change command for upgrade as suggested here: Impossible to upgrade mysql docker-library/mysql#130 (comment)
  6. docker-compose up -d
  7. remove command definition
  8. docker-compose up -d

After that the gitea container was able to process the db migration and the webserver sucessfully started.
I now use the following repo for my gitea setup: https://github.com/sguter90/docker-compose-gitea

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants