You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -28,13 +28,12 @@ This article assumes that you have already installed a SUSE or openSUSE Leap Lin
28
28
* The VHDX format isn't supported in Azure, only **fixed VHD**. You can convert the disk to VHD format using Hyper-V Manager or the convert-vhd cmdlet.
* The `vfat` kernel module must be enabled in the kernel
31
-
* When installing the Linux operating system, use standard partitions rather than logical volume manager (LVM) managed partitions, which is often the default for many installations. Using standard partitions will avoid LVM name conflicts with cloned VMs, particularly if an OS disk ever needs to be attached to another VM for troubleshooting. [LVM](/previous-versions/azure/virtual-machines/linux/configure-lvm) or [RAID](/previous-versions/azure/virtual-machines/linux/configure-raid) may be used on data disks if preferred.
32
31
* Don't configure a swap partition on the OS disk. The Linux agent can be configured to create a swap file on the temporary resource disk. More information about configuring swap space can be found in the steps below.
33
32
* All VHDs on Azure must have a virtual size aligned to 1 MB. When converting from a raw disk to VHD, you must ensure that the raw disk size is a multiple of 1 MB before conversion. See [Linux Installation Notes](create-upload-generic.md#general-linux-installation-notes) for more information.
34
33
35
34
36
35
> [!NOTE]
37
-
> **_Cloud-init >= 21.2 removes the udf requirement_**. However, without the udf module enabled, the cdrom won't mount during provisioning, preventing custom data from being applied. A workaround for this is to apply custom data using user data. However, unlike custom data, user data isn't encrypted. https://cloudinit.readthedocs.io/en/latest/topics/format.html
36
+
> **(_Cloud-init >= 21.2 removes the udf requirement._)** however without the udf module enabled the cdrom won't mount during provisioning, preventing custom data from being applied. A workaround for this is to apply custom data. However, unlike custom data user data, isn't encrypted. https://cloudinit.readthedocs.io/en/latest/topics/format.html
38
37
39
38
40
39
## Use SUSE Studio
@@ -45,140 +44,188 @@ As an alternative to building your own VHD, SUSE also publishes BYOS (Bring Your
45
44
46
45
## Prepare SUSE Linux Enterprise Server for Azure
47
46
48
-
1. In the center pane of Hyper-V Manager, select the virtual machine.
49
-
2. Click **Connect** to open the window for the virtual machine.
47
+
1. Configure the Azure/Hyper-v modules if required.
48
+
49
+
If your software hypervisor is not Hyper-V, other modules need to be added into the initramfs to successfully boot in Azure
50
+
51
+
Edit the "/etc/dracut.conf" file and add the following line to the file then executeh the ```dracut```command to rebuild the initramfs file:
52
+
53
+
```config
54
+
add_drivers+=" hv_vmbus hv_netvsc hv_storvsc "
55
+
```
56
+
57
+
```bash
58
+
sudo dracut --verbose --force
59
+
```
60
+
61
+
2. Setup the Serial Console.
62
+
63
+
In order to successfully work with the serial console, it's required to set up several variables in the "/etc/defaults/grub" file and recreate the grub on the server.
64
+
65
+
```config
66
+
# Add console=ttyS0 and earlyprintk=ttS0 to the variable
This configuration will ensure all console messages are sent to the first serial port, which can assist Azure support with debugging issues.
123
+
```bash
124
+
sudo cat <<EOF | sudo tee /etc/cloud/cloud.cfg.d/05_logging.cfg
125
+
# This tells cloud-init to redirect its stdout and stderr to
126
+
# 'tee -a /var/log/cloud-init-output.log' so the user can see output
127
+
# there without needing to look on the console.
128
+
output: {all: '| tee -a /var/log/cloud-init-output.log'}
129
+
EOF
130
+
131
+
# Make sure mounts and disk_setup are in the init stage:
132
+
echo"Adding mounts and disk_setup to init stage"
133
+
sudo sed -i '/ - mounts/d' /etc/cloud/cloud.cfg
134
+
sudo sed -i '/ - disk_setup/d' /etc/cloud/cloud.cfg
135
+
sudo sed -i '/cloud_init_modules/a\\ - mounts' /etc/cloud/cloud.cfg
136
+
sudo sed -i '/cloud_init_modules/a\\ - disk_setup' /etc/cloud/cloud.cfg
137
+
```
100
138
101
-
9. Ensure the "/etc/fstab" file references the disk using its UUID (by-uuid)
139
+
8. If you want to mount, format, and create a swap partition you can either:
140
+
* Pass this configuration in as a cloud-init config every time you create a VM.
141
+
* Use a cloud-init directive baked into the image that configures swap space every time the VM is created:
142
+
102
143
103
-
10. Modify udev rules to avoid generating static rules forthe Ethernet interface(s). These rules can cause problems when cloning a virtual machinein Microsoft Azure or Hyper-V:
9. Previously, the Azure Linux Agent was used to automatically configure swap space by using the local resource disk that is attached to the virtual machine after the virtual machine is provisioned on Azure. However, this step is now handled by cloud-init, you **must not** use the Linux Agent to format the resource disk or create the swap file. Use these commands to modify `/etc/waagent.conf` appropriately:
11. It's recommended to edit the "/etc/sysconfig/network/dhcp" file and change the `DHCLIENT_SET_HOSTNAME` parameter to the following:
171
+
```bash
172
+
sudo sed -i 's/Provisioning.UseCloudInit=n/Provisioning.UseCloudInit=auto/g' /etc/waagent.conf
173
+
sudo sed -i 's/Provisioning.Enabled=y/Provisioning.Enabled=n/g' /etc/waagent.conf
174
+
sudo sed -i 's/ResourceDisk.Format=y/ResourceDisk.Format=n/g' /etc/waagent.conf
175
+
sudo sed -i 's/ResourceDisk.EnableSwap=y/ResourceDisk.EnableSwap=n/g' /etc/waagent.conf
176
+
```
111
177
112
-
```config
113
-
DHCLIENT_SET_HOSTNAME="no"
114
-
```
178
+
> [!NOTE]
179
+
> Make sure the **'udf'** module is enabled. Removing/disabling them will cause a provisioning/boot failure. **(_Cloud-init >= 21.2 removes the udf requirement. Please read top of document for more detail)**
115
180
116
-
12. In the "/etc/sudoers" file, comment out or remove the following lines if they exist:
181
+
10. Ensure the "/etc/fstab" file references the disk using its UUID (by-uuid)
117
182
118
-
```output
119
-
Defaults targetpw # ask for the password of the target user i.e. root
120
-
ALL ALL=(ALL) ALL # WARNING! Only use this setting together with 'Defaults targetpw'!
121
-
```
183
+
11. Remove udev rules and network adapter configuration files to avoid generating static rules for the Ethernet interface(s). These rules can cause problems when cloning a virtual machine in Microsoft Azure or Hyper-V:
122
184
123
-
13. Ensure that the SSH server is installed and configured to start at boot time.
12. It's recommended to edit the "/etc/sysconfig/network/dhcp" file and change the `DHCLIENT_SET_HOSTNAME` parameter to the following:
126
192
127
-
Don't create swap space on the operating system disk.
193
+
```config
194
+
DHCLIENT_SET_HOSTNAME="no"
195
+
```
128
196
197
+
13. In the "/etc/sudoers" file, comment out or remove the following lines if they exist:
129
198
130
-
Previously, the Azure Linux Agent was used to automatically configure swap space by using the local resource disk that is attached to the virtual machine after the virtual machine is provisioned on Azure. However, this step is now handled by cloud-init, you **must not** use the Linux Agent to format the resource disk or create the swap file. Use these commands to modify `/etc/waagent.conf` appropriately:
199
+
```output
200
+
Defaults targetpw # ask for the password of the target user i.e. root
201
+
ALL ALL=(ALL) ALL # WARNING! Only use this setting together with 'Defaults targetpw'!
202
+
```
131
203
132
-
```bash
133
-
sudo sed -i 's/ResourceDisk.Format=y/ResourceDisk.Format=n/g' /etc/waagent.conf
134
-
sudo sed -i 's/ResourceDisk.EnableSwap=y/ResourceDisk.EnableSwap=n/g' /etc/waagent.conf
135
-
```
136
204
137
-
For more information on the waagent.conf configuration options, see the [Linux agent configuration](../extensions/agent-linux.md#configuration) documentation.
205
+
14. Ensure that the SSH server is installed and configured to start at boot time.
138
206
139
-
If you want to mount, format, and create a swap partition you can either:
140
-
* Pass this configuration in as a cloud-init config every time you create a VM.
141
-
* Use a cloud-init directive baked into the image that configures swap space every time the VM is created:
> Make sure the **'udf'** module is enabled. Removing/disabling them will cause a provisioning/boot failure. **(_Cloud-init >= 21.2 removes the udf requirement. Please read top of document for more detail)**
211
+
15. Make sure to clean cloud-init stage;
165
212
213
+
```bash
214
+
sudo cloud-init clean --seed --logs
215
+
```
166
216
167
-
15. Run the following commands to deprovision the virtual machine and prepare it for provisioning on Azure:
217
+
16. Run the following commands to deprovision the virtual machine and prepare it for provisioning on Azure:
168
218
169
-
>[!NOTE]
170
-
> If you're migrating a specific virtual machine and don't wish to create a generalized image, skip the deprovision step.
219
+
>[!NOTE]
220
+
> If you're migrating a specific virtual machine and don't wish to create a generalized image, skip the deprovision step
171
221
172
222
```bash
173
-
sudo rm -f /var/log/waagent.log
174
-
sudo cloud-init clean
175
-
sudo waagent -force -deprovision+user
176
-
sudo rm -f ~/.bash_history
177
-
sudo export HISTSIZE=0
178
-
```
223
+
sudo rm -f /var/log/waagent.log
224
+
sudo waagent -force -deprovision+user
225
+
sudo export HISTSIZE=0
226
+
sudo rm -f ~/.bash_history
227
+
```
179
228
180
-
16. Click **Action -> Shut Down**in Hyper-V Manager. Your Linux VHD is now ready to be [**uploaded to Azure**](./upload-vhd.md#option-1-upload-a-vhd).
181
-
182
229
---
183
230
184
231
## Prepare openSUSE 15.2+
@@ -225,13 +272,13 @@ As an alternative to building your own VHD, SUSE also publishes BYOS (Bring Your
225
272
sudo zypper install WALinuxAgent
226
273
```
227
274
228
-
6. Modify the kernel boot line in your grub configuration to include additional kernel parameters for Azure. To do this, open "/boot/grub/menu.lst" in a text editor and ensure that the default kernel includes the following parameters:
275
+
6. Modify the kernel boot line in your grub configuration to include other kernel parameters for Azure. To do this, open "/boot/grub/menu.lst" in a text editor and ensure that the default kernel includes the following parameters:
229
276
230
277
```config-grub
231
278
console=ttyS0 earlyprintk=ttyS0
232
279
```
233
280
234
-
This option will ensure all console messages are sent to the first serial port, which can assist Azure support with debugging issues. In addition, remove the following parameters from the kernel boot line if they exist:
281
+
This option ensures all console messages are sent to the first serial port, which can assist Azure support with debugging issues. In addition, remove the following parameters from the kernel boot line if they exist:
235
282
236
283
```config-grub
237
284
libata.atapi_enabled=0 reserve=0x1f0,0x8
@@ -253,13 +300,13 @@ As an alternative to building your own VHD, SUSE also publishes BYOS (Bring Your
253
300
9. Ensure that the SSH server is installed and configured to start at boot time.
254
301
10. Don't create swap space on the OS disk.
255
302
256
-
The Azure Linux Agent can automatically configure swap space using the local resource disk that is attached to the VM after provisioning on Azure. Note that the local resource disk is a *temporary* disk and might be emptied when the VM is deprovisioned. After installing the Azure Linux Agent (see previous step), modify the following parameters in the "/etc/waagent.conf" as follows:
303
+
The Azure Linux Agent can automatically configure swap space using the local resource disk that is attached to the VM after provisioning on Azure. The local resource disk is a *temporary* disk and will be emptied when the VM is deprovisioned. After installing the Azure Linux Agent (see previous step), modify the following parameters in the "/etc/waagent.conf" as follows:
257
304
258
305
```config-conf
259
-
ResourceDisk.Format=y
306
+
ResourceDisk.Format=n
260
307
ResourceDisk.Filesystem=ext4
261
308
ResourceDisk.MountPoint=/mnt/resource
262
-
ResourceDisk.EnableSwap=y
309
+
ResourceDisk.EnableSwap=n
263
310
ResourceDisk.SwapSizeMB=2048 ## NOTE: set the size to whatever you need it to be.
264
311
```
265
312
@@ -276,6 +323,7 @@ As an alternative to building your own VHD, SUSE also publishes BYOS (Bring Your
276
323
277
324
```bash
278
325
sudo rm -f ~/.bash_history # Remove current user history
0 commit comments