我一直在尝试解决两个我怀疑相互关联的问题。最近,我们的网络进行了重新配置,之后,由于网络配置问题,我遇到了非常长的启动时间,并且在启动后,无法再从 Win10 客户端访问 samba 文件共享。
启动时消息:
[ OK ] Reached target Network (Pre).
Starting Network Service...
Starting Wait for Network to be Configured...
Starting Network Name Resolution.
[ OK ] Started Network Name Resolution.
[ OK ] Reached target Host and Network Name Lookups.
[** ] A start job is running for Wait for Network to be Configured (XX / no limit)
最后一条消息需要大约两分钟才能清除。我怀疑这可能是 DHCP 或 DNS 相关的问题。我还注意到 /var/log/syslog 中散布着几个“NXDOMAIN / 潜在 DVE2018-0001 违规”错误。目前,我真的不知道下一步该去哪里找出导致这种延迟的原因(或者为什么文件服务器对 Win10 客户端不可见)。顺便说一句,Samba 似乎正在运行,Webmin 报告文件夹共享处于活动状态...
编辑1:
根据评论中@heynnema的建议,输出cat /etc/netplan/*.yaml
:
# This is the network config written by 'subiquity'
network:
ethernets:
enp4s0:
dhcp4: true
version: 2
编辑2:
与 Samba 相关的输出。
fstab 内容:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/md2 during curtin installation
/dev/disk/by-id/md-uuid-4c695059:2f774b0b:9e5492d2:bcb62609 / ext4 defaults 0 0
/dev/disk/by-id/md-uuid-05f3f447:6002213f:2bb97c81:6416f121 none swap sw 0 0
# /boot was on /dev/md0 during curtin installation
/dev/disk/by-id/md-uuid-58dd9ab9:74b02d8a:10890b55:2212c9cb /boot ext4 defaults 0
0
/swap.img none swap sw 0 0
smb.conf 共享定义:
#======================= Share Definitions =======================
# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
; comment = Home Directories
; browseable = no
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
; read only = yes
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
; create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
; directory mask = 0700
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# Un-comment the following parameter to make sure that only "username"
# can connect to \\server\username
# This might need tweaking when using external authentication schemes
; valid users = %S
# Un-comment the following and create the netlogon directory for Domain
Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin
[media_Public]
create mode = 777
path = /home/media/Public
writeable = yes
public = yes
directory mode = 777
答案1
更换当前/etc/netplan/*.yaml用这个文件,并将 enpxxx 更改为第二个接口的正确名称......
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
dhcp4: true
optional: true
enpxxx:
dhcp4: true
optional: true
sudo netplan generate
sudo netplan apply
reboot
答案2
我遇到了同样的问题。与 heynnema 的答案类似,但更具体地将接口设置为选修的允许虚拟机启动(可能没有来自 DHCP 的 IP)。例如,我的 netplan 配置现在如下所示:
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: true
dhcp6: true
optional: true
答案3
我在最近从 Ubuntu 16 升级到 18,然后又升级到 Ubuntu 20 的服务器上遇到了同样的问题。我发现这是由于网络计划和/etc/网络/接口同时启用。根据我过去使用 Ubuntu 20 的经验,我最初认为 Netplan 会默认启用,但现在显然情况不再如此了……
我通过注释掉以下内容解决了该问题/etc/网络/接口(默认情况下为 DHCP 地址设置)并添加子句dhcp4: 假在 netplan 配置文件中/etc/netplan/01-netcfg.yaml,因为我使用的是静态 IP(尽管设置了静态 IP,但长时间超时可能是由于对不存在的 DHCP 的查询导致的)。
祝你好运...
答案4
我在 ESXi 主机上配置的虚拟机上安装 Ubuntu 22.04。我必须提供至少 8 GB 的 RAM 才能继续完成主机网络查找安装部分。我可以通过将 RAM 切换为 4GB 来可靠地重现此问题。
结论
将虚拟机上的 RAM 增加到 8gb。