本地网络共享 Ubuntu 20.04

本地网络共享 Ubuntu 20.04

我今天从 ubuntu 19.10 升级到了 ubuntu 20.04。由于某种原因,我的所有网络共享都消失了。我尝试共享一个文件夹,但系统提示我安装共享服务。当我继续时,我收到此错误:

The following packages have unmet dependencies:

samba: Depends: python3 (< 3.9) but 3.8.2-0ubuntu2 is to be installed
       Depends: samba-common (= 2:4.11.6+dfsg-0ubuntu1) but 2:4.11.6+dfsg-0ubuntu1 is to be installed
       Depends: samba-common-bin (= 2:4.11.6+dfsg-0ubuntu1) but 2:4.11.6+dfsg-0ubuntu1 is to be installed
       Depends: python3:any but it is a virtual package
       Depends: libwbclient0 (= 2:4.11.6+dfsg-0ubuntu1) but 2:4.11.6+dfsg-0ubuntu1 is to be installed
       Depends: samba-libs (= 2:4.11.6+dfsg-0ubuntu1) but 2:4.11.6+dfsg-0ubuntu1 is to be installed

我也尝试过教程。然而,这也失败了:

tasksel: apt-get failed (100)

@DankyNanky 这是我运行 ugrade 时得到的结果:

$ sudo apt upgrade -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libisl21
Use 'sudo apt autoremove' to remove it.
The following packages have been kept back:
  gnome-panel gnome-panel-data indicator-applet-complete indicator-datetime indicator-printers libpython-all-dev libpython2-dev libpython2-stdlib python-all
  python-all-dev python-pip-whl python2 python2-dev python2-minimal python3-pip
The following packages will be upgraded:
  cpp cpp-9 g++ g++-9 gcc gcc-9 gcc-9-base gcc-9-base:i386 libasan5 libgcc-9-dev libgcc1 libstdc++-9-dev
12 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
5 not fully installed or removed.
Need to get 0 B/28.7 MB of archives.
After this operation, 2,051 kB disk space will be freed.
(Reading database ... 380702 files and directories currently installed.)
Preparing to unpack .../00-libgcc1_1%3a10-20200411-0ubuntu1_amd64.deb ...
Unpacking libgcc1 (1:10-20200411-0ubuntu1) over (1:9.2.1-9ubuntu2) ...
Preparing to unpack .../01-g++-9_9.3.0-10ubuntu2_amd64.deb ...
Unpacking g++-9 (9.3.0-10ubuntu2) over (9.2.1-9ubuntu2) ...
Preparing to unpack .../02-gcc-9_9.3.0-10ubuntu2_amd64.deb ...
Unpacking gcc-9 (9.3.0-10ubuntu2) over (9.2.1-9ubuntu2) ...
Preparing to unpack .../03-cpp-9_9.3.0-10ubuntu2_amd64.deb ...
Unpacking cpp-9 (9.3.0-10ubuntu2) over (9.2.1-9ubuntu2) ...
Preparing to unpack .../04-libstdc++-9-dev_9.3.0-10ubuntu2_amd64.deb ...
Unpacking libstdc++-9-dev:amd64 (9.3.0-10ubuntu2) over (9.2.1-9ubuntu2) ...
Preparing to unpack .../05-libgcc-9-dev_9.3.0-10ubuntu2_amd64.deb ...
Unpacking libgcc-9-dev:amd64 (9.3.0-10ubuntu2) over (9.2.1-9ubuntu2) ...
Preparing to unpack .../06-libasan5_9.3.0-10ubuntu2_amd64.deb ...
Unpacking libasan5:amd64 (9.3.0-10ubuntu2) over (9.2.1-9ubuntu2) ...
Preparing to unpack .../07-gcc-9-base_9.3.0-10ubuntu2_amd64.deb ...
De-configuring gcc-9-base:i386 (9.2.1-9ubuntu2) ...
Unpacking gcc-9-base:amd64 (9.3.0-10ubuntu2) over (9.2.1-9ubuntu2) ...
Preparing to unpack .../08-gcc-9-base_9.3.0-10ubuntu2_i386.deb ...
Unpacking gcc-9-base:i386 (9.3.0-10ubuntu2) over (9.2.1-9ubuntu2) ...
Preparing to unpack .../09-g++_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking g++ (4:9.3.0-1ubuntu2) over (4:9.2.1-3.1ubuntu1) ...
Preparing to unpack .../10-gcc_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking gcc (4:9.3.0-1ubuntu2) over (4:9.2.1-3.1ubuntu1) ...
Preparing to unpack .../11-cpp_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking cpp (4:9.3.0-1ubuntu2) over (4:9.2.1-3.1ubuntu1) ...
Setting up libgcc1 (1:10-20200411-0ubuntu1) ...
Setting up samba-common-bin (2:4.11.6+dfsg-0ubuntu1) ...
Checking smb.conf with testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
ERROR: lock directory /run/samba does not exist

ERROR: pid directory /run/samba does not exist

Server role: ROLE_STANDALONE

dpkg: error processing package samba-common-bin (--configure):
 installed samba-common-bin package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of samba:
 samba depends on samba-common-bin (= 2:4.11.6+dfsg-0ubuntu1); however:
  Package samba-common-bin is not configured yet.

dpkg: error processing package samba (--configure):
 dependency problems - leaving unconfigured
Setting up gcc-9-base:amd64 (9.3.0-10ubuntu2) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Setting up gcc-9-base:i386 (9.3.0-10ubuntu2) ...
dpkg: dependency problems prevent configuration of winbind:
 winbind depends on samba-common-bin (= 2:4.11.6+dfsg-0ubuntu1); however:
  Package samba-common-bin is not configured yet.

dpkg: error processing package winbind (--configure):
 dependency problems - leaving unconfigured
Setting up libasan5:amd64 (9.3.0-10ubuntu2) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of lib
nss-winbind:amd64:
 libnss-winbind:amd64 depends on winbind:any (= 2:4.11.6+dfsg-0ubuntu1); however:
  Package winbind is not configured yet.

dpkg: error processing package libnss-winbind:amd64 (--configure):
 dependency problems - leaving unconfigured
Setting up cpp-9 (9.3.0-10ubuntu2) ...
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libpam-winbind:amd64:
 libpam-winbind:amd64 depends on winbind:any (= 2:4.11.6+dfsg-0ubuntu1); however:
  Package winbind is not configured yet.

dpkg: error processing package libpam-winbind:amd64 (--configure):
 dependency problems - leaving unconfigured
Setting up libgcc-9-dev:amd64 (9.3.0-10ubuntu2) ...
No apport report written because MaxReports is reached already
                                                              Setting up cpp (4:9.3.0-1ubuntu2) ...
Setting up gcc-9 (9.3.0-10ubuntu2) ...
Setting up libstdc++-9-dev:amd64 (9.3.0-10ubuntu2) ...
Setting up gcc (4:9.3.0-1ubuntu2) ...
Setting up g++-9 (9.3.0-10ubuntu2) ...
Setting up g++ (4:9.3.0-1ubuntu2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9) ...
Errors were encountered while processing:
 samba-common-bin
 samba
 winbind
 libnss-winbind:amd64
 libpam-winbind:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

解决方案很简单。只需卸载并重新安装 Samba。问题是 Samba 卸载也失败了:

# sudo apt purge samba
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gcc-9-base:i386 libisl21
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  samba*
0 upgraded, 0 newly installed, 1 to remove and 47 not upgraded.
4 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 samba-common-bin (2:4.11.6+dfsg-0ubuntu1) ...
Checking smb.conf with testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
ERROR: lock directory /run/samba does not exist

ERROR: pid directory /run/samba does not exist

Server role: ROLE_STANDALONE

dpkg: error processing package samba-common-bin (--configure):
 installed samba-common-bin package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of winbind:
 winbind depends on samba-common-bin (= 2:4.11.6+dfsg-0ubuntu1); however:
  Package samba-common-bin is not configured yet.

dpkg: error processing package winbind (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message ind
icates its a followup error from a previous failure.
                                                    dpkg: dependency problems prevent configuration of libnss-winbind:amd64:
 libnss-winbind:amd64 depends on winbind:any (= 2:4.11.6+dfsg-0ubuntu1); however:
  Package winbind is not configured yet.

dpkg: error processing package libnss-winbind:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libpam-winbind:amd64:
 libpam-winbind:amd64 depends on winbind:any (= 2:4.11.6+dfsg-0ubuntu1); however:
  Package winbind is not configured yet.

dpkg: error processing package libpam-winbind:amd64 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 samba-common-bin
 winbind
 libnss-winbind:amd64
 libpam-winbind:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

因此我尝试重新配置 winbind:

#sudo dpkg-reconfigure winbind
/usr/sbin/dpkg-reconfigure: winbind is broken or not fully installed

这也不起作用。所以我删除了 winbind:

# sudo apt purge winbind
    ...
# sudo apt purge samba:

这次 samba 卸载正确。

然后重新安装 samba:

#sudo apt install samba

这恢复了我所有的旧共享。这个故事的寓意是,如果某些东西不起作用,请尝试卸载并重新安装,包括依赖项。我通常会犹豫,因为我不想卸载共享依赖项。

相关内容