We install the qemu-guest-agent package in ensure_packages_installed().
Try to start the qemu-guest-agent service only afterwards therefore.
Fixup for commit 82e6638b40
Change-Id: Ic4aa2e493851b4c92ac134d68a9a76e05485658d
(cherry picked from commit cf94193f88)
/dev/virtio-ports/org.qemu.guest_agent.0 usually is a symlink to the
character device /dev/vport1p1. So adjust the device check accordingly
and only verify it exists, but don't expected any special file type.
This actually matches the behavior we also have in ngcp-installer.
Fixup for commit 82e6638b40
Change-Id: I0aa93c1f0e1086847eb7ed6967692a52e183bdc3
(cherry picked from commit 4a292ab4be)
Now that we enabled the QEMU Guest Agent option for our PVE VMs, we need
to have qemu-guest-agent present and active. Otherwise the VMs might
fail to shut down, like with our debian/sipwise/docker Debian systems
which are created via
https://jenkins.mgm.sipwise.com/job/daily-build-matrix-debian-boxes/:
| [proxmox-vm-shutdown] $ /bin/sh -e /tmp/env-proxmox-vm-shutdown7956268380939677154.sh
| [environment-script] Adding variable 'vm1reset' with value 'NO'
| [environment-script] Adding variable 'vm2' with value 'none'
| [environment-script] Adding variable 'vm1' with value 'none'
| [environment-script] Adding variable 'vm2reset' with value 'NO'
| [proxmox-vm-shutdown] $ /bin/bash /tmp/jenkins14192704603218787414.sh
| Using safe VM 'shutdown' for modern releases (mr6.5+). Executing action 'shutdown'...
| Shutting down VM 106
| Build timed out (after 10 minutes). Marking the build as aborted.
| Build was aborted
| [WS-CLEANUP] Deleting project workspace...
Let's make sure qemu-guest-agent is available in our Grml live system.
We added qemu-guest-agent to the package list of our Grml Sipwise ISO
(see git rev 65c3fea4c), but to ensure we don't strictly depend on this
brand new Grml Sipwise ISO yet, make sure to install it on-the-fly if
not yet present (like we already did for git, augeas-tools + gdisk).
Also make sure qemu-guest-agent service is enabled if socket
/dev/virtio-ports/org.qemu.guest_agent.0 is present (indicating that the
agent feature is enabled on VM level).
Furthermore ensure qemu-guest-agent is present also in the installed
Debian system. Otherwise when rebooting the VM once it's no longer
running the Grml live system but the installed Debian system, it might
also fail to shutdown. So add it to the default package list of packages
for bootstrapping.
Change-Id: Id6adac55a47cfaed542cad2f9ac9740783e6d924
(cherry picked from commit 82e6638b40)
Packages like 'firmware-linux', 'firmware-linux-nonfree',
'firmware-misc-nonfree' and further 'firmware-*' got moved from non-free
to the new non-free-firmware component/repository (related to
https://www.debian.org/vote/2022/vote_003).
grml-live v0.43.0 provides supports for this new component, so let's
make sure we have proper support for firmware related packages by
updating to the corresponding grml-live version.
Change-Id: I4704e8be051ab6b5496021f07f42208b34963739
Use system-tools' ngcp-initialize-udev-rules-net script to
deploy the /etc/udev/rules.d/70-persistent-net.rules, no need
to maintain code at multiple places.
Change-Id: I81925262a8c687aa9976cbc1113568989fa53281
When building our Debian boxes for buster, bullseye + bookworm (via
daily-build-matrix-debian-boxes Jenkins job), we get broken networking,
so e.g. `vagrant up debian-bookworm doesn't work.
This is caused by /etc/network/interfaces (using e.g. "neth0", being our
naming schema which we use in NGCP, as adjusted by the deployment
script) not matching the actual system network devices (like enp0s3).
TL;DR: no behavior change for NGCP systems, only when building non-NGCP
systems then enable net.ifnames=0 (via set_custom_grub_boot_options),
but do *not* generate /etc/udev/rules.d/70-persistent-net.rules (via
invoke generate_udev_network_rules) nor rename eth*->neth* in
/etc/network/interfaces.
More verbose version:
* rename the "eth*" networking interfaces into "neth*" in
/etc/network/interfaces only when running in ngcp-installer mode
(this is the behavior we rely on in NGCP, but it doesn't matter
for plain Debian systems)
* generate /etc/udev/rules.d/70-persistent-net.rules only when running
in ngcp-installer mode. While our jenkins-configs.git's
jobs/daily-build/scripts/vm_clean-fs.sh removes the file anyways (for
the VM use case), between the initial deployment run and the next reboot
the configuration inside the PVE VM still applies, so we end up with
an existing /etc/udev/rules.d/70-persistent-net.rules, referring to
neth0, while our /etc/network/interfaces configures eth0 instead.
* when *not* running in ngcp-installer mode, enable net.ifnames=0 usage
in GRUB to disable persistent network interface naming. FTR, this
change is *not* needed for NGCP, as on NGCP systems we use
/etc/udev/rules.d/70-persistent-net.rules, generated by
ngcp-system-tools' ngcp-initialize-udev-rules-net script also in VM
use case
This is a fixup for a change in git commit a50903a30c (see also commit
message of git commit ab62171), that should have been adjusted for
ngcp-installer-only mode instead.
Change-Id: I6d0021dbdc2c1587127f0e115c6ff9844460a761
The public name servers resolve deb.sipwise.com to our public OVH IP
address 164.132.119.186, while internally we want to use its cname
haproxy.mgm.sipwise.com. This only works with using our internal
nameservers (like 192.168.212.30 and 192.168.88.20).
Default to 192.168.212.30, so deployments work as expected, otherwise
we're failing during deployment with:
| Err:5 https://deb.sipwise.com/autobuild release-trunk-bookworm InRelease
| 403 Forbidden [IP: 164.132.119.186 443]
While at it also update the ip=... kernel option, to use
168.192.91.XX/24 by default, and also use a FQDN for the hostname (since
that's our current policy for puppet hostname/certificates).
Change-Id: I1ce6541f7a31baa437e679b67056bb7851b1b33d
Relevant changes:
* GRMLBASE/39-modprobe: avoid usage of /lib/modprobe.d/50-nfs.conf
* GRMLBASE/39-modprobe: do not expect all files in /etc/modprobe.d to be used
This gives us working netboot images and avoids sysctl errors during bootup,
if nfs-kernel-server should be present on the ISO.
Change-Id: I0012199658c186b69c45ac51bc249ce75b8d81ce
If the date of the running system isn't appropriate enough, then apt
runs might fail with somehint like:
| E: Release file for https://deb/sipwise/com/spce/mr10.5.2/dists/bullseye/InRelease is not valid yet (invalid for another 6h 19min 2s)
So let's try to sync date/time of the system via NTP. Given that chrony
is a small (only 650 kB disk space) and secure replacement for ntp,
let's ship chrony with the Grml deployment ISO (and fall back to ntp
usage in deployment script if chrony shouldn't be available).
Also, if the system is configured to read the RTC time in the local time
zone, this is known as another source of problems, so let's make sure to
use the RTC in UTC.
Change-Id: I747665d1cee3b6f835c62812157d0203bcfa96e2
For deploying Debian/bookworm (see MT#55524), we'd like to have an
updated Grml ISO. With such a Debian/bookworm based live system, we can
still deploy older target systems (like Debian/bullseye).
Relevant changes:
1) Ad jo as new build-dependency, to generate build information in
conf/buildinfo.json (new dependency of grml-live)
2) Always include ca-certificates, as this is required with more recent
mmdebstrap versions (>=0.8.0), when using apt repositories with
https, otherwise bootstrapping Debian fails.
3) Update to latest stable grml-live version v0.42.0, which:
a) added support for "bookworm" as suite name
cff66073a7
b) provides corresponding templates for memtest support:
c01a86b3fc
c) and a workaround for a kmod/initramfs-tools issue with PXE/NFS boot:
ea1e5ea330
4) Update memtest86+ to v6.00-1 as present in Debian/bookworm and
add corresponding UEFI support (based on grml-live's upstream change,
though as we don't support i386, dropped the 32bit related bits)
Change-Id: I327c0e25c28f46e097212ef4329d75fc8d34767c
We build the pre-loaded library targeting a specific Debian release,
which might be different (and newer) to the release Grml was built for.
This can cause missing versioned symbols (and a loading failure) if the
libc in the outer system is older than the inner system.
Change-Id: I84f4f307863e534fe0fff85274ae1d5db809012c
Git commit 6661b04af0 broke all our bullseye based builds
(debian, sipwise + docker), see
https://jenkins.mgm.sipwise.com/view/All/job/daily-build-matrix-debian-boxes/
For plain Debian installations we don't have SP_VERSION available,
so default to what was used before supporting trunk-weekly next
to trunk.
Change-Id: I61958f0c67d165d2f6dcb059fe4991ed24a328c9
We want to be able to track down any left-behind tmp files,
so ensure we're creating them with according file names.
Change-Id: I4eb44047f2eb86ba9f0a8aeeb8d6555290f60c00
It's needed for support of spN nodes.
Sort options in deployment.sh.
Remove unused boot options ngcpnonwrecfg and ngcpfillcache.
Change-Id: I300e533c15b71d65e768ca2ed4b3a73eb7ec6954
Merge all options parsing to single point.
Move options parsing to the top of the script.
Parse boot options first then cmd options if they exist.
Simplify some checks.
Remove unused options.
Change-Id: Ibcb099d9bb2ba26ffed9904c8e5065b392ecb78a
The logic to detect disks via /proc/partitions didn't cover NVMe disks,
as the regex '[a-z]$' fails for the "nvme0n1" pattern:
| % cat /proc/partitions
| major minor #blocks name
|
| 259 0 500107608 nvme0n1
| 259 1 524288 nvme0n1p1
| 259 2 499582279 nvme0n1p2
| [...]
| 8 0 384638976 sda
| 8 1 384606208 sda1
Instead, let's use lsblk to detect present disks, which works
fine for all kinds of disks, incl. NVMe devices.
Change-Id: I586877da8b4fadf3d05b4e6c8e88bfdeae6d7f15
Sort default values.
Rework cmd parameters parsing - remove some reassign, reformat
to be more clear, etc.
Add some default options CROLE, EADDR, EXTERNAL_NETMASK, ROLE.
Change-Id: I287facafeb53dc5390517424935c8a50932246dc
If grml-debootstrap detects an existing FAT filesystem on the EFI partition,
it doesn't modify/re-create it:
| EFI partition /dev/nvme0n1p2 seems to have a FAT filesystem, not modifying.
The underlying check is execution of `fsck.vfat -bn $DEVICE`.
Now with fsck.fat from dosfstools v4.1-2 as present in Debian/buster we got:
| root@grml ~ # fsck.vfat -bn /dev/nvme0n1p2
| fsck.fat 4.1 (2017-01-24)
| 0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
| Automatically removing dirty bit.
| There are differences between boot sector and its backup.
| This is mostly harmless. Differences: (offset:original/backup)
| 0:00/eb, 82:00/46, 83:00/41, 84:00/54, 85:00/33, 86:00/32, 87:00/20
| , 88:00/20, 89:00/20, 510:00/55, 511:00/aa
| Not automatically fixing this.
| Leaving filesystem unchanged.
| 1 root@grml ~ #
Now with dosfstools v4.2-1 as present in Debian/bullseye, this might become:
| root@grml ~ # fsck.vfat -bn /dev/nvme0n1p2
| fsck.fat 4.2 (2021-01-31)
| There are differences between boot sector and its backup.
| This is mostly harmless. Differences: (offset:original/backup)
| 0:00/eb, 65:01/00, 82:00/46, 83:00/41, 84:00/54, 85:00/33, 86:00/32
| , 87:00/20, 88:00/20, 89:00/20, 510:00/55, 511:00/aa
| Not automatically fixing this.
In such situations we end up with an incomplete/broken EFI partition,
which breaks within our efivarfs post-script:
| Mounting /dev/nvme0n1p2 on /boot/efi
| mount: /boot/efi: wrong fs type, bad option, bad superblock on /dev/nvme0n1p2, missing codepage or helper program, or other error.
| ESC[31;01m-> Failed (rc=1)ESC[0m
| ESC[32;01m*ESC[0m Removing chroot-script again
| ESC[32;01m*ESC[0m Executing post-script /etc/debootstrap/post-scripts//efivarfs
| Executing /etc/debootstrap/post-scripts//efivarfs
| Mounting /dev (via bind mount)
| Mounting /boot/efi
| mount: /boot/efi: special device UUID= does not exist.
Change-Id: I46939b4e191982a84792f3aca27c6cc415dbdaf4
When we run current versions of deployment.sh, which include the fix
from commit f9aea18c, in combination with grml-debootstrap <=0.96 (as
shipped by our Grml deployment ISO version sipwise20210511), deployments
using EFI might fail with:
| Mounting /dev/nvme0n1p2 on /boot/efi
| Invoking efibootmgr
| EFI variables are not supported on this system.
| -> Failed (rc=1)
| [...]
| Mounting /dev (via bind mount)
| Mounting efivarfs on /sys/firmware/efi/efivars
| Invoking grub-install with proper EFI environment
| chroot: failed to run command 'grub-install': No such file or directory
| -> Failed (rc=127)
This is caused by a failing invocation of efibootmgr from within
grml-debootstrap (versions <=0.96 and running with Debian kernel
>=5.10), causing grml-debootstrap to exit then. As a result, the EFI
specific GRUB steps in grml-debootstrap's grub_install() from within
chroot-script doesn't get executed. Therefor the grub-efi-amd64 package
is missing for usage by our efivarfs post-script.
By re-introducing the efivarfs pre-script from commit 535e6df3
we can work around this bug.
Furthermore, when /boot/efi should be mounted within the target system
by our efivarfs post-script, it might fail when /proc isn't available, like:
| # chroot /mnt mount /boot/efi
| mount: /boot/efi: can't find UUID=FE60-5B75.
This can be fixed by ensuring to mount /proc, /sys etc *before*
/boot/efi. Then scanning for the UUID device (as configured in
/etc/fstab) works as expected.
While at it fix a comment regarding grml-debootstrap >=v0.97 vs >=v0.99,
as only v0.99 behaves as expected with our EFI requirements.
Change-Id: I9db677a06f7e161f971743fc18b034ad3191a449
This is a followup fixup for commit 535e6df / Change-Id: I5374322cb0a39cfed6563df6c4c30f1eafe560c1
We had to apply fixes due to efivars vs efivarfs in kernel versions
>=5.10, and addressed them in commit 535e6df. Those changes were
incomplete though, as the fix included in grml-debootstrap v0.97 is
incomplete: while efibootmgr was properly invoked and working,
invocation of grub-install doesn't reliably work (as at that time
/sys/firmware/efi/efivars is no longer accessible). GRUB installation on
EFI systems without /sys/firmware/efi/efivars present warns with "EFI
variables are not supported on this system" (see
https://sources.debian.org/src/grub2/2.04-20/debian/patches/efi-variable-storage-minimise-writes.patch/?hl=650#L650),
though returns with exit code 0. This leaves us with an incomplete and
therefore not booting GRUB EFI environment.
This used to work with mr9.5.1 only, because there we install(ed)
systems using grml-debootstrap v0.96, which is *older* than the version
v0.97 (which included the EFI workaround) we check for in deployment.sh.
Since the grml-debootstrap version v0.96 isn't recent enough there, we
applied the fallback to our local scripts, which took care of proper
installation of GRUB in EFI environments.
On the other side, in recent trunk deployments we have grml-debootstrap
v0.98 available, which includes the EFI workaround - therefore our local
scripts aren't applied. The resulting installation is incomplete, and
recent trunk deployments fail to boot in EFI environments.
The according fix for grml-debootstrap has been made and is going to be
released in the next few days as v0.99. But to ensure that it's working
also with older grml-debootstrap versions (and we don't have to rebuild
our squashfs environments), the local scripts have been adjusted.
We don't even need any pre-script at all, instead we handle all of the
GRUB EFI installation through /etc/debootstrap/post-scripts/efivarfs.
FTR: this issue didn't show up on certain test systems of us, because
SW-RAID is used there. In deployment.sh we have special handling
of SW-RAID regarding efibootmgr and grub-install, see line 2330 ff.
Change-Id: Ifa90fbfab7d69bc331acfec15a6cc9318c84ee8f
Jobs like daily-build-matrix-debian-boxes build plain Debian machines,
not NGCP-based ones. At the moment we're generating the udev-rules for
network renaming unconditionally, so we have to do it consistently,
either both conditionally and not for "plain" systems, or both
unconditionally, so network can be brought up by a correct
/etc/network/interfaces after the devices are brought up with the new
names.
There is a good-ish argument for keeping using eth0, as it is more of a
default, but we're already deviating from the default for several years
and Debian stable releases by having these names and not ones like
"ens18" or "enp4s0f2" which is the default in Debian nowadays, at least
since buster.
So it is probably better to keep it consistent with our other machines
and use "neth*" naming for those too.
Change-Id: I6b3b49a1769894580df768abb817ae5196e65963
The code removed was enabled when $VAGRANT=true, and this happened when
passing "vagrant" parameter to deployment.sh, which is done in places
like proxmox-vm-clone job, the base of many of our tests machines.
VMs do not necessarily have the same hardware configuration, so removing
udev-rules for network devices makes sense in principle. Especially
when since the beginning we were using network devices named "eth*"
everywhere, even if in the last years we had to use net.ifnames=0 and
udev-rules files in hardware to keep using "eth*" names.
However, now with mr9.5 and the move to Debian bullseye we have to start
using different names, and we settled on the direct translation to
"neth*". So we need a way to assign whatever network devices the
machines come with, including VMs, to names "neth*".
(If we used the new-permanent device names like ens18 or enp3s0f1 we
would have to adapt network.yml and files like network interface, and
they would be different across all the different machines (HW and VM) so
this is not a better or faster solution to the problem.)
So, back to the topic of removal of this udev-rules file: in many cases
in our test infra, the machines are built "in place" and then rebooted
for upgrades or tests, in princicple with the same hardware
configuration, so there is no need to remove these files.
In cases where the underlying (virtualized) hardware changes, e.g. to
use like local VirtualBox-based vagrant machines, we will need to adapt
the rules for the existing devices.
Change-Id: I57e39a2ec6849f3b5bb8f6cf518e2a2923ec19cb
Using "eth*" names was discouraged for many years, we've been finding
problems here and there and working around them with the help of
udev-rules (/etc/udev/rules.d/70-persistent-net.rules) to map address
interfaces according to PCIIDs, using "net.ifnames=0" as Linux kernel
boot parameter when booting in GRUB, etc.
Finally we found unsurmountable problems when moving to Debian bullseye
(mr9.5), because as we attempt to rename interfaces in some hardware
systems that we use, we got race conditions and clashes with renaming
that we could not solve in other ways.
We had different alternatives:
- Use names purely deterministic, based on PCI paths (for example
"enp4s0f1"), MAC address or other of the alternatives, which would be
"definitive", but given that we have a diversity of hardware and VM
installations in customers the devices in different systems would be
different, and the fact that it would be easier to mistype or confuse
them makes this not ideal.
- Use names purely based on functionality, like for example "ha0",
"ext0" or "int0". The problem in this case is that we would have to
find names that would satisfy everyone (and there's no time for doing
this at this point), that different of our system types are quite
different (e.g. Pro without bonds, Carrier with bonds and many vlans
by default; using the same hardware), and some customers with
different installations or needs (e.g. using VMs) have also totally
different network configuration -- so any attempt to unify this to
make good use of the functionality-based names would be very
challenging.
- Finally, there's the option to use some symbolic names similar to
traditional names like "eth0", but without being exactly this.
Popular names in general, although there's no wide consensus, are
names like "net0" and "lan0".
Talking with groups involved in deploying and maintaining the system,
the decision was taken to move to names not purely deterministic, and
there's no time for purely symbolic (they also didn't express much
interest on them), and prefer something more traditional that they are
already used too. Instead of names like "net0" or "lan0", they prefer
the more direct mapping to existing interfaces like "neth0".
This is ugly or slighly discomforting to use for some, but since the
main users (among us) of these names prefer them, so be it. It has the
advantage of having a very simple and mechanichal translation based on
the current names, which is an advantage especially at the critical time
of upgrading existing systems to the new name.
Change-Id: I4a168c7d81e40f609749f77a509d2acb72d3a9d3
This is commit cd50e4934c applied again.
As explained in ab62171c49, the original
change had to be reverted because even if things work perfectly fine, in
the case of Vagrant machines (or when passing "vagrant" parameter to the
script) the udev-rules for persistent-net devices get removed, so then
the network interfaces get "random" names and the configuration in
/etc/network/interfaces doesn't match, the network is not brought up.
This removal happens in the case of {ce,pro,carrier}-trunk.mgm machines
of our tests, which shouldn't be needed, and also in the images created
for Vagrant machines, which is understandable because the machines could
be brought up with different PCIIDs in different versions of VirtualBox,
or due to some other difference -- not sure how we can ensure that the
PCIIDs as written in the udev-rules files will work in that case.
But in principle this change must go ahead when we solve these problems,
so submitting it again to be ready.
Change-Id: Ib39481a2608aa56e6ec6c9255e290787a6ce3af7
Run the installer under "eatmydata" to speed up the process. Also add
some more information about timing.
In some VMs that we install daily ({ce,pro,carrier}-trunk.mgm) we have
the following timings:
ce-runner, no eatmydata:
162 seconds, 2 mins 42 secs
ce-runner, with eatmydata:
142 seconds, 2 mins 22 secs
pro-runner, no eatmydata:
246 seconds, 4 mins 06 secs
pro-runner, with eatmydata:
217 seconds, 3 mins 37 secs
So in these machines, for CE we save about 20 seconds, which is not much
in total but it's about 12.5% saving; and in Pro about 30 seconds (and
twice, once per machine, so about a minute in total), which is about
12.2% as well.
In Carrier, which is mostly equivalent to Pro in this respect and
typically at least 8 machines, it would mean about 4 mins in total.
When installing in hardware in previous days, maybe due to the disks
being slower, the total installation time was slightly slower:
pro-hardware (Lenovo ThinkSystem SR250), with eatmydata:
226 seconds, 3 mins 46 secs
Installing without eatmydata was not measured yet in hardware, but given
that the time to install is similar to the case of pro-runner, probably
the performance gain is similar too.
This looks like a relevant saving, the risk of things going wrong are
minimal, so enable it by default.
Change-Id: I8267fad08ff337c02801fb8fad0433d9b6d9f4c2
This reverts commit cd50e4934c.
In principle this works fine when using
/etc/udev/rules.d/70-persistent-net.rules, but it turns out that in the
test infrastructure (including {ce,pro,carrier}-trunk.mgm machines and
build-matrix) we remove the generated rules in many places:
if $VAGRANT; then
...
# MACs are different on buildbox and on local VirtualBox
# see http://ablecoder.com/b/2012/04/09/vagrant-broken-networking-when-packaging-ubuntu-boxes/
echo "Removing '${TARGET_UDEV_PERSISTENT_NET_RULES}'"
rm -f "${TARGET_UDEV_PERSISTENT_NET_RULES:?}"
So in this way, the interfaces that we get are ens18 in our infra for
{ce,pro,carrier}-trunk.mgm machines, and so the generated
/etc/network/interfaces usint the fixed names "eth*" (in process to be
renamed "neth*") cannot be found in those systems, and all
build-install-vm jobs fail.
In a local vagrant machine (ce-trunk from just before the change) we
have names like these for the network devices:
root@spce:~# dmesg | grep rename
[ 2.051263] e1000 0000:00:09.0 enp0s9: renamed from eth1
[ 2.065876] e1000 0000:00:03.0 enp0s3: renamed from eth0
[ 3.950540] e1000 0000:00:03.0 eth0: renamed from enp0s3
[ 4.049842] e1000 0000:00:09.0 eth1: renamed from enp0s9
In this boot session from which the logs above are taken, was booted
with grub without "net.ifnames=0", and udev "70-persistent-net.rules"
generated in place with the right infromation, and then of course things
work fine.
So we need some solution this before moving on with the change now
reverted.
Change-Id: I25d3b9c175b92214670ebb63a7916b60e0e4e5f9