Subject: [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present.

From: [email-masked] (Ludovic Courtès)
Date: Fri, 09 Mar 2018 23:06:50 +0100

Hello!

I’ve reworked this patch series a bit, but now I’m stuck on this:

Danny Milosavljevic <[email-masked]> skribis:

> ERROR: In procedure network-interface-flags:
> In procedure network-interface-flags: No such device

When than happens, our modprobe gets called with the “netdev-eth0”
alias, which it cannot handle, leading to this error.

By explicitly loading “virtio_net” and sleeping a bit, we get past that
point, but fail later on:

--8<---------------cut here---------------start------------->8---
loading '/gnu/store/n2zvdxp25kvg7wy5xr1y5n9r4502fw80-linux-vm-loader'...
environment variable `PATH' set to `/gnu/store/vxl918zb9brnrgaipzsykpy3mzcafvcr-qemu-minimal-2.11.1/bin:/gnu/store/lvkaf3xlvy57bvap51xlzb209ilbkgcv-parted-3.2/sbin:/gnu/store/nm305rpb2mvridkyj4l3636nc9ql4lf9-e2fsprogs-1.43.6/bin:/gnu/store/nm305rpb2mvridkyj4l3636nc9ql4lf9-e2fsprogs-1.43.6/sbin:/gnu/store/0sq2nflm42x0znkv44add0gk82khkcb6-dosfstools-4.1/sbin:/gnu/store/0hl513mnpkhszm2hjai2w9cxmpxs0vgq-sed-4.4/bin:/gnu/store/1h44pkgdd7n6s3i2vjh54awsvfmc219j-grep-3.1/bin:/gnu/store/kgzvfby2ggi1xawsh5vjh4s93qk2dp9k-coreutils-8.28/bin:/gnu/store/k7r2m2wgj8x8jjhccwjsiimp0dlzxb7i-findutils-4.6.0/bin:/gnu/store/ahxc89r6npzf2bbl8yg5vdjicskzzjf3-gawk-4.1.4/bin'
creating partition table with 2 partitions (20.0 MiB, 40.0 MiB)...
Warning: The resulting partition is not properly aligned for best performance.
creating ext4 partition...
mke2fs 1.43.6 (29-Aug-2017)
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/vda1 is mounted.
Creating filesystem with 20480 1k blocks and 5136 inodes
Filesystem UUID: 81a538e9-3efe-406b-bf67-fa153fa3c6a6
Superblock backups stored on blocks: 
	8193

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

[    3.190801] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
populating...
clearing file timestamps...
creating FAT partition...
mkfs.fat 4.1 (2017-01-24)
[    3.235493] FAT-fs (vda2): IO charset iso8859-1 not found
ERROR: In procedure mount:
In procedure mount: Invalid argument
--8<---------------cut here---------------end--------------->8---

Here the nls_iso8859-1 module doesn’t get loaded and modprobe isn’t even
invoked, although my understanding is that it should (per ‘load_nls’ in
nls_base.c in the kernel, called from vfat/inode.c).

Similarly, it seems that virtio_blk has to be loaded explicitly: is not
reported by ‘needed-modules’ (i.e., not listed in /sys/…/modalias), nor
do we get a modprobe query for it.

All in all on-demand loading seems more complicated that it seemed.

What are we missing here?

Ludo’.