When launching a new instance and immediately attempting to run dnf update, I encountered errors related to downloading metadata from the repository.
The issue was due to DNS resolution failure because the network services were not fully operational yet. Hereâs the error message I received:
$ sudo incus launch images:almalinux/8 target && sudo incus exec target -- sudo dnf update -y
Launching target
AlmaLinux 8 - BaseOS 0.0 B/s | 0 B 00:00
Errors during downloading metadata for repository 'baseos':
- Curl error (6): Couldn't resolve host name for https://mirrors.almalinux.org/mirrorlist/8/baseos [Could not resolve host: mirrors.almalinux.org]
Error: Failed to download metadata for repo 'baseos': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.almalinux.org/mirrorlist/8/baseos [Could not resolve host: mirrors.almalinux.org]
Waiting a few seconds before running the command resolves this error, as shown below.
I received this advice from stgraber, and it worked wondersâthank you so much!
sudo incus launch images:almalinux/8 target && sleep 5 && sudo incus exec target -- sudo dnf update -y
Launching target
AlmaLinux 8 - BaseOS 352 kB/s | 2.9 MB 00:08
AlmaLinux 8 - AppStream 2.8 MB/s | 10 MB 00:03
AlmaLinux 8 - Extras 1.4 kB/s | 21 kB 00:14
Dependencies resolved.
Nothing to do.
Complete!
To understand why this brief delay is necessary, I ran the following command sequence to monitor the system processes immediately after launch.
kou helped me to figure it out. Thanks!
% sudo incus stop target; sudo incus delete target; sudo incus launch images:almalinux/8 target && sudo incus exec target -- bash -c 'for x in {1..10}; do echo $x; ps axuwww; sleep 1; done' | tee /tmp/log
log
Launching target
1
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 89292 7808 ? Ss 09:07 0:00 /sbin/init
root 21 0.0 0.0 89292 2492 ? S 09:07 0:00 (sd-execut
root 22 0.0 0.0 12132 2432 ? S 09:07 0:00 /bin/sh /etc/systemd/system-generators/lxc /run/systemd/generator /run/systemd/generator.early /run/systemd/generator.late
root 36 0.0 0.0 231888 2688 ? S 09:07 0:00 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 44 0.0 0.0 12132 1892 ? S 09:07 0:00 /bin/sh /etc/systemd/system-generators/lxc /run/systemd/generator /run/systemd/generator.early /run/systemd/generator.late
root 45 0.0 0.0 264668 3456 ? R 09:07 0:00 ps axuwww
2
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90096 9472 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? S 09:07 0:00 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89648 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
root 498 0.0 0.0 225520 3840 ? Ss 09:07 0:00 /bin/bash /etc/rc.d/init.d/network start
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 541 0.0 0.0 225520 3968 ? S 09:07 0:00 /bin/bash /etc/sysconfig/network-scripts/ifup-eth ifcfg-lo
root 576 0.0 0.0 224860 3072 ? S 09:07 0:00 /bin/bash /etc/sysconfig/network-scripts/ifup-ipv6 ifcfg-lo
root 577 0.0 0.0 264668 3584 ? R 09:07 0:00 ps axuwww
3
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90096 9472 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? S 09:07 0:00 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89648 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
root 498 0.0 0.0 225520 3840 ? Ss 09:07 0:00 /bin/bash /etc/rc.d/init.d/network start
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 646 0.0 0.0 225520 3840 ? S 09:07 0:00 /bin/bash /etc/sysconfig/network-scripts/ifup-eth ifcfg-eth0 boot
root 665 0.0 0.0 82004 8960 ? S 09:07 0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /run/dhclient-eth0.pid -H target eth0
root 671 0.0 0.0 12396 3072 ? S 09:07 0:00 /bin/bash /usr/sbin/dhclient-script
root 677 0.0 0.0 16560 1792 ? S 09:07 0:00 arping -D -q -c2 -I eth0 10.222.242.89
root 678 0.0 0.0 264668 3712 ? R 09:07 0:00 ps axuwww
4
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90096 9472 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? S 09:07 0:00 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89648 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
root 498 0.0 0.0 225520 3840 ? Ss 09:07 0:00 /bin/bash /etc/rc.d/init.d/network start
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 646 0.0 0.0 225520 3840 ? S 09:07 0:00 /bin/bash /etc/sysconfig/network-scripts/ifup-eth ifcfg-eth0 boot
root 665 0.0 0.0 82004 8960 ? S 09:07 0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /run/dhclient-eth0.pid -H target eth0
root 671 0.0 0.0 12396 3072 ? S 09:07 0:00 /bin/bash /usr/sbin/dhclient-script
root 677 0.0 0.0 16560 1792 ? S 09:07 0:00 arping -D -q -c2 -I eth0 10.222.242.89
root 680 0.0 0.0 264668 3456 ? R 09:07 0:00 ps axuwww
5
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90204 9600 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? S 09:07 0:00 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89640 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 700 0.0 0.0 79176 6784 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-hostnamed
root 705 0.0 0.0 82004 3616 ? Ss 09:07 0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /run/dhclient-eth0.pid -H target eth0
root 778 0.0 0.0 211724 4800 ? Ssl 09:07 0:00 /usr/sbin/rsyslogd -n
root 779 0.0 0.0 235704 3200 ? Ss 09:07 0:00 /usr/sbin/crond -n
root 780 0.0 0.0 219328 1920 pts/0 Ss+ 09:07 0:00 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 linux
root 785 0.0 0.0 264668 3584 ? R 09:07 0:00 ps axuwww
6
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90204 9600 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? S 09:07 0:00 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89640 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 700 0.0 0.0 79176 6784 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-hostnamed
root 705 0.0 0.0 82004 3616 ? Ss 09:07 0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /run/dhclient-eth0.pid -H target eth0
root 778 0.0 0.0 211724 4800 ? Ssl 09:07 0:00 /usr/sbin/rsyslogd -n
root 779 0.0 0.0 235704 3200 ? Ss 09:07 0:00 /usr/sbin/crond -n
root 780 0.0 0.0 219328 1920 pts/0 Ss+ 09:07 0:00 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 linux
root 787 0.0 0.0 264668 3584 ? R 09:07 0:00 ps axuwww
7
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90204 9600 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? R 09:07 0:00 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89640 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 700 0.0 0.0 79176 6784 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-hostnamed
root 705 0.0 0.0 82004 3616 ? Ss 09:07 0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /run/dhclient-eth0.pid -H target eth0
root 778 0.0 0.0 211724 4800 ? Ssl 09:07 0:00 /usr/sbin/rsyslogd -n
root 779 0.0 0.0 235704 3200 ? Ss 09:07 0:00 /usr/sbin/crond -n
root 780 0.0 0.0 219328 1920 pts/0 Ss+ 09:07 0:00 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 linux
root 789 0.0 0.0 264668 3456 ? R 09:07 0:00 ps axuwww
8
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90204 9600 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? S 09:07 0:01 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89640 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 700 0.0 0.0 79176 6784 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-hostnamed
root 705 0.0 0.0 82004 3616 ? Ss 09:07 0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /run/dhclient-eth0.pid -H target eth0
root 778 0.0 0.0 211724 4800 ? Ssl 09:07 0:00 /usr/sbin/rsyslogd -n
root 779 0.0 0.0 235704 3200 ? Ss 09:07 0:00 /usr/sbin/crond -n
root 780 0.0 0.0 219328 1920 pts/0 Ss+ 09:07 0:00 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 linux
root 791 0.0 0.0 264668 3584 ? R 09:07 0:00 ps axuwww
9
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90204 9600 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? R 09:07 0:01 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89640 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 700 0.0 0.0 79176 6784 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-hostnamed
root 705 0.0 0.0 82004 3616 ? Ss 09:07 0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /run/dhclient-eth0.pid -H target eth0
root 778 0.0 0.0 211724 4800 ? Ssl 09:07 0:00 /usr/sbin/rsyslogd -n
root 779 0.0 0.0 235704 3200 ? Ss 09:07 0:00 /usr/sbin/crond -n
root 780 0.0 0.0 219328 1920 pts/0 Ss+ 09:07 0:00 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 linux
root 793 0.0 0.0 264668 3712 ? R 09:07 0:00 ps axuwww
10
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 90204 9600 ? Ss 09:07 0:00 /sbin/init
root 36 0.0 0.0 231888 2688 ? S 09:07 0:01 bash -c for x in {1..10}; do echo $x; ps axuwww; sleep 1; done
root 483 0.0 0.0 89640 9856 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-journald
root 489 0.0 0.0 93184 7296 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-udevd
dbus 500 0.0 0.0 54220 4736 ? Ss 09:07 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 501 0.0 0.0 79408 7040 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-logind
root 700 0.0 0.0 79176 6784 ? Ss 09:07 0:00 /usr/lib/systemd/systemd-hostnamed
root 705 0.0 0.0 82004 3616 ? Ss 09:07 0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /run/dhclient-eth0.pid -H target eth0
root 778 0.0 0.0 211724 4800 ? Ssl 09:07 0:00 /usr/sbin/rsyslogd -n
root 779 0.0 0.0 235704 3200 ? Ss 09:07 0:00 /usr/sbin/crond -n
root 780 0.0 0.0 219328 1920 pts/0 Ss+ 09:07 0:00 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 linux
root 795 0.0 0.0 264668 3328 ? R 09:07 0:00 ps axuwww
Based on the log data, itâs evident that network configuration commands take a few seconds to complete. Key processes involved include:
/etc/rc.d/init.d/network start
- Initializes network services.
ifup-eth ifcfg-eth0 boot
- Activates the Ethernet interface.
dhclient
- Acquires an IP address from the DHCP server.
arping
- Ensures no IP address conflicts on the network.
These processes are essential for establishing a network connection that allows external commands like dnf update to execute successfully.
Thus, inserting a brief pause after the instance launch and before executing network-dependent commands ensures the system is fully prepared and connected.