Transmission 2.93升级踩坑记录

Rhilip 2018-03-07 PM 2773℃ 0条

PPA源已修复该问题,目前升级不会出现无法启动的情况,如果你的web页面恢复原版请直接重打补丁即可~

前言

因为马上有个站点将要禁用Transmission 2.92,所以准备将自己主服务器上的Transmission 2.92升级到2.93。在此过程中遇到很多问题,在此一并描述:

本文也适用于使用包管理器从tr2.84升级至2.93。

原环境

原环境配置大体可以参照本人已有博文 从零开始自主搭建全套 Seedbox 环境 (1) -下载篇

下面我将用 Transmission 2.84 作为演示

[email protected]:~# transmission-daemon -v
Transmission 2.84 (14307)  http://www.transmissionbt.com/
.........

升级中踩坑

升级完无法自动启动

使用apt-get upgrade transmission-daemon升级,无法自动启动。主要报错信息:transmission-daemon.service: Failed at step USER spawning /usr/bin/transmission-daemon: No such process

tr_fail.jpg

以下为详细过程:

[email protected]:~# apt-get upgrade transmission-daemon
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  linux-generic linux-headers-generic linux-image-generic
The following packages will be upgraded:
  transmission-cli transmission-common transmission-daemon
3 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 912 kB of archives.
After this operation, 144 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
........... (省略)
Processing triggers for man-db (2.7.5-1) ...
Setting up transmission-common (2.93-1ubuntu1~16.04.1ubuntu1) ...
Setting up transmission-daemon (2.93-1ubuntu1~16.04.1ubuntu1) ...
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 Wed 2018-03-07 10:21:14 UTC; 9ms ago
  Process: 19952 ExecStart=/usr/bin/transmission-daemon -f --log-error (code=exited, status=217/USER)
 Main PID: 19952 (code=exited, status=217/USER)

Mar 07 10:21:14 vultr.guest systemd[1]: Starting Transmission BitTorrent Daemon...
Mar 07 10:21:14 vultr.guest systemd[19952]: transmission-daemon.service: Failed at step USER spawning /usr/bin/transmission-daemon: No such process
Mar 07 10:21:14 vultr.guest systemd[1]: transmission-daemon.service: Main process exited, code=exited, status=217/USER
Mar 07 10:21:14 vultr.guest systemd[1]: Failed to start Transmission BitTorrent Daemon.
Mar 07 10:21:14 vultr.guest systemd[1]: transmission-daemon.service: Unit entered failed state.
Mar 07 10:21:14 vultr.guest 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
Setting up transmission-cli (2.93-1ubuntu1~16.04.1ubuntu1) ...E: Sub-process /usr/bin/dpkg returned an error code (1)

这个问题在 Github以及ubuntuforums 均有人提出。

最终的解决方法有:

  • build your own from source and do not forget to install libsystemd-dev before building. // 安装libsystemd-dev依赖并从源码编译
  • wait for the PPA maintainer to do the above and build a new version. // 等待
  • change the type in /etc/systemd/system/transmission-daemon.service from "notify" to "simple" // 修改/etc/systemd/system/transmission-daemon.service

从源码编译我们当然不选,等待是回事吗?
但是从PPA源安装旧版本并升级到2.93的用户,原先使用的是init.d进行管理的,并不是systemctl。而且原来的管理用户是debian-transmission,而现在变成了transmission所以我们选择第三条路。

新建/etc/systemd/system/transmission-daemon.service.d/override.conf文件,并填入以下内容(注意:上层文件夹需要自己建立。

[Service]
User=
Type=
Type=simple
User=debian-transmission
Group=debian-transmission

然后用systemctl daemon-reload重建systemctl daemon
之后就能顺利使用sytsemctl start transmission-daemon命令启动transmission了。

[email protected]:~# mkdir /etc/systemd/system/transmission-daemon.service.d
[email protected]:~# vi /etc/systemd/system/transmission-daemon.service.d/override.conf
[email protected]:~# systemctl daemon-reload
[email protected]:~# systemctl start transmission-daemon
[email protected]:~# systemctl status transmission-daemon
● transmission-daemon.service - Transmission BitTorrent Daemon
   Loaded: loaded (/lib/systemd/system/transmission-daemon.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/transmission-daemon.service.d
           └─override.conf
   Active: active (running) since Wed 2018-03-07 10:40:05 UTC; 14s ago
 Main PID: 20197 (transmission-da)
    Tasks: 4
   Memory: 6.9M
      CPU: 36ms
   CGroup: /system.slice/transmission-daemon.service
           └─20197 /usr/bin/transmission-daemon -f --log-error

Mar 07 10:40:05 vultr.guest systemd[1]: Started Transmission BitTorrent Daemon.
Mar 07 10:40:06 vultr.guest transmission-daemon[20197]: [2018-03-07 10:40:06.535] UDP Failed to set receive buffer: requested 4194304, got 425984 (tr-udp.c:84)

恢复transmission-web-control美化

在完成升级后,你可能会发现web页面被恢复到原版或者无法正常显示。
这时候只要重新安装就行

wget https://github.com/ronggang/transmission-web-control/raw/master/release/install-tr-control.sh
sudo bash install-tr-control.sh

如果安装后后刷新页面(以<ip>:9091和域名形式分别试试)发现一切OK,那么说明你没有踩到很多的坑,在此恭喜。。。

如果还是无法正常显示,我们来慢慢排查

  • 检查Transmission配置项,将rpc-host-whitelist-enabled改成false,或者将你的域名添加至rpc-host-whitelist修改Tr配置时记得先停止服务~
  • 检查Nginx日志以及本地浏览器开发者面板,是否有大量js请求被404了。如果是的话,我们需要修改下原来配置的反代设置。

以下是一个挂在二级域名的一个目录下的写法,server字段省略部分请根据自己原有内容补齐。

upstream transmission  {
      server 127.0.0.1:9091; #Transmission
}
server {

      # .....................

      location ^~ /transmission {

          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_set_header X-NginX-Proxy true;
          proxy_http_version 1.1;
          proxy_set_header Connection "";
          proxy_pass_header X-Transmission-Session-Id;
          add_header   Front-End-Https   on;

          location /transmission/rpc {
              proxy_pass http://transmission;
          }

          location /transmission/web/ {
              proxy_pass http://transmission;
          }

          location /transmission/upload {
              proxy_pass http://transmission;
          }

          location /transmission/web/style/ {
              alias /usr/share/transmission/web/style/;
          }

          location /transmission/web/javascript/ {
              alias /usr/share/transmission/web/javascript/;
          }

          location /transmission/web/images/ {
              alias /usr/share/transmission/web/images/;
          }

          location /transmission/web/tr-web-control/ {
              alias /usr/share/transmission/web/tr-web-control/;
          }

          location /transmission/ {
              return 301 https://$server_name/transmission/web;
          }
      }

}

然后重载nginx配置,即可~

参考

标签: Transmission, Ubuntu

非特殊说明,本博所有文章均为博主原创。

评论啦~