LXC 无限重启动循环

LXC 无限重启动循环

(请参阅下面的更新 1、2 和 3)

今天我更新了主机系统,然后重新启动后 LXD 守护进程没有启动。

它给出了错误

failed to create listening socket for 10.104.52.1: Address already in use

我能做些什么?

我有:

  • Ubuntu 16.04.3 LTS
  • lxd 2.16 3346 规范-(Snap 版本)

我用来启动的命令

sudo systemctl start snap.lxd.daemon.service

从系统日志中提取:

Aug 15 20:05:52 s4 lxc[23200]: cmd.go:118: DEBUG: restarting into "/snap/core/current/usr/bin/snap"
Aug 15 20:06:12 s4 systemd[1]: Started Service for snap application lxd.daemon.
Aug 15 20:06:12 s4 /usr/bin/snap[23219]: cmd.go:118: DEBUG: restarting into "/snap/core/current/usr/bin/snap"
Aug 15 20:06:12 s4 snap[23219]: => Preparing the system
Aug 15 20:06:12 s4 snap[23219]: ==> Preparing a clean copy of /run
Aug 15 20:06:12 s4 snap[23219]: ==> Preparing a clean copy of /etc
Aug 15 20:06:12 s4 snap[23219]: ==> Setting up ceph configuration
Aug 15 20:06:12 s4 snap[23219]: ==> Setting up LVM configuration
Aug 15 20:06:12 s4 snap[23219]: ==> Escaping the systemd cgroups                                                                                                                     
Aug 15 20:06:12 s4 snap[23219]: ==> Escaping the systemd process resource limits                                                                                                     
Aug 15 20:06:12 s4 snap[23219]: ==> Enabling unprivileged containers kernel support                                                                                                  
Aug 15 20:06:12 s4 snap[23219]: => Starting LXCFS                                                                                                                                    
Aug 15 20:06:12 s4 snap[23219]: => Starting LXD                                                                                                                                      
Aug 15 20:06:12 s4 kernel: [  767.318344] cgroup: new mount options do not match the existing superblock, will be ignored                                                            
Aug 15 20:06:12 s4 snap[23219]: lvl=warn msg="CGroup memory swap accounting is disabled, swap limits will be ignored." t=2017-08-15T18:06:12+0000                                    
Aug 15 20:06:12 s4 snap[23219]: hierarchies:                                                                                                                                         
Aug 15 20:06:12 s4 snap[23219]:   0: fd:   5: memory                                                                                                                                 
Aug 15 20:06:12 s4 snap[23219]:   1: fd:   6: blkio                                                                                                                                  
Aug 15 20:06:12 s4 snap[23219]:   2: fd:   7: hugetlb                                                                                                                                
Aug 15 20:06:12 s4 snap[23219]:   3: fd:   8: cpuset                                                                                                                                 
Aug 15 20:06:12 s4 snap[23219]:   4: fd:   9: devices
Aug 15 20:06:12 s4 snap[23219]:   5: fd:  10: net_cls,net_prio
Aug 15 20:06:12 s4 snap[23219]:   6: fd:  11: freezer
Aug 15 20:06:12 s4 snap[23219]:   7: fd:  12: pids
Aug 15 20:06:12 s4 snap[23219]:   8: fd:  13: perf_event
Aug 15 20:06:12 s4 snap[23219]:   9: fd:  14: cpu,cpuacct
Aug 15 20:06:12 s4 snap[23219]:  10: fd:  15: name=systemd
Aug 15 20:06:12 s4 avahi-daemon[1986]: Withdrawing address record for 10.104.52.1 on lxdbr0.
Aug 15 20:06:12 s4 avahi-daemon[1986]: Leaving mDNS multicast group on interface lxdbr0.IPv4 with address 10.104.52.1.
Aug 15 20:06:12 s4 avahi-daemon[1986]: Interface lxdbr0.IPv4 no longer relevant for mDNS.
Aug 15 20:06:12 s4 named[2579]: no longer listening on 10.104.52.1#53
Aug 15 20:06:12 s4 avahi-daemon[1986]: Joining mDNS multicast group on interface lxdbr0.IPv4 with address 10.104.52.1.
Aug 15 20:06:12 s4 avahi-daemon[1986]: New relevant interface lxdbr0.IPv4 for mDNS.
Aug 15 20:06:12 s4 avahi-daemon[1986]: Registering new address record for 10.104.52.1 on lxdbr0.IPv4.
Aug 15 20:06:12 s4 named[2579]: listening on IPv4 interface lxdbr0, 10.104.52.1#53
Aug 15 20:06:12 s4 dnsmasq[23351]: failed to create listening socket for 10.104.52.1: Address already in use
Aug 15 20:06:12 s4 dnsmasq[23351]: FAILED to start up

============ 更新 ======================================

重新打开电源后,LXC 守护进程进入无限重启循环。尝试停止守护进程;但结果却以错误状态结束。以下是记录:

sysop@s4:~$ lxc list
LXD socket not found; is LXD installed and running?
sysop@s4:~$ sudo systemctl stop snap.lxd.daemon.service
[sudo] password di sysop: 
sysop@s4:~$ sudo systemctl status snap.lxd.daemon.service
● snap.lxd.daemon.service - Service for snap application lxd.daemon
Loaded: loaded (/etc/systemd/system/snap.lxd.daemon.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since mer 2017-08-16 06:26:41 CEST; 33s ago
Process: 32064 ExecStop=/usr/bin/snap run --command=stop lxd.daemon (code=exited, status=0/SUCCESS)
Process: 29801 ExecStart=/usr/bin/snap run lxd.daemon (code=exited, status=1/FAILURE)
Main PID: 29801 (code=exited, status=1/FAILURE)

ago 16 06:26:39 s4 snap[29526]: action=shutdown created=2017-08-06T10:45:02+0000 ephemeral=false lvl=eror msg="Failed shutting down container" name=liferaybase t=2017-08-16T04:26:39
ago 16 06:26:39 s4 snap[29526]: lvl=warn msg="Unable to update backup.yaml at this time." name=cybersec t=2017-08-16T04:26:39+0000
ago 16 06:26:39 s4 snap[29526]: lvl=warn msg="Unable to update backup.yaml at this time." name=liferaybase t=2017-08-16T04:26:39+0000
ago 16 06:26:39 s4 snap[29526]: lvl=warn msg="Unable to update backup.yaml at this time." name=servizi t=2017-08-16T04:26:39+0000
ago 16 06:26:39 s4 snap[29526]: lvl=warn msg="Unable to update backup.yaml at this time." name=db-server t=2017-08-16T04:26:39+0000
ago 16 06:26:40 s4 snap[29526]: lvl=warn msg="Unable to update backup.yaml at this time." name=icons t=2017-08-16T04:26:40+0000
ago 16 06:26:40 s4 snap[32064]: => Stopping LXCFS
ago 16 06:26:41 s4 systemd[1]: Stopped Service for snap application lxd.daemon.
ago 16 06:26:41 s4 systemd[1]: snap.lxd.daemon.service: Unit entered failed state.
ago 16 06:26:41 s4 systemd[1]: snap.lxd.daemon.service: Failed with result 'exit-code'.
sysop@s4:~$ 

我该如何清除错误状态?

============================= 更新 2 ==================================

“sudo systemctl start snap.lxd.daemon.service” 在 syslog 中的输出

Aug 16 11:09:44 s4 systemd[1]: Started Service for snap application lxd.daemon.
Aug 16 11:09:44 s4 /usr/bin/snap[25736]: cmd.go:189: DEBUG: restarting into "/snap/core/current/usr/bin/snap"
Aug 16 11:09:44 s4 snap[25736]: => Preparing the system
Aug 16 11:09:44 s4 snap[25736]: ==> Preparing a clean copy of /run
Aug 16 11:09:44 s4 snap[25736]: ==> Preparing a clean copy of /etc
Aug 16 11:09:44 s4 snap[25736]: ==> Setting up ceph configuration
Aug 16 11:09:44 s4 snap[25736]: ==> Setting up LVM configuration
Aug 16 11:09:44 s4 snap[25736]: ==> Escaping the systemd cgroups
Aug 16 11:09:44 s4 snap[25736]: ==> Escaping the systemd process resource limits
Aug 16 11:09:44 s4 snap[25736]: ==> Enabling unprivileged containers kernel support
Aug 16 11:09:44 s4 snap[25736]: => Starting LXCFS
Aug 16 11:09:44 s4 snap[25736]: => Starting LXD
Aug 16 11:09:44 s4 kernel: [ 1154.222272] cgroup: new mount options do not match the existing superblock, will be ignored
Aug 16 11:09:44 s4 snap[25736]: lvl=warn msg="CGroup memory swap accounting is disabled, swap limits will be ignored." t=2017-08-16T09:09:44+0000
Aug 16 11:09:44 s4 snap[25736]: => LXD is ready
Aug 16 11:09:44 s4 snap[25736]: hierarchies:
Aug 16 11:09:44 s4 snap[25736]:   0: fd:   5: freezer
Aug 16 11:09:44 s4 snap[25736]:   1: fd:   6: devices
Aug 16 11:09:44 s4 snap[25736]:   2: fd:   7: memory
Aug 16 11:09:44 s4 snap[25736]:   3: fd:   8: pids
Aug 16 11:09:44 s4 snap[25736]:   4: fd:   9: perf_event
Aug 16 11:09:44 s4 snap[25736]:   5: fd:  10: hugetlb
Aug 16 11:09:44 s4 snap[25736]:   6: fd:  11: cpuset
Aug 16 11:09:44 s4 snap[25736]:   7: fd:  12: blkio
Aug 16 11:09:44 s4 snap[25736]:   8: fd:  13: cpu,cpuacct
Aug 16 11:09:44 s4 snap[25736]:   9: fd:  14: net_cls,net_prio
Aug 16 11:09:44 s4 snap[25736]:  10: fd:  15: name=systemd
Aug 16 11:09:44 s4 avahi-daemon[1993]: Withdrawing address record for 10.104.52.1 on lxdbr0.
Aug 16 11:09:44 s4 avahi-daemon[1993]: Leaving mDNS multicast group on interface lxdbr0.IPv4 with address 10.104.52.1.
Aug 16 11:09:44 s4 avahi-daemon[1993]: Interface lxdbr0.IPv4 no longer relevant for mDNS.
Aug 16 11:09:44 s4 named[2591]: no longer listening on 10.104.52.1#53
Aug 16 11:09:44 s4 avahi-daemon[1993]: Joining mDNS multicast group on interface lxdbr0.IPv4 with address 10.104.52.1.
Aug 16 11:09:44 s4 avahi-daemon[1993]: New relevant interface lxdbr0.IPv4 for mDNS.
Aug 16 11:09:44 s4 avahi-daemon[1993]: Registering new address record for 10.104.52.1 on lxdbr0.IPv4.
Aug 16 11:09:44 s4 named[2591]: listening on IPv4 interface lxdbr0, 10.104.52.1#53
Aug 16 11:09:44 s4 named[2591]: network unreachable resolving 'ubuntu.com/DS/IN': 2001:503:a83e::2:30#53
Aug 16 11:09:44 s4 named[2591]: network unreachable resolving 'ubuntu.com/DS/IN': 2001:503:eea3::30#53
Aug 16 11:09:44 s4 dnsmasq[25868]: failed to create listening socket for 10.104.52.1: Address already in use
Aug 16 11:09:44 s4 dnsmasq[25868]: FAILED to start up
Aug 16 11:09:45 s4 dnsmasq[25869]: failed to create listening socket for 10.104.52.1: Address already in use
Aug 16 11:09:45 s4 dnsmasq[25869]: FAILED to start up
Aug 16 11:09:45 s4 dnsmasq[25870]: failed to create listening socket for 10.104.52.1: Address already in use
Aug 16 11:09:45 s4 dnsmasq[25870]: FAILED to start up
Aug 16 11:09:46 s4 dnsmasq[25871]: failed to create listening socket for 10.104.52.1: Address already in use
Aug 16 11:09:46 s4 dnsmasq[25871]: FAILED to start up

从这里开始它进入无限循环并且永远不会开始

==================== 更新 3 ====================================

我有一台出现无限重启循环错误的物理机和一台可以正确重启的虚拟机。

在物理机器中(在循环过程中出现错误):

sysop@s4:~$ sudo brctl show
bridge name     bridge id               STP enabled     interfaces
lxdbr0          8000.fe049a888031       no              veth7KVBSH
                                                        vethFPOTVD
                                                        vethRA1QON
                                                        vethXPQLPC
                                                        vethYWVLD4
lxdbr1          8000.fe503c909805       no              vethGDM55D
virbr1          8000.525400d8609d       yes             virbr1-nic

在虚拟机中(正确重启):

sysop@vx00:~$ sudo brctl show
[sudo] password di sysop: 
bridge name     bridge id               STP enabled     interfaces
lxdbr0          8000.fe4f7f04c603       no              veth13QLME
                                                        veth8VLGTS
                                                        vethK17EY7
                                                        vethMBSAPN
                                                        vethX7TJ8L
lxdbr1          8000.fec3f10606ce       no              vethOXYX5G
virbr1          8000.fe5400ffa6aa       yes             vnet1

这有关系吗?

答案1

读取消息“无法为 10.104.52.1 创建监听套接字:地址已被使用”

因此选择另一个 IP 地址,例如 10.104.52.2 或类似的

答案2

回复我自己 解决了

我在同一台机器上安装了 bind9,它在 dnsmasq 上优先

处于无限循环状态:

sysop@s4:~/script$ sudo netstat -anlp | grep -w LISTEN
tcp        0      0 127.0.0.1:5900          0.0.0.0:*               LISTEN      4888/qemu-system-x8
tcp        0      0 127.0.0.1:5901          0.0.0.0:*               LISTEN      5145/qemu-system-x8
tcp        0      0 127.0.0.1:5902          0.0.0.0:*               LISTEN      5287/qemu-system-x8
tcp        0      0 127.0.0.1:5903          0.0.0.0:*               LISTEN      5457/qemu-system-x8
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN      3916/perl       
tcp        0      0 10.0.1.1:53             0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 10.104.52.1:53          0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 192.168.66.1:53         0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 192.168.33.1:53         0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 192.168.99.1:53         0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 192.168.13.128:53       0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 192.168.1.21:53         0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 192.168.1.22:53         0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 192.168.1.20:53         0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2593/sshd       
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      20214/named     
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      3910/master     
tcp6       0      0 :::10000                :::*                    LISTEN      3916/perl       
tcp6       0      0 :::53                   :::*                    LISTEN      20214/named     
tcp6       0      0 :::22                   :::*                    LISTEN      2593/sshd       
tcp6       0      0 ::1:953                 :::*                    LISTEN      20214/named     
tcp6       0      0 :::25                   :::*                    LISTEN      3910/master     

停止 bind9 lxc 正确启动,并且我有

sysop@s4:~/script$ sudo netstat -anlp | grep -w LISTEN
tcp        0      0 127.0.0.1:5900          0.0.0.0:*               LISTEN      4888/qemu-system-x8
tcp        0      0 127.0.0.1:5901          0.0.0.0:*               LISTEN      5145/qemu-system-x8
tcp        0      0 127.0.0.1:5902          0.0.0.0:*               LISTEN      5287/qemu-system-x8
tcp        0      0 127.0.0.1:5903          0.0.0.0:*               LISTEN      5457/qemu-system-x8
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN      3916/perl       
tcp        0      0 10.0.1.1:53             0.0.0.0:*               LISTEN      20457/dnsmasq   
tcp        0      0 10.104.52.1:53          0.0.0.0:*               LISTEN      20402/dnsmasq   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2593/sshd       
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      3910/master     
tcp6       0      0 :::10000                :::*                    LISTEN      3916/perl       
tcp6       0      0 fe80::fc50:3cff:fe90:53 :::*                    LISTEN      20457/dnsmasq   
tcp6       0      0 fe80::20b2:ceff:fe25:53 :::*                    LISTEN      20402/dnsmasq   
tcp6       0      0 :::22                   :::*                    LISTEN      2593/sshd       
tcp6       0      0 :::25                   :::*                    LISTEN      3910/master     

相关内容