重新启动 Ubuntu 服务器,现在 Transmission Daemon 突然无法启动

重新启动 Ubuntu 服务器,现在 Transmission Daemon 突然无法启动

解决方案

https://github.com/transmission/transmission/issues/537#issuecomment-370660548

tzeejay 的评论:

  1. 创建目录然后放置文件(如果您不是 root,则需要 sudo):

    sudo mkdir /etc/systemd/system/transmission-daemon.service.d/ && sudo nano /etc/systemd/system/transmission-daemon.service.d/override.conf

  2. 将其放在刚刚打开的配置文件中:

    [服务] 类型=简单 用户=debian-transmission 组=debian-transmission

  3. 重启一切

    sudo systemctl daemon-reload && sudo systemctl start transmission-daemon.service

给了我一个正在运行的 Transmission 实例

我可以确认这对我有用。希望这对其他受此影响的人也有用。只是希望我再推迟卸载一段时间……今晚我基本上要重新添加所有内容。

感谢大家的帮助!


编辑:我用来安装 Transmission 的指南是这样的; https://help.ubuntu.com/community/TransmissionHowTo

在服务器上安装新的硬盘后,我重新启动了操作系统,因为某种原因,GParted 无法使用其更改来更新内核,并提示先重新启动(不确定这是否与我遇到的问题有关,但认为值得一提)。

自重新启动后,当我尝试启动 Trasmission Daemon(在启动期间、在 apt 更新期间或手动启动服务)时收到以下消息;

● transmission-daemon.service - Transmission BitTorrent Daemon
Loaded: loaded (/lib/systemd/system/transmission-daemon.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-03-05 00:04:10 GMT; 1min 53s ago
Process: 28068 ExecStart=/usr/bin/transmission-daemon -f --log-error (code=exited, status=217/USER)
Main PID: 28068 (code=exited, status=217/USER)
CPU: 0

systemd[1]: Starting Transmission BitTorrent Daemon...
systemd[28068]: transmission-daemon.service: Failed to determine user credentials: No such process
systemd[1]: transmission-daemon.service: Main process exited, code=exited, status=217/USER
systemd[1]: Failed to start Transmission BitTorrent Daemon.
systemd[1]: transmission-daemon.service: Unit entered failed state.
systemd[1]: transmission-daemon.service: Failed with result 'exit-code'.

我对 Linux 还很陌生,正在努力弄清楚守护进程实际上将其日志文件放在哪里,为什么它首先出现故障以及如何修复它......非常感谢任何帮助或指导。


一些额外的信息;

认为值得一提的是,我过去曾重新启动过该服务器而没有任何问题,因此如果突然加载错误的配置文件,我会感到惊讶(尽管我没有排除任何可能性!)。

Ubuntu 17.10 最初仅作为 CLI 安装,但通过 GUI 比通过 CLI 执行某些操作(例如在 GParted 中格式化和管理驱动器)更容易,因此我在顶部安装了 GUI 并将事情保持在最低限度。

从我读到的有关 transmission 守护进程的信息来看,它会自行创建自己的用户帐户(没有主目录,也称为服务帐户)。自从我设置它以来已经有一段时间了,所以我不记得用它做过什么特别的事情。我基本上遵循了以下指南:

http://idroot.net/tutorials/how-to-install-transmission-on-ubuntu-14-04/

虽然可以通过 apt 进行更新,但由于帖子中列出的消息,它实际上无法安装它。它似乎出于某种原因在更新之前尝试启动服务。或者在更新后它无法启动并恢复更改...我不确定。

以下是我尝试运行 apt-get update/upgrade 时显示的内容:

**sudo apt-get upgrade**
 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 Calculating upgrade... Done
 0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
 1 not fully installed or removed.
 After this operation, 0 B of additional disk space will be used.
 **Do you want to continue? [Y/n] y**
 Setting up transmission-daemon (2.93-1ubuntu1~17.10.1) ...
 Job for transmission-daemon.service failed because the control process exited with error code.
 See "systemctl  status transmission-daemon.service" and "journalctl  -xe" for details.
 invoke-rc.d: initscript transmission-daemon, action "start" failed.
 ● transmission-daemon.service - Transmission BitTorrent Daemon
    Loaded: loaded (/lib/systemd/system/transmission-daemon.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Mon 2018-03-05 18:43:15 GMT; 6ms ago
   Process: 13378 ExecStart=/usr/bin/transmission-daemon -f --log-error (code=exited, status=217/USER)
  Main PID: 13378 (code=exited, status=217/USER)
  CPU: 0

 systemd[1]: Starting Transmission BitTorrent Daemon...
 systemd[13378]: transmission-daemon.service: Failed to determine user credentials: No such process
 systemd[1]: transmission-daemon.service: Main process exited, code=exited, status=217/USER
 systemd[1]: Failed to start Transmission BitTorrent Daemon.
 systemd[1]: transmission-daemon.service: Unit entered failed state.
 systemd[1]: transmission-daemon.service: Failed with result 'exit-code'.
 dpkg: error processing package transmission-daemon (--configure):
  subprocess installed post-installation script returned error exit status 1
 Errors were encountered while processing:
  transmission-daemon
 E: Sub-process /usr/bin/dpkg returned an error code (1)

任何帮助是极大的赞赏。


因此,根据@Trevor Hammonds的建议,我编辑了/lib/systemd/system/transmission-daemon.service文件(我相信他指的是该文件)。它最初包含以下文本;

[Unit]
Description=Transmission BitTorrent Daemon
After=network.target

[Service]
User=transmission
Type=notify
ExecStart=/usr/bin/transmission-daemon -f --log-error
ExecReload=/bin/kill -s HUP $MAINPID

[Install]
WantedBy=multi-user.target

因此我将 User= 更改为 daemon-transmission,现在当我尝试启动或更新服务时(经过 2 分钟的暂停后)出现不同的错误,失败。journalctl 指出以下内容:

Mar 06 22:12:46 PlexServer sudo[3382]:     *me*  : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/service transmission-daemon start
Mar 06 22:12:46 PlexServer sudo[3382]: pam_unix(sudo:session): session opened for user root by *me*(uid=0)
Mar 06 22:12:47 PlexServer systemd[1]: Starting Transmission BitTorrent Daemon...
-- Subject: Unit transmission-daemon.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit transmission-daemon.service has begun starting up.
Mar 06 22:12:48 *server* transmission-daemon[3411]: [2018-03-06 22:12:48.759] UDP Failed to set receive buffer: requested 4194304, got 425984 (tr-udp.c:84)
Mar 06 22:12:48 *server* transmission-daemon[3411]: [2018-03-06 22:12:48.759] UDP Failed to set send buffer: requested 1048576, got 425984 (tr-udp.c:95)
Mar 06 22:12:48 *server* transmission-daemon[3411]: [2018-03-06 22:12:48.759] UDP Failed to set receive buffer: requested 4194304, got 425984 (tr-udp.c:84)
Mar 06 22:12:48 *server* transmission-daemon[3411]: [2018-03-06 22:12:48.759] UDP Failed to set send buffer: requested 1048576, got 425984 (tr-udp.c:95)
Mar 06 22:14:17 *server* systemd[1]: transmission-daemon.service: Start operation timed out. Terminating.
Mar 06 22:14:18 *server* transmission-daemon[3411]: Closing transmission session... done.
Mar 06 22:14:18 *server* systemd[1]: Failed to start Transmission BitTorrent Daemon.
-- Subject: Unit transmission-daemon.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit transmission-daemon.service has failed.
--
-- The result is failed.
Mar 06 22:14:18 *server* systemd[1]: transmission-daemon.service: Unit entered failed state.
Mar 06 22:14:18 *server* systemd[1]: transmission-daemon.service: Failed with result 'timeout'.
Mar 06 22:14:18 *server* sudo[3382]: pam_unix(sudo:session): session closed for user root

我正准备重新安装...我只希望知道是什么损坏了它/如何修复它,因为这是一个巨大的干扰/不便,我宁愿不必在 Transmission 开发人员每次更新时都经历这种情况 :(

答案1

apt 升级将用户更改为“ debian-transmission”,并将多个目录的所有权也更改为该用户。因此,transmssion 守护进程无法读取其配置文件,也无法写入下载目录。您需要更改文件transmission-daemon.service以反映新用户名,或者通过将文件和目录的所有所有权改回之前的 transmission 用户来修复升级造成的所有问题。

相关内容