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