Commit Graph

5309 Commits (93be2bc6ab00d40b304d2a3b1ce02fd8a3f31b31)

Author SHA1 Message Date
Harald Hoyer 93be2bc6ab add DRACUT_NO_XATTR global environment variable
Useful, if you know, that those can't be copied anyway.
2020-02-27 13:49:21 +01:00
Harald Hoyer a8ba1c4e25 network-legacy/net-genrules.sh: use $name instead of $env{INTERFACE}
The original behavior of $env{INTERFACE} was undocumented and changed in
the recent udev versions, breaking the ability to bring up networking
reliably. Switching to $name directive should fix this issue.

Related links:
 - systemd/systemd#12700 (udev PR)
 - systemd/systemd#12291 (related udev issue)
 - systemd/systemd#14935 (this issue, udev side)
 - #732 (this issue, dracut side)

Fixes: #732
2020-02-27 13:49:21 +01:00
Jonathan Lebon 4985aa8c6e network-legacy/ifup: fix ip=dhcp,dhcp6 setup_net logic
Previously, we were doing `setup_net` from `ifup` for any setup that
wasn't DHCP, since those are already taken care of by `dhclient-script`.

The issue is that the case-statement we use to detect this doesn't catch
options like `ip=dhcp,dhcp6`.

Fix this by reworking the logic here to just check if a
`setup_net_$netif.sh` hook exists. If so, then we know that `setup_net`
will be called for this interface later.

This was causing issues in RHCOS which now ships with `ip=dhcp,dhcp6` to
support IPv6 environments[1]. The code here would make us do `setup_net`
pre-emptively which IIUC would then cause the initqueue to finish
earlier even if we had more udev netif events to process.

[1] https://github.com/coreos/coreos-assembler/pull/1067

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1803926
2020-02-25 14:34:58 +01:00
Jonathan Lebon 7795fde44c network-legacy/ifup: drop redundant if-statement
No need to check that `$ret` is 0, we're already running inside an
if-statement block which checks this.
2020-02-25 14:34:58 +01:00
Harald Hoyer 2dc0cb50e3
Revert "github workflow"
This reverts commit 150cea0336.
2020-02-25 14:06:36 +01:00
Harald Hoyer 150cea0336
github workflow 2020-02-25 14:01:13 +01:00
Donovan Tremura 4237aeb040 Support the EFI Stub loader's splash image feature.
Checks if `uefi_splash_image` exists in `dracutsysroot` if not unset
`uefi_splash_image`. Alternate Value parameter expansion adds section-vma
for splash image to EFI stub loader when the path to image is valid and
not an empty file.

I did not test on other distributions, but on Arch Linux the `systemd`
package includes a splash image at the path
`/usr/share/systemd/bootctl/splash-arch.bmp`. Perhaps, if this is a
common practice, a default image could be gathered from that directory.

It is required that the image be in bitmap (`.bmp`) format according to
`splash.c`.

The code for `stub.c` and `splash.c` can be found at:
https://github.com/systemd/systemd/blob/master/src/boot/efi/stub.c
https://github.com/systemd/systemd/blob/master/src/boot/efi/splash.c
2020-02-20 11:03:30 +01:00
Harald Hoyer 16abea2592
systemd: install systemd-tty-ask-password-agent systemd-ask-password
fixes https://github.com/dracutdevs/dracut/issues/726
2020-02-18 15:33:23 +01:00
Eugene S. Sobolev c7ee6b3dbb network/net-lib.sh: Configure all iBFT interfaces
Added boolean command line option rd.iscsi.mp
2020-02-14 10:42:34 +01:00
Lukas Nykryn 76f6566fd7 Revert "wait for IPv6 RA if using none/static IPv6 assignment"
This reverts commit c603419030.

wait_for_ipv6_dad_link is only called from dhclient script,
so the original intent "wait for IPv6 RA if using none/static IPv6 assignment"
does not seem to be correct.

Anyway, this brings an issue on isolated networks, where you don't
have any routes outside. dhclient-script hangs on this check
and after it times out, dhclient is able to set the address normally.
2020-02-11 14:23:27 +01:00
Lukas Nykryn 962310483f dhclient-script: ipv6 uses different variables for nameservers
new_domain_name_servers and new_domain_search is only provided vit IPv4

see: https://src.fedoraproject.org/rpms/dhcp/blob/HEAD/f/dhclient-script#_148
2020-02-11 14:23:03 +01:00
Lukas Nykryn 579fbb9fc4 40network: bump rd.net.timeout.carrier to 10 seconds
On some devices kernel currently takes 5.2 seconds to detect carrier,
so let's make the default in dracut bit more sensible.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1772010
2020-02-10 14:37:15 +01:00
Daniel Cordero f668e7174e dracut.sh: check kmoddir is properly formed
Due to the way dracut-install handles modules from custom kmoddirs, add
a test that ensures the kmoddir argument seems sane.

In addition to erroring out, provide some guidance on how to proceed, as
well as a method of skipping the test via environment variable.
2020-01-27 09:02:46 +01:00
Daniel Cordero 1bef2934d7 dracut-install: fetch kernel modules from kmoddir
dracut, when passing --kmoddir, would only install modules that exist at
the same location as it will appear in the initramfs.

For most (possibly all) outputs, the output path would be /lib/modules,
so previously all kernel modules must be copied there or the module
installation silently fails.

Now use the original path variable, and install to the shortened path
variable (as calculated by kerneldirlen).

Note: This means that the argument to --kmoddir (and the modules filetree)
should be a directory that ends in 'lib/modules/$kernelversion'.
2020-01-27 09:02:46 +01:00
Harald Hoyer 350ec5d9dd
uefi-lib/uefi-lib.sh: fixed script for bash version 5
bash 5 `read` behaves differently and returns != 0 for 0 bytes read

fix it with the best effort
2020-01-24 13:42:46 +01:00
Jonas Witschel d613d88dd2 ucode: use microcode found in packed cpio images
Some distributions (Arch, Gentoo) ship prepacked microcode images. These
are cpio images that follow the structure specified in the Linux kernel
documentation (x86/microcode.rst, "Early load microcode"), the same
structure dracut uses for its early microcode images.

In case of Arch Linux, the microcode for Intel CPUs is currently only
available in this packed form, /usr/lib/firmware/intel-ucode does not
exist. This commit adds a way to make use of these images on such
systems by unpacking them to the early cpio directory. (Note that the
packed image cannot be used directly since dracut might need to add ACPI
tables to the early initramfs.)

This approach has the drawback that it is not possible to control the
selection of CPUs to be included in the microcode file in host-only
mode, so we only try it as a last ressort if no unpacked microcode could
be found in fw_dir.

The list of possible file names for the packed microcode image is taken
from GRUB (cf. GRUB_EARLY_INITRD_LINUX_STOCK), but can be adapted by
setting "early_microcode_image_name" (and "early_microcode_image_dir")
in a dracut configuration file.
2020-01-24 09:06:32 +01:00
Harald Hoyer 2ee69a40c8
add missing crypto modules for aarch64
Fixes https://github.com/dracutdevs/dracut/issues/711
2020-01-23 13:47:53 +01:00
Jonathan Lebon d0de58f232 network-legacy/ifup: nuke pid and lease files if dhclient failed
Otherwise we won't retry dhclient again on that interface. In
FCOS/RHCOS, we want to bake in `ip=dhcp,dhcp6` so we automatically try
getting a DHCPv6 lease if DHCPv4 failed.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1793591
2020-01-23 09:32:25 +01:00
Kairui Song f4ad2e5c89 90kernel-modules: don't install any block driver if not needed
If hostonly mode is in use, and there isn't any block device included
as hostonly device, then the initramfs won't need any block driver.

Eg. for kdump built image, there could be only one nfs mount point,
or the initramfs may only execute some network operation then reboot.

In such case, skip block driver installation to save space and time.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-01-17 07:26:24 +01:00
Jan Macku cb86c560b0 Write dns values passed by ip argument to ifcfg-* files 2020-01-14 09:33:38 +01:00
Jan Macku 70b19acf94 Replace ln with systemctl 2020-01-14 09:29:51 +01:00
Jacob Wen d5e818f349 35network-legacy: using 'replace' instead of 'add' to add route
This is a simple trick to honor RFC 3442:
If the DHCP server returns both a Classless Static Routes option and
a Router option, the DHCP client MUST ignore the Router option.

Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
2020-01-14 09:26:12 +01:00
Kairui Song 4598b5540e 95iscsi: Fix /etc/iscsi installation
Previous all files are installed with inst_dir, which will not install
the files under /etc/iscsi/, and it create folders with the same of the
files which is wrong.

Now only use inst_dir to install the config dir and ensure it
exists, and use inst_multiple to install the config files.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-01-14 09:25:29 +01:00
Lubomir Rintel 5965710e01 network-manager: don't run NetworkManager when there are no connections
NetworkManager would unnecessarily bring up the devices, colliding with
further attempts to rename the devices.

This is arguably a NetworkManager bug and should eventually be fixed there.
Running NetworkManager without the connection is unnecessary regardless.
2020-01-14 09:24:42 +01:00
Brian C. Lane 05b75703b0 Check .hmac of boot.iso in fips mode
Instead of carrying the kernel and hmac in the install.img (which takes
up more space) use the vmlinuz installed under /images/pxeboot/ and the
.hmac in the install.img /boot.

This check is triggered by the presence of /run/install/repo/images/pxeboot/vmlinuz

Related: rhbz#1782737
2020-01-14 09:23:21 +01:00
Colin Walters 7fea85ce5f modules/network-manager: Install `ip`
We don't need `ip` but having it is *really* useful for people debugging
in an emergency shell.
2020-01-14 09:17:22 +01:00
Lukas Nykryn 2181c80c91 network-legacy/ifup: dhclient should be started in oneshot mode
since we handle the retries explicitly via rd.net.dhcp.retry

Without -1 if user sets ip=dhcp6 and there is no dhcp on the network,
dhclient seems to wait indefinitely, ignoring rd.net.timeout.dhcp
2020-01-14 09:16:48 +01:00
Lukas Nykryn 212043f94d network-legacy/ifup: fix typo when calling dhclient --timeout 2020-01-14 09:16:23 +01:00
Alexey Kodanev 958ca9e912 fips: add 'ofb' and 'cts' block cipher modes
Add cts, Linux-5.0 commit:
* 196ad6043e9f ("crypto: testmgr - mark cts(cbc(aes)) as FIPS allowed")

Linux 4.20 commits for 'ofb':
* dfb89ab3f0a7 ("crypto: tcrypt - add OFB functional tests")
* e497c51896b3 ("crypto: ofb - add output feedback mode")

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
2019-11-29 18:56:56 +01:00
Petr Tesarik 7d47d1c423 95ssh-client: improve nsswitch.conf parser
The actual syntax of nsswitch.conf is slightly different from the
current regular expression:

- A comment can appear anywhere, not just at the beginning of a
  line.
- Action items take the general form [STATUS=ACTION] or
  [!STATUS=ACTION] (with some optional whitespace).
- A service name cannot include a colon. This is a nitpick,
  because there should never be more than a single colon per
  line.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
2019-11-22 17:54:00 +01:00
Lubomir Rintel ff2043fb42 Revert "travis: run TEST-14-IMSM on Fedora 29"
We're on Fedora 31 that should be good enough for this test.

This reverts commit 7a2503ab8c.
2019-11-13 10:08:32 +01:00
Daniel Molkentin 8996d3dfcd test: use hosts randomness, not rngd 2019-11-13 09:07:45 +01:00
Daniel Molkentin c226bfdda7 test: Provide host's randomness via virtio 2019-11-13 09:07:45 +01:00
Lubomir Rintel 9a752007b3 TEST-30-ISCSI: test iBFT boot as well
Setting up the machinery to boot with the aid of real networked boot loader
(such as iPXE) would involve much hassle, including possibly serving the kernel
and initrd via TFTP, etc.

Let us generate the iBFT table ourselves, with a Perl script. Include the
pregenerated table as well so that the test run won't depend on Perl. In the
end it's just reproducibly built static data, totally independent of the host
system.
2019-11-12 13:27:59 +01:00
Lubomir Rintel 80238086ab git2spec: include contents of binaries in patches
The patches don't include the binary files, such as the iBFT table for testing,
which makes %autosetup sad.
2019-11-12 13:27:59 +01:00
Daniel Molkentin 50057af19c Documentation: dynamically set current version
Fixes #369
2019-11-12 13:24:41 +01:00
Lubomir Rintel e863807685 spec: dracut-network is happy with either NM or dhclient 2019-11-12 13:11:40 +01:00
Lubomir Rintel f3f081e542 TEST-{20,50,60,70): set MACAddressPolicy=keep
New systemd defaults to generating MAC addresses for software devices (whereas
previously they would inherit them from the first enslaved slave).

Sadly, among the things this breaks is our test fixture, where the dhcp servers
are configured to expect a particular MAC address. Disable this for the
affected tests, which are essentially the ones that use bridges and bonds.
2019-11-11 21:17:31 +01:00
Lubomir Rintel c9391e8f6a TEST-{20,30,31,40,50,60,70): wait for server interfaces to come up
The network interfaces appear asynchronously and sometimes just too late,
after we're already halfway throught server-init.sh:

  + ip link set dev eth0 name ens3
  Cannot find device "eth0"
  + ip addr add 192.168.50.1/24 dev ens3
  Cannot find device "ens3"
  + dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases ens3 ens5
  ...
  [    8.040825] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:01:12:34:56
  [    8.047105] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
  ...
  No subnet declaration for ens3 (no IPv4 addresses).
  ** Ignoring requests on ens3.  If this is not what
     you want, please write a subnet declaration
     in your dhcpd.conf file for the network segment
     to which interface ens3 is attached. **

Whoopsie. Let's ensure all the interfaces are there before we proceed
fiddling around with them.
2019-11-11 21:16:47 +01:00
Lubomir Rintel 031e949c62 TEST-50-MULTINIC: fix how a basename is determined
Analogous to what commit 687e17aa7f ("network-manager: fix getting of
ifname from the sysfs path") fixes.
2019-11-11 21:15:52 +01:00
Lubomir Rintel 10f8438c1e logtee: time out after a period of no output
Travis cuts us short after 10 minutes of slience, giving us no chance to puke
out the output. Be faster.
2019-11-11 20:30:45 +01:00
Lubomir Rintel f5d48a31db Revert "travis: run TEST-13-ENC-RAID-LVM on Fedora 29"
We're on Fedora 31 that should be good enough for this test.

This reverts commit 8238f41b34.
2019-11-11 20:04:58 +01:00
Lubomir Rintel fe54c9b7a9 TEST-13-ENC-RAID-LVM: increase memory
In Fedora 31 it ooms until it has, uh, twice the memory.
2019-11-11 20:04:58 +01:00
Doan Tran Cong Danh 41a37bc626 dmraid: require kpartx binary
dmraid requires kpartx to activate device mapper.
But kpartx is only a recommend dependency.

Check for kpartx's existent first.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Doan Tran Cong Danh cf31ed2ae6 multipath: require kpartx binary
multipath requires kpartx to activate device mapper.
But kpartx is only a recommend dependency.

Check for kpartx's existent first.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Doan Tran Cong Danh 62f27ee6f1 configure: find cflags and libs for fts on musl
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Mikhail Novosyolov 718aefda13 Ensure that udevadm --version reported an integer
If it is not an integer, further script will fail unexepectedly.
2019-11-05 14:26:14 +01:00
Mikhail Novosyolov 6e761674ad Fail if udevadm could not be run
Fixes: #668
2019-11-05 14:26:14 +01:00
Lubomir Rintel 687e17aa7f network-manager: fix getting of ifname from the sysfs path
commit 5e0f8c8a4c ('network-manager: remove useless use of basename')
somewhat carelessly didn't take into account that $_i has a slash at
the end which made the result of the ## substitution be just an empty
string.

The slash was put to the end of /sys/class/net/*/ to make sure we're only
iterating directories, but it's not strictly necessary. In an unlikely case
something else than a directory appears in /sys/class/net/, we'll already deal
with it gracefully. Remove it.

This fixes the TEST-30-ISCSI test.
2019-11-05 14:18:01 +01:00
Thomas Blume 3f4bbca751 keep network device naming scheme on upgrade 2019-11-05 11:37:22 +01:00