我最近从 14.04 升级到了 Ubuntu 16.04LTS。除了 Samba 之外,其他一切都正常。在花了很多时间尝试让 Samba 正常工作后,我决定重新安装 Samba。但是,当我安装 Samba 时,出现以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libuser1 python-libuser
Use 'sudo apt autoremove' to remove them.
Suggested packages:
bind9 bind9utils ctdb ntp winbind
The following NEW packages will be installed:
samba
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/900 kB of archives.
After this operation, 11.5 MB of additional disk space will be used.
Selecting previously unselected package samba.
(Reading database ... 412707 files and directories currently installed.)
Preparing to unpack .../samba_2%3a4.3.9+dfsg-0ubuntu0.16.04.2_amd64.deb ...
Unpacking samba (2:4.3.9+dfsg-0ubuntu0.16.04.2) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up samba (2:4.3.9+dfsg-0ubuntu0.16.04.2) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
insserv: warning: script 'binfmt-support' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `binfmt-support'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `binfmt-support'
Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript smbd, action "start" failed.
dpkg: error processing package samba (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
samba
E: Sub-process /usr/bin/dpkg returned an error code (1)
该问题是一个已知问题,与从 Ubuntu 15 向上进行的 Upstart/systemd 转换有关。但我使用的是 Ubuntu 16 存储库,因此我应该从那里获取正确版本的 Samba:为什么没有发生这种情况?
我的 /etc/apt/sources.list 文件的内容是:
# OFFICIAL UBUNTU REPOS #
#------------------------------------------------------------------------------#
###### Ubuntu Main Repos
deb http://ch.archive.ubuntu.com/ubuntu/ xenial main universe
deb-src http://ch.archive.ubuntu.com/ubuntu/ xenial main universe
###### Ubuntu Update Repos
deb http://ch.archive.ubuntu.com/ubuntu/ xenial-security main universe
deb http://ch.archive.ubuntu.com/ubuntu/ xenial-updates main universe
deb-src http://ch.archive.ubuntu.com/ubuntu/ xenial-security main universe
deb-src http://ch.archive.ubuntu.com/ubuntu/ xenial-updates main universe
###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
#------------------------------------------------------------------------------#
# UNOFFICIAL UBUNTU REPOS #
#------------------------------------------------------------------------------#
###### 3rd Party Binary Repos
#### GetDeb - http://www.getdeb.net
## Run this command: wget -q -O- http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
deb http://archive.getdeb.net/ubuntu xenial-getdeb apps
#### Gimp PPA - https://launchpad.net/~otto-kesselgulasch/+archive/gimp
## Run this command: sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 614C4B38
deb http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu xenial main
#### GNOME3 Extra Apps PPA - https://launchpad.net/~gnome3-team/+archive/gnome3
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B1510FD
deb http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu xenial main
#### Google Chrome Browser - http://www.google.com/linuxrepositories/
## Run this command: wget -q https://dl.google.com/linux/linux_signing_key.pub -O- | sudo apt-key add -
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
#### Google Earth - http://www.google.com/linuxrepositories/
## Run this command: wget -q https://dl.google.com/linux/linux_signing_key.pub -O- | sudo apt-key add -
deb [arch=amd64] http://dl.google.com/linux/earth/deb/ stable main
#### Mozilla Daily Build Team PPA - http://edge.launchpad.net/~ubuntu-mozilla-daily/+archive/ppa
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE
deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu xenial main
#### Opera - http://www.opera.com/
## Run this command: sudo wget -O - http://deb.opera.com/archive.key | sudo apt-key add -
deb http://deb.opera.com/opera/ stable non-free
#### Oracle Java (JDK) Installer PPA - http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
deb http://ppa.launchpad.net/webupd8team/java/ubuntu vivid main
#### ownCloud Desktop Client - http://owncloud.org/
## Run this command: wget -q http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_16.04/Release.key -O- | sudo apt-key add -
deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_16.04/ /
#### PlayDeb - http://www.playdeb.net/
## Run this command: wget -O- http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
deb http://archive.getdeb.net/ubuntu xenial-getdeb games
#### Samsung Unified Linux Driver Repository (SULDR) - http://www.bchemnet.com/suldr/index.html
## Run this command: wget -O - http://www.bchemnet.com/suldr/suldr.gpg | sudo apt-key add -
deb http://www.bchemnet.com/suldr/ debian extra
#### SimpleScreenRecorder PPA - http://www.maartenbaert.be/simplescreenrecorder/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 283EC8CD
deb http://ppa.launchpad.net/maarten-baert/simplescreenrecorder/ubuntu xenial main
#### Tor: anonymity online - https://www.torproject.org
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 886DDD89
deb http://deb.torproject.org/torproject.org xenial main
#### Unsettings PPA - http://www.florian-diesch.de/software/unsettings/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0FEB6DD9
deb http://ppa.launchpad.net/diesch/testing/ubuntu xenial main
#### Wine PPA - https://launchpad.net/~ubuntu-wine/+archive/ppa/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 883E8688397576B6C509DF495A9A06AEF9CB8DB0
deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu xenial main
####### 3rd Party Source Repos
#### Gimp PPA (Source) - https://launchpad.net/~otto-kesselgulasch/+archive/gimp
## Run this command: sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 614C4B38
deb-src http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu xenial main
#### GNOME3 Extra Apps PPA (Source) - https://launchpad.net/~gnome3-team/+archive/gnome3
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B1510FD
deb-src http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu xenial main
#### Mozilla Daily Build Team PPA (Source) - http://edge.launchpad.net/~ubuntu-mozilla-daily/+archive/ppa
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE
deb-src http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu xenial main
#### Oracle Java (JDK) Installer PPA (Source) - http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu vivid main
#### SimpleScreenRecorder PPA (Source) - http://www.maartenbaert.be/simplescreenrecorder/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 283EC8CD
deb-src http://ppa.launchpad.net/maarten-baert/simplescreenrecorder/ubuntu xenial main
#### Tor: anonymity online (Source) - https://www.torproject.org
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 886DDD89
deb-src http://deb.torproject.org/torproject.org xenial main
#### Unsettings PPA (Source) - http://www.florian-diesch.de/software/unsettings/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0FEB6DD9
deb-src http://ppa.launchpad.net/diesch/testing/ubuntu xenial main
#### Wine PPA (Source) - https://launchpad.net/~ubuntu-wine/+archive/ppa/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 883E8688397576B6C509DF495A9A06AEF9CB8DB0
deb-src http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu xenial main
答案1
我找到了答案:您不仅需要清除 samba,还需要清除 samba-common,方法是使用 sudo apt-get purge samba-common。使用 sudo apt autoremove 后,您可以再次安装 samba。