-
Notifications
You must be signed in to change notification settings - Fork 814
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
cloud-init cannot create swap files on paths that it mounts #3633
Comments
Launchpad user Dan Watkins(oddbloke) wrote on 2020-03-31T14:53:37.371652+00:00 Hi Johnson, thanks for the bug report! Swap file creation and mounting are both handled by the same module, cc_mounts. This has two phases: /etc/fstab generation and /etc/fstab application. In order for the use of swap files to be persisted between boots, they have to be included in /etc/fstab, so the swap file is created during the generation phase. This, of course, means that the other generated mounts haven't yet been applied, which leads to the behaviour you've observed here. As other mounts (in general) presumably aren't dependent on the swap file's creation, it may be possible to change the order of these operations to behave as you would like without affecting other use cases, but we would probably need the expected new behaviour to be specified well to satisfy ourselves of this. Thanks! Dan |
Launchpad user Johnson Shi(johnsonshi) wrote on 2020-04-06T22:34:14.150895+00:00 Hi Dan, thanks for getting back to me. I discussed this with Ryan Harper through IRC and he confirmed that this is a bug. Relevant links: cloud-init/cloudinit/config/cc_mounts.py Lines 478 to 480 in e30599c
Swapfile setup (L478 where cloud-init attempts to create the swapfile) and writing of swap entry to /etc/fstab happens much earlier than "mount -a" (happens later below the code block). cloud-init/cloudinit/config/cc_mounts.py Lines 523 to 535 in e30599c
Also, "swapon -a" is issued before "mount -a". Suggested approach:
This suggested change will enable cloud-init users to create swapfiles (not just swap partitions) on mounted disks on various clouds (not just Azure but also AWS and GCE). Indeed, I think mounts in general won't presumably depend on swap files being created beforehand, while on the other hand, having swapfile creation happen after mounting would make more sense and unlock more user potentials, so our suggested changes won't disrupt users too much. Thanks! |
Launchpad user Dan Watkins(oddbloke) wrote on 2020-04-07T21:12:38.569427+00:00 Hi Johnson, thanks for the update! I agree that this is something we can address. I see you've assigned yourself, are you interested in (or already) working on a fix? |
Launchpad user Marco Wester(mwester) wrote on 2021-02-02T20:28:05.415282+00:00 Hi everybody, today I ran into the same problem. Thanks! |
This bug was originally filed in Launchpad as LP: #1869114
Launchpad details
Launchpad user Johnson Shi(johnsonshi) wrote on 2020-03-26T01:03:00.287171+00:00
Bug exists in all clouds, but the bug was discovered through deploying an Azure VM, mounting the Azure resource disk, and then creating a swapfile within the mounted resource disk.
Relevant logs: https://paste.ubuntu.com/p/QdGybC2wyc/
The text was updated successfully, but these errors were encountered: