linux - 为什么 apache2 和 tomcat7 服务不能在 Ubuntu Cloudimg 上自动启动?

标签 linux ubuntu virtualbox vagrant

我使用官方的 Ubuntu Cloudimg 作为我的测试环境,我在这个页面下载它:

http://cloud-images.ubuntu.com/vagrant/raring/current/

我使用vagrant + virtualbox来部署box文件。

一切正常,但 apache2 ant tomcat7 服务从不自动启动,我尝试尽一切努力解决它,但我失败了。

这是我尝试做的:

cat/var/log/boot.log

Cloud-init v. 0.7.2 running 'init-local' at Thu, 05 Sep 2013 01:15:26 +0000. Up 3.59 seconds.
cloud-init-nonet[3.70]: waiting 10 seconds for network device
rpcbind: Cannot open '/run/rpcbind/rpcbind.xdr' file for reading, errno 2 (No such file or directory)^M
rpcbind: Cannot open '/run/rpcbind/portmap.xdr' file for reading, errno 2 (No such file or directory)^M
cloud-init-nonet[4.74]: static networking is now up
Cloud-init v. 0.7.2 running 'init' at Thu, 05 Sep 2013 01:15:28 +0000. Up 4.89 seconds.
ci-info: +++++++++++++++++++++++++Net device info+++++++++++++++++++++++++
ci-info: +--------+------+-----------+---------------+-------------------+
ci-info: | Device |  Up  |  Address  |      Mask     |     Hw-Address    |
ci-info: +--------+------+-----------+---------------+-------------------+
ci-info: |   lo   | True | 127.0.0.1 |   255.0.0.0   |         .         |
ci-info: |  eth0  | True | 10.0.2.15 | 255.255.255.0 | 08:00:27:ae:1a:5c |
ci-info: +--------+------+-----------+---------------+-------------------+
ci-info: ++++++++++++++++++++++++++++++Route info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+----------+---------------+-----------+-------+
ci-info: | Route | Destination | Gateway  |    Genmask    | Interface | Flags |
ci-info: +-------+-------------+----------+---------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.0.2.2 |    0.0.0.0    |    eth0   |   UG  |
ci-info: |   1   |   10.0.2.0  | 0.0.0.0  | 255.255.255.0 |    eth0   |   U   |
ci-info: +-------+-------------+----------+---------------+-----------+-------+
2013-09-05 09:15:28,570 - cloud-init[WARNING]: Stdout, stderr changing to (| tee -a /var/log/cloud-init-output.log, | tee -a /var/log/cloud-init-output.log)

奇怪的是,只有第一次启动日志。之后永远不要在 boot.log 中写入任何日志。

ll/etc/rc2.d/

total 12
drwxr-xr-x   2 root root 4096 Sep  3 10:31 ./
drwxr-xr-x 116 root root 4096 Nov  8 11:26 ../
-rw-r--r--   1 root root  677 Jan 30  2013 README
lrwxrwxrwx   1 root root   17 Sep  2 17:09 S20postfix -> ../init.d/postfix*
lrwxrwxrwx   1 root root   22 Sep  2 17:09 S20redis-server -> ../init.d/redis-server*
lrwxrwxrwx   1 root root   32 Aug 31 12:06 S20virtualbox-guest-utils -> ../init.d/virtualbox-guest-utils*
lrwxrwxrwx   1 root root   16 Aug 31 12:06 S21puppet -> ../init.d/puppet*
lrwxrwxrwx   1 root root   13 Sep  3 10:31 S23ntp -> ../init.d/ntp*
lrwxrwxrwx   1 root root   26 Aug 31 11:36 S45landscape-client -> ../init.d/landscape-client*
lrwxrwxrwx   1 root root   15 Aug 31 11:36 S50rsync -> ../init.d/rsync*
lrwxrwxrwx   1 root root   19 Aug 31 11:36 S70dns-clean -> ../init.d/dns-clean*
lrwxrwxrwx   1 root root   18 Aug 31 11:36 S70pppd-dns -> ../init.d/pppd-dns*
lrwxrwxrwx   1 root root   14 Aug 31 11:34 S75sudo -> ../init.d/sudo*
lrwxrwxrwx   1 root root   17 Sep  2 17:08 S91apache2 -> ../init.d/apache2*
lrwxrwxrwx   1 root root   17 Sep  2 17:07 S92tomcat7 -> ../init.d/tomcat7*
lrwxrwxrwx   1 root root   21 Aug 31 12:06 S99chef-client -> ../init.d/chef-client*
lrwxrwxrwx   1 root root   21 Aug 31 11:36 S99grub-common -> ../init.d/grub-common*
lrwxrwxrwx   1 root root   18 Aug 31 11:34 S99ondemand -> ../init.d/ondemand*
lrwxrwxrwx   1 root root   18 Aug 31 11:34 S99rc.local -> ../init.d/rc.local*

可以看到apache2和tomcat7服务以S开头。

但我必须使用命令 service apache2 start ; service tomcat7 start 在每次启动后手动启动服务。

但是mysql服务是正常的。该服务可以自动启动。

怎么了?我该如何解决这个问题?

最佳答案

我也遇到过类似的问题。我认为这是由这个错误引起的: sysv init scripts not started on boot with cloud ubuntu raring

尽管该错误尚未得到确认,但错误报告中描述的解决方法(使用/etc/init/rc.conf 中的“控制台日志”)对我有用。

关于linux - 为什么 apache2 和 tomcat7 服务不能在 Ubuntu Cloudimg 上自动启动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19851265/

相关文章:

键盘在 oracle vm 虚拟盒中不起作用

ubuntu - AWS ubuntu 14.04 实例中的虚拟盒安装问题 "Running VirtualBox in a Xen environment is not supported"

linux - chroot jail + ssh key 被拒绝

linux - test -n 和 test -z 都为真的情况

python - 用python杀死进程

linux - 如何向 SBT 添加插件? [Ubuntu]

mysql - 无法连接到mysql

ubuntu - Jenkins 无法打开make

mysql - 在ubuntu中 Sequelize

virtualbox - 如何在 VirtualBox 中调整 Parrot Sec 的屏幕大小?