New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fake ubuntu drivers #1959
base: main
Are you sure you want to change the base?
Fake ubuntu drivers #1959
Conversation
Draft because I'm still uncertain about the live packages behavior. I just did some tests before opening the PR and I found when doing autoinstall and installing live packages I get an extraneous
Feels like a bug with the client code, but my changes probably don't help. Needs some investigation if keeping it around sounds like a good idea. |
Adds a new interface UbuntuDriversFakePCIDevicesInterface for wrapping the `ubuntu-drivers list` command, as well as the `ubuntu-drivers install` command, with the ubuntu-drivers-common fake-devices-wrapper script. Pass `fake-pci-devices` on the kernel command line to change to this interface. The list command is moved to be run on the live environment because the script depends on umockdev and gir1.2-umockdev-1.0 to be installed, but it appears that the apt source tree is not yet configured enough to install these packages. This is fine since ubuntu-drivers should behave the same on the live systems as it does in the target system. Modifications to make these packages available in the live and target system are not in this commit.
Adds packages umockdev and gir1.2-umockdev-1.0 to the set of packages required in the live environment and the target system when faking pci devices during install.
Post install models should also be able to define live_packages. In particularly, the drivers model needs some packages to support testing MOK enrollment, but there may be other models in the future which could use this functionality too.
Install live packages one step sooner. AFAICT there isn't a hard need to install live_packages after apt has been configured for the target system. In this case there's a race condition between apt being configured and the driver controller calling list drivers as a result/callback, but in testing MOK enrollment we need some packages intalled to the live system before this callback is excecuted.
On server, we force the usage of the --gpgpu flag in the ubuntu-drivers invocation which has the effect of ignoring broadcom wireless drivers at install time. To make MOK enrollment testing easier, this adds a debug flag that disables this behavior. Pass `server-force-no-gpgpu` on the kernel commandline to enable this.
1. Adds the --fake-pci-devices flag which will pass `fake-pci-devices` on the kernel command line. 2. Adds the --server-force-no-gpgpu flag which will pass `server-force-no-gpgpu` on the kernel command line. These flags are used in conjunction with the --secure-boot flag to simulate systems which require MOK enrollment.
Ensure correct behavior in tests when kernel_cmdline is not set correctly. Also add to the the schema cmd submodules make_app function so that it doesn't crash when trying to read from the kernel_cmdline in the ubuntu drivers.
Copies changes to /usr/share/ubuntu-drivers-common/fake-devices-wrapper to /target/usr/share/ubuntu-drivers-common/fake-devices-wrapper. Makes sure the command is called in the system environment and not the snap environment. in-progress umockdev configs misc logging statements
ef02861
to
e574049
Compare
This wraps the
ubuntu-drivers
calls with thefake-devices-wrapper
script fromubuntu-drivers-common
. In the future it would probably be nice to copy/transplant some of the code we have in scripts/umockdev-wrapper.py to facilitate this instead of callingfake-devices-wrapper
, but I think this keeps it pretty simple for now. (We could probably provide the config via autoinstall somehow but getting it to the target would be slightly more difficult I think?).Two related questionable things here:
Currently, only install models are able to specify packages to be installed into the live system. I've changed this to allow post install models to specify these as well. I suppose post install models aren't really given a chance to be configured and change this before packages are set to be installed, but in the ubuntu-drivers case we need to have
gir1.2-umockdev-1.0
andumockdev
installed before the list drivers command is called and we know early on if it's needed or not.I moved installation of live packages up a step. Particularly we were waiting to do the steps to configure apt before installing live packages, but I don't see any reason live packages have to wait for apt configuration (I'm assuming on the target system). The problem I was running into is that ubuntu drivers waits on apt to be configured and then calls the ubuntu-drivers list command as soon as it's ready. This makes sense normally (ubuntu-drivers list is normally called in the target system) but when doing MOK enrollment testing we need the packages in the live environment before this.
If these changes are more dangerous than I suspect, we could remove all of the live_packages logic and get away with using autoinstall and specifying that these packages are installed in early commands. Although I think remembering a few debug flags is better than having to keep around an autoinstall file, it might be good motivation to start a "how-to-test X" doc somewhere to keep this type of information which would be good. Opinions please.
If you want to test out these changes: Build the snap as normal, but when injecting it into an ISO, make sure to add
umockdev
andgir1.2-umockdev-1.0
to the pool on the ISO as well:Then you can launch the VM with:
The quickest way to check if drivers were installed on the secure boot system is check for
MOK.der
in/target/var/lib/shim-signed/mok/
(created by dmks on install)If you want to do it with autoinstall you can do that too. Just use