Uploading files broken after upgrade to Zammad 4.0

  • Used Zammad version: zammad amd64 4.0.0-1617109315.8178bec2.bionic
  • Used Zammad installation source: package
  • Operating system: Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-139-generic x86_64)
  • Elasticsearch version: elasticsearch 7.12.0 amd64
  • DB: mysql-server: 5.7.33
  • Browser + version: Firefox 86.0.1

Expected behavior:

Uploading files to a ticket is working. Usually you can see a filename + size

Actual behavior:

after uploading a file, zammad only displays “undefined bytes” and the file isnt uploaded

Steps to reproduce the behavior:

Upload a file to a ticket after upgrading to Zammad 4.0.x

Production log:
I, [2021-03-30T14:27:41.264540 #13310-47293835828520]  INFO -- : Started POST "/api/v1/ticket_attachment_upload" for `2001:0db8:85a3:08d3:1319:8a2e:0370:7344` at 2021-03-30 14:27:41 +0200
I, [2021-03-30T14:27:41.270154 #13310-47293835828520]  INFO -- : Processing by ErrorsController#routing as */*
I, [2021-03-30T14:27:41.270404 #13310-47293835828520]  INFO -- :   Parameters: {"form_id"=>"106946816", "File"=>#<ActionDispatch::Http::UploadedFile:0x00005606e807ecf8 @tempfile=#<Tempfile:/tmp/RackMultipart20210330-13310-n70nkg.jpg>, @original_filename="sasaa.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"File\"; filename=\"sasaa.jpg\"\r\nContent-Type: image/jpeg\r\n">, "a"=>"api/v1/ticket_attachment_upload"}
E, [2021-03-30T14:27:41.274230 #13310-47293835828520] ERROR -- : No route matches [POST] /api/v1/ticket_attachment_upload (ActionController::RoutingError)

I, [2021-03-30T14:27:41.276173 #13310-47293835828520]  INFO -- : Completed 404 Not Found in 6ms (Views: 0.2ms | ActiveRecord: 1.2ms)

I already tried:

  • Restart Ubuntu
  • Change browser to safari
  • Clear browser cache
  • zammad run rake searchindex:rebuild
  • systemctl stop zammad; zammad run rails r “Cache.clear”; systemctl start zammad
  • searched @google

Edit:

I made a video:

Today I made a cleaninstall on a Ubuntu 20.04.1:

  • Server version: 20.04.1 (Ubuntu)
  • Elastic search
  • Zammad 4.0.0
  • mysql

I made a backup and a restore:
https://docs.zammad.org/en/latest/appendix/backup-and-restore.html

Same issue!

Maybe u guys have some advice?

1 Like

Hi @W4qr

Could you try to open Web Inspector’s Network tab and check out where upload request goes to?

In V4, requests shall go either to /api/v1/attachments (new ticket) or /api/v1/upload_caches/~~ID~~ (existing ticket). There’s no ticket_attachment_upload API that shows up in your log in V4.

Hi,

thank you for your reply.

I made a test with Google Chrome, I uploaded an attachment to a existing ticket:

Event: upload onCompleted, data = {"error":"No route matches [POST] /api/v1/ticket_attachment_upload","error_human":"No route matches [POST] /api/v1/ticket_attachment_upload"}

What does Web Inspector show in headers of that request? What URL is it calling?

Either you’ve a wrong javascript file that is calling a wrong endpoint. Or your server is doing URL rewrite.

I hope thats the part :slight_smile:

You did run a forced reinstall after restoring, right?
Hopefully you also ensured your Browser is not caching the JS and CSS that may strike you here.

Hi @MrGeneration,

I made a new virtual server at Hetzner, installed everything and then made a migration / restore:

apt update && apt upgrade -y
apt install apt-transport-https sudo wget
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
apt update
apt install elasticsearch
/usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment
vi /etc/elasticsearch/elasticsearch.yml
insert: 
http.max_content_length: 400mb
indices.query.bool.max_clause_count: 2000

systemctl start elasticsearch
systemctl enable elasticsearch

apt install mysql-server
create database and user, grant privileges, flush privileges, edit zammad database.yml
configure nginx with lets encrypt...

wget -qO- https://dl.packager.io/srv/zammad/zammad/key | apt-key add -
wget -O /etc/apt/sources.list.d/zammad.list \
https://dl.packager.io/srv/zammad/zammad/stable/installer/ubuntu/20.04.repo
apt update
tee /etc/apt/sources.list.d/xenial.list > /dev/null <<EOF
deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe
deb http://dk.archive.ubuntu.com/ubuntu/ xenial-updates universe
EOF
apt-get update
apt-get install -y libmysqlclient20
apt install zammad
zammad run rails r "Setting.set('es_url', 'http://localhost:9200')"
zammad run rake searchindex:rebuild
zammad run rails r "Setting.set('es_attachment_ignore',\
  [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ] )"
zammad run rails r "Setting.set('es_attachment_max_size_in_mb', 50)"
chmod -R a+r /opt/zammad/public/

After all that, I made a backup on the old machine and did a restore on the new one:
https://docs.zammad.org/en/latest/appendix/backup-and-restore.html

I made a fresh install of GoogleChrome and tried Safari and Firefox on different OS

Again… did you follow these particular steps…?
https://docs.zammad.org/en/latest/appendix/backup-and-restore.html#when-migrated-from-a-self-hosted-zammad-system

Im sorry, now I got what you wanted in your previous post.
No I didnt. But I tried these now and got the same issue. (Cleared browser cache)

Could you try to install it, but do not restore? Wonder if it’s broken on install or after restore.

Yes, I did a snapshot before restore. Give me 30 min

Cleaninstall Ubuntu 20.04 with PostgreSQL Server - no problem everything is working properly.
Cleaninstall Ubuntu 20.04 with MySQL Server:

To reproduce the error:

Get a clean install server with Ubuntu 20.04:
apt update && apt update -y
hostnamectl set-hostname zammad
set yout hostname in /etc/hosts
apt install apt-transport-https wget gnupg sudo
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
apt update
apt install elasticsearch
/usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment
vi /etc/elasticsearch/elasticsearch.yml
 insert:
 http.max_content_length: 400mb
 indices.query.bool.max_clause_count: 2000
systemctl start elasticsearch
systemctl enable elasticsearch
systemctl restart elasticsearch
apt install python3-certbot-nginx -y
certbot --nginx -d yourhostname.xy -d www.yourhostname.xy
##check your nginx config for zammad
apt install mysql-server
mysql_secure_installation
mysql -u root -p
CREATE DATABASE zammad CHARACTER SET utf8;
CREATE USER 'zammad'@'localhost' IDENTIFIED BY 'supersecurepassword';
GRANT ALL PRIVILEGES ON zammad.* TO 'zammad'@'localhost';
FLUSH PRIVILEGES;
ALTER USER 'zammad'@'localhost' IDENTIFIED WITH mysql_native_password BY 'supersecurepassword';
EXIT;

wget -qO- https://dl.packager.io/srv/zammad/zammad/key | apt-key add -
wget -O /etc/apt/sources.list.d/zammad.list \
https://dl.packager.io/srv/zammad/zammad/stable/installer/ubuntu/20.04.repo
apt update
apt-get install libmysqlclient-dev -y
mkdir -p /opt/zammad/config/
vi /opt/zammad/config/database.yml
 insert: 
 production:
  adapter: mysql2
  database: zammad
  pool: 50
  timeout: 5000
  encoding: utf8
  username: zammad
  password: supersecurepassword

apt install zammad -y

Then I get a really long error output:

I, [2021-04-08T14:37:49.722922 #18427-47243739969940]  INFO -- : Migrating to RemoveUnfixableGenericOauth2Login (20210311130946)
== 20210311130946 RemoveUnfixableGenericOauth2Login: migrating ================
== 20210311130946 RemoveUnfixableGenericOauth2Login: migrated (0.0013s) =======

# Updating translations...
nil versions are discouraged and will be deprecated in Rubygems 4
nil versions are discouraged and will be deprecated in Rubygems 4
Traceback (most recent call last):
	58: from bin/rails:9:in `<main>'
	57: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `require'
	56: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:257:in `load_dependency'
	55: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `block in require'
	54: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	53: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	52: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	51: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	50: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	49: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands.rb:18:in `<main>'
	48: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command.rb:46:in `invoke'
	47: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/base.rb:69:in `perform'
	46: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	45: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	44: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	43: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `perform'
	42: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `eval'
	41: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `<main>'
	40: from /opt/zammad/app/models/translation.rb:23:in `sync'
	39: from /opt/zammad/app/models/translation.rb:317:in `load_from_file'
	38: from /opt/zammad/app/models/translation.rb:317:in `each'
	37: from /opt/zammad/app/models/translation.rb:322:in `block in load_from_file'
	36: from /opt/zammad/app/models/translation.rb:449:in `to_database'
	35: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/transactions.rb:212:in `transaction'
	34: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `transaction'
	33: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
	32: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
	31: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
	30: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `block in transaction'
	29: from /opt/zammad/app/models/translation.rb:466:in `block in to_database'
	28: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:529:in `bulk_import'
	27: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:695:in `import_helper'
	26: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:753:in `import_with_validations'
	25: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:805:in `import_without_validations_or_callbacks'
	24: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:805:in `each_slice'
	23: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:805:in `each'
	22: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:807:in `block in import_without_validations_or_callbacks'
	21: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/adapters/mysql_adapter.rb:37:in `insert_many'
	20: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/query_cache.rb:21:in `insert'
	19: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/composite_primary_keys-11.2.0/lib/composite_primary_keys/connection_adapters/abstract/database_statements.rb:6:in `insert'
	18: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/database_statements.rb:130:in `exec_insert'
	17: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:33:in `exec_query'
	16: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:196:in `execute_and_free'
	15: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:28:in `execute'
	14: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:185:in `execute'
	13: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_adapter.rb:571:in `log'
	12: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
	11: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_adapter.rb:580:in `block in log'
	10: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
	 9: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_adapter.rb:581:in `block (2 levels) in log'
	 8: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:186:in `block in execute'
	 7: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
	 6: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
	 5: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
	 4: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:187:in `block (2 levels) in execute'
	 3: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:119:in `query'
	 2: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:119:in `handle_interrupt'
	 1: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `block in query'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `_query': Cannot add or update a child row: a foreign key constraint fails (`zammad`.`translations`, CONSTRAINT `fk_rails_d6e6d9635d` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`)) (Mysql2::Error)
	58: from bin/rails:9:in `<main>'
	57: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `require'
	56: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:257:in `load_dependency'
	55: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `block in require'
	54: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	53: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	52: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	51: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	50: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	49: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands.rb:18:in `<main>'
	48: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command.rb:46:in `invoke'
	47: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/base.rb:69:in `perform'
	46: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	45: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	44: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	43: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `perform'
	42: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `eval'
	41: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `<main>'
	40: from /opt/zammad/app/models/translation.rb:23:in `sync'
	39: from /opt/zammad/app/models/translation.rb:317:in `load_from_file'
	38: from /opt/zammad/app/models/translation.rb:317:in `each'
	37: from /opt/zammad/app/models/translation.rb:322:in `block in load_from_file'
	36: from /opt/zammad/app/models/translation.rb:449:in `to_database'
	35: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/transactions.rb:212:in `transaction'
	34: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `transaction'
	33: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
	32: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
	31: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
	30: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `block in transaction'
	29: from /opt/zammad/app/models/translation.rb:466:in `block in to_database'
	28: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:529:in `bulk_import'
	27: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:695:in `import_helper'
	26: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:753:in `import_with_validations'
	25: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:805:in `import_without_validations_or_callbacks'
	24: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:805:in `each_slice'
	23: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:805:in `each'
	22: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/import.rb:807:in `block in import_without_validations_or_callbacks'
	21: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-import-1.0.2/lib/activerecord-import/adapters/mysql_adapter.rb:37:in `insert_many'
	20: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/query_cache.rb:21:in `insert'
	19: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/composite_primary_keys-11.2.0/lib/composite_primary_keys/connection_adapters/abstract/database_statements.rb:6:in `insert'
	18: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract/database_statements.rb:130:in `exec_insert'
	17: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:33:in `exec_query'
	16: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:196:in `execute_and_free'
	15: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:28:in `execute'
	14: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:185:in `execute'
	13: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_adapter.rb:571:in `log'
	12: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
	11: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_adapter.rb:580:in `block in log'
	10: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
	 9: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_adapter.rb:581:in `block (2 levels) in log'
	 8: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:186:in `block in execute'
	 7: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
	 6: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
	 5: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
	 4: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:187:in `block (2 levels) in execute'
	 3: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:119:in `query'
	 2: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:119:in `handle_interrupt'
	 1: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `block in query'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `_query': Mysql2::Error: Cannot add or update a child row: a foreign key constraint fails (`zammad`.`translations`, CONSTRAINT  `fk_rails_d6e6d9635d` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`)): INSERT INTO `translations` 

###skipping big part

021-04-08 12:37:56.145000') (ActiveRecord::InvalidForeignKey)
# Configuring Elasticsearch...
nil versions are discouraged and will be deprecated in Rubygems 4
-- Nevermind, no es_url is set, leaving Elasticsearch untouched ...!
-- The above is all right if you don't want to use Elasticsearch (locally) - if this is not intended, consult https://docs.zammad.org !
nil versions are discouraged and will be deprecated in Rubygems 4
Traceback (most recent call last):
	18: from bin/rails:9:in `<main>'
	17: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `require'
	16: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:257:in `load_dependency'
	15: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `block in require'
	14: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	13: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	12: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	11: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	10: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	 9: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands.rb:18:in `<main>'
	 8: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command.rb:46:in `invoke'
	 7: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/base.rb:69:in `perform'
	 6: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	 5: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	 4: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	 3: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `perform'
	 2: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `eval'
	 1: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:41:in `<main>'
/opt/zammad/app/models/setting.rb:37:in `set': Can't find config setting 'es_url' (RuntimeError)
Setting default Logging to file, set via "zammad config:set RAILS_LOG_TO_STDOUT=true" if you want to log to STDOUT!
# Starting Zammad
# Creating webserver bootstart
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
# Restarting webserver nginx
Add your fully qualified domain name or public IP to servername directive of
nginx, if this installation is done on a remote server. You have to change:
/etc/nginx/sites-available/zammad.conf and restart nginx process.
Otherwise just open http://localhost/ in your browser to start using Zammad.
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

So I think Zamamd v4 is not compatible with Mysql DB?
Maybe Im doing something wrong… I dont get it.

It is.
You might not have configured your mysql as needed ( Software — Zammad documentation )

However, that shouldn’t lead to your upload issues (that’s another story)

Hey,

first, thanks for your help!
I forgot to set the packet size on the test system correct.

I changed it:
/etc/mysql/mysql.conf.d/mysqld.cnf
max_allowed_packet=128M

Same error on install…
Yes I know, its a different story, but I wanted to build a mysql test system for @mantas , so I can check if this error persists with v4 mysql clean install. But Im not able to install it. :confused:

Hello,

I made a mysql clean install with:

  • Ubuntu 18
  • Ubuntu 20
  • mysql 5.7
  • mysql 8.x
  • Zammad v4
  • Zammad v3.5

(I know a lot of installs) Everywhere same issue.
Did you test it with mysql? I wonder what the hell Im doing wrong.

Good morning,

so for everyone else with mysql install issues on Ubuntu 18, Ubuntu 20 etc.

Install Zammad with PostgreSQL FIRST, I know it sounds crazy, but if you install mysql-server first and edit the /etc/mysql/mysql.conf.d/mysqld.cnf before installing zammad, you will fail!

Zammad install with mysql-server on ubuntu 20.04:

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
wget -qO- https://dl.packager.io/srv/zammad/zammad/key | apt-key add -
wget -O /etc/apt/sources.list.d/zammad.list \
https://dl.packager.io/srv/zammad/zammad/stable/installer/ubuntu/20.04.repo

apt update
apt install apt-transport-https wget gnupg sudo python3-certbot-nginx elasticsearch -y
/usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

Edit /etc/elasticsearch/elasticsearch.yml
##
http.max_content_length: 400mb
indices.query.bool.max_clause_count: 2000
##
systemctl start elasticsearch
systemctl enable elasticsearch
systemctl restart elasticsearch

certbot --nginx -d your.domain.com -d www.your.domain.com

apt install zammad -y
zammad run rails r "Setting.set('es_url', 'http://localhost:9200')"
zammad run rake searchindex:rebuild
zammad run rails r "Setting.set('es_attachment_ignore',\
  [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ] )"
zammad run rails r "Setting.set('es_attachment_max_size_in_mb', 50)"
chmod -R a+r /opt/zammad/public/
systemctl stop zammad
systemctl stop postgresql
systemctl disable postgresql

Then install mysql-server:

apt install mysql-server libmysqlclient-dev -y
mysql_secure_installation
mysql -u root -p
CREATE DATABASE zammad CHARACTER SET utf8;
CREATE USER 'zammad'@'localhost' IDENTIFIED BY 'yoursupersecurepassword*';
GRANT ALL PRIVILEGES ON zammad.* TO 'zammad'@'localhost';
FLUSH PRIVILEGES;
ALTER USER 'zammad'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yoursupersecurepassword*';
EXIT;

Edit /etc/mysql/mysql.conf.d/mysqld.cnf:

max_allowed_packet=128M

Edit /opt/zammad/config/database.yml:

production:
  adapter: mysql2
  database: zammad
  pool: 50
  timeout: 5000
  encoding: utf8
  username: zammad
  password: yoursupersecurepassword*

Edit /opt/zammad/config/database/database.yml (yes there is another)
Enable and restart mysql-server

Then run:
zammad run rake db:migrate
zammad run rake db:seed

systemctl start zammad

// @mantas

The upload error does not appear on a clean installed zammad with mysql! Only after upgrading from zammad 3.5 to version 4!

@W4qr I’ve a feeling that somewhere along the upgrade path old Javascript is not cleaned up. It ends up serving V3.5 Javascript with V4 backend.

I see 2 possible solutions:

a) upgrade step-by-step to V3.6, V3.7 and then V4.0. Either it works or you find out which upgrade step did not work. Maybe someone else had the same issue and had the solution.

b) remove compiled Javascript and CSS files at ~ZAMMAD_DIR~/public/assets. You shall not nuke all files in that directory! Only JS and CSS files with a fingerprint in their names. Both gzipped and non-gzipped versions. Then re-generate them with assets:precompile rake task.

Option A helped… Thank you for your help.

Elastic search sometimes stops working without crash, but thats different story.