您尚未登录。

#1 2015-01-13 13:03:37

estoday
会员
注册时间: 2014-10-30
帖子: 5

systemd下自定义service服务90秒后failed

树莓派运行archlinuxarm,使用无线网卡作软AP,配置完成后通过hostapd /etc/hostapd/hostapd.conf命令测试可以正常运行。然后,设置一个.service来让其开机自动运行,出现开机运行大概90秒后无线网卡灯熄灭,通过systemctl查看faild了,在之前的90秒内查看是active(显示为activating)的.      .service和脚本文件如下:

/etc/systemd/system/myhostapd.service内容如下:

[Unit]
Description=Turn on hostap
Wants=network.target
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/myhostapd

[Install]
WantedBy=multi-user.target


/usr/bin/myhostapd内容如下:

#!/bin/sh

hostapd /etc/hostapd/hostapd.conf


请问各位大神,是哪里在出了问题,本人新手!

离线

#2 2015-01-13 14:46:29

lainme
论坛版主
注册时间: 2011-08-19
帖子: 131

Re: systemd下自定义service服务90秒后failed

看一下journal里面有什么没?

离线

#3 2015-01-13 15:46:10

estoday
会员
注册时间: 2014-10-30
帖子: 5

Re: systemd下自定义service服务90秒后failed

journalctl -u myhostapd.service  查看到如下:

-- Reboot --
Jan 13 07:33:17 alarmpi systemd[1]: Starting Turn on hostap...
Jan 13 07:35:08 alarmpi systemd[1]: myhostapd.service start operation timed out. Terminating.
Jan 13 07:35:08 alarmpi myhostapd[131]: Configuration file: /etc/hostapd/hostapd.conf
Jan 13 07:35:08 alarmpi myhostapd[131]: drv->ifindex=3
Jan 13 07:35:08 alarmpi myhostapd[131]: l2_sock_recv==l2_sock_xmit=0x0x14b2078
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_rts_threshold, rts=2347
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_frag_threshold, frag=2346
Jan 13 07:35:08 alarmpi myhostapd[131]: +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_key_ops
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_key_ops
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_key_ops
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_key_ops
Jan 13 07:35:08 alarmpi myhostapd[131]: Using interface wlan0 with hwaddr e8:4e:06:**:**.** and ssid 'Arch'
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_wps_assoc_resp_ie
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_wps_beacon_ie
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_wps_probe_resp_ie
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_key_ops
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_beacon_ops
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, Arch,4
Jan 13 07:35:08 alarmpi myhostapd[131]: rtl871x_set_acl
Jan 13 07:35:08 alarmpi myhostapd[131]: +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
Jan 13 07:35:08 alarmpi myhostapd[131]: ELOOP: remaining socket: sock=6 eloop_data=0x14b15e8 user_data=(nil) handler=0x324f8
Jan 13 07:35:08 alarmpi systemd[1]: Failed to start Turn on hostap.
Jan 13 07:35:08 alarmpi systemd[1]: Unit myhostapd.service entered failed state.
Jan 13 07:35:08 alarmpi systemd[1]: myhostapd.service failed.

离线

#4 2015-01-13 16:24:00

依云
a.k.a. 百合仙子
所在地: 一个等待妹纸出现的地方
注册时间: 2011-08-21
帖子: 4,388
个人网站

Re: systemd下自定义service服务90秒后failed

Type=forking 但是你没给 -B 参数。

要么加 -B 要么改成 Type=simple。

离线

#5 2015-01-13 18:52:04

estoday
会员
注册时间: 2014-10-30
帖子: 5

Re: systemd下自定义service服务90秒后failed

多谢“百合仙子”!搞定了!

离线

页脚