我无法更新我的 redmine。每次运行时apt-get upgrade
,我都会收到 ruby 未找到错误:
Setting up redmine (2.4.2-1) ...
dbconfig-common: writing config to /etc/dbconfig-common/redmine/instances/default.conf
Creating config file /etc/redmine/default/database.yml.new with new version
dbconfig-common: flushing administrative password
Populating database for redmine instance "default".
This may take a while.
/usr/bin/env: ruby1.8: No such file or directory
Error when running rake db:migrate, check database configuration.
dpkg: error processing package redmine (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
redmine
E: Sub-process /usr/bin/dpkg returned an error code (1)
我现在被困住了。我的 redmine 已经停止工作了。
我尝试通过将 /usr/bin/ruby1.8 链接到 /usr/bin/ruby 来进行“redmine”,但却遇到了不同的错误。
设置 redmine (2.4.2-1) ... dbconfig-common:将配置写入 /etc/dbconfig-common/redmine/instances/default.conf
Creating config file /etc/redmine/default/database.yml.new with new version
dbconfig-common: flushing administrative password
Populating database for redmine instance "default".
This may take a while.
/usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rake (>= 0) amongst [] (Gem::LoadError)
from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
from /usr/local/bin/rake:18:in `<main>'
Error when running rake db:migrate, check database configuration.
dpkg: error processing package redmine (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
redmine
E: Sub-process /usr/bin/dpkg returned an error code (1)
然后我尝试按照建议重新安装 ruby1.8在这个问题上。但是在安装 ruby1.8 时我遇到了不同的错误。
apt-get install ruby1.8
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
redmine-sqlite : Depends: ruby-sqlite3 but it is not going to be installed
ruby-fcgi : Depends: libruby1.9.1 (>= 1.9.2.0) but it is not going to be installed or
libruby2.0 (>= 2.0.0) but it is not going to be installed
ruby-railties-3.2 : Depends: ruby-actionpack-3.2 (>= 3.2.16) but it is not going to be installed
Depends: ruby-actionmailer-3.2 (>= 3.2.16) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
答案1
显示的(第一条)错误消息是:
/usr/bin/env: ruby1.8: No such file or directory
正在尝试运行ruby1.8
,但没有这样的程序。不幸的是,揭露通过“包裹内容”搜索,Ubuntu 14.04中不再提供ruby1.8。
仍然安装 ruby1.8:
您可以使用以下答案中描述的两种方法之一安装 ruby1.8:
目前有两个答案,一个建议启用 13.10 版的软件存储库来安装用于前一版本的旧版本,另一个建议使用(可能尤其是)实验性的 PPA。
我不确定这两者中哪一个更好或更可靠。 任何一个都应该有效。
尝试将 ruby1.9 用作 ruby1.8:
另一种可能性,建议/启发自tres 的这个回答到那个不同的问题在堆栈溢出,就是“欺骗”redmine的安装脚本,让其将ruby的最新版本(ruby1.9)当做ruby1.8。这不会阻止ruby1.9为需要该版本的应用程序工作,但也不一定能正常工作;问题在于redmine对ruby1.8的依赖程度有多高。
为此,创建一个符号链接ruby
(运行默认版本,在本例中为 1.9),名为ruby1.8
:
sudo ln -s /usr/bin/ruby /usr/bin/ruby1.8
(更新)如果你得到Could not find rake (>= 0) amongst [] (Gem::LoadError)
:
在添加到您的答案的更新信息中,您提到符号链接/usr/bin/ruby1.8
(/usr/bin/ruby
使其使用已安装的 ruby1.9)并收到一条错误消息,其中第一个错误是:
/usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rake (>= 0) amongst [] (Gem::LoadError)
from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
from /usr/local/bin/rake:18:in `<main>'
Error when running rake db:migrate, check database configuration.
您可以通过安装该rake
包来修复该错误:
sudo apt-get update
sudo apt-get install rake
如果符号链接ruby1.8
不起作用ruby
,您决定尝试实际安装 ruby1.8,则应先使用 删除链接sudo rm /usr/bin/ruby1.8
。
如果您还有其他问题,请编辑您的问题并提供详细信息。(或者,如果您觉得问题与您在此处询问的问题有很大不同,您可以提出新问题。)祝您好运。
答案2
尝试了不同的解决方案后,还是无法正确安装 redmine。我终于在另一台机器上让它工作了。并使用以下步骤。
- 备份mysql上的redmine_default数据库,并在另一台同名机器上恢复
在新机器上全新安装 redmine。
apt-get 安装 redmine redmine-mysql
按照 redmine 安装步骤这里
安装/升级顺利进行,我现有的所有数据均完好无损。
几天后,我在旧机器上又做了一次测试,发现通过卸载 redmine 并清除它,确保删除了以前的 redmine 和 ruby 的所有痕迹,然后从头开始重新安装它,就可以了!!!
因此,如果升级有问题,请备份数据库,卸载 redmine
apt-get remove redmine redmine-mysql
apt-get purge redmine redmine-mysql
恢复数据库,并按照上面的安装