Help: Internal Error on new file upload.
Added by Jason Johnson over 13 years ago
Pardon me if this is an easily solved problem, but I'm a Redmine newbie. I have Redmine 1.0.3 set up on an Ubuntu Server 10.04 Linode instance. Everything seems to be working great except that when I try to add a file to a project, I get the following error:
Internal error
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your redMine administrator for assistance.
I have selected a Version from the drop-down, and the file is only 287kb.
I have tested everything else from new Documents, adding a Wiki, Issues, etc. and it is all working fine, so I don't think it's a database issue, and I have set the permissions on the files folder to 777 just for fun.
If someone has a suggestion on how I might diagnose this problem, I'd really appreciate it.
Thanks.
Replies (15)
RE: Help: Internal Error on new file upload.
-
Added by Deoren Moor over 13 years ago
You probably want to include the info mentioned here: http://www.redmine.org/boards/2/topics/667
Checking your log/production.log file and /var/log/apache2/error.log might also help.
RE: Help: Internal Error on new file upload.
-
Added by Jason Johnson over 13 years ago
Fixed!
Thanks for the reply. Turned out to be an ownership problem.
I'll be sure to include the information mentioned in the link above if I have further questions.
Thanks again!
RE: Help: Internal Error on new file upload.
-
Added by Mohd Shakir Zakaria over 13 years ago
I'm having the same problem and I think it's a permission problem for me as well.
Care to share the name of the folder/file which permission need to be changed?
RE: Help: Internal Error on new file upload.
-
Added by Jason Johnson over 13 years ago
It was actually an ownership problem, not permissions. I just had to change the ownership of the files directory to the apache user (www-data in my case). Anyway, just make sure that your files directory is owned by your apache (or nginx, or whatever) user.
Good luck!
RE: Help: Internal Error on new file upload.
-
Added by Mohd Shakir Zakaria over 13 years ago
I chown-ed the /usr/share/redmine and still getting the same error. I end up installing from scratch (I previously installed everything using apt-get) and now I no longer have the issue.
RE: Help: Internal Error on new file upload.
-
Added by mike kromarek over 13 years ago
I had this same issue and it turned out to be passenger running as nobody. You can change who passenger runs as by adding the line "PassengerDefaultUser www-data" (change www-data to whatever user you like) to your passenger.conf file under /etc/apache2/mods-enabled/ in ubuntu.
Of course, don't forget to give the specified user permission to the files directory.
RE: Help: Internal Error on new file upload.
-
Added by John H about 13 years ago
I also have this issue with permissions on the files directory on a Ubuntu 10.04, 1.2.0 from archive install.
Apache runs as the www-data user. My PassengerDefaultUser value is also www-data.
But uploaded files are owned by the user "ubuntu" not www-data.
For now I have opened up the permissions on the directory but of course that's not the best solution.
Any ideas on why the ubuntu user is the owner? There must be another configuration file somewhere. Also, I've been restarting apache2 from the command line, where my user is ubuntu. Could this be setting the user to ubuntu?
RE: Help: Internal Error on new file upload.
-
Added by mick mcshady almost 13 years ago
I've read the faq's on Phusion's and Nginx's sites, googled, etc and I'm not finding anything that helps me solve this problem.
We're having a similar issue, but I think we're using Nginx rather than Apache2 to run passenger. If I set the acl to 777 we can upload files but the user is "nobody" and the group is "no group".
Our path is /opt/redmine/files. I've changed the owner and group to www-data and the acl is set to 775 for the "files" directory.
I tried adding "passengerdefaultuser www-data;" in the Nginx passenger.conf file but when I restart Nginx I get the msg emerg]: unknown directive "passengerdefaultuser" in /etc/nginx/conf.d/passenger.conf:2. So I've removed it.
What I get from this thread is that passenger shouldn't be running as nobody and you need to set the acl on the files directory.
Would someone clue me in on how to proceed to solve this problem? I've tried the things mentioned in this thread but it's geared more for Apache2 than Nginx. If you need additional info let me know. I'm guessing that I need to setup passengerdefaultuser www-data in the Nginx passenger.conf file similar to how it's mentioned for Apache2.
server:/etc/nginx/conf.d# ps -ef | grep passenger | grep -v grep
root 22355 1 0 Sep08 ? 00:00:04 PassengerNginxHelperServer /usr/lib/phusion_passenger ruby 3 4 0 6 0 300 1 nobody 33 33 /tmp/passenger.22353
server:/etc/nginx/conf.d#
server:/etc/nginx/conf.d# more passenger.conf
passenger_root /usr/lib/phusion_passenger;
server:/etc/nginx# cat nginx.conf
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
server:/nginx/conf.d# ps -ef | grep nginx | grep -v grep
root 22377 1 0 Sep08 ? 00:00:00 nginx: master process /usr/sbin/nginx
www-data 22392 22377 0 Sep08 ? 00:00:16 nginx: worker process
server:/etc/nginx/conf.d# ps -ef |grep apache2 | grep -v grep
root 16686 1 0 09:38 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 16690 16686 0 09:38 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 16691 16686 0 09:38 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 16692 16686 0 09:38 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 16693 16686 0 09:38 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 16694 16686 0 09:38 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 16763 16686 0 09:52 ? 00:00:00 /usr/sbin/apache2 -k start
==========================================================================
ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux] ==========================================================================
mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (i486) using readline 6.1 ===========================================================================
Linux server 2.6.32-4-pve #1 SMP Thu Oct 21 09:35:29 CEST 2010 i686 GNU/Linux ===========================================================================
Server version: Apache/2.2.16 (Debian) ===========================================================================
nginx version: nginx/0.7.64
===========================================================================
RAILS_ENV=production script/about
/var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
About your application's environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.7
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /opt/redmine
Environment production
Database adapter mysql
Database schema version 20100819172912
=======================================================================
RAILS_ENV=development script/about
/var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
About your application's environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.7
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /opt/redmine
Environment development
Database adapter mysql
Database schema version 20100819172912
RE: Help: Internal Error on new file upload.
-
Added by mick mcshady almost 13 years ago
It's working for us now. I added passenger_default_user www-data; to /etc/nginx/conf.d/passenger.conf and restarted nginx. The acl is set to 755 on /opt/redmine/files folder and the owner and group are www-data. After uploading, I checked the file owner and it's www-data. Note the second line in the nginx.conf file user www-data;
RE: Help: Internal Error on new file upload.
-
Added by Brant Yuan about 12 years ago
I meet this too. log/production.log
Connecting to database specified by database.yml
OpenIdAuthentication.store is nil. Using in-memory store.
Creating scope :active. Overwriting existing method User.active.
Creating scope :open. Overwriting existing method Version.open.
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in CollectiveIdea::Acts::NestedSet::Model instead. (called from include at /usr/local/redmine-2.0.3/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb:58)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in CollectiveIdea::Acts::NestedSet::Model instead. (called from include at /usr/local/redmine-2.0.3/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb:58)
Creating scope :open. Overwriting existing method Issue.open.
I don't know how to fix?
RE: Help: Internal Error on new file upload.
-
Added by Massimo Rossello almost 11 years ago
Same problem here.
"PassengerDefaultUser www-data" is set, but periodically production.log and new file/folders created by attachments take root as the owner. The system is Ubuntu 12.04, Redmine 2.3.2 under Apache+Passenger is NOT installed through apt. Ruby 1.9.3 from rvm.
Some passenger processes still run as root, actually.
ps -ef | grep Passenger | grep -v grep
www-data 22481 24860 1 11:18 ? 00:00:06 Passenger ApplicationSpawner: /var/www/redmine_2.3
root 24855 1319 0 Nov03 ? 00:00:00 PassengerWatchdog
root 24858 24855 0 Nov03 ? 00:04:31 PassengerHelperAgent
root 24860 24858 0 Nov03 ? 00:00:00 Passenger spawn server
nobody 24865 24855 0 Nov03 ? 00:00:00 PassengerLoggingAgent
The only workaround I found is to set "chown -R www-data" in a cron, every minute!
RE: Help: Internal Error on new file upload.
-
Added by Mario Scondo almost 11 years ago
Try to check the runtime user of your Redmine processes and the permissions / ownership of utilized directories.
The best way to start the server process is utilize the correct user account. If you are required to change the Linux user / group at runtime, you have to utilize the super user account at startup. Ordinary Linux accounts are not allowed to change the user / group at runtime.
RE: Help: Internal Error on new file upload.
-
Added by Massimo Rossello almost 11 years ago
Mario, thank you for your answer.
Yes, my problem is that created files get root permissions, then the system complains that it cannot change them.
From further searching the internet, I came to the hypotesis that this depends from the user that Passenger uses, but PassengerDefaultUser setting is not enough. Passenger user switch feature relies on the permissions given to the config/environment.db file, or from the PassengerUser global setting.
I have now tried to set PassengerUser properly, and I am waiting some days to see if the problem is solved.
Thanks!
RE: Help: Internal Error on new file upload.
-
Added by Mario Scondo almost 11 years ago
If the problem is not solved: when starting Passenger with 'root' you may utilize the command 'su <user> <command>'. So the Passenger process will be started with the correct user account.
RE: Help: Internal Error on new file upload.
-
Added by Mischa The Evil almost 11 years ago
Massimo Rossello wrote:
Not exactly. Passenger, by default (PassengerUserSwitching: on), runs applications as the owner of their "startup file" (using Rails < 3 this is {../config/environment.rb and when using Rails >= 3 [which is build on top of Rack] this is ../config.ru) unless:[...]
From further searching the internet, I came to the hypotesis that this depends from the user that Passenger uses, but PassengerDefaultUser setting is not enough. Passenger user switch feature relies on the permissions given to the config/environment.db file, or from the PassengerUser global setting.
- Apache doesn't have root privileges (then apps are run as the same user that is running Apache)
- PassengerUserSwitching is switched off explicitly (then apps are run as the user which is configured using the PassengerDefaultUser directive)
- PassengerUser is set explicitly (then apps will run as the user which is configured with it)
See the "User Switching" section of the Passenger manual, where this is extensively explained, for more information.