[我创建的服务]。服务:无法执行命令:权限被拒绝

[我创建的服务]。服务:无法执行命令:权限被拒绝

我一直在尝试建立一个可以在运行 Ubuntu 的计算机上运行的网站。到目前为止,我已经设法解决了大部分问题,我认为我已经接近完成这个东西的上线。我尝试安装和运行的网站名为 WriteFreely(这是一个极简主义的博客平台,我和其他人可以注册并开始写博客,而不会受到干扰。

我已在此处遵循该指南:https://writefreely.org/start并一直成功到标题启动服务。我正在运行 Ubuntu 18.04,因此遵循以下说明:通过在 /etc/systemd/system/writefreely.service 创建文件来创建 Systemd 服务:。我假设我需要打开文本编辑器,创建一个名为 writefreely.service 的 .service 文件,然后复制并粘贴服务脚本:

[Unit]
Description=WriteFreely Instance
After=syslog.target network.target
# If MySQL is running on the same machine, uncomment the following 
# line to use it, instead. 
#After=syslog.target network.target mysql.service

[Service]
Type=simple
StandardOutput=syslog
StandardError=syslog
WorkingDirectory=/var/www/example.com
ExecStart=/var/www/example.com/writefreely
Restart=always

[Install]
WantedBy=multi-user.target

在提供的文档中,它告诉您将 /var/www/example.com 更改为您自己的域名。我通过转到 /var/www/ 并在 (amcosy.club) 中创建了一个包含我的域名的文件夹,然后将最新的 writefreely 文件夹移动到这个新创建的文件夹中。

现在,我真的不知道该怎么做。我输入了sudo systemctl start writefreely,它要求我输入密码,然后什么也没发生。我认为这是正常的。下一个输入是使用 验证应用程序日志sudo journalctl -f -u writefreely。这将返回以下内容:

-- Logs begin at Wed 2020-04-08 00:01:21 BST. --
Apr 08 20:10:42 AMCosyClub systemd[11537]: writefreely.service: Failed to execute command: Permission denied
Apr 08 20:10:42 AMCosyClub systemd[11537]: writefreely.service: Failed at step EXEC spawning /var/www/amcosy.club/writefreely: Permission denied
Apr 08 20:10:42 AMCosyClub systemd[1]: writefreely.service: Main process exited, code=exited, status=203/EXEC
Apr 08 20:10:42 AMCosyClub systemd[1]: writefreely.service: Failed with result 'exit-code'.
Apr 08 20:10:42 AMCosyClub systemd[1]: writefreely.service: Service hold-off time over, scheduling restart.
Apr 08 20:10:42 AMCosyClub systemd[1]: writefreely.service: Scheduled restart job, restart counter is at 5.
Apr 08 20:10:42 AMCosyClub systemd[1]: Stopped WriteFreely Instance.
Apr 08 20:10:42 AMCosyClub systemd[1]: writefreely.service: Start request repeated too quickly.
Apr 08 20:10:42 AMCosyClub systemd[1]: writefreely.service: Failed with result 'exit-code'.
Apr 08 20:10:42 AMCosyClub systemd[1]: Failed to start WriteFreely Instance.

如果这太明显了,我很抱歉,但我真的不擅长这些。如果我需要提供更多详细信息,请告诉我!非常感谢任何能提供见解的人!

编辑1 运行id产生:uid=1000(harry) gid=1000(harry) groups=1000(harry),4(adm),24(cdrom),27(sudo),30(dip),33(www-data),46(plugdev),116(lpadmin),126(sambashare)

运行df -h产生

Filesystem Size Used Avail Use% Mounted on udev 5.8G 0 5.8G 0% /dev tmpfs 1.2G 1.9M 1.2G 1% /run /dev/sda7 41G 27G 13G 70% / tmpfs 5.9G 64M 5.8G 2% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 5.9G 0 5.9G 0% /sys/fs/cgroup /dev/loop1 1.0M 1.0M 0 100% /snap/gnome-logs/81 /dev/loop6 15M 15M 0 100% /snap/gnome-characters/495 /dev/loop5 49M 49M 0 100% /snap/gtk-common-themes/1474 /dev/loop0 161M 161M 0 100% /snap/gnome-3-28-1804/116 /dev/loop7 3.8M 3.8M 0 100% /snap/gnome-system-monitor/127 /dev/loop4 15M 15M 0 100% /snap/gnome-characters/399 /dev/loop2 45M 45M 0 100% /snap/gtk-common-themes/1440 /dev/loop9 3.8M 3.8M 0 100% /snap/gnome-system-monitor/135 /dev/loop10 1.0M 1.0M 0 100% /snap/gnome-logs/93 /dev/loop11 4.3M 4.3M 0 100% /snap/gnome-calculator/544 /dev/loop8 90M 90M 0 100% /snap/core/8268 /dev/loop12 4.4M 4.4M 0 100% /snap/gnome-calculator/704 /dev/loop3 55M 55M 0 100% /snap/core18/1668 /dev/loop13 55M 55M 0 100% /snap/core18/1705 /dev/loop14 94M 94M 0 100% /snap/core/8935 /dev/sda2 256M 110M 147M 43% /boot/efi tmpfs 1.2G 20K 1.2G 1% /run/user/1000

dmesg给出了大量反馈。实际上有数千行。

[ 65.595748] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 []不断重复。

[ 65.595754] nouveau 0000:07:00.0: timeout [ 65.595757] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595765] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595815] WARNING: CPU: 4 PID: 294 at /build/linux-hwe-3vURZB/linux-hwe-5.3.0/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c:174 gk104_fifo_runlist_commit+0x140/0x190 [nouveau] [ 65.595816] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595818] Modules linked in: rfcomm cmac bnep nls_iso8859_1 intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp kvm irqbypass nouveau snd_hda_codec_hdmi i915 btusb crct10dif_pclmul btrtl crc32_pclmul btbcm mxm_wmi ghash_clmulni_intel ttm btintel [ 65.595824] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595824] aesni_intel drm_kms_helper bluetooth wl(POE) mei_hdcp aes_x86_64 crypto_simd cryptd glue_helper intel_cstate intel_rapl_perf ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 snd_hda_codec_idt snd_hda_codec_generic ledtrig_audio xt_hl snd_hda_intel uvcvideo snd_intel_nhlt ip6t_rt videobuf2_vmalloc videobuf2_memops snd_hda_codec [ 65.595832] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595832] videobuf2_v4l2 videobuf2_common hp_wmi serio_raw videodev snd_hda_core snd_hwdep ecdh_generic sparse_keymap mc input_leds ipt_REJECT ecc wmi_bmof joydev nf_reject_ipv4 snd_pcm drm cfg80211 xt_comment snd_seq_midi snd_seq_midi_event i2c_algo_bit fb_sys_fops snd_rawmidi syscopyarea rtsx_pci_ms [ 65.595839] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595839] hp_accel sysfillrect lis3lv02d nf_log_ipv4 sysimgblt memstick input_polldev nf_log_common lpc_ich snd_seq xt_LOG snd_seq_device snd_timer snd soundcore ie31200_edac mac_hid mei_me intel_smartconnect hp_wireless mei [ 65.595847] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595847] xt_limit xt_tcpudp xt_addrtype sch_fq_codel xt_conntrack ip6table_filter ip6_tables nf_conntrack_netbios_ns nf_conntrack_broadcast nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack parport_pc nf_defrag_ipv6 ppdev nf_defrag_ipv4 libcrc32c iptable_filter bpfilter [ 65.595854] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595855] lp parport ip_tables x_tables autofs4 hid_generic usbhid hid rtsx_pci_sdmmc r8169 psmouse ahci realtek libahci rtsx_pci wmi video [ 65.595863] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595866] CPU: 4 PID: 294 Comm: kworker/4:2 Tainted: P W OE 5.3.0-46-generic #38~18.04.1-Ubuntu [ 65.595867] Hardware name: Hewlett-Packard HP ENVY 17 Notebook PC/1968, BIOS F.60 04/08/2014 [ 65.595870] Workqueue: pm pm_runtime_work [ 65.595871] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595908] RIP: 0010:gk104_fifo_runlist_commit+0x140/0x190 [nouveau] [ 65.595909] Code: 45 a8 48 8b 40 10 48 8b 78 10 48 8b 5f 50 48 85 db 74 49 e8 62 cc b5 f5 48 89 da 48 89 c6 48 c7 c7 a5 3a 46 c1 e8 10 ce 51 f5 <0f> 0b 41 8b 46 50 85 c0 74 a0 41 8b 46 28 44 89 e9 48 c7 c6 b0 8a [ 65.595910] RSP: 0018:ffffac5b803f7a80 EFLAGS: 00010282 [ 65.595912] RAX: 0000000000000000 RBX: ffff9fa810bf8450 RCX: 0000000000000006 [ 65.595912] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff9fa813117440 [ 65.595913] RBP: ffffac5b803f7ae0 R08: 000000000057c9a3 R09: 0000000000000004 [ 65.595914] R10: 0000000000000000 R11: 0000000000000001 R12: 00000000000022a4 [ 65.595915] R13: 0000000000000004 R14: ffff9fa80df1a000 R15: 0000000000000000 [ 65.595915] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595917] FS: 0000000000000000(0000) GS:ffff9fa813100000(0000) knlGS:0000000000000000 [ 65.595918] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 65.595919] CR2: 00007f9f1d3e1120 CR3: 000000029500a002 CR4: 00000000001606e0 [ 65.595920] Call Trace: [ 65.595922] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595958] gk104_fifo_runlist_update+0x1cc/0x200 [nouveau] [ 65.595959] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.595994] gk104_fifo_gpfifo_fini+0x84/0xa0 [nouveau] [ 65.595994] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596030] nvkm_fifo_chan_fini+0x1d/0x30 [nouveau] [ 65.596030] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596047] nvkm_object_fini+0xbd/0x220 [nouveau] [ 65.596048] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596066] nvkm_object_fini+0x78/0x220 [nouveau] [ 65.596067] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596088] nvkm_object_fini+0x78/0x220 [nouveau] [ 65.596089] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596104] nvkm_object_fini+0x78/0x220 [nouveau] [ 65.596105] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596136] nvkm_client_suspend+0x13/0x20 [nouveau] [ 65.596136] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596156] nvif_client_suspend+0x1d/0x20 [nouveau] [ 65.596157] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596185] nouveau_do_suspend+0x1a0/0x2c0 [nouveau] [ 65.596186] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596215] nouveau_pmops_runtime_suspend+0x44/0xb0 [nouveau] [ 65.596215] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596218] pci_pm_runtime_suspend+0x62/0x1a0 [ 65.596222] ? __switch_to_asm+0x40/0x70 [ 65.596222] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596224] ? pci_pm_runtime_resume+0xd0/0xd0 [ 65.596227] __rpm_callback+0x9b/0x150 [ 65.596228] ? pci_pm_runtime_resume+0xd0/0xd0 [ 65.596230] rpm_callback+0x24/0x80 [ 65.596231] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596233] rpm_suspend+0x109/0x600 [ 65.596236] ? __switch_to+0x85/0x480 [ 65.596237] ? __switch_to_asm+0x40/0x70 [ 65.596238] ? __switch_to_asm+0x34/0x70 [ 65.596239] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596241] pm_runtime_work+0x78/0xa0 [ 65.596244] process_one_work+0x1fd/0x3f0 [ 65.596246] worker_thread+0x34/0x410 [ 65.596248] kthread+0x121/0x140 [ 65.596248] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596251] ? process_one_work+0x3f0/0x3f0 [ 65.596252] ? kthread_park+0xb0/0xb0 [ 65.596254] ret_from_fork+0x35/0x40 [ 65.596255] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596256] ---[ end trace 4dbe70ab8c0632f5 ]--- [ 65.596258] nouveau 0000:07:00.0: fifo: runlist 4 update timeout [ 65.596263] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596273] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 65.596283] nouveau 0000:07:00.0: fifo: SCHED_ERROR 20 [] [ 126.942326] [UFW BLOCK] IN=wlp8s0 OUT= MAC=(MAC Address) df:(df) SRC=(SRC) DST=(DST) LEN=36 TOS=0x00 PREC=0x00 TTL=1 ID=0 DF PROTO=2

编辑2 运行后sudo ls -l /var/www/amcosy.club/writefreely我得到以下信息:

total 50600 -rw-rw-rw- 1 root root 1004 Apr 7 20:43 config.ini drwxrwxrwx 2 root root 4096 Apr 7 20:43 keys drwxrwxrwx 2 root root 4096 Dec 18 02:41 pages drwxrwxrwx 6 root root 4096 Dec 18 02:41 static drwxrwxrwx 4 root root 4096 Dec 18 02:41 templates -rwxrwxrwx 1 root root 51786256 Dec 18 02:43 writefreely

答案1

刚刚按照您的指南在 Ubuntu 18.04 测试机上安装了 writefreely,没有任何问题:

$ sudo journalctl  -u writefreely
-- Logs begin at Thu 2020-04-09 20:43:07 UTC, end at Thu 2020-04-09 21:57:13 UTC. --
Apr 09 21:57:00 ubuntu systemd[1]: Started WriteFreely Instance.
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Starting WriteFreely 0.11.2...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Loading config.ini configuration...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Loading templates...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Loading pages...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Loading user pages...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Loading encryption keys...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Connecting to sqlite3 database...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Adding {domain} routes (single user)...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Going to serve...
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 Serving on http://localhost:8080
Apr 09 21:57:00 ubuntu writefreely[1435]: 2020/04/09 21:57:00 ---

您的主机可能还存在其他问题。

相关内容