服務端:ubuntu 客戶端:ARM開發板
安裝失敗過程:
先是參考了 Linux——Linux系統編程之基於TFTP實現服務器與開發板間的文件傳輸實戰總結 先后安裝了xinetd tftp tftpd ,也新建了/etc/xinetd.d/tftp
重啟服務后,在本機使用tffp測試傳輸文件,一直顯示超時,關閉防火牆等措施也沒用。
嘗試卸載 sudo apt-get remove xinetd tftp tftpd , 再重新安裝時報錯:
... Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. 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 tftpd-hpa (5.2+20150808-1ubuntu4) ... tftpd user (tftp) already exists, doing nothing. tftpd-hpa directory (/srv/tftp) already exists, doing nothing. Job for tftpd-hpa.service failed because the control process exited with error code. See "systemctl status tftpd-hpa.service" and "journalctl -xe" for details. invoke-rc.d: initscript tftpd-hpa, action "start" failed. * tftpd-hpa.service - LSB: HPA's tftp server Loaded: loaded (/etc/init.d/tftpd-hpa; generated) Active: failed (Result: exit-code) since Tue 2021-11-23 18:08:20 CST; 3ms ago Docs: man:systemd-sysv-generator(8) Process: 28678 ExecStart=/etc/init.d/tftpd-hpa start (code=exited, status=71) Nov 23 18:08:20 tianyu systemd[1]: Starting LSB: HPA's tftp server... Nov 23 18:08:20 tianyu tftpd-hpa[28678]: * Starting HPA's tftpd in.tftpd Nov 23 18:08:20 tianyu systemd[1]: tftpd-hpa.service: Control process exited, code=exited, status=71/OSERR Nov 23 18:08:20 tianyu systemd[1]: tftpd-hpa.service: Failed with result 'exit-code'. Nov 23 18:08:20 tianyu systemd[1]: Failed to start LSB: HPA's tftp server. dpkg: error processing package tftpd-hpa (--configure): installed tftpd-hpa package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: tftpd-hpa E: Sub-process /usr/bin/dpkg returned an error code (1)
參考該博客:E: Sub-process /usr/bin/dpkg returned an error code (1)解決辦法 解決問題
可知,要么安裝tftp-hpa 和tftpd-hpa(tftp的增強版), 或者安裝xinetd , tftp ,tftpd
如果同時安裝了並啟動了tftp-hpa 和xinetd,會導致tftp-hpa的端口被占用,導致超時。如何解決:修改xinetd的配置文件,關閉服務。
