1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
2 | <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
|
---|
3 | <topic xml:lang="en-us" id="cloud-export-oci-prepare-vm">
|
---|
4 | <title>Preparing a VM for Export to <ph conkeyref="vbox-conkeyref-phrases/oci"/></title>
|
---|
5 |
|
---|
6 | <body>
|
---|
7 | <p><ph conkeyref="vbox-conkeyref-phrases/oci"/> provides the option to import a custom Linux image. Before an <ph
|
---|
8 | conkeyref="vbox-conkeyref-phrases/product-name"/> image can be exported to <ph
|
---|
9 | conkeyref="vbox-conkeyref-phrases/oci"/>, the custom image needs to be prepared to ensure that instances
|
---|
10 | launched from the custom image can boot correctly and that network connections will work. This section provides
|
---|
11 | advice on how to prepare a Linux image for export from <ph conkeyref="vbox-conkeyref-phrases/product-name"/>. </p>
|
---|
12 | <p>The following list shows some tasks to consider when preparing an Oracle Linux VM for export: </p>
|
---|
13 | <ul>
|
---|
14 | <li>
|
---|
15 | <p><b outputclass="bold">Use DHCP for network
|
---|
16 | addresses.</b> Configure the VM to use a DHCP
|
---|
17 | server to allocate network addresses, rather than using a
|
---|
18 | static IP address. The <ph conkeyref="vbox-conkeyref-phrases/oci"/> instance will then be
|
---|
19 | allocated an IP address automatically.
|
---|
20 | </p>
|
---|
21 | </li>
|
---|
22 | <li>
|
---|
23 | <p><b outputclass="bold">Do not specify a MAC
|
---|
24 | address.</b> The network interface configuration
|
---|
25 | for the VM must not specify the MAC address.
|
---|
26 | </p>
|
---|
27 | <p>Remove the HWADDR setting from the <filepath>/etc/sysconfig/ifcfg-<varname>devicename</varname></filepath>
|
---|
28 | network script. </p>
|
---|
29 | </li>
|
---|
30 | <li>
|
---|
31 | <p><b outputclass="bold">Disable persistent network device
|
---|
32 | naming rules.</b> This means that the <ph conkeyref="vbox-conkeyref-phrases/oci"/>
|
---|
33 | instance will use the same network device names as the VM.
|
---|
34 | </p>
|
---|
35 | <ol>
|
---|
36 | <li>
|
---|
37 | <p>Change the GRUB kernel parameters. </p>
|
---|
38 | <p>Add <codeph>net.ifnames=0</codeph> and <codeph>biosdevname=0</codeph> as kernel parameter values to the
|
---|
39 | <codeph>GRUB_CMDLINE_LINUX</codeph> variable. </p>
|
---|
40 | </li>
|
---|
41 | <li>
|
---|
42 | <p>Update the GRUB configuration. </p>
|
---|
43 | <pre xml:space="preserve"># grub2-mkconfig -o /boot/grub2/grub.cfg</pre>
|
---|
44 | </li>
|
---|
45 | <li>
|
---|
46 | <p>Disable any <codeph>udev</codeph> rules for network device naming. </p>
|
---|
47 | <p>For example, if an automated <codeph>udev</codeph> rule exists for <codeph>net-persistence</codeph>: </p>
|
---|
48 | <pre xml:space="preserve"># cd /etc/udev/rules.d
|
---|
49 | # rm -f 70-persistent-net.rules
|
---|
50 | # ln -s /dev/null /etc/udev/rules.d/70-persistent-net.rules</pre>
|
---|
51 | </li>
|
---|
52 | </ol>
|
---|
53 | </li>
|
---|
54 | <li>
|
---|
55 | <p><b outputclass="bold">Enable the serial
|
---|
56 | console.</b> This enables you to troubleshoot the
|
---|
57 | instance when it is running on <ph conkeyref="vbox-conkeyref-phrases/oci"/>.
|
---|
58 | </p>
|
---|
59 | <ol>
|
---|
60 | <li>
|
---|
61 | <p>Edit the <filepath>/etc/default/grub</filepath> file, as follows: </p>
|
---|
62 | <ul>
|
---|
63 | <li>
|
---|
64 | <p>Remove the <codeph>resume</codeph> setting from the kernel parameters. This setting slows down boot
|
---|
65 | time significantly. </p>
|
---|
66 | </li>
|
---|
67 | <li>
|
---|
68 | <p>Replace <codeph>GRUB_TERMINAL="gfxterm"</codeph> with <codeph>GRUB_TERMINAL="console
|
---|
69 | serial"</codeph>. This configures use of the serial console instead of a graphical terminal. </p>
|
---|
70 | </li>
|
---|
71 | <li>
|
---|
72 | <p>Add <codeph>GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200"</codeph>. This configures the serial
|
---|
73 | connection. </p>
|
---|
74 | </li>
|
---|
75 | <li>
|
---|
76 | <p>Add <codeph>console=tty0 console=ttyS0,115200</codeph> to the <codeph>GRUB_CMDLINE_LINUX</codeph>
|
---|
77 | variable. This adds the serial console to the Linux kernel boot parameters. </p>
|
---|
78 | </li>
|
---|
79 | </ul>
|
---|
80 | </li>
|
---|
81 | <li>
|
---|
82 | <p>Regenerate the GRUB configuration. </p>
|
---|
83 | <pre xml:space="preserve"># grub2-mkconfig -o /boot/grub2/grub.cfg</pre>
|
---|
84 | </li>
|
---|
85 | <li>
|
---|
86 | <p>To verify the changes, reboot the machine and run the <userinput>dmesg</userinput> command to look for
|
---|
87 | the updated kernel parameters. </p>
|
---|
88 | <pre xml:space="preserve"># dmesg |grep console=ttyS0</pre>
|
---|
89 | </li>
|
---|
90 | </ol>
|
---|
91 | </li>
|
---|
92 | <li>
|
---|
93 | <p><b outputclass="bold">Enable paravirtualized device
|
---|
94 | support.</b> You do this by adding the
|
---|
95 | <codeph>virtio</codeph> drivers to the
|
---|
96 | <codeph>initrd</codeph> for the VM.
|
---|
97 | </p>
|
---|
98 | <ol>
|
---|
99 | <li>
|
---|
100 | <p>This procedure works only on machines with a Linux kernel of version 3.4 or later. Check that the VM is
|
---|
101 | running a supported kernel: </p>
|
---|
102 | <pre xml:space="preserve"># uname -a</pre>
|
---|
103 | </li>
|
---|
104 | <li>
|
---|
105 | <p>Use the <codeph>dracut</codeph> tool to rebuild <codeph>initrd</codeph>. Add the <codeph>qemu</codeph>
|
---|
106 | module, as follows: </p>
|
---|
107 | <pre xml:space="preserve"># dracut –-logfile /var/log/Dracut.log --force --add qemu</pre>
|
---|
108 | </li>
|
---|
109 | <li>
|
---|
110 | <p>Verify that the <codeph>virtio</codeph> drivers are now present in <codeph>initrd</codeph>. </p>
|
---|
111 | <pre xml:space="preserve"> # lsinitrd |grep virtio</pre>
|
---|
112 | </li>
|
---|
113 | </ol>
|
---|
114 | </li>
|
---|
115 | </ul>
|
---|
116 | <p>For more information about importing a custom Linux image into <ph conkeyref="vbox-conkeyref-phrases/oci"/>, see
|
---|
117 | also: </p>
|
---|
118 | <p>
|
---|
119 | <ph>https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/importingcustomimagelinux.htm</ph>
|
---|
120 | </p>
|
---|
121 | </body>
|
---|
122 |
|
---|
123 | </topic>
|
---|