/srv/irclogs.ubuntu.com/2022/08/15/#cloud-init.txt

=== Daniel is now known as toolz
SDes91Hi all does someone have a reference `user-data` file for partitioning Ubuntu 20/22 Cloud Images? I wish to create a 30% for `/` and remaining for `/home`. I am unable to partition the QEMU image (via Packer). Any help would be appreciated.13:44
zigotarruda: Yeah, like frickler wrote: you can install cloud-init from official bullseye-backports.13:46
holmanbsamip537: I don't think so :( contributions are definitely welcome16:44
holmanbSDes91: 30/70 split makes sense in an install scenario, but in a cloud scenario repartitioning the image doesn't really jive, does it?16:48
SDes91holmanb so maybe it is best to stick to a live server (Ubuntu) and go with Subiquity / Autoinstall then?16:49
holmanbSDES91: Yeah if I had specific partition/disk requirements I would probably bake that into an image, and then use the image with cloud-init.16:50
SDes91holmanb would make sense however would `disk_setup` and `fs_setup` actually work with the live-server? I have a `curtin` storage config and would want to stick cloud-init because subiquity / autoinstall takes an eternity to setup everything up16:53
holmanbSDes91: During an install, you have lots of flexibility since you typically install from a livecd/usb/whatever, and can slice up your disks however you like before copying data. In a running cloud-init instance the disk modifications happen to the already-installed-instance - much less flexible16:54
holmanbSDes91: what do you mean by live-server?16:54
SDes91holmanb I mean Ubuntu Live Server Images as opposed to Cloud Images here.16:55
holmanbSDes91: ah, I think I see what you mean. There are some guides out there about how to use server images as a base for building your instance (the guides typically involve installing cloud-init, sometimes running an initial module followed by some combination of `cloud-init clean`)16:56
holmanbUnfortunately this isn't something I've personally done, otherwise I'd point you to one.16:57
SDes91holmanb Well I wish to create a custom image so I can load it into a Hardware Device. They only possibility is to configure `user-data` either with subiquity / cloud-init config to get the partitioning right.17:01
holmanbSDes91: I see. It sounds like subiquity is your best option then, if you're limited to cloud-init or subiquity.17:08
anankeI'm reading through the docs and I'm not quite sure how to figure something out: where does cloud-init gets its network interface names, when the datasource is DataSoruceEc2Local? I can't find it in metadata provided by AWS, etc18:17
anankethe issue is simple: depending on instance type, I get different NIC names: ethX vs ensX. I see cloud-init write out netplan config with those values, so I'm wondering where cloud-init gets them from, and ultimately I want to figure out how to control that18:18
holmanbananke: with network v2 you could match on e* and then use set-name to set to whatever you want. Should work unless you have an interface that starts with a character besides `e`, I think18:24
holmanbananke: I would have to dig a little to find the exact source of the names, but it might just be whatever the kernel originally named them.18:26
anankeholmanb: the issue is, cloud-init's config for netplan is automatically generated: '# This file is generated from information provided by the datasource.', so I'm not sure how I would even attempt to use set-name in this context18:30
anankeI'm right now poking around trying to figure out what's responsible for changes in the network names. AWS own documentation says it is expected, but I'm wondering what's responsible for it, and whether it can be controlled18:31
minimalananke: the list of ethernet device names is simply obtained from /sys/class/net/18:41
anankelooks like this may be related to the network driver: vif vs ena18:41
anankeminimal: thanks18:41
minimalananke: depending on your kernel config it may name interfaces using old-style (ethX) or new-style (ensX) names18:42
minimalananke: controlled by kernel cmdline line setting "net.ifnames=" (defaults to using predictable names, set to "0" to disable)18:45
minimalso AFAIK cloud-init takes the interface names from /sys/class/net/ and matches then against interfaces mentioned in network config (obtained from IMDS on AWS)18:47
anankeminimal: kernel config is the same, it's the same identical image in both cases. difference is in ec2 instance type, which dictates what network driver will be used20:08
holmanbananke: which file are you referring to?21:53
holmanbananke: oh you're refering to manually setting the netplan config? why not use cloud-init networkv2? https://cloudinit.readthedocs.io/en/latest/topics/network-config.html21:56
minimalananke: the ethernet network driver used should not make a difference to the ethernet device naming...23:42
anankeholmanb: netplan config is automatically populated by cloud-init. I'm talking about booting the same identical VM image on AWS, and having different interface names, based on the EC2 type.23:42
minimalananke: have you tried enabling debugging for cloud-init? I'd expect you would then see entries in cloud-init.log showing cloud-init looking up the device names in /sys/class/net23:44
anankeminimal: it sure does, because they are essentially two different types of networking devices. not quite the difference say between ethernet and IB, but clearly there is. ena driver appears to be using 'ens' device names, while ivf uses traditional device names23:44
anankeminimal: the issue isn't cloud-init, it was something I suspected at first, because of the cloud-init generated netplan config23:45
minimalananke: what is the kernel module for this ivf interface?23:45
anankevif interface, that was a transposition. to be honest, I haven't looked which driver is used, it appears to be one built into the kernel23:46
minimalananke: well that's my question, what make/model of network device is it? knowing the kernel module will indicate this23:47
anankeminimal: likely whatever xen provides23:48
minimalananke: something like "lshw" or "hwinfo" should indicate the driver used by that interface23:49
minimalI'm suspecting that this driver does not support the "new" ethernet interface naming scheme whereas the "ena" one does23:50
anankepresumably. I'm booting a sample instance right now23:52
anankehah, driver: vif23:52
anankeand AWS docs state: Amazon EC2 instances have three different virtual network adapters, VIF, Intel 82599 VF, and Elastic Network Adapter (ENA).23:53
minimalananke: yeah I found that, but from a quick search of kernel source I can't find a VIF driver23:54
anankeminimal: it's not a module, that's for sure. looks like official ubuntu AMIs don't have /proc/config.gz enabled, so I'd have to dig deeper23:56
minimalananke: if the vif driver a loadable module ("lsmod") or compiled into the kernel?23:56
ananke^23:56
anankecomparing lsmod output on t2.x instance and t3.x instance shows that the vif one doesn't have any additional modules loaded, while the t3 has ena and a few others23:57
minimaldoes "dmesg" give any useful info re the VIF?23:57
anankeanyway, point being is that I've been able to narrow it down to the driver, and it's not a cloud-init related issue. I wanted to eliminate cloud-init as a possible culprit, thinking it was a network config handed down from the metatada service23:58
minimalnormally it would give some info re: vendor23:58
minimalalso perhaps "lspci"23:58
anankeclosest is: [    2.728564] xen_netfront: Initialising Xen virtual ethernet driver23:58
anankethere is nothing on lspci23:59
anankelike I mentioned earlier, my guess it's part of xen support23:59
minimalanyway, what exactly is the actual problem? cloud-init gets the network config from the AWS IMDS so then should set things up appropriately23:59

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!