Ubuntu更新terraform失败,因为输入是必需的

rlcwz9us  于 7个月前  发布在  其他
关注(0)|答案(1)|浏览(78)

我是terraform的新手,当创建服务器并使用远程执行调用时,我总是收到一个错误,因为它看起来像terraform正在等待用户输入来重新启动服务。
有没有办法做这些更新?
这是在我的终端上运行命令时的样子。x1c 0d1x
这是remote-exec代码:

provisioner "remote-exec" {
        inline = [
            "export PATH=$PATH:/usr/bin",
            # update server
            "sudo apt update",
            "sudo apt upgrade -y",  # I think this is the one doing causing the error. 
        ]
    }

字符串
到目前为止,我已经尝试使用Ubuntu 22.04和22.10。认为导致这一问题的更新可以在该版本中解决。它没有。
最初盒子启动的速度不够快,所以terraform无法连接到新的示例。为了纠正这个问题,我添加了30秒的延迟。
编辑:错误文本

digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning candidates...
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning processor microc [            ]
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning processor microc [======      ]
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning processor microc [============]
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning processor microcode...
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning linux images... [             ]
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning linux images... [====         ]
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning linux images... [========     ]
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning linux images... [=============]
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Scanning linux images...

digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Running kernel seems to be up-to-date.

digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Failed to check for processor microcode
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):  upgrades.

digitalocean_droplet.tailscale-exitnode-ne (remote-exec): Restarting services...
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): 
Package configuration                   
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
─┤ Daemons using outdated libraries ├───

digitalocean_droplet.tailscale-exitnode-ne (remote-exec): 
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): hich services should be
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): estarted?
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): 
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [*] cloud-final.service  
digitalocean_droplet.tailscale-exitnode-ne: Still creating... [1m40s elapsed]        
digitalocean_droplet.tailscale-exitnode-ne: Still creating... [1m50s elapsed]rvice   
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [*] ssh.service          
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [*] systemd-journald...  
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [ ] systemd-logind.s...  
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [*] systemd-manager      
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [*] systemd-networkd...  
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [*] systemd-resolved...  
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [*] systemd-timesync...  
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [*] systemd-udevd.se...  
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):   [ ] unattended-upgra...  
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): 
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): 
digitalocean_droplet.tailscale-exitnode-ne (remote-exec):         <Ok>              <Cancel>
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): 
digitalocean_droplet.tailscale-exitnode-ne (remote-exec): ────────────────────────────────────────

  • 编辑2 -
    当手动升级时,这就是升级的内容。我做了重新启动,它工作了。只是想确认如何做,这样terraform应用就成功了。
root@docker:~# apt upgrade -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  dbus dbus-bin dbus-daemon dbus-session-bus-common dbus-system-bus-common dbus-user-session distro-info-data
  kpartx libdbus-1-3 libksba8 libntfs-3g89 libpython3.10 libpython3.10-minimal libpython3.10-stdlib libssl3
  multipath-tools ntfs-3g openssl python3.10 python3.10-minimal tzdata ubuntu-advantage-tools
22 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.3 MB of archives.
After this operation, 20.5 kB disk space will be freed.
Get:1 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 libpython3.10 amd64 3.10.7-1ubuntu0.1 [1938 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 libssl3 amd64 3.0.5-2ubuntu2 [1893 kB]
Get:3 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 python3.10 amd64 3.10.7-1ubuntu0.1 [497 kB]
Get:4 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 libpython3.10-stdlib amd64 3.10.7-1ubuntu0.1 [1785 kB]
Get:5 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 python3.10-minimal amd64 3.10.7-1ubuntu0.1 [2115 kB]
Get:6 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 libpython3.10-minimal amd64 3.10.7-1ubuntu0.1 [803 kB]
Get:7 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 ntfs-3g amd64 1:2022.5.17-1ubuntu1.1 [410 kB]
Get:8 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 libntfs-3g89 amd64 1:2022.5.17-1ubuntu1.1 [160 kB]
Get:9 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 dbus-session-bus-common all 1.14.0-2ubuntu3 [73.0 kB]
Get:10 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 dbus-user-session amd64 1.14.0-2ubuntu3 [10.1 kB]
Get:11 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 dbus-daemon amd64 1.14.0-2ubuntu3 [118 kB]
Get:12 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 libdbus-1-3 amd64 1.14.0-2ubuntu3 [200 kB]
Get:13 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 dbus-system-bus-common all 1.14.0-2ubuntu3 [74.2 kB]
Get:14 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 dbus amd64 1.14.0-2ubuntu3 [24.2 kB]
Get:15 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 dbus-bin amd64 1.14.0-2ubuntu3 [39.4 kB]
Get:16 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 distro-info-data all 0.54ubuntu0.1 [5242 B]
Get:17 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 openssl amd64 3.0.5-2ubuntu2 [1178 kB]
Get:18 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 tzdata all 2022f-0ubuntu0.22.10.1 [400 kB]
Get:19 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 ubuntu-advantage-tools amd64 27.11.3~22.10.1 [142 kB]
Get:20 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 libksba8 amd64 1.6.0-3ubuntu1 [119 kB]
Get:21 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 kpartx amd64 0.8.8-1ubuntu1.22.10.1 [28.0 kB]
Get:22 http://mirrors.digitalocean.com/ubuntu kinetic-updates/main amd64 multipath-tools amd64 0.8.8-1ubuntu1.22.10.1 [328 kB]
Fetched 12.3 MB in 1s (9704 kB/s)          
Preconfiguring packages ...
(Reading database ... 65170 files and directories currently installed.)
Preparing to unpack .../00-libpython3.10_3.10.7-1ubuntu0.1_amd64.deb ...
Unpacking libpython3.10:amd64 (3.10.7-1ubuntu0.1) over (3.10.7-1) ...
Preparing to unpack .../01-libssl3_3.0.5-2ubuntu2_amd64.deb ...
Unpacking libssl3:amd64 (3.0.5-2ubuntu2) over (3.0.5-2ubuntu1) ...
Preparing to unpack .../02-python3.10_3.10.7-1ubuntu0.1_amd64.deb ...
Unpacking python3.10 (3.10.7-1ubuntu0.1) over (3.10.7-1) ...
Preparing to unpack .../03-libpython3.10-stdlib_3.10.7-1ubuntu0.1_amd64.deb ...
Unpacking libpython3.10-stdlib:amd64 (3.10.7-1ubuntu0.1) over (3.10.7-1) ...
Preparing to unpack .../04-python3.10-minimal_3.10.7-1ubuntu0.1_amd64.deb ...
Unpacking python3.10-minimal (3.10.7-1ubuntu0.1) over (3.10.7-1) ...
Preparing to unpack .../05-libpython3.10-minimal_3.10.7-1ubuntu0.1_amd64.deb ...
Unpacking libpython3.10-minimal:amd64 (3.10.7-1ubuntu0.1) over (3.10.7-1) ...
Preparing to unpack .../06-ntfs-3g_1%3a2022.5.17-1ubuntu1.1_amd64.deb ...
Unpacking ntfs-3g (1:2022.5.17-1ubuntu1.1) over (1:2022.5.17-1ubuntu1) ...
Preparing to unpack .../07-libntfs-3g89_1%3a2022.5.17-1ubuntu1.1_amd64.deb ...
Unpacking libntfs-3g89 (1:2022.5.17-1ubuntu1.1) over (1:2022.5.17-1ubuntu1) ...
Preparing to unpack .../08-dbus-session-bus-common_1.14.0-2ubuntu3_all.deb ...
Unpacking dbus-session-bus-common (1.14.0-2ubuntu3) over (1.14.0-2ubuntu2) ...
Preparing to unpack .../09-dbus-user-session_1.14.0-2ubuntu3_amd64.deb ...
Unpacking dbus-user-session (1.14.0-2ubuntu3) over (1.14.0-2ubuntu2) ...
Preparing to unpack .../10-dbus-daemon_1.14.0-2ubuntu3_amd64.deb ...
Unpacking dbus-daemon (1.14.0-2ubuntu3) over (1.14.0-2ubuntu2) ...
Preparing to unpack .../11-libdbus-1-3_1.14.0-2ubuntu3_amd64.deb ...
Unpacking libdbus-1-3:amd64 (1.14.0-2ubuntu3) over (1.14.0-2ubuntu2) ...
Preparing to unpack .../12-dbus-system-bus-common_1.14.0-2ubuntu3_all.deb ...
Unpacking dbus-system-bus-common (1.14.0-2ubuntu3) over (1.14.0-2ubuntu2) ...
Preparing to unpack .../13-dbus_1.14.0-2ubuntu3_amd64.deb ...
Unpacking dbus (1.14.0-2ubuntu3) over (1.14.0-2ubuntu2) ...
Preparing to unpack .../14-dbus-bin_1.14.0-2ubuntu3_amd64.deb ...
Unpacking dbus-bin (1.14.0-2ubuntu3) over (1.14.0-2ubuntu2) ...
Preparing to unpack .../15-distro-info-data_0.54ubuntu0.1_all.deb ...
Unpacking distro-info-data (0.54ubuntu0.1) over (0.54) ...
Preparing to unpack .../16-openssl_3.0.5-2ubuntu2_amd64.deb ...
Unpacking openssl (3.0.5-2ubuntu2) over (3.0.5-2ubuntu1) ...
Preparing to unpack .../17-tzdata_2022f-0ubuntu0.22.10.1_all.deb ...
Unpacking tzdata (2022f-0ubuntu0.22.10.1) over (2022e-0ubuntu2) ...
Preparing to unpack .../18-ubuntu-advantage-tools_27.11.3~22.10.1_amd64.deb ...
Unpacking ubuntu-advantage-tools (27.11.3~22.10.1) over (27.11.2~22.10.1) ...
Preparing to unpack .../19-libksba8_1.6.0-3ubuntu1_amd64.deb ...
Unpacking libksba8:amd64 (1.6.0-3ubuntu1) over (1.6.0-3) ...
Preparing to unpack .../20-kpartx_0.8.8-1ubuntu1.22.10.1_amd64.deb ...
Unpacking kpartx (0.8.8-1ubuntu1.22.10.1) over (0.8.8-1ubuntu1) ...
Preparing to unpack .../21-multipath-tools_0.8.8-1ubuntu1.22.10.1_amd64.deb ...
Unpacking multipath-tools (0.8.8-1ubuntu1.22.10.1) over (0.8.8-1ubuntu1) ...
Setting up libksba8:amd64 (1.6.0-3ubuntu1) ...
Setting up distro-info-data (0.54ubuntu0.1) ...
Setting up libssl3:amd64 (3.0.5-2ubuntu2) ...
Setting up libntfs-3g89 (1:2022.5.17-1ubuntu1.1) ...
Setting up ntfs-3g (1:2022.5.17-1ubuntu1.1) ...
Setting up tzdata (2022f-0ubuntu0.22.10.1) ...

Current default time zone: 'Etc/UTC'
Local time is now:      Thu Nov 17 18:37:42 UTC 2022.
Universal Time is now:  Thu Nov 17 18:37:42 UTC 2022.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

Setting up libdbus-1-3:amd64 (1.14.0-2ubuntu3) ...
Setting up libpython3.10-minimal:amd64 (3.10.7-1ubuntu0.1) ...
Setting up dbus-session-bus-common (1.14.0-2ubuntu3) ...
Setting up kpartx (0.8.8-1ubuntu1.22.10.1) ...
Setting up ubuntu-advantage-tools (27.11.3~22.10.1) ...
Installing new version of config file /etc/apt/apt.conf.d/20apt-esm-hook.conf ...
Setting up dbus-system-bus-common (1.14.0-2ubuntu3) ...
Setting up openssl (3.0.5-2ubuntu2) ...
Setting up dbus-bin (1.14.0-2ubuntu3) ...
Setting up dbus-daemon (1.14.0-2ubuntu3) ...
Setting up python3.10-minimal (3.10.7-1ubuntu0.1) ...
Setting up multipath-tools (0.8.8-1ubuntu1.22.10.1) ...
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 145.
Setting up libpython3.10-stdlib:amd64 (3.10.7-1ubuntu0.1) ...
Setting up dbus-user-session (1.14.0-2ubuntu3) ...
Setting up dbus (1.14.0-2ubuntu3) ...
A reboot is required to replace the running dbus-daemon.
Please reboot the system when convenient.
Setting up libpython3.10:amd64 (3.10.7-1ubuntu0.1) ...
Setting up python3.10 (3.10.7-1ubuntu0.1) ...
Processing triggers for libc-bin (2.36-0ubuntu4) ...
Processing triggers for man-db (2.10.2-2) ...
Processing triggers for initramfs-tools (0.140ubuntu17) ...
update-initramfs: Generating /boot/initrd.img-5.19.0-23-generic
Scanning processes...                                                                                                                                     
Scanning candidates...                                                                                                                                    
Scanning processor microcode...                                                                                                                           
Scanning linux images...                                                                                                                                  

Running kernel seems to be up-to-date.

Failed to check for processor microcode upgrades.

Restarting services...
 /etc/needrestart/restart.d/systemd-manager
 systemctl restart packagekit.service ssh.service systemd-journald.service systemd-networkd.service systemd-resolved.service systemd-timesyncd.service systemd-udevd.service
Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

User sessions running outdated binaries:
 root @ user manager service: systemd[2838]

No VM guests are running outdated hypervisor (qemu) binaries on this host.

iq3niunx

iq3niunx1#

我也遇到了同样的问题。按照here的建议,我编辑了**/etc/needrestart/needrestart.conf**文件。
我改变了以下行:

$nrconf{restart} = 'i';


$nrconf{restart} = 'a';
您可以使用sed命令来自动化它。
请注意,您必须对.tf文件中的双引号进行转义,如下所示:

"sudo sed -i 's/#$nrconf{restart} = '\"'\"'i'\"'\"';/$nrconf{restart} = '\"'\"'a'\"'\"';/g' /etc/needrestart/needrestart.conf"

字符串

相关问题