<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ubuntu &#8211; richliu&#039;s blog</title>
	<atom:link href="https://richliu.com/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>https://richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Tue, 09 Apr 2024 09:42:18 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Play Game On Ampere Altra ARM64 Platform</title>
		<link>https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/</link>
					<comments>https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 25 Feb 2024 04:38:53 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[GAME]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[Box86]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5816</guid>

					<description><![CDATA[<p>Setup Steam on Ampere Altra platform. </p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/">Play Game On Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img fetchpriority="high" decoding="async" width="2560" height="1527" src="https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-scaled.jpg" alt="" class="wp-image-5824" style="aspect-ratio:1.676489849377865;width:367px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-600x358.jpg 600w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-768x458.jpg 768w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-1536x916.jpg 1536w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-2048x1222.jpg 2048w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-816x487.jpg 816w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure>
</div>


<p>In previous article on <a href="https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a> , we installed the Nvidia driver and ran PyTorch on the platform. Now, this platform has Nvidia RTX gaming card, can we use it to play game? </p>



<p>The answer is yes, there are some windows x86 or x64 emulators on Linux, but the most stable solution comes from Ampere&#8217;s official release solution. Other emulators might not work as well on this combination, such as FEX, but I don&#8217;t know whether it is a driver issue or another issue.</p>



<span id="more-5816"></span>



<p><br />Basically, following Ampere&#8217;s documentation makes it easy to install the driver and play games. Let&#8217;s combine both documents into one and simplify it in this article.<br /><br />Hardware <br />CPU: Ampere Altra <br />Board: AsRock ALTRAD8UD<br />GPU: Nvidia RTX 4080 <br /><br />Reference Ampere&#8217;s document<br /><a href="https://github.com/AmpereComputing/NVIDIA-GPU-Accelerated-Linux-Desktop-on-Ampere" target="_blank" rel="noopener">NVIDIA GPU Accelerated Linux Desktop on Ampere</a><br /><a href="https://github.com/AmpereComputing/Steam-on-Ampere" target="_blank" rel="noopener">Steam-on-Ampere</a></p>



<h2 class="wp-block-heading">Install Nvidia Driver</h2>



<p>All the conditions are similar to those outlined in the article <a href="https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a>, using Ubuntu 22.04 with a general kernel (not the HWE kernel, which Nvidia may address in the future).</p>



<p>I haven&#8217;t utilized the original document&#8217;s script; instead, I&#8217;ve copied some necessary commands from it.</p>



<pre class="wp-block-preformatted">sudo apt-get install build-essential
# Install Nvidia driver here
sudo rmmod nouveau
cat &lt;&lt; EOF | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
EOF

sudo nvidia-xconfig -a --cool-bits=31 --allow-empty-initial-configuration

# Install Desktop, personally I like kde. 
sudo apt install kde-plasma-desktop
# or it can install regular ubuntu desktop 
# sudo apt install ubuntu-desktop</pre>



<p>Download <a href="https://www.nvidia.com/en-us/drivers/unix/linux-aarch64-archive/" target="_blank" rel="noopener">Nvidia ARM64 (aarch64) Display Driver </a>; the current version, 535.154.05, is acceptable. After installing the Nvidia driver, simply reboot the system. You can then use the following command to check the driver status.</p>



<pre class="wp-block-preformatted">nvidia-smi</pre>



<h2 class="wp-block-heading">Disable aspm from kernel </h2>



<p>I didn&#8217;t apply this option. Most of the time, it&#8217;s only necessary to do so if the system encounters the massive AER error issue. Here&#8217;s an example command from the original document:</p>



<pre class="wp-block-preformatted">sudo nano /etc/default/grub
# Add pcie_aspm=off to kernel parameters
# GRUB_CMDLINE_LINUX_DEFAULT="pcie_aspm=off"
sudo update-grub
</pre>



<h2 class="wp-block-heading">Install Box86</h2>



<p>Following commands show how to install Box86</p>



<pre class="wp-block-preformatted">sudo wget https://itai-nelken.github.io/weekly-box86-debs/debian/box86.list -O /etc/apt/sources.list.d/box86.list
wget -qO- https://itai-nelken.github.io/weekly-box86-debs/debian/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg
sudo dpkg --add-architecture armhf
sudo apt update
sudo apt install box86:armhf -y</pre>



<h2 class="wp-block-heading">Install Box64</h2>



<p>Following command show how to install <a href="https://github.com/ryanfortner/box64-debs" target="_blank" rel="noopener">Box64</a>, but original instruction have update , a package name was changed. </p>



<pre class="wp-block-preformatted">sudo wget https://ryanfortner.github.io/box64-debs/box64.list -O /etc/apt/sources.list.d/box64.list
wget -qO- https://ryanfortner.github.io/box64-debs/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
sudo apt update 
sudo apt install box64-arm64 -y
sudo systemctl restart systemd-binfmt</pre>



<h2 class="wp-block-heading">Installing Steam</h2>



<p>Because I am using the Ubuntu 22.04 ARM64 server version with minimal, so,  some packages might not be installed, Before Install Steam, install necessary packages</p>



<pre class="wp-block-preformatted">sudo apt install lsof

sudo apt install zenity
sudo apt install alsa
</pre>



<p>Use the following to install steam.</p>



<pre class="wp-block-code"><code>git clone https://github.com/ptitSeb/box86
cd box86
./install_steam.sh</code></pre>



<p>Now, it can use steam now. </p>



<pre class="wp-block-preformatted">/usr/local/bin/steam</pre>



<p>Okay, log in and enjoy it. However, in my experience, when installing other emulators, it might damage the box86+Steam setup, necessitating a system reinstallation to fix it.</p>



<p>Furthermore, the game&#8217;s performance seems not as good as expected, possibly due to my choice of Vampire Survivors and enabling high performance</p>



<h2 class="wp-block-heading">Xbox JoyStick controller</h2>



<p>I have an Xbox controller, and ALTRAD8UD doesn&#8217;t have Bluetooth capability, so I cannot use wireless conntions. However, it can connect via USB.</p>



<p>There are several Xbox drivers available for Linux. After testing, I found that <a href="https://atar-axis.github.io/xpadneo/" target="_blank" rel="noopener">xpadano</a> is compatible with this platform. Simply follow their instruction guide to install the Xbox driver.</p>



<pre class="wp-block-preformatted"># Install DKMS package
sudo apt-get install dkms linux-headers-`uname -r`

# download source code
git clone https://github.com/atar-axis/xpadneo.git
cd xpadneo
# use DKMS to compile the driver
sudo ./install.sh</pre>



<p>The Xbox controller driver will be installed automatically, and it works well in my tests. You can install the <code>jstest</code> package to perform a joystick test.</p>



<p>The Xbox controller functions seamlessly on Steam and Vampire Survivors. I can easily use the Xbox controller to play Vampire Survivors.</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/">Play Game On Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu/Fedora PXE Boot</title>
		<link>https://richliu.com/2023/04/16/5181/ubuntu-fedora-pxe-boot/</link>
					<comments>https://richliu.com/2023/04/16/5181/ubuntu-fedora-pxe-boot/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 15 Apr 2023 16:56:38 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[pxe]]></category>
		<category><![CDATA[pxeboot]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5181</guid>

					<description><![CDATA[<p>Before setting up Ubuntu/Fedora PXE boot, it needs to p [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2023/04/16/5181/ubuntu-fedora-pxe-boot/">Ubuntu/Fedora PXE Boot</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Before setting up Ubuntu/Fedora PXE boot, it needs to prepare several items on your PXE server:</p>



<ul class="wp-block-list">
<li>* The Ubuntu/Fedora rootfs on tftp/nfs server:<br />It can refer to the my article <a href="https://richliu.com/2017/02/23/2098/mips_arm64_debian_ubuntu_debootstrap/" target="_blank" rel="noreferrer noopener">MIPS/ARM64 Debian/Ubuntu debootstrap</a> for building the Ubuntu rootfs. <br />If want to build the Fedora rootfs, it can install a new system on qemu and copy it from the qcow2 image.</li>
</ul>



<ul class="wp-block-list">
<li>* PXE Server:<br />You can refer my article  <a href="https://richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/" target="_blank" rel="noreferrer noopener">ARM64 Centos8/Ubuntu PXE Boot Install on Ubuntu Server</a>  to build a PXE server.</li>
</ul>



<ul class="wp-block-list">
<li>NFS Server:<br /> Assume the rootfs for Ubuntu is on /nfs/ubuntu2204 and Fedora 36 is on /nfs/fedora36.</li>
</ul>



<span id="more-5181"></span>



<h2 class="wp-block-heading">Ubuntu PXE Boot</h2>



<p>Copy vmlinux and initramfs to tftp server. Copy your current system’s vmlinux to your tftpboot. For example, create a directory for Ubuntu 22.04 in /tftpboot/nfs/ubuntu2204, and copy the vmlinuz to the folder using the following command:</p>



<pre class="wp-block-preformatted">$ cp /boot/vmlinuz-$(uname -r) /tftpboot/nfs/ubuntu2204/vmlinuz</pre>



<p>Copy the initrd.img to the folder using the following command:</p>



<pre class="wp-block-preformatted">$ cp /boot/initrd.img-$(uname -r) /tftpboot/nfs/ubuntu2204/initrd.img</pre>



<p>Setup your PXE server’s grub.cfg and add a record. Use the following example for the record:</p>



<pre class="wp-block-preformatted">menuentry 'Ubuntu22.04 nfsboot' { 
    linux nfs/ubuntu2204/vmlinuz ip=dhcp root=/dev/nfs nfsroot=&lt;NFS server IP>:/nfs/ubuntu2204,nolock rw netboot=nfs 
    initrd nfs/ubuntu2204/initrd.img 
}
</pre>



<h2 class="wp-block-heading">Fedora PXE Boot</h2>



<p>The procedure is similar to Ubuntu, but the default Fedora initramfs doesn&#8217;t support nfs boot.<br />1. Rebuild the initramfs with dracut. You need to add nfs and network support to your Fedora initramfs using the following command:</p>



<pre class="wp-block-preformatted">$ dracut --add nfs --add network --force</pre>



<p>It will generate the same name vmlinuz and initramfs. Copy it to your directory just like Ubuntu.<br />2. Disable selinux. <br />Default Fedora selinux is enabled, but it cannot enable on nfs rootfs (or it can but needs to set up something). You can disable it by adding selinux=0 on boot kernel parameter. Use the following example for the record:</p>



<pre class="wp-block-preformatted">linux nfs/fedora36/vmlinuz boot=nfs root=/dev/nfs nfsroot=&lt;NFS server IP>:/nfs/fedora36,nolock rw netboot=nfs ip=dhcp selitarnux=0</pre>
<p>The post <a rel="nofollow" href="https://richliu.com/2023/04/16/5181/ubuntu-fedora-pxe-boot/">Ubuntu/Fedora PXE Boot</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2023/04/16/5181/ubuntu-fedora-pxe-boot/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ARM64 Centos8/Ubuntu PXE Boot Install on Ubuntu Server</title>
		<link>https://richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/</link>
					<comments>https://richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 08 Apr 2020 08:21:38 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[centos8]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[pxe]]></category>
		<category><![CDATA[pxeboot]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=4263</guid>

					<description><![CDATA[<p>This document will introduce how to setup a centos PXE  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/">ARM64 Centos8/Ubuntu PXE Boot Install on Ubuntu Server</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This document will introduce how to setup a centos PXE boot environment on ubuntu 18.04 for install centos8 to your ARM64 machine. <br /><br />In this document, it uses CentOS 8 version is 8.1.1911, it might also work on later version if you change file name accordingly .&nbsp;<br /><br />all command in this document we assume you already run with root permission.&nbsp;<br /></p>



<span id="more-4263"></span>



<h2 class="wp-block-heading">Hardware topology&nbsp;</h2>



<p>[ARM64 CLIENT] &lt;&#8212;&#8212;-&gt; [Server]&nbsp; &lt;&#8212;&#8212;-&gt; Internet&nbsp;</p>



<p>SERVER ethernet ip is 10.0.0.1 , another interface connect to internet.&nbsp;</p>



<p></p>



<h2 class="wp-block-heading">Install necessary packages&nbsp;<br /></h2>



<p>Install TFTP, HTTP and DHCPD Server and rpm2cpio&nbsp;<br /></p>



<p>$ apt install tftpd-hpa apache2 isc-dhcp-server rpm2cpio<br /></p>



<h2 class="wp-block-heading">Modify dhcpd server configuration&nbsp;<br /></h2>



<p>$ vim /etc/dhcp/dhcpd.conf<br /></p>



<p>following is example configuration,it can be changed to fit your environment&nbsp;</p>



<pre class="wp-block-verse">authoritative;
default-lease-time&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 259200;
max-lease-time&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 518400;
option routers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10.0.0.1;
option subnet-mask&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 255.255.255.0;
option domain-name-servers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 168.95.1.1,8.8.8.8;
ddns-update-style &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; interim;
ignore client-updates;
allow booting;
allow bootp;
allow unknown-clients;
server-name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pxis;

subnet 10.0.0.0 netmask 255.255.255.0 {
&nbsp;&nbsp;&nbsp;&nbsp;range 10.0.0.100 10.0.0.200;
&nbsp;&nbsp;&nbsp;&nbsp;option ip-forwarding off;
&nbsp;&nbsp;&nbsp;&nbsp;option subnet-mask&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 255.255.255.0;
&nbsp;&nbsp;&nbsp;&nbsp;next-server 10.0.0.1;
&nbsp;&nbsp;&nbsp;&nbsp;filename "shim.efi";

}</pre>



<h2 class="wp-block-heading">Modify tftpd setting&nbsp;<br /></h2>



<p>$ vim /etc/default/tftpd-hpa<br /></p>



<p>Add &#8211;create to TFTP_OPTIONS and change tftp directory to /tftpboot&nbsp;<br /></p>



<p>following is example configuration file&nbsp;</p>



<pre class="wp-block-preformatted">TFTP_USERNAME="tftp"<br />TFTP_DIRECTORY="/tftpboot"<br />TFTP_ADDRESS=":69"<br />TFTP_OPTIONS="--secure&nbsp; --create"</pre>



<h2 class="wp-block-heading">Restart Service&nbsp;<br /></h2>



<pre class="wp-block-preformatted">mkdir /tftpboot&nbsp;
/etc/init.d/tftpd-hpa restart
/etc/init.d/apache2 restart
/etc/init.d/isc-dhcp-server restart
</pre>



<h2 class="wp-block-heading">Get ARM64 pxeboot file&nbsp;</h2>



<p>some times the shim and grub2-efi would be erase, just visit mirror.centos.org and find new one than download it. </p>



<pre class="wp-block-preformatted">cd /tftpboot&nbsp;
wget http://mirror.centos.org/centos/8-stream/BaseOS/aarch64/os/Packages/shim-aa64-15-15.el8_2.aarch64.rpm
wget http://mirror.centos.org/centos/8-stream/BaseOS/aarch64/os/Packages/grub2-efi-aa64-2.02-106.el8.aarch64.rpm
rpm2cpio shim-aa64-15-15.el8_2.aarch64.rpm | cpio -dimv
rpm2cpio grub2-efi-aa64-2.02-106.el8.aarch64.rpm | cpio -dimv
cp ./boot/efi/EFI/centos/shim.efi .
cp ./boot/efi/EFI/centos/grubaa64.efi .
chmod +rx *.efi</pre>



<h2 class="wp-block-heading">Configure grub.conf&nbsp;<br /></h2>



<p>$ vim /tftpboot/grub.cfg<br /></p>



<p>Following is grub.conf example&nbsp;</p>



<pre class="wp-block-verse">set timeout=60<br />menuentry 'CentOS' {<br /> &nbsp;linux images/pxeboot/vmlinuz ip=dhcp inst.repo=http://10.0.0.1/centos8/<br />&nbsp;&nbsp;initrd images/pxeboot/initrd.img<br />}</pre>



<p>If your system support secure boot and you want to do it, please replace linux with linuxefi and replace initrd with initrdefi.&nbsp;</p>



<h2 class="wp-block-heading">Get CentOS 8 stream image and copy it to web server&nbsp;</h2>



<pre class="wp-block-preformatted">cd /var/www/html&nbsp;
wget <a href="https://mirror01.idc.hinet.net/centos/8-stream/isos/aarch64/CentOS-Stream-8-aarch64-20211202-dvd1.iso" target="_blank" rel="noopener">http://ftp.twaren.net/Linux/CentOS/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-20220215-dvd1.iso</a>
mkdir disk&nbsp;
mount -o loop CentOS-Stream-8-x86_64-20220215-dvd1.iso disk
cp -a disk centos8&nbsp;
umount disk&nbsp;
rmdir disk

# copy boot file into tftp directory </pre>



<p>cd /tftpboot<br />cp /var/www/html/centos8/images/ . -a<br /></p>



<p>After copy all file into http file directory, it can visit via browser on server with URL <a href="http://10.0.0.1/centos8/">http://10.0.0.1/centos8/</a> to check whether file exist or not.&nbsp;<br /></p>



<h2 class="wp-block-heading">NAT<br /></h2>



<p>Server should support NAT function to forward packet.&nbsp;<br /><br />assume interface connect to internet is wls3 <br />Following is a sample command to enable Linux NAT function which can make client to access internet or intranet .&nbsp;</p>



<p>$ echo 1 &gt; /proc/sys/net/ipv4/ip_forward ==&gt; enable it immediately&nbsp;<br />$ iptables -t nat -A POSTROUTING -o wls3 -j MASQUERADE</p>



<p></p>



<p>Now, you can choose pxeboot on your ARM64 machine. if everything successful, you can see CentOS on your console if everything is ok .&nbsp;<br /></p>



<h2 class="wp-block-heading">Known Issue</h2>



<h3 class="wp-block-heading">Stdin: Invalid argument</h3>



<p>My system cannot boot into the Ubuntu install program for an unknown reason. After checking the system, it seems that the issue may be caused by an inability to access internet resources for some reason, even though the DNS and network appear to be fine. An alternative solution is to put the ISO on a website and assign the argument to the parameter. Here is an example using Ubuntu 22.04.</p>



<pre class="wp-block-preformatted">menuentry 'Ubuntu22.04 Net Install' {<br />linux ubuntu2204/vmlinuz ip=dhcp url=http://10.0.0.1/ubuntu-22.04.1-live-server-arm64.iso only-ubiquity<br />initrd ubuntu2204/initrd<br />}</pre>



<h2 class="wp-block-heading">Debug&nbsp;<br /></h2>



<p>Wireshark is your good friend, use it.&nbsp;<br /></p>



<h2 class="wp-block-heading">Ubuntu PXE Environment</h2>



<p>It can download Ubuntu Netboot images from this url. <br /> <a href="http://cdimage.ubuntu.com/netboot/" target="_blank" rel="noopener">http://cdimage.ubuntu.com/netboot/</a> <br /><br />Choice what you want, for example, url below is Ubuntu 18.04 for ARM64 image<br /> <a href="http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/installer-arm64/current/images/netboot/" target="_blank" rel="noopener">http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/installer-arm64/current/images/netboot/</a> <br />Ubuntu 20.04 Netboot file <br />http://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/main/installer-arm64/current/legacy-images/netboot/netboot.tar.gz</p>



<p><br />Download netboot image to tftp directory, I prefer to put different version to different directory. </p>



<pre class="wp-block-code"><code>$ cd /tftpboot
$ wget http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/installer-arm64/current/images/netboot/netboot.tar.gz
$ mkdir ubuntu1804
$ cd ubuntu1804
$ tar xvf ../netboot.tar.gz</code></pre>



<p>Modify grub.cfg and add Ubuntu option to grub.cfg, save it, now, this server can also provide ubuntu net install</p>



<pre class="wp-block-code"><code>set timeout=60
menuentry 'CentOS8 Install' {
  linux images/pxeboot/vmlinuz ip=dhcp inst.repo=http://10.0.0.1/centos8/
  initrd images/pxeboot/initrd.img
}
menuentry 'Ubuntu18.04 Install' {
  linux ubuntu1804/ubuntu-installer/arm64/linux ip=dhcp
  initrd ubuntu1804/ubuntu-installer/arm64/initrd.gz
}
</code></pre>



<h2 class="wp-block-heading">Ubuntu ISO environment </h2>



<p>It can download iso file and use the iso file as install media. <br /><br />in Linux, download Ubuntu 20.04 ARM64 iso file</p>



<pre class="wp-block-preformatted">$ wget https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso
$ mount -o loop ubuntu-20.04.3-live-server-arm64.iso disk
$ mkdir ubuntu2004
$ cp disk/casper ubuntu2004/ -a 
$ umount disk</pre>



<p>Modify grub.cfg as below (not test)</p>



<pre class="wp-block-preformatted">set timeout=60
menuentry 'CentOS8 Install' {
  linux images/pxeboot/vmlinuz ip=dhcp inst.repo=http://10.0.0.1/centos8/
  initrd images/pxeboot/initrd.img
}
menuentry 'Ubuntu20.04 Install' {
  linux ubuntu2004/casper/vmlinuz ip=dhcp
  initrd ubuntu2004/casper/initrd
}
</pre>



<p>It also can use HWE kernel </p>



<pre class="wp-block-preformatted">menuentry 'Ubuntu20.04 Install' {
  linux ubuntu2004/casper/hwe-vmlinux ip=dhcp
  initrd ubuntu2004/casper/hwe-initrd
}

</pre>



<h2 class="wp-block-heading">Note for GRUB Install Command</h2>



<h2 class="wp-block-heading">CentOS</h2>



<pre class="wp-block-preformatted">svr=10.0.0.1; root=boot/centos8/images/pxeboot
linux (http,$svr)/$root/vmlinuz inst.stage2=http://$svr/boot/centos8 text
initrd (http,$svr)/$root/initrd.img
</pre>



<h2 class="wp-block-heading">Ubuntu</h2>



<pre class="wp-block-preformatted">svr=192.168.110.254; root=boot/ubuntu2004/casper
iso=ubuntu-20.04.3-live-server-arm64.iso
linux (http,$svr)/$root/vmlinuz url=http://192.168.110.254/boot/$iso only-ubiquity ip=dhcp ---
initrd (http,$svr)/$root/initrd

linux (http,$svr)/$root/hwe-vmlinuz url=http://192.168.110.254/boot/$iso only-ubiquity ip=dhcp ---
initrd (http,$svr)/$root/hwe-initrd

</pre>



<h2 class="wp-block-heading">Fedora 36</h2>



<p>Fedora&#8217;s setting is more closed to CentOS, due to CentOS might be dropped recently, so, moved to Fedora environment is necessary. </p>



<h3 class="wp-block-heading">Get initrd/vmlinux image</h3>



<p>Other parts like CentOS, <br />Download the PXE initrd and vmlinuz image, free.nchc.org.tw is Taiwan local Fedora server, you can replace it with local server. </p>



<pre class="wp-block-preformatted">mkdir -p /tftpboot/f36

cd /tftpboot/f36
wget http://free.nchc.org.tw/fedora/linux/releases/36/Server/aarch64/os/images/pxeboot/initrd.img
wget http://free.nchc.org.tw/fedora/linux/releases/36/Server/aarch64/os/images/pxeboot/vmlinuz

cd /var/www/html
wget http://free.nchc.org.tw/fedora/linux/releases/36/Server/aarch64/iso/Fedora-Server-dvd-aarch64-36-1.5.iso
mkdir disk 
mount -o loop Fedora-Server-dvd-aarch64-36-1.5.iso disk
cp -a disk f36
umount disk</pre>



<h3 class="wp-block-heading">Grub Fedora Setting</h3>



<p>Add following grub entry text into /tftpboot/grub.cfg, thus, it can insert a &#8220;Fedora36&#8221; menu on pxe boot.</p>



<pre class="wp-block-preformatted">menuentry 'Fedora36' {
  linux f36/vmlinuz ip=dhcp inst.repo=http://10.0.0.1/f36/
  initrd f36/initrd.img
}
</pre>



<p>Ref.&nbsp;</p>



<p><a href="https://docs.centos.org/en-US/centos/install-guide/pxe-server/#sect-network-boot-setup-uefi" target="_blank" rel="noopener">https://docs.centos.org/en-US/centos/install-guide/pxe-server/#sect-network-boot-setup-uefi</a><br /><a href="https://docs.centos.org/en-US/8-docs/advanced-install/assembly_preparing-for-a-network-install/" target="_blank" rel="noopener">https://docs.centos.org/en-US/8-docs/advanced-install/assembly_preparing-for-a-network-install/</a><br /><a href="https://forums.opensuse.org/showthread.php/501075-error-cannot-find-commands-linuxefi-or-initrdefi" target="_blank" rel="noopener">https://forums.opensuse.org/showthread.php/501075-error-cannot-find-commands-linuxefi-or-initrdefi</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/">ARM64 Centos8/Ubuntu PXE Boot Install on Ubuntu Server</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Install Kubernetes on ARM64 Ubuntu 18.04 (with QEMU)</title>
		<link>https://richliu.com/2019/09/25/4160/install-kubernetes-on-arm64-ubuntu-18-04/</link>
					<comments>https://richliu.com/2019/09/25/4160/install-kubernetes-on-arm64-ubuntu-18-04/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 25 Sep 2019 03:39:36 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[18.04]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[flannel. qemu]]></category>
		<category><![CDATA[k8s]]></category>
		<category><![CDATA[kubernetes]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[weave]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=4160</guid>

					<description><![CDATA[<p>Install Kubernetes on Ubuntu 18.04 is very easy now, bu [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2019/09/25/4160/install-kubernetes-on-arm64-ubuntu-18-04/">Install Kubernetes on ARM64 Ubuntu 18.04 (with QEMU)</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Install Kubernetes on Ubuntu 18.04 is very easy now, but only for x86 platform. If on ARM64 environment, it might have some other problem. <br />Some old article mentioned a lot of information but software version is too old for deploy a new version software. <br /><br />After a lot of time to have research, here is instruction for how to install Kubernetes on ARM64 Ubuntu 18.04</p>



<span id="more-4160"></span>



<h2 class="wp-block-heading">Environment</h2>



<p>Hardware : Ampere eMag Server with 128G RAM and 1T storage<br />Kubernetes master and nodes are running in QEMU image, so, we prepared three QEMU  ARM64 ubuntu 18.04 images for kubernetes running. It also can use two VM to run this demo. </p>



<h2 class="wp-block-heading">Prepare QEMU Image</h2>



<p>It can download Ubuntu bionic cloud image from Taiwan mirror site</p>



<pre class="wp-block-preformatted">wget http://ftp.yzu.edu.tw/Linux/ubuntu-cloud-images/bionic/current/bionic-server-cloudimg-arm64.img </pre>



<p>or international mirror site </p>



<pre class="wp-block-preformatted">https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-arm64.img</pre>



<h4 class="wp-block-heading">Install Necessary Package  </h4>



<p>Run following command to install necessary packages . </p>



<pre class="wp-block-preformatted">apt install -y qemu-system-arm bridge-utils cloud-image-utils git qemu-efi</pre>



<h4 class="wp-block-heading">Increase QEMU image size</h4>



<pre class="wp-block-preformatted">qemu-img resize bionic-server-cloudimg-arm64.img +200G</pre>



<p>Create UEFI bios and nvram for qemu image boot. </p>



<pre class="wp-block-preformatted">dd if=/dev/zero of=flash0.img bs=1M count=64
dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1M count=64</pre>



<p>Copy Image to three spare images </p>



<pre class="wp-block-preformatted">cp flash0.img flash0-1.img
cp flash0.img flash0-2.img 
cp flash0.img flash0-3.img 
cp flash1.img flash1-1.img
cp flash1.img flash1-2.img
cp flash1.img flash1-3.img
cp  bionic-server-cloudimg-arm64.img   bionic-server-cloudimg-arm64-1.img 
cp  bionic-server-cloudimg-arm64.img   bionic-server-cloudimg-arm64-2.img 
cp  bionic-server-cloudimg-arm64.img   bionic-server-cloudimg-arm64-3.img </pre>



<h2 class="wp-block-heading"> Set up bridge and network devices </h2>



<p>

We already install bridge-utils before, now, it should configure bridge devices.

</p>



<pre class="wp-block-preformatted"> mkdir -p /etc/qemu ; echo "allow br0" > /etc/qemu/bridge.conf </pre>



<p> Because there is only one network interface on machine, we should use this interface as bridge device, save text below (name nic-br.sh or what you like) and modify it to fit your environment. <br /></p>



<pre class="wp-block-preformatted">ORIGNIC=enP6p1s0
ip addr flush $ORIGINIC
brctl addbr br0
brctl addif br0 $ORIGINIC
ifconfig br0 up
ifconfig br0 192.168.110.1 netmask 255.255.0.0
route add default gw 192.168.1.1
echo nameserver 8.8.8.8 &gt;&gt; /etc/resolv.conf </pre>



<h2 class="wp-block-heading">Configure Hugepage On Host Site (Option)</h2>



<p>Due to previous research on dpdk runs on ARM64 server, so, configure hugepages here. But not necessary for run k8s environment. <br />You can ignore this part </p>



<h4 class="wp-block-heading"> Configure Line Kernel boot command </h4>



<p> It needs to reserve hugepages memory space for Linux kernel, it reserves 32 pages and each pages 1GB, total 32GB. Please modify /etc/default/grub , and add hugepagesz=1GB hugepages=32 to GRUB_CMDLINE_LINUX, ex: </p>



<pre class="wp-block-preformatted">GRUB_CMDLINE_LINUX="console=tty0 hugepagesz=1GB hugepages=32"</pre>



<p> then run foloowing command to update grub.cfg </p>



<pre class="wp-block-preformatted"> update-grub </pre>



<h4 class="wp-block-heading"> Mount hugetlbfs by default </h4>



<p>

If wants to use hugepage, it needs to mount hugetlbfs somewhere, we can create a directory, ex: /mnt/hugepages and mount hugetblsfs there by default.

</p>



<pre class="wp-block-preformatted">mkdir -p /mnt/hugepages 
echo "nodev   /mnt/hugepages                  hugetlbfs       defaults,pagesize=1G    0 0 none" &gt;&gt; /etc/fstab </pre>



<p>Now, please reboot to make huagpage works. </p>



<h2 class="wp-block-heading">Running QEMU</h2>



<p>Following is QEMU script, save it (ex: named run-qemu.sh). It can be more simplification, but this script would be more understand what different. </p>



<pre class="wp-block-preformatted">IMAGE1=bionic-server-cloudimg-arm64-1.img
sudo qemu-system-aarch64 -name vm1 \
         -machine virt,gic_version=3,accel=kvm,usb=off \
         -cpu host -m 8192 \
         -uuid d0000000-1111-1111-1111-11111aaaaaaa \
         -smp 12,sockets=1,cores=12,threads=1 \
         -nographic -nodefaults \
         -pflash flash0-1.img -pflash flash1-1.img \
         -drive file=$IMAGE1,if=none,id=disk1 \
         -device virtio-blk-device,scsi=off,drive=disk1,id=virtio-disk1,bootindex=1 \
         -netdev tap,id=net0,ifname=tap0 \
         -device virtio-net-device,netdev=net0,mac=52:54:00:11:11:11 \
         -mem-path /mnt/hugepages \
         -serial telnet::9001,server,nowait &gt; guest_log-1.txt 2&gt;&gt; guest_log-1.txt &amp;
IMAGE2=bionic-server-cloudimg-arm64-2.img
sudo qemu-system-aarch64 -name vm2 \
         -machine virt,gic_version=3,accel=kvm,usb=off \
         -cpu host -m 8192 \
         -uuid d0000000-2222-2222-2222-22222bbbbbbb \
         -smp 12,sockets=1,cores=12,threads=1 \
         -nographic -nodefaults \
         -pflash flash0-2.img -pflash flash1-2.img \
         -drive file=$IMAGE2,if=none,id=disk2 \
         -device virtio-blk-device,scsi=off,drive=disk2,id=virtio-disk1,bootindex=1 \
         -netdev tap,id=net2,ifname=tap1 \
         -device virtio-net-device,netdev=net2,mac=52:54:00:22:22:22 \
         -mem-path /mnt/hugepages \
         -serial telnet::9002,server,nowait &gt; guest_log-2.txt 2&gt;&gt; guest_log-2.txt &amp;
IMAGE3=bionic-server-cloudimg-arm64-3.img
sudo qemu-system-aarch64 -name vm3 \
         -machine virt,gic_version=3,accel=kvm,usb=off \
         -cpu host -m 8192 \
         -uuid d0000000-3333-3333-3333-33333ccccccc \
         -smp 12,sockets=1,cores=12,threads=1 \
         -nographic -nodefaults \
         -pflash flash0-3.img -pflash flash1-3.img \
         -drive file=$IMAGE3,if=none,id=disk3 \
         -device virtio-blk-device,scsi=off,drive=disk3,id=virtio-disk1,bootindex=1 \
         -netdev tap,id=net3,ifname=tap2 \
         -device virtio-net-device,netdev=net3,mac=52:54:00:33:33:33 \
         -mem-path /mnt/hugepages \
         -serial telnet::9003,server,nowait &gt; guest_log-3.txt 2&gt;&gt; guest_log-3.txt &amp;
sleep 5
brctl addif br0 tap0
brctl addif br0 tap1
brctl addif br0 tap2</pre>



<p>There are some parameters need to understand in QEMU script. <br /><br />-uuid d0000000-1111-1111-1111-11111aaaaaaa \<br /><br />this will assign a unique uuid for each VM, k8s needs different VM run with different uuid and MAC address. <br />It also can use command &#8220;uuidgen&#8221; to generate different uuid for each VM, but here just for debug so assign a &#8220;easy to read&#8221; uuid. <br /><br />-device virtio-net-device,netdev=net3,mac=52:54:00:33:33:33 \<br /><br />Assign a special mac address for VM, because for k8s internal communication, use the same mac address will cause problem, please configure different address before run qemu script. It not easy to modify it after first boot (with cloud image)<br /><br />* Notice, first number for mac address cannot be odd , it would cause problem. <br /><br />-mem-path /mnt/hugepages \<br /><br />Tell VM to use hugepage, if were not configure host with hugepage, please remove this line. </p>



<p>Now,  please run scripts </p>



<pre class="wp-block-preformatted">bash nic-br.sh
bash run-qemu.sh </pre>



<p>Now, it can use telnet to connect each VM&#8217;s console </p>



<pre class="wp-block-preformatted">telnet localhost 9001<br /># or <br />telnet localhost 9002<br /># or <br />telnet localhost 9003</pre>



<p>After system booted/initialed, if you cannot login, please &#8220;killall qemu-system-aarch64&#8221; and follow this article <a href="https://richliu.com/2017/08/31/2165/change-ubuntu-cloud-image-password">Change Ubuntu Cloud Image Password</a> to change all images&#8217;s password.  <br /><br />Somehow, for recent cloud image, it cannot modify password before run qemu script.</p>



<h2 class="wp-block-heading">Install Kubernetes </h2>



<p>There are a lot of article to talk about how to install on Ubuntu, I choice one for reference : <a href="https://vitux.com/install-and-deploy-kubernetes-on-ubuntu/" target="_blank" rel="noopener">Install and Deploy Kubernetes on Ubuntu 18.04 LTS</a><br /><br />Below will shortly note install command here. </p>



<h4 class="wp-block-heading">Install Docker and Kubeadm on every node </h4>



<pre class="wp-block-preformatted">sudo apt update 
sudo apt -y upgrade 

# install and enable docker
sudo apt -y install docker.io 
sudo systemctl enable docker 
sudo systemctl start docker 

# Install k8s
sudo apt -y install apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add 
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
sudo apt update
sudo apt-get install kubeadm -y</pre>



<h4 class="wp-block-heading">Configure Network IP address (Optional)</h4>



<p> Update to you network environment, here we used fix ip address.<br /><br /> Add new record to /etc/hosts   </p>



<pre class="wp-block-preformatted">192.168.110.50     k8s-master
192.168.110.60     k8s-worker-node1
192.168.110.70     k8s-worker-node2</pre>



<p>Please modify /etc/netplan/50-cloud-init.yam, remove dhcp and add fix address. remember, each node has different IP.  Following is only for k8s-master. </p>



<pre class="wp-block-preformatted">network:
     ethernets:
         eth0:
<strong>             addresses: [192.168.110.50/16,]
             gateway4: 192.168.1.1
             nameservers:
                 addresses: [8.8.8.8,8.8.4.4]</strong>
             match:
                 macaddress: '52:54:00:11:11:11'
             set-name: eth0
     version: 2</pre>



<h4 class="wp-block-heading">Configure Host name </h4>



<p>Run following command on master node </p>



<pre class="wp-block-preformatted">sudo hostnamectl set-hostname  k8s-master</pre>



<p> Run following command on other nodes</p>



<pre class="wp-block-preformatted">sudo hostnamectl set-hostname   k8s-worker-node1 
sudo hostnamectl set-hostname   k8s-worker-node2</pre>



<h4 class="wp-block-heading">Disable swap (Option)</h4>



<p>if image is not from cloud image, default Linux enabled swap function, k8s doesn&#8217;t support it, please disable it manually on all nodes and remove swap mount in /etc/fstab. </p>



<pre class="wp-block-preformatted"> sudo swapoff -a </pre>



<h2 class="wp-block-heading">Configure Kubernetes</h2>



<p>Now, we can initial Kubernetes. Run following command</p>



<pre class="wp-block-preformatted"> sudo kubeadm init --pod-network-cidr=10.244.0.0/16 </pre>



<p>wait for few minutes, it will show some result like this </p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="749" src="https://richliu.com/wp-content/uploads/2019/09/image-1024x749.png" alt="" class="wp-image-4172" srcset="https://richliu.com/wp-content/uploads/2019/09/image-1024x749.png 1024w, https://richliu.com/wp-content/uploads/2019/09/image-300x220.png 300w, https://richliu.com/wp-content/uploads/2019/09/image-768x562.png 768w, https://richliu.com/wp-content/uploads/2019/09/image.png 1398w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Run following command to assign current account has right to access k8s. </p>



<pre class="wp-block-preformatted">mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config</pre>



<p>Run this command on another node(k8s-worker-node1 and k8s-worker-node2).</p>



<pre class="wp-block-preformatted">sudo kubeadm join 192.168.110.50:6443 --token 46c1oj.i00vyfyn027pgew9 \
     --discovery-token-ca-cert-hash sha256:ed05198cc603ae009a862477bacef329a9e9a2bedc4a040bc4731e6d5cf4f48e</pre>



<figure class="wp-block-image"><img decoding="async" width="1024" height="737" src="https://richliu.com/wp-content/uploads/2019/09/image-1-1024x737.png" alt="" class="wp-image-4174" srcset="https://richliu.com/wp-content/uploads/2019/09/image-1-1024x737.png 1024w, https://richliu.com/wp-content/uploads/2019/09/image-1-300x216.png 300w, https://richliu.com/wp-content/uploads/2019/09/image-1-768x552.png 768w, https://richliu.com/wp-content/uploads/2019/09/image-1.png 1204w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Run get nodes command, it will show current status, the master node status is NotReady, but don&#8217;t worry, it will become Ready after add pod and CNI (container networking interface) plugin. </p>



<pre class="wp-block-preformatted">ubuntu@k8s-master:~$ kubectl get nodes
 NAME         STATUS     ROLES    AGE     VERSION
 k8s-master   NotReady   master   3m42s   v1.16.0</pre>



<p>This action is very import on ARM64 k8s platform, in other document, they told you use flannel or some other document told you used old flannel. all of them not work for me. Please instead flannel with weave net. <br />(Ref <a rel="noreferrer noopener" aria-label="Weave Net for NetworkPolicy (opens in a new tab)" href="https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/weave-network-policy/" target="_blank">Weave Net for NetworkPolicy</a> and <a rel="noreferrer noopener" aria-label="CoreDNS is not starting on Ubuntu 18.04.Bionic Beaver #980 (opens in a new tab)" href="https://github.com/kubernetes/kubeadm/issues/980" target="_blank">CoreDNS is not starting on Ubuntu 18.04.Bionic Beaver #980</a>)<br />Run following command to install weave net </p>



<pre class="wp-block-preformatted">kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"</pre>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="232" src="https://richliu.com/wp-content/uploads/2019/09/image-2-1024x232.png" alt="" class="wp-image-4175" srcset="https://richliu.com/wp-content/uploads/2019/09/image-2-1024x232.png 1024w, https://richliu.com/wp-content/uploads/2019/09/image-2-300x68.png 300w, https://richliu.com/wp-content/uploads/2019/09/image-2-768x174.png 768w, https://richliu.com/wp-content/uploads/2019/09/image-2.png 1397w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p> Use the following command to view the status of the network:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="330" src="https://richliu.com/wp-content/uploads/2019/09/image-3-1024x330.png" alt="" class="wp-image-4176" srcset="https://richliu.com/wp-content/uploads/2019/09/image-3-1024x330.png 1024w, https://richliu.com/wp-content/uploads/2019/09/image-3-300x97.png 300w, https://richliu.com/wp-content/uploads/2019/09/image-3-768x248.png 768w, https://richliu.com/wp-content/uploads/2019/09/image-3-620x200.png 620w, https://richliu.com/wp-content/uploads/2019/09/image-3.png 1398w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p> Get nodes again. </p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="142" src="https://richliu.com/wp-content/uploads/2019/09/image-4-1024x142.png" alt="" class="wp-image-4177" srcset="https://richliu.com/wp-content/uploads/2019/09/image-4-1024x142.png 1024w, https://richliu.com/wp-content/uploads/2019/09/image-4-300x42.png 300w, https://richliu.com/wp-content/uploads/2019/09/image-4-768x107.png 768w, https://richliu.com/wp-content/uploads/2019/09/image-4.png 1395w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Great!! it works. </p>



<h2 class="wp-block-heading">MicroK8s</h2>



<p>If you think steps above are too complex and you would like to only run k8s on one machine, microk8s is a good friend for you, can run on ARM64 and very easy to use, just run command </p>



<p>sudo snap install microk8s</p>



<p>And just add a prefix &#8220;microk8s.&#8221; before k8s command, ex:</p>



<pre class="wp-block-preformatted">microk8s.kubectl get nodes</pre>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="854" height="133" src="https://richliu.com/wp-content/uploads/2019/09/image-5.png" alt="" class="wp-image-4178" srcset="https://richliu.com/wp-content/uploads/2019/09/image-5.png 854w, https://richliu.com/wp-content/uploads/2019/09/image-5-300x47.png 300w, https://richliu.com/wp-content/uploads/2019/09/image-5-768x120.png 768w" sizes="auto, (max-width: 854px) 100vw, 854px" /></figure>



<p>See, it&#8217;s very easy to use. right?</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2019/09/25/4160/install-kubernetes-on-arm64-ubuntu-18-04/">Install Kubernetes on ARM64 Ubuntu 18.04 (with QEMU)</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2019/09/25/4160/install-kubernetes-on-arm64-ubuntu-18-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 18.04 Change Mac Address on QEMU via Netplan</title>
		<link>https://richliu.com/2019/09/09/4146/ubuntu18-04changemacaddressonqemuvianetplan/</link>
					<comments>https://richliu.com/2019/09/09/4146/ubuntu18-04changemacaddressonqemuvianetplan/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 09 Sep 2019 15:40:32 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[mac address]]></category>
		<category><![CDATA[netplan]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=4146</guid>

					<description><![CDATA[<p>This is a quick note about how to modify mac address fo [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2019/09/09/4146/ubuntu18-04changemacaddressonqemuvianetplan/">Ubuntu 18.04 Change Mac Address on QEMU via Netplan</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This is a quick note about how to modify mac address for qemu image with ubuntu 18.04 cloud image. <br /><br />but I have not found a working way only change mac address in system </p>



<span id="more-4146"></span>



<h4 class="wp-block-heading">Add mac parameter to qemu command</h4>



<p>in qemu command line, add mac= parameter to netdev option , ex:</p>



<pre class="wp-block-preformatted">-device virtio-net-device,netdev=net2,<strong>mac=52:54:00:56:12:34</strong> \</pre>



<h4 class="wp-block-heading">Modify netplan</h4>



<p>edit file /etc/netplan/50-cloud-init.yaml, and add section match, ex</p>



<pre class="wp-block-preformatted">network:
     version: 2
     ethernets:
         eth0:
             dhcp4: true
<strong>             match:
                 macaddress: 52:54:00:56:12:34</strong>
             set-name: eth0</pre>



<p>now, you can shutdown qemu system and restart . <br /><br />* Notice: if used ubuntu cloud image, please assign mac address before init it. <br />suppose that cloud image might save mac address some where . </p>
<p>The post <a rel="nofollow" href="https://richliu.com/2019/09/09/4146/ubuntu18-04changemacaddressonqemuvianetplan/">Ubuntu 18.04 Change Mac Address on QEMU via Netplan</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2019/09/09/4146/ubuntu18-04changemacaddressonqemuvianetplan/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 18.04 ARM64 DPDK in VM (QEMU)</title>
		<link>https://richliu.com/2019/08/19/4057/ubuntu-18-04-arm64-dpdk-in-vm-qemu/</link>
					<comments>https://richliu.com/2019/08/19/4057/ubuntu-18-04-arm64-dpdk-in-vm-qemu/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 19 Aug 2019 08:17:56 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[18.04]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[dpdk]]></category>
		<category><![CDATA[hugepages]]></category>
		<category><![CDATA[l3fwd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=4057</guid>

					<description><![CDATA[<p>DPDK is a very popular infrastructure in high speed pac [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2019/08/19/4057/ubuntu-18-04-arm64-dpdk-in-vm-qemu/">Ubuntu 18.04 ARM64 DPDK in VM (QEMU)</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>DPDK is a very popular infrastructure in high speed packet process domain, some applications will used the same architecture to process packet, like EPC. <br /><br />For Ubuntu 18.04, it used dpdk 17.11, it not good for some other application like dpdk pktgen, but enough for testpmd and l3fwd test. here is some personal note for setup whole environment. </p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://richliu.com/wp-content/uploads/2019/08/image-3.png" alt="" class="wp-image-4076" width="363" height="257" srcset="https://richliu.com/wp-content/uploads/2019/08/image-3.png 634w, https://richliu.com/wp-content/uploads/2019/08/image-3-300x213.png 300w" sizes="auto, (max-width: 363px) 100vw, 363px" /><figcaption>DPDK in QEMU archeticture</figcaption></figure>



<span id="more-4057"></span>



<p>Hardware : Ampere eMag Server with 128GB Memory <br />                      Network Card: Intel i210 Gigabit NIC Card * 2 <br /><br />HOST means commands and instructions on host machines <br />VM means commands and instructions inside VM</p>



<h2 class="wp-block-heading">Prepare Environment</h2>



<h4 class="wp-block-heading">Apt source</h4>



<p>First, please add deb-src to your database, edit file /etc/apt/source.list and removed all &#8220;#&#8221; before deb-src, then, run follow commands to update apt database (suppose all commands run with sudo or root in this article)</p>



<pre class="wp-block-preformatted">sed -i 's/# deb-src/deb-src/g' sources.list
apt update</pre>



<h4 class="wp-block-heading">Install Packages</h4>



<p>It needs to install relative packages in host </p>



<pre class="wp-block-preformatted">sudo apt install -y dpdk dpdk-dev dpdk-doc </pre>



<p>Only needs to install on HOST.</p>



<pre class="wp-block-preformatted">sudo apt install -y qemu-efi bridge-utils</pre>



<p>It will install all necessary dpdk packages in host.</p>



<h4 class="wp-block-heading">Preload Module</h4>



<p>It needs to preload vfio-pci modules by default, run following command</p>



<pre class="wp-block-preformatted">echo "vfio-pci" &gt;&gt; /etc/modules</pre>



<h4 class="wp-block-heading">Configure Line Kernel boot command</h4>



<p>It needs to reserve hugepages memory space for Linux kernel, it reserves 32 pages and each pages 1GB, total 32GB. Please modify  /etc/default/grub , and  add hugepagesz=1GB hugepages=32 to GRUB_CMDLINE_LINUX, ex:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>GRUB_CMDLINE_LINUX=&#8221;console=tty0 hugepagesz=1GB hugepages=32&#8243;</p></blockquote>



<p>then run foloowing command to update grub.cfg</p>



<pre class="wp-block-preformatted">update-grub</pre>



<p>Mount hugetlbfs by default</p>



<p>If wants to use hugepage, it needs to mount hugetlbfs somewhere, we can create a directory, ex: /mnt/hugepages and mount hugetblsfs there by default. </p>



<pre class="wp-block-preformatted">mkdir -p /mnt/hugepages
echo "nodev   /mnt/hugepages                  hugetlbfs       defaults,pagesize=1G    0 0 none" &gt;&gt; /etc/fstab</pre>



<h2 class="wp-block-heading">Bind Network Card for DPDK</h2>



<p>It wants to let DPDK use current network card, it needs to bind the network card with dpdk. dpdk-devbind command is a useful command. <br />List current command </p>



<pre class="wp-block-preformatted"> $ dpdk-devbind --status
 Network devices using kernel driver
 0001:01:00.0 'I210 Gigabit Network Connection 1533' if=enP1p1s0 drv=igb unused=vfio-pci
 0002:01:00.0 'I210 Gigabit Network Connection 1533' if=enP2p1s0 drv=igb unused=vfio-pci
 0006:01:00.0 'I210 Gigabit Network Connection 1533' if=enP6p1s0 drv=igb unused=vfio-pci <em>Active</em> </pre>



<p>There are three network card in the machine, we would like to bind 1:1:0.0 and 2:1:0.0 to vfio-pci driver. please used following command to bind those network cards. </p>



<pre class="wp-block-preformatted">dpdk-devbind -b vfio-pci 0001:01:00.0 0002:01:00.0</pre>



<p>and check status again</p>



<pre class="wp-block-preformatted"> $ dpdk-devbind --status

Network devices using DPDK-compatible driver
============================================
0001:01:00.0 'I210 Gigabit Network Connection 1533' drv=vfio-pci unused=igb
0002:01:00.0 'I210 Gigabit Network Connection 1533' drv=vfio-pci unused=igb

Network devices using kernel driver
============================================
0006:01:00.0 'I210 Gigabit Network Connection 1533' if=enP6p1s0 drv=igb unused=vfio-pci <em>Active</em> </pre>



<p>Both network cards would be under  Network devices using DPDK-compatible driver  . </p>



<h2 class="wp-block-heading">Prepare QEMU environment </h2>



<h4 class="wp-block-heading">Set up bridge devices  </h4>



<p>We already install bridge-utils before, now, it should configure bridge devices. </p>



<pre class="wp-block-preformatted">mkdir -p /etc/qemu
echo "allow br0" &gt; /etc/qemu/bridge.conf</pre>



<p>Because there is only one network interface on machine, we should use this interface as bridge device, save text below and modify it to fit your environment. </p>



<pre class="wp-block-preformatted"> ORIGNIC=enP6p1s0

 ip addr flush enP6p1s0


 brctl addbr br0
 brctl addif br0 enP6p1s0
 ifconfig br0 up
 ifconfig br0 192.168.110.1 netmask 255.255.0.0
 route add default gw 192.168.1.1


 echo nameserver 8.8.8.8 >> /etc/resolv.conf </pre>



<p>Run script, command brctl show will show how whether it configure property or not. </p>



<h2 class="wp-block-heading">Prepare QEMU image</h2>



<p>Ubuntu 18.04 cloud image is here</p>



<pre class="wp-block-preformatted">wget http://ftp.yzu.edu.tw/Linux/ubuntu-cloud-images/bionic/current/bionic-server-cloudimg-arm64.img</pre>



<p>and please refer this article to change cloud image&#8217;s password <br />Change Ubuntu Cloud Image Password, before use it, don&#8217;t forget to increase cloud image size. 20G is enough for test.</p>



<pre class="wp-block-preformatted">qemu-img resize bionic-server-cloudimg-arm64.img +20G</pre>



<p>Next step is to create bios and nvram for qemu image boot. </p>



<pre class="wp-block-preformatted">dd if=/dev/zero of=flash0.img bs=1M count=64
dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1M count=64</pre>



<h2 class="wp-block-heading">Run Qemu</h2>



<p>Here is qemu command, save text below and run it </p>



<pre class="wp-block-preformatted"> IMAGE=bionic-server-cloudimg-arm64.img
 sudo qemu-system-aarch64 -name vm1 \
         -machine virt,gic_version=3,accel=kvm,usb=off \
         -cpu host -m 8192 \
         -smp 12,sockets=1,cores=12,threads=1 \
         -nographic -nodefaults \
         -pflash flash0.img -pflash flash1.img \
         -device vfio-pci,host=0001:01:00.0 \
         -device vfio-pci,host=0002:01:00.0 \
         -drive file=$IMAGE,if=none,id=disk1 \
         -device virtio-blk-device,scsi=off,drive=disk1,id=virtio-disk1,bootindex=1 \
         -netdev tap,id=net0,ifname=tap0 \
         -device virtio-net-device,netdev=net0 \
         -mem-path /mnt/hugepages \
         -serial telnet::9001,server,nowait > guest1_log.txt 2>> guest1_log.txt &amp;
 sleep 5
 brctl addif br0 tap0 </pre>



<p>-m 8192 : use 8G RAM for VM<br />&#8211;mem-path will use /mnt/hugepages for VM memory<br /><br />it will create a network device tap0 for bridge device interface between VM and host.  and create a telnet server on port 9001, it can use &#8220;telnet 9001&#8221; to get console, I would like to suggest to use ssh if it can access console. </p>



<h2 class="wp-block-heading">Remove cloudinit service</h2>



<p>it needs to remove cloud-initramfs-copymods, it will copy modules from ramdisk to harddriver, and cloud-init, it&#8217;s for some cloud service like aws(?)<br /><br />removed them would help system runs better. </p>



<pre class="wp-block-preformatted">apt remove cloud-initramfs-copymods cloud-init </pre>



<h2 class="wp-block-heading">Disable Services</h2>



<p>After boot, it needs to disable some default service to improve speed, here is some services can be disabled. (needs run those command with root)</p>



<pre class="wp-block-preformatted">systemctl disable ufw
systemctl disable lxcfs
systemctl disable atd
systemctl disable cron
systemctl disable irqbalance
systemctl disable apparmor
systemctl disable apport
systemctl disable ebtables
systemctl disable grub-common
systemctl disable unattended-upgrades
systemctl disable iscsid</pre>



<p>Most import service is irqbalance, without disable it, performance will be drop down. <br /><br />Now, it can reboot VM now. </p>



<h2 class="wp-block-heading">Prepare QEMU environment </h2>



<p>Prepare QEMU environment and prepare host almost the same, only differences are</p>



<ol class="wp-block-list"><li>in QEMU, apt install doesn&#8217;t needs to install qemu-efi and bridge-utils</li><li>in QEMU, before call dpdk-devbind command, it needs to configure enable_unsafe_noiommu_mode for ARM64 platform </li><li>Hugepage size is different , in HOST it uses 32G, in VM we uses 4G</li></ol>



<p>Enable unsafe noiommu </p>



<pre class="wp-block-preformatted">echo 1 &gt; /sys/module/vfio/parameters/enable_unsafe_*</pre>



<p> To permanently enable the no-IOMMU mode, add it to modprobe.d: (<a href="https://dpdk-guide.gitlab.io/dpdk-guide/setup/binding.html" target="_blank" rel="noopener">ref</a>) </p>



<pre class="wp-block-preformatted">echo "options vfio enable_unsafe_noiommu_mode=1" &gt; /etc/modprobe.d/vfio-noiommu.conf</pre>



<p>It also needs to reserve hugepages memory space for Linux kernel for VM, it reserves 4 pages and each pages 1GB, total 4GB. Please modify  /etc/default/grub , and  add hugepagesz=1GB hugepages=4 to GRUB_CMDLINE_LINUX, ex:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>GRUB_CMDLINE_LINUX=&#8221;console=tty0 hugepagesz=1GB hugepages=4&#8243;</p></blockquote>



<p>then run foloowing command to update grub.cfg</p>



<pre class="wp-block-preformatted">update-grub</pre>



<h2 class="wp-block-heading">Run DPDK  l3fwd</h2>



<p>Before run l3fwd, we need to recompile it. </p>



<pre class="wp-block-preformatted">. /usr/share/dpdk/dpdk-sdk-env.sh
make -C /usr/share/dpdk/examples/l3fwd</pre>



<p>Bind network interface</p>



<pre class="wp-block-preformatted">dpdk-devbind -b vfio-pci  enp0s1
dpdk-devbind -b vfio-pci  enp0s2</pre>



<p>Run l3fwd example</p>



<pre class="wp-block-preformatted">cd /usr/share/dpdk/examples/l3fwd/build
./l3fwd -c 1 -- -p 0x3 --config="(0,0,0),(1,0,0)"</pre>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="639" src="https://richliu.com/wp-content/uploads/2019/08/image-1024x639.png" alt="" class="wp-image-4072" srcset="https://richliu.com/wp-content/uploads/2019/08/image-1024x639.png 1024w, https://richliu.com/wp-content/uploads/2019/08/image-300x187.png 300w, https://richliu.com/wp-content/uploads/2019/08/image-768x479.png 768w, https://richliu.com/wp-content/uploads/2019/08/image.png 1440w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Multi Queue example</p>



<pre class="wp-block-preformatted">./l3fwd -l 1,2,3,4 -n 4 -- -p 0x3 --config="(0,0,1),(1,0,2),(0,1,3),(1,1,4)"</pre>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="715" src="https://richliu.com/wp-content/uploads/2019/08/image-1-1024x715.png" alt="" class="wp-image-4073" srcset="https://richliu.com/wp-content/uploads/2019/08/image-1-1024x715.png 1024w, https://richliu.com/wp-content/uploads/2019/08/image-1-300x209.png 300w, https://richliu.com/wp-content/uploads/2019/08/image-1-768x536.png 768w, https://richliu.com/wp-content/uploads/2019/08/image-1.png 1438w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Other</h2>



<p>There is good tool to get hugepage information </p>



<pre class="wp-block-preformatted">apt install hugepages
hugeadm --pool-list</pre>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="865" height="130" src="https://richliu.com/wp-content/uploads/2019/08/image-2.png" alt="" class="wp-image-4074" srcset="https://richliu.com/wp-content/uploads/2019/08/image-2.png 865w, https://richliu.com/wp-content/uploads/2019/08/image-2-300x45.png 300w, https://richliu.com/wp-content/uploads/2019/08/image-2-768x115.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /></figure>
<p>The post <a rel="nofollow" href="https://richliu.com/2019/08/19/4057/ubuntu-18-04-arm64-dpdk-in-vm-qemu/">Ubuntu 18.04 ARM64 DPDK in VM (QEMU)</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2019/08/19/4057/ubuntu-18-04-arm64-dpdk-in-vm-qemu/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ARM64 Kdump cannot allocate crashkernel</title>
		<link>https://richliu.com/2019/07/11/4004/arm64-kdump-cannot-allocate-crashkernel/</link>
					<comments>https://richliu.com/2019/07/11/4004/arm64-kdump-cannot-allocate-crashkernel/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 11 Jul 2019 03:19:15 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[Kdump]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=4004</guid>

					<description><![CDATA[<p>In ARM64 server and installed memory around 128G, ubunt [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2019/07/11/4004/arm64-kdump-cannot-allocate-crashkernel/">ARM64 Kdump cannot allocate crashkernel</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In ARM64 server and installed memory around 128G, ubuntu default /etc/default/grub.d/kdump-tools.cfg default configuration might cause kdump allocate memory failed. error message as below </p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>  [ 0.000000] cannot allocate crashkernel (size:0x80000000)<br />[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.18.0-25-generic root=UUID=ee8be10d-d649-425d-a807-640751836186 ro console=tty0 crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M</p></blockquote>



<span id="more-4004"></span>



<p>reserve memory is for RAM disk. root cause might be system cannot allocate enough memory for crash kernel. </p>



<p>Reduce allocate memory size will work </p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>dmesg | grep crash<br /> [    0.000000] crashkernel reserved: 0x00000000bfe00000 &#8211; 0x00000000ffe00000 (1024 MB)<br /> [    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.18.0-25-generic root=UUID=ee8be10d-d649-425d-a807-640751836186 ro console=tty0 crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:1024M,high,128G-:16384M</p></blockquote>
<p>The post <a rel="nofollow" href="https://richliu.com/2019/07/11/4004/arm64-kdump-cannot-allocate-crashkernel/">ARM64 Kdump cannot allocate crashkernel</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2019/07/11/4004/arm64-kdump-cannot-allocate-crashkernel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Change Ubuntu Cloud Image Size</title>
		<link>https://richliu.com/2018/08/25/2318/change-ubuntu-cloud-image-size/</link>
					<comments>https://richliu.com/2018/08/25/2318/change-ubuntu-cloud-image-size/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 25 Aug 2018 14:39:21 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[16.04]]></category>
		<category><![CDATA[cloud image]]></category>
		<category><![CDATA[kpartx]]></category>
		<category><![CDATA[parted]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=2318</guid>

					<description><![CDATA[<p>Ubuntu Cloud Image Size 似乎各個版本的特性不太一樣, 而且似乎也要用不同的方式修改 I [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2018/08/25/2318/change-ubuntu-cloud-image-size/">Change Ubuntu Cloud Image Size</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Ubuntu Cloud Image Size 似乎各個版本的特性不太一樣, 而且似乎也要用不同的方式修改 Image size</p>
<p><span id="more-2318"></span></p>
<p>一般 change image size 是用這個指令</p>
<p>$ sudo qemu-img resize $UBUNTUVERSION-server-cloudimg-$ARCH.img +50G0<br />
ex:</p>
<pre lang="bash">
$ sudo qemu-img resize xenial-server-cloudimg-amd64-uefi1.img +50G
</pre>
<p>將 qcow2 image format 變成 raw disk </p>
<pre lang="bash">
$ sudo qemu-img convert  xenial-server-cloudimg-amd64-uefi1.img xenial-server-cloudimg-amd64-uefi1.raw
</pre>
<p>之前測 ARM64 17.04 和 17.10 都會自動增加 partition size<br />
但是最近碰到 18.04 似乎不會. (Both X64 and ARM64)</p>
<p>如果碰到的是 16.04 要增加 partition size 有問題, 要用 parted 修改 (似乎 fdisk 和 gdisk 都有問題)<br />
ex:</p>
<pre lang="bash">
$ parted xenial-server-cloudimg-amd64-uefi1.raw
(parted) p
Model:  (file)
Disk /work/research/vm/1.raw: 56.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
14      1049kB  5243kB  4194kB                     bios_grub
15      5243kB  116MB   111MB   fat32              boot, esp
 1      116MB   2361MB  2245MB  ext4

(parted) resizepart
Warning: Not all of the space available to /work/research/vm/1.raw appears to be used, you can fix the GPT to use
all of the space (an extra 104857600 blocks) or continue with the current setting?
parted: invalid token: 1

Partition number? 1
End?  [2361MB]? 56G
</pre>
<p>離開就會儲存</p>
<p>Ubuntu 16.04 的 cloud image 不知道為什麼 cloud-init 會無法結束, 如果不能接觸到 login 那 cloud image 也沒有用. </p>
<p>這時可以用另一個方式移除 cloud-init 相關的套件,<br />
1. 使用 kpartx 將 image 掛到 loop devices 如果沒有, 就先安裝 kpartx 套件</p>
<pre lang="bash">
$ sudo apt install kpartx 
</pre>
<p>2. mount partition (還有 proc, dev, sys)<br />
3. 移除 cloud 相關套件<br />
4. umount partition (要先 umount proc, dev, sys<br />
5. 移除 loop device<br />
6. convert raw file 到 qcow2 格式 </p>
<p>mount cloud image partition </p>
<pre lang="bash">
$ sudo kpartx -av xenial-server-cloudimg-amd64-uefi1.raw
add map loop0p1 (253:0): 0 109147673 linear 7:0 227328
add map loop0p14 (253:1): 0 8192 linear 7:0 2048
add map loop0p15 (253:2): 0 217088 linear 7:0 10240
</pre>
<p>loop0p1 就是我們要 mount 的 disk , (註: 有可能因系統不同, 所以會有其他的 device name)</p>
<p>mount disk</p>
<pre lang="bash">
$ sudo su
$ mkdir disk
$ mount /dev/mapper/loop0p1 disk 
$ cd disk
$ mount --bind /proc proc
$ mount --bind /dev dev
$ mount --bind /sys sys
$ cd ..
$ chroot disk 
</pre>
<p>移除 cloud-init 相關的套件</p>
<pre lang="bash">
$ dpkg  -l |grep cloud
ii  cloud-guest-utils                0.27-0ubuntu25.1                           all          cloud guest utilities
ii  cloud-init                       18.3-9-g2e62cb8a-0ubuntu1~16.04.2          all          Init scripts for cloud instances
ii  cloud-initramfs-copymods         0.27ubuntu1.5                              all          copy initramfs modules into root filesystem for later use
ii  cloud-initramfs-dyn-netconf      0.27ubuntu1.5                              all          write a network interface file in /run for BOOTIF
ii  ubuntu-cloudimage-keyring        2013.11.11                                 all          GnuPG keys of the Ubuntu Cloud Image builder

$ dpkg -r cloud-guest-utils  cloud-init cloud-initramfs-copymods  ubuntu-server
</pre>
<p>umount disk </p>
<pre lang="bash">
$ exit 
$ cd disk 
$ umount proc
$ umount dev
$ umount sys
$ cd ..
$ umount disk
</pre>
<p>最後將 raw disk image 轉成 qcow2 </p>
<pre lang="bash">
$ sudo qemu-img convert  xenial-server-cloudimg-amd64-uefi1.raw xenial-server-cloudimg-amd64-uefi1.img
</pre>
<p>這樣 16.04 開機就不會卡在 cloud init script 了. </p>
<p>The post <a rel="nofollow" href="https://richliu.com/2018/08/25/2318/change-ubuntu-cloud-image-size/">Change Ubuntu Cloud Image Size</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2018/08/25/2318/change-ubuntu-cloud-image-size/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Change Ubuntu Cloud Image Password</title>
		<link>https://richliu.com/2017/08/31/2165/change-ubuntu-cloud-image-password/</link>
					<comments>https://richliu.com/2017/08/31/2165/change-ubuntu-cloud-image-password/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 31 Aug 2017 07:49:25 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=2165</guid>

					<description><![CDATA[<p>Ubuntu cloud image is very good for deploy a simple qem [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2017/08/31/2165/change-ubuntu-cloud-image-password/">Change Ubuntu Cloud Image Password</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Ubuntu cloud image is very good for deploy a simple qemu image system.<br />But the image has it owns password and initial script. </p>



<span id="more-2165"></span>



<p>

If want to use it, it needs to add new username and password into it.<br />and remove some packages.Download cloud Image from ubuntu, ex: download Ubuntu Zesty Cloud Image

</p>



<pre class="wp-block-preformatted">wget https://cloud-images.ubuntu.com/zesty/current/zesty-server-cloudimg-arm64.img </pre>



<p>

If locate in Taiwan, there is Taiwan mirror site,http://ftp.yzu.edu.tw/Linux/ubuntu-cloud-images/, it would be fast then cloud-images.ubuntu.com

</p>



<pre class="wp-block-preformatted">wget http://ftp.yzu.edu.tw/Linux/ubuntu-cloud-images/zesty/current/zesty-server-cloudimg-arm64.img</pre>



<p> Zesty only has UEFI image, so, there is no -disk1 or -uefi postfix keyword. </p>



<p><strong>If used bionic (Ubuntu 18.04), if you found change password function doesn&#8217;t work. <br />Please shutdown this image (suppose run with QEMU) and run change password command again . <br /><br />Suppose that something modify password when booting on Ubuntu 18.04.</strong></p>



<p>Install backdoor-image package, this program can help to install new username and password into cloud image. </p>



<pre class="wp-block-preformatted"><del>apt install bzr qemu-utils  <br />bzr branch lp:~smoser/+junk/backdoor-image  </del></pre>



<pre class="wp-block-preformatted">sudo apt-get install -qy cloud-image-utils git
git clone https://gist.github.com/8c65b8771d5ab1d99c44c285323dfff6.git backdoor-image</pre>



<p>Add new password, but first account is not work for me most time, so, I would like to add new username and password. (note: please don&#8217;t use this as default password on business purpose. )</p>



<pre class="wp-block-preformatted">cd backdoor-image  
sudo ./backdoor-image --user ubuntu --password ubuntu --password-auth ../zesty-server-cloudimg-arm64.img 
sudo ./backdoor-image --user test --password 123456 --password-auth ../zesty-server-cloudimg-arm64.img </pre>



<p>After boot into virtual machine with this image,  it can remove unnecessary packages.</p>



<pre class="wp-block-preformatted">sudo apt remove cloud-initramfs-copymods cloud-init</pre>
<p>The post <a rel="nofollow" href="https://richliu.com/2017/08/31/2165/change-ubuntu-cloud-image-password/">Change Ubuntu Cloud Image Password</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2017/08/31/2165/change-ubuntu-cloud-image-password/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu Create Netboot Image</title>
		<link>https://richliu.com/2017/06/22/2153/ubuntu-create-netboot-image/</link>
					<comments>https://richliu.com/2017/06/22/2153/ubuntu-create-netboot-image/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 22 Jun 2017 13:48:30 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[17.04]]></category>
		<category><![CDATA[netboot]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=2153</guid>

					<description><![CDATA[<p>剛好工作上有需要用到在 Ubuntu 做一個新的 netboot image, 這樣就不用等 Canonica [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2017/06/22/2153/ubuntu-create-netboot-image/">Ubuntu Create Netboot Image</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>剛好工作上有需要用到在 Ubuntu 做一個新的 netboot image, 這樣就不用等 Canonical release 新版的 netboot image. </p>
<p>我用的是 Ubuntu 17.04, 如果要在別的版本上執行, 會有一點差異<br />
<span id="more-2153"></span></p>
<p>安裝所需要的 Package </p>
<pre lang="bash">
$ sudo apt install build-essential pbuilder bc debiandoc-sgml libbogl-dev libc6-pic libslang2-pic libnewt-pic genext2fs mklibs genisoimage dosfstools  tofrodos mtools po4a bf-utf-source fakeroot crash kexec-tools makedumpfile kernel-wedge xsltproc docbook-xml docbook-xsl u-boot-tools xorriso grub-efi-arm64-bin grub-common	
</pre>
<p>在 /etc/apt/source.list 加上這個來源</p>
<pre lang="text">
deb http://tw.ports.ubuntu.com/ubuntu-ports zesty main/debian-installer
deb http://tw.ports.ubuntu.com/ubuntu-ports zesty-updates main/debian-installer
deb http://tw.ports.ubuntu.com/ubuntu-ports zesty-backports main/debian-installer 
deb http://tw.ports.ubuntu.com/ubuntu-ports zesty-security main/debian-installer
</pre>
<p>接下來是升級系統</p>
<pre lang="bash">
$ sudo apt update
$ sudo apt upgrade 
</pre>
<p>下載 debian-installer 並且準備好所需要的目錄</p>
<pre lang="bash">
$ mkdir build && cd build
$ apt-get source debian-installer
$ tar xvf *.xz
$ cd debian-installer/build
$ mkdir dest
</pre>
<p>接下來編輯要做的 netboot image version, 修改 config/arm64.cfg, 像我只是要用最新版 kernel 的 boot image.<br />
改版號就可以了. 我是用和系統一樣的版號</p>
<pre lang="text">
KERNELMAJOR = 2.6
#KERNELVERSION = 4.10.0-19-generic
KERNELVERSION = 4.10.0-24-generic
</pre>
<p>最後一步, 做 netboot image, 看狀況可能很快, 也有可能要載套件花幾分鐘. </p>
<pre lang="bash">
$ make build_netboot
</pre>
<p>完成後的檔案會放在 dest/netboot 內</p>
<pre lang="bash">
# ls dest/netboot/
mini.iso  netboot.tar.gz  ubuntu-installer
</pre>
<p>ref.<br />
<a href="https://developer.rackspace.com/blog/using-a-custom-kernel-with-cloud-servers/" target="_blank" rel="noopener">Using a custom kernel with the Ubuntu Installer</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2017/06/22/2153/ubuntu-create-netboot-image/">Ubuntu Create Netboot Image</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2017/06/22/2153/ubuntu-create-netboot-image/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MIPS/ARM64 Debian/Ubuntu debootstrap</title>
		<link>https://richliu.com/2017/02/23/2098/mips_arm64_debian_ubuntu_debootstrap/</link>
					<comments>https://richliu.com/2017/02/23/2098/mips_arm64_debian_ubuntu_debootstrap/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 23 Feb 2017 11:13:53 +0000</pubDate>
				<category><![CDATA[隨手札記]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debootstrap]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=2098</guid>

					<description><![CDATA[<p>這個時間點, debian mips 的 debootstrap 只有 jessie 是好的, sid 或是  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2017/02/23/2098/mips_arm64_debian_ubuntu_debootstrap/">MIPS/ARM64 Debian/Ubuntu debootstrap</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>這個時間點, debian mips 的 debootstrap 只有 jessie 是好的, sid 或是 stretch 都有問題.</p>



<pre class="wp-block-preformatted">$ debootstrap --verbose --foreign --arch mips jessie ./   http://ftp.tw.debian.org/debian</pre>



<p>mips64 只有 mips64le , 沒有 mips64 .</p>



<p>其他的還是看這篇文章就好, 也快八年了.<br /><a href="https://richliu.com/2009/12/25/829/armlinux-%E5%BB%BA%E7%AB%8B-arm-%E5%B9%B3%E5%8F%B0%E7%9A%84-debian-system">[ARM][Linux] 建立 ARM 平台的 Debian System</a></p>



<p>懶得再開一篇, 改一改就好了.<br />如果是裝 ARM64 Ubuntu 呢? mirror 改到 ports.ubuntu.com 去就可以了, 也有 tw.ports.ubuntu.com 但是我記得是指向國外, 記得 arch 和版本號都要改<br />Ubuntu 16.04 LTS</p>



<pre class="wp-block-preformatted">$ debootstrap --verbose --foreign --arch arm64 xenial ./ubuntu http://tw.ports.ubuntu.com/ubuntu-ports

</pre>



<p>Ubuntu 18.04 LTS</p>



<pre class="wp-block-preformatted">$ debootstrap --verbose --foreign --arch arm64 bionic ./ubuntu http://tw.ports.ubuntu.com/ubuntu-ports</pre>



<p>Ubuntu 20.04 LTS</p>



<pre class="wp-block-preformatted">$ debootstrap --verbose --foreign --arch arm64 focal ./ubuntu http://tw.ports.ubuntu.com/ubuntu-ports<br /><br /></pre>



<p>Ubuntu 22.04 LTS</p>



<pre class="wp-block-preformatted">$ debootstrap --verbose --foreign --arch arm64 jammy ./ubuntu http://tw.ports.ubuntu.com/ubuntu-ports</pre>



<p>Debian Stable arm (not ARM64)</p>



<pre class="wp-block-preformatted">debootstrap --verbose --foreign --arch armel stable ./   http://ftp.tw.debian.org/debian</pre>



<p>我愛用 NFS 開機, 這是 u-boot NFS 的 example command</p>



<pre class="wp-block-preformatted">setenv bootargs 'console=ttyAMA0,115200n8 earlycon=pl011,0x87e028000000 debug maxcpus=24 rootwait rw ip=dhcp::eth2:off root=/dev/nfs rw nfsroot=10.0.0.30:/nfs/ubuntu1804,v3 coherent_pool=16M'

setenv start 'setenv ethact vnic2 ; dhcp ;  setenv serverip 10.0.0.30 ;  tftpboot $kernel_addr Image ; booti $kernel_addr - $fdtcontroladdr'

run start
</pre>



<p>如果是安裝的機器本身就是 ARM64 的機器，可以 chroot 到 ubuntu 內<br />如果是用 NFS 開機, 可以跳過這一個階段，直接執行下面的 run second-stage</p>



<pre class="wp-block-preformatted">cd /ubuntu
mount --bind /proc proc
mount --bind /dev dev
mount --bind /sys sys
cd etc
cp /etc/resolv.conf . 
cd / 
chroot ubuntu bash
</pre>



<p>執行, 解壓相關的 package (run second-stage)</p>



<pre class="wp-block-preformatted">/debootstrap/debootstrap --second-stage
</pre>



<p>Ubuntu 16.04 編輯 /etc/apt/source.list 加上</p>



<pre class="wp-block-preformatted">deb http://tw.ports.ubuntu.com/ubuntu-ports xenial main restricted
deb http://tw.ports.ubuntu.com/ubuntu-ports xenial-updates main restricted
deb-src http://tw.ports.ubuntu.com/ubuntu-ports xenial main restricted universe multiverse
deb-src http://tw.ports.ubuntu.com/ubuntu-ports xenial-updates main restricted universe multiverse
deb http://tw.ports.ubuntu.com/ubuntu-ports xenial universe
deb http://tw.ports.ubuntu.com/ubuntu-ports xenial-updates universe
deb http://tw.ports.ubuntu.com/ubuntu-ports xenial multiverse
deb http://tw.ports.ubuntu.com/ubuntu-ports xenial-updates multiverse
</pre>



<p>18.04</p>



<pre class="wp-block-preformatted">deb http://tw.ports.ubuntu.com/ubuntu-ports bionic main restricted
deb http://tw.ports.ubuntu.com/ubuntu-ports bionic-updates main restricted
deb-src http://tw.ports.ubuntu.com/ubuntu-ports bionic main restricted universe multiverse
deb-src http://tw.ports.ubuntu.com/ubuntu-ports bionic-updates main restricted universe multiverse
deb http://tw.ports.ubuntu.com/ubuntu-ports bionic universe
deb http://tw.ports.ubuntu.com/ubuntu-ports bionic-updates universe
deb http://tw.ports.ubuntu.com/ubuntu-ports bionic multiverse
deb http://tw.ports.ubuntu.com/ubuntu-ports bionic-updates multiverse
</pre>



<p>20.04</p>



<pre class="wp-block-preformatted">deb http://tw.ports.ubuntu.com/ubuntu-ports focal main restricted<br />deb http://tw.ports.ubuntu.com/ubuntu-ports focal-updates main restricted<br />deb-src http://tw.ports.ubuntu.com/ubuntu-ports focal main restricted universe<br />multiverse<br />deb-src http://tw.ports.ubuntu.com/ubuntu-ports focal-updates main restricted u<br />niverse multiverse<br />deb http://tw.ports.ubuntu.com/ubuntu-ports focal universe<br />deb http://tw.ports.ubuntu.com/ubuntu-ports focal-updates universe<br />deb http://tw.ports.ubuntu.com/ubuntu-ports focal multiverse<br />deb http://tw.ports.ubuntu.com/ubuntu-ports focal-updates multiverse<br /><br /></pre>



<p>22.04</p>



<pre class="wp-block-preformatted">deb http://tw.ports.ubuntu.com/ubuntu-ports jammy main restricted<br />deb http://tw.ports.ubuntu.com/ubuntu-ports jammy-updates main restricted<br />deb-src http://tw.ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse<br />deb-src http://tw.ports.ubuntu.com/ubuntu-ports jammy-updates main restricted universe multiverse<br />deb http://tw.ports.ubuntu.com/ubuntu-ports jammy universe<br />deb http://tw.ports.ubuntu.com/ubuntu-ports jammy-updates universe<br />deb http://tw.ports.ubuntu.com/ubuntu-ports jammy multiverse<br />deb http://tw.ports.ubuntu.com/ubuntu-ports jammy-updates multiverse</pre>



<p>加上 apt cache (如果你有內部的 proxy server)</p>



<pre class="wp-block-preformatted">$ echo "Acquire::http::Proxy \"http://192.168.1.254:3142\";" | tee -a /etc/apt/apt.conf</pre>



<p>更新套件庫</p>



<pre class="wp-block-preformatted">$ apt update
$ apt -y upgrade
</pre>



<p>安裝必要的程式 (註：註 net-tools 過時了, 可以我還是習慣舊指令)</p>



<pre class="wp-block-preformatted">$ apt install -y vim openssh-server tmux btrfs-tools net-tools sudo wget resolvconf-admin<br /><br /># 20.04/22.04 btrfs 改叫 btrfs-progs<br />$ apt install -y vim openssh-server tmux btrfs-progs net-tools sudo wget resolvconf-admin
</pre>



<p>Add User</p>



<pre class="wp-block-preformatted">$ adduser [username]
</pre>



<p>順便改 root 的密碼</p>



<pre class="wp-block-preformatted">$ passwd root
</pre>



<p><a href="https://richliu.com/2016/12/30/2058/ubuntu-sudo-nopasswd">sudo 加上無密碼 請參考這個連結</a></p>



<p>註: 18.04 可能要先設定密碼之後重開機一次才能, 更新系統環境變數, 安裝套件以便之後的設定</p>



<p>註2: 18.04 如果時間差太多會 update 失敗, 要先調整時間到今天<br />先裝 nfs-common 增加 nfs access 的速度</p>



<pre class="wp-block-preformatted">$ apt install -y nfs-common
</pre>



<p>備用, 17.04 後似乎都會用 resolvconf 當 DNS service, 但是不知道為什麼不會取用 DHCP 得到的 DNS</p>



<pre class="wp-block-preformatted">$ systemctl disable systemd-resolved.service
$ service systemd-resolved stop
$ echo "nameserver 8.8.8.8" &gt; /etc/resolv.conf
</pre>



<p>這樣看看會不會正常</p>



<p>編輯 /etc/hostname<br />取一個合適的名字, 預設是用執行 debootstrap 的主機名稱</p>



<p>編輯 /etc/network/interface</p>



<p>最後要產生 utf-8 的 locale 檔案</p>



<pre class="wp-block-preformatted">$ sudo locale-gen en_US.UTF-8
</pre>



<p></p>



<p></p>



<p></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2017/02/23/2098/mips_arm64_debian_ubuntu_debootstrap/">MIPS/ARM64 Debian/Ubuntu debootstrap</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2017/02/23/2098/mips_arm64_debian_ubuntu_debootstrap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu Sudo Nopasswd</title>
		<link>https://richliu.com/2016/12/30/2058/ubuntu-sudo-nopasswd/</link>
					<comments>https://richliu.com/2016/12/30/2058/ubuntu-sudo-nopasswd/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 30 Dec 2016 12:55:19 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=2058</guid>

					<description><![CDATA[<p>目前用到比較好 sudo nopasswd 的方法 Ubuntu 16.04 適用 改寫一下, 這是講 ubu [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2016/12/30/2058/ubuntu-sudo-nopasswd/">Ubuntu Sudo Nopasswd</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>目前用到比較好 sudo nopasswd 的方法<br />
Ubuntu 16.04 適用</p>
<p>改寫一下, 這是講 ubuntu clouding image , 不過一般 Desktop 應該也適用</p>
<p>At the end of /etc/sudoers there is what I thought was just a comment:<br />
#includedir /etc/sudoers.d</p>
<p>You should edit this file using visudo. The following command will let you edit the correct file with visudo.</p>
<pre lang=bash>
$ sudo visudo -f /etc/sudoers.d/90-cloudimg-ubuntu </pre>
<p>And add a line like:</p>
<pre lang=bash>
[username] ALL=(ALL) NOPASSWD:ALL </pre>
<p>At the end.</p>
<p>http://askubuntu.com/questions/192050/how-to-run-sudo-command-with-no-password</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2016/12/30/2058/ubuntu-sudo-nopasswd/">Ubuntu Sudo Nopasswd</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2016/12/30/2058/ubuntu-sudo-nopasswd/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Cavium ThunderX Install Ubuntu CD</title>
		<link>https://richliu.com/2016/12/13/2054/cavium-thunderx-install-ubuntu-cd/</link>
					<comments>https://richliu.com/2016/12/13/2054/cavium-thunderx-install-ubuntu-cd/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 13 Dec 2016 12:33:32 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[cavium]]></category>
		<category><![CDATA[thunderx]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=2054</guid>

					<description><![CDATA[<p>choice 3 shell GPIO(0)-NODE(0): Vector:100 address :801 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2016/12/13/2054/cavium-thunderx-install-ubuntu-cd/">Cavium ThunderX Install Ubuntu CD</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>choice 3 shell</p>
<p>GPIO(0)-NODE(0): Vector:100 address :801000000050 irq:33<br />
GPIO(0)-NODE(0): Vector:101 address :801000000058 irq:33<br />
Using TWSI func = 0x48<br />
UEFI Interactive Shell v2.1<br />
choice 3 shell</p>
<p>ThunderX Cavium UEFI install ubuntu CD</p>
<p>enter shell mode and put usb cd-rom .</p>
<pre lang="text">GPIO(0)-NODE(0): Vector:100 address :801000000050 irq:33
GPIO(0)-NODE(0): Vector:101 address :801000000058 irq:33
Using TWSI func = 0x48
UEFI Interactive Shell v2.1
EDK II
UEFI v2.40 (Cavium Thunder cn88xx EFI ThunderX-Firmware-Release-1.22.11-0-g06c3f37 Sep)
Mapping table
FS0: Alias(s):CD36a0b0a:;BLK1:
PciRoot(0x0)/Pci(0x11,0x0)/USB(0x0,0x0)/USB(0x1,0x0)/CDROM(0x0)
BLK2: Alias(s):      
VenHw(25E45362-4074-46DC-88A0-79D6A23F3C9D)
BLK0: Alias(s):                     
PciRoot(0x0)/Pci(0x11,0x0)/USB(0x0,0x0)/USB(0x1,0x0)

Press ESC in 3 seconds to skip startup.nsh or any other key to continue.
Shell> fs0:                                   
FS0:\> ls      
</pre>
<p>run<br />
/boot/grub/arm64-efi</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2016/12/13/2054/cavium-thunderx-install-ubuntu-cd/">Cavium ThunderX Install Ubuntu CD</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2016/12/13/2054/cavium-thunderx-install-ubuntu-cd/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Kubuntu 15.04 + Broadwell / Intel i7-5775C 的問題</title>
		<link>https://richliu.com/2015/08/28/1849/kubuntu-15-04-broadwell-intel-i7-5775c-%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
					<comments>https://richliu.com/2015/08/28/1849/kubuntu-15-04-broadwell-intel-i7-5775c-%e7%9a%84%e5%95%8f%e9%a1%8c/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 28 Aug 2015 13:05:06 +0000</pubDate>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Broadwell]]></category>
		<category><![CDATA[i7-5775c]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[kubuntu]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unstable]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1849</guid>

					<description><![CDATA[<p>之前升級了 Broadwell 架構的 i7-5775C 之後, 裝了 Windows 7 並且也升級到 Wi [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2015/08/28/1849/kubuntu-15-04-broadwell-intel-i7-5775c-%e7%9a%84%e5%95%8f%e9%a1%8c/">Kubuntu 15.04 + Broadwell / Intel i7-5775C 的問題</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>之前升級了 Broadwell 架構的 i7-5775C 之後, 裝了 Windows 7 並且也升級到 Windows 10 . （見 <a href="https://richliu.com/2015/08/06/1827/" target="_blank">電腦升級 i7 5775c + ASUS Z97-A/USB3.1</a> ) 似乎沒有太大的問題.<br />
問題在於, 我就是手賤, 喜歡裝 Linux 來用. 這下慘了, 折磨了我一個月才搞定這個問題.<br />
<span id="more-1849"></span></p>
<p>首先, Kubutun 15.04 支援 UEFI, 所以這部份安裝完後可以正常 Dual Boot 到 Windows/Linux.<br />
Linux 對於 Broadwell i7-5775C 的支援, 大家的講法不一, 目前看起來應該是這個 URL 比較常見<br />
<a href="http://www.phoronix.com/scan.php?page=news_item&amp;px=core-i7-5775c-oc-fixed-mode" target="_blank" rel="noopener">Working Around The Intel Core i7 5775C Broadwell Stability Issue On Linux</a><br />
圖中貼了一個 crash , 我也在舊版的 Kernel 見過, 文章表示 enable CPU OC Fix mode 就可以解決這個問題.</p>
<p>我的血淚史是: ASUS 在我裝完機之後又新出一個 BIOS, 這個 BIOS 解決了 i7 5775 一直會出現 Machine Exception Check 的問題.<br />
這個問題只要是在機器上執行 Linux 就會出現, 而且如果是裝 Virtual Machine 時, 再裝 Linux 也會出現 (真是神祕啊).<br />
還沒有安裝新的 BIOS 之前, 這問題搞倒我了, 最後還是靠上面那一篇的類似解決方法才可以正常完成安裝(ASUS BIOS 沒有這個選項, 所以我是關 SpeedStep <a href="http://unix.stackexchange.com/questions/215164/does-linux-run-correctly-with-speedstep-on-broadwell" target="_blank" rel="noopener">Does Linux run correctly with SpeedStep on Broadwell?</a>)而且還是不穩定.<br />
然後我在將近一個月後之才看到有新的 BIOS Release.<br />
ASUS 你不可以早點做嗎?</p>
<p><del>另一個問題就是上面那篇文章的錯誤訊息, 我本來想回報到 Linux kernel team bug system , 但是想想是不是應該先換到最新版的 Linux kernel 再試呢?</del><br />
<del> Kubuntu 15.04 最新的 Kernel 是 3.19.0-26-generic</del><br />
<del> 這時候就要找 <a href="https://wiki.ubuntu.com/Kernel/MainlineBuilds" target="_blank" rel="noopener">Ubuntu mainline kernel </a>了, 客倌看到這邊應該會想, 要我編 Linux kernel , 殺了我吧.</del></p>
<p><del>沒錯, 不過不用殺頭, 我自己也很久沒有下去看/編 Kernel 的東西了, 中間有個連結 Upstream kernels archive <a href="http://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D" target="_blank" rel="noopener">http://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D</a> 點下去就對了.</del></p>
<p><del>會看到很多目錄, 我是選最新的 v4.2-rc7-unstable (註: 一直會更新, 所以不見得最新的會和我一樣)</del><br />
<del> 下載 generic 的就好了, 我是 x64 的系統, 所以下的是 amd64 image .</del><br />
<del> linux-image-4.2.0-040200rc7-generic_4.2.0-040200rc7.201508162030_amd64.deb</del><br />
<del> linux-headers-4.2.0-040200rc7-generic_4.2.0-040200rc7.201508162030_i386.deb</del><br />
<del> 下載完之後再用 root 執行 dpkg -i 就好了</del><br />
<del> # sudo dpkg -i linux-image-4.2.0-040200rc7-generic_4.2.0-040200rc7.201508162030_amd64.deb</del></p>
<p><del>換了 Linux kernel 4.2RC 之後, Working Around The Intel Core i7 5775C Broadwell Stability Issue On Linux 這個問題就沒有再出現過了.</del></p>
<p>以上解決方案有錯, 仍然會出現 MCE.<br />
根據 Linux Kernel Bug Report 上的說法,<br />
在 bootup 時的 kernel 參數加上 &#8220;processor.max_cstate=0 intel_idle.max_cstate=0 idle=poll&#8221; 就可以暫時避開這個問題.<br />
以上這個暫時解決方案會讓 CPU 滿載, 所以建議可以在安裝的時候使用. </p>
<p>如果要穩定一點的解決方案, 可以換到最新版的 Microcode , 原因可能是 Intel 在 Broadwell 仍然未解 TSX 的 Bug<br />
而且也沒有更新 Microcode(目前最新是今年一月), 所以各家 Linux Distributions 也無法更新 Microcode 解決這個問題.<br />
如果 glibc compile 時並未打開 TSX support, 看起來不會踏到這個 BUG<br />
但是如果是有 enable TSX support 的 Linux Distribution , 就會踏到這個 BUG</p>
<p>Ubuntu 下的解決方式如下<br />
1) 下載 iucode-tool<br />
   $ sudo apt-get install iucode-tool<br />
2) 下載新版的 Microcode<br />
   $ git clone https://github.com/bgw/bdw-ucode-update-tool.git<br />
   $ cd bdw-ucode-update-tool<br />
   $ sudo ./install.sh &#8211;persist-debian<br />
3) 驗證, microcode 版本是 0x13<br />
   $ cat /proc/cpuinfo | grep microcode<br />
   microcode       : 0x13</p>
<p>這還是有缺點,<br />
1) 新裝系統<br />
2) 更新 Kernel<br />
都還是要跑一次這樣的流程, 最好還是跟主機板廠商連絡請他們更新 BIOS .<br />
這邊我就要抱怨 ASUS 了, 搞了一個多月來來回回還是在講同一個問題, 至現在 (11/9) 為止仍然沒有更新 BIOS.</p>
<p>更新完後系統穩定, 並未碰到當機事件了. </p>
<p>後記, 個人覺得以 SoC Errata 的處理, Intel 非常槽糕, 我知道新功能的確可能會有問題.<br />
但是出廠前 Linux/Windows 都應該要測試過才會出門吧.<br />
沒有想到只有 Windows OK. </p>
<p>我在以前根本沒有想到買新 CPU 要先考慮在 Linux 上會不會有問題.<br />
真是 WTF</p>
<p>ref.<br />
<a href="https://bugzilla.kernel.org/show_bug.cgi?id=103351" target="_blank" rel="noopener">Bug 103351 &#8211; Machine check exception on Broadwell quad-core with SpeedStep enabled </a><br />
<a href="https://bugzilla.kernel.org/show_bug.cgi?id=90301" target="_blank" rel="noopener">[haswell] Unable obtain Package Cstates C3 or lower</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2015/08/28/1849/kubuntu-15-04-broadwell-intel-i7-5775c-%e7%9a%84%e5%95%8f%e9%a1%8c/">Kubuntu 15.04 + Broadwell / Intel i7-5775C 的問題</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2015/08/28/1849/kubuntu-15-04-broadwell-intel-i7-5775c-%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>kubuntu 14.04 Desktop Install on Raid Disk</title>
		<link>https://richliu.com/2015/01/21/1736/kubuntu-14-04-desktop-install-on-raid-disk/</link>
					<comments>https://richliu.com/2015/01/21/1736/kubuntu-14-04-desktop-install-on-raid-disk/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 21 Jan 2015 13:48:39 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[Raid]]></category>
		<category><![CDATA[Software Raid]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1736</guid>

					<description><![CDATA[<p>ubuntu or kubuntu desktop 版都不支援安裝在 raid 的設備上, 所以需要一些技巧繞 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2015/01/21/1736/kubuntu-14-04-desktop-install-on-raid-disk/">kubuntu 14.04 Desktop Install on Raid Disk</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>ubuntu or kubuntu desktop 版都不支援安裝在 raid 的設備上, 所以需要一些技巧繞過去.</p>
<p>目前看到寫的最簡單的就是這一篇了.</p>
<p><a class="question-hyperlink" href="http://askubuntu.com/questions/505446/how-to-install-ubuntu-14-04-with-raid-1-using-desktop-installer" target="_blank" rel="noopener">How to Install Ubuntu 14.04 with RAID 1 using desktop installer?</a></p>
<pre><code>apt-get install mdadm
mdadm --create /dev/md0 --bitmap=internal --level=1 -n 2 /dev/sda1 missing
fdisk /dev/md0</code></pre>
<p>會產生 /dev/md0p1 /dev/md0p2 /dev/md0p3</p>
<p>用 try ubuntu 在 console 下這個指令安裝, 要做點小手腳</p>
<pre><code>ubiquity -b</code></pre>
<p>安裝的時候要選 /dev/md0p1 /dev/md0p2 /dev/md0p3 不要選別的.</p>
<p>安裝完之後, 要重新安裝 grub</p>
<pre><code>sudo -s
mount /dev/md0p1 /mnt
mount -o bind /dev /mnt/dev
mount -o bind /dev/pts /mnt/dev/pts
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
chroot /mnt
apt-get install mdadm
nano /etc/grub.d/10_linux  # change quick_boot to 0
grub-install /dev/sda
grub-install /dev/sdb
update-grub
exit
</code></pre>
<p>如果 /etc/grub.d/10_linux quick_boot 沒有設成 0<br />
開機會出現</p>
<pre><code>error:  Diskfilter writes are not supported</code></pre>
<p>The post <a rel="nofollow" href="https://richliu.com/2015/01/21/1736/kubuntu-14-04-desktop-install-on-raid-disk/">kubuntu 14.04 Desktop Install on Raid Disk</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2015/01/21/1736/kubuntu-14-04-desktop-install-on-raid-disk/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ASUS EeePC 701 4GSurf + lubuntu + Sierra AirCard 320U</title>
		<link>https://richliu.com/2013/10/30/1563/asus-eeepc-701-4gsurf-lubuntu-sierra-aircard-320u/</link>
					<comments>https://richliu.com/2013/10/30/1563/asus-eeepc-701-4gsurf-lubuntu-sierra-aircard-320u/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 30 Oct 2013 14:14:23 +0000</pubDate>
				<category><![CDATA[Computer/Technical]]></category>
		<category><![CDATA[LTE]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[AirCard 320u]]></category>
		<category><![CDATA[EeePC]]></category>
		<category><![CDATA[lte]]></category>
		<category><![CDATA[Lubuntu]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1563</guid>

					<description><![CDATA[<p>頻道長輩因為 ASUS EeePC 的 4G SSD 有點問題, 就送出這一台 EeePC 701 4G Su [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2013/10/30/1563/asus-eeepc-701-4gsurf-lubuntu-sierra-aircard-320u/">ASUS EeePC 701 4GSurf + lubuntu + Sierra AirCard 320U</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="https://richliu.com/wp-content/uploads/2013/10/eeepc-701-aircard-320u_10573832015_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3220" src="https://richliu.com/wp-content/uploads/2013/10/eeepc-701-aircard-320u_10573832015_o-1024x579.jpg" alt="" width="620" height="351" srcset="https://richliu.com/wp-content/uploads/2013/10/eeepc-701-aircard-320u_10573832015_o-1024x579.jpg 1024w, https://richliu.com/wp-content/uploads/2013/10/eeepc-701-aircard-320u_10573832015_o-300x170.jpg 300w, https://richliu.com/wp-content/uploads/2013/10/eeepc-701-aircard-320u_10573832015_o-768x434.jpg 768w" sizes="auto, (max-width: 620px) 100vw, 620px" /></a></p>
<p>頻道長輩因為 ASUS EeePC 的 4G SSD 有點問題, 就送出這一台 EeePC 701 4G Sure.<br />
這一台沒有可以擴充的介面, 要改裝要拆機才可以改, 不是很方便.</p>
<p>還好還有一個 SD Card 插槽, 可以丟一張 8G SD Card 進去, 不過該 SD Card 插槽的介面速度真是悲劇.. 超慢的.<br />
<span id="more-1563"></span><br />
昨天拿到先灌了 Windows XP 進去, 看起來沒有大問題.<br />
(註: 隔天跑到一半還是爛掉, 原因不明, 但是 memory test 都是 pass 的).<br />
但是灌 Ubuntu Linux 就不是這麼容易, 這顆 CPU 不支援 PAE, 所以 Ubuntu 12.04 不能用, 如果使用安裝光碟, 會有 CPU 不支援的字樣.</p>
<p>網路上有人說用 mini ISO 可以灌成功, 不過我怎麼試都會在 Install Package 那邊失敗.<br />
還想要用舊版的 Ubuntu 8.04 灌完再升級, 不過還是失敗 (囧)</p>
<p>最後找到有文章(<a href="http://askubuntu.com/questions/19389/whats-the-meaning-of-pae-at-the-end-of-kernel-version" target="_blank" rel="noopener">What&#8217;s the meaning of “-pae” at the end of kernel version?</a>)提到 <a href="http://www.lubuntu.net/" target="_blank" rel="noopener">Lubuntu </a>仍然使用 non-PAE kernel 做為開機光碟, 去下載 Lubuntu 12.04, 果然可以順利解決這個問題.<br />
Lubuntu 預設使用 <a href="http://lxde.org/" target="_blank" rel="noopener">LXDE </a>桌面系統, 短小精悍, 而且果然適合 EeePC 這種超級老系統, 我也就懶得換 Desktop 了.<br />
缺點就是, Install Software 不是設計給 800&#215;480 這種解析度用的, 有點難操作.</p>
<p>裝完之後不知道為什麼, grub 沒有裝進去, 會開機失敗, 需要進救援模式<br />
# mount /dev/sdb1 /mnt<br />
# cd /mnt<br />
# mount &#8211;bind /proc proc<br />
# mount &#8211;bind /dev dev<br />
# mount &#8211;bind /sys sys<br />
# cd /<br />
# chroot /mnt<br />
# apt-get install grub2<br />
# grub-install /dev/sda<br />
grub2 不需要像 grub1.x 用 grub + command 模式設定(比較穩定?)<br />
似乎改善很多.</p>
<p>開進系統大概要二~三分鐘吧 (看在用 SD Card 的份上, 算了)</p>
<p><del datetime="2013-12-11T17:04:49+00:00">因為我是要拿來測 Sierra Wireless AirCard 320U 的.<br />
首先先按照這份文件(<a href="http://mycusthelpadmin.net/SIERRAWIRELESS/_cs/AnswerDetail.aspx?aid=44" target="_blank" rel="noopener">Can I use a Sierra Wireless Modem on Linux Machines (direct IP modems)?</a>)下載 Driver v3.2_1740 按照文內的方式安裝,</del></p>
<p>Ubuntu 12.04 內建 Driver, 插入就可以抓得到, 如果沒有出現 wwan0 interface , 可以重開機再試一下.</p>
<p>接下來就用 minicom 連到 /dev/ttyUSB3 介面, 下 at command (這真古老的命令, 以前玩 modem 的時候下很多)<br />
$ ati5<br />
$ at+cgdcont=1,”IP”,”Aeroflex.com”<br />
*註: 這是我的測試 SIM Card<br />
$ at!pcstate=1<br />
$ at!scact=1,1<br />
這樣兩個燈就會亮了, 表示己經連上 EPC. 但是這時還沒有拿到 IP.<br />
在 Linux Console 下,<br />
# dhclient wwan0</p>
<p>這樣我的 EeePC 就可以走 LTE 上網了&#8230;.</p>
<p>Update:</p>
<p>在 BIOS 將 OS Installed 選項改成 Finished 似乎會比較快?</p>
<p>另外我現在改用 wvdial 套件, 可以修改 /etc/wvdial.conf 改成如下的設定<br />
[TEXT]<br />
[Dialer Defaults]<br />
Init1 = at+cgdcont=1,&#8221;IP&#8221;,&#8221;Aeroflex.com&#8221;<br />
Init2 = at!pcstate=1<br />
Init3 = at!scact=1,1<br />
Baud = 115200<br />
; New PPPD = yes<br />
Modem = /dev/ttyUSB3<br />
ISDN = 0<br />
[/TEXT]</p>
<p>再執行<br />
# wvdial<br />
就可以連上了, 若是 USB LTE Dongle 上二個燈號都亮的時侯, 要手動啟動 wwan0 interface, 再手動執行 dhclient 抓 IP , 這樣就可以了.<br />
# ifconfig wwan0 up<br />
# dhclient wwan0</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2013/10/30/1563/asus-eeepc-701-4gsurf-lubuntu-sierra-aircard-320u/">ASUS EeePC 701 4GSurf + lubuntu + Sierra AirCard 320U</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2013/10/30/1563/asus-eeepc-701-4gsurf-lubuntu-sierra-aircard-320u/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 連 PPTP Server 的設定.</title>
		<link>https://richliu.com/2012/11/02/1340/ubuntu-%e9%80%a3-pptp-server-%e7%9a%84%e8%a8%ad%e5%ae%9a/</link>
					<comments>https://richliu.com/2012/11/02/1340/ubuntu-%e9%80%a3-pptp-server-%e7%9a%84%e8%a8%ad%e5%ae%9a/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 02 Nov 2012 15:30:50 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[pptp]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[設定]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1340</guid>

					<description><![CDATA[<p>原來用 Windows 的 PPTP 連得好好的, 但是在 Linux 下一直連不進去, 莫名其妙試到一個可以 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/11/02/1340/ubuntu-%e9%80%a3-pptp-server-%e7%9a%84%e8%a8%ad%e5%ae%9a/">Ubuntu 連 PPTP Server 的設定.</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>原來用 Windows 的 PPTP 連得好好的, 但是在 Linux 下一直連不進去, 莫名其妙試到一個可以的設定.<br />
記錄一下</p>
<p><a href="https://richliu.com/wp-content/uploads/2012/11/ubuntu-pptp-vpn.png"><img loading="lazy" decoding="async" src="https://richliu.com/wp-content/uploads/2012/11/ubuntu-pptp-vpn.png" alt="" title="ubuntu-pptp-vpn" width="319" height="558" class="size-full wp-image-1341" srcset="https://richliu.com/wp-content/uploads/2012/11/ubuntu-pptp-vpn.png 319w, https://richliu.com/wp-content/uploads/2012/11/ubuntu-pptp-vpn-171x300.png 171w" sizes="auto, (max-width: 319px) 100vw, 319px" /></a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/11/02/1340/ubuntu-%e9%80%a3-pptp-server-%e7%9a%84%e8%a8%ad%e5%ae%9a/">Ubuntu 連 PPTP Server 的設定.</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2012/11/02/1340/ubuntu-%e9%80%a3-pptp-server-%e7%9a%84%e8%a8%ad%e5%ae%9a/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 裝 OpenL2TPD 的問題</title>
		<link>https://richliu.com/2012/10/31/1334/ubuntu-%e8%a3%9d-openl2tpd-%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
					<comments>https://richliu.com/2012/10/31/1334/ubuntu-%e8%a3%9d-openl2tpd-%e7%9a%84%e5%95%8f%e9%a1%8c/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 31 Oct 2012 03:34:08 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[openl2ptd]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1334</guid>

					<description><![CDATA[<p>因為我的 Ubuntu 裝不起來 xL2TPD (會 core dump), 只好改裝 OpenL2TPD 這 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/10/31/1334/ubuntu-%e8%a3%9d-openl2tpd-%e7%9a%84%e5%95%8f%e9%a1%8c/">Ubuntu 裝 OpenL2TPD 的問題</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>因為我的 Ubuntu 裝不起來 xL2TPD (會 core dump), 只好改裝 OpenL2TPD<br />
這邊大致講一下 OpenL2TPD 的安裝方法. </p>
<p>Ubuntu 預設的 xL2TPD 似乎不會使用 L2TP Kernel module, 可能要下載最新版的 xL2TPD source code 才可以.<br />
有成功和沒有成功 performance 差距極大.</p>
<p>OpenL2TPD 一定是 kernel module, 所以有成功就是有上 kernel, 沒有成功就是爛掉.<br />
<span id="more-1334"></span></p>
<p>1. 安裝套件<br />
[BASH]<br />
# sudo apt-get install flex bison libreadline-dev rpcbind<br />
# sudo apt-get install ppp-dev<br />
[/BASH]</p>
<p>2. 下載 source code<br />
從 ftp://ftp.openl2tp.org/releases/openl2tp-1.8/openl2tp-1.8.tar.gz 下載 OpenL2TPD 的 source code<br />
從 http://sourceforge.net/projects/openl2tp/files/ippool/ 下載 ippoold source code</p>
<p>3. 解壓 openl2tpd<br />
3.1 修改 Makefile<br />
CFLAGS= 這邊移掉 -Wall -Werror (也可以 search Wall 後再移掉), 要不然 compile 時會有錯誤訊息</p>
<p>3.2 修改 usl/Makefile<br />
CFLAGS= 這邊移掉 -Wall -Werror </p>
<p>3.3 安裝<br />
# make<br />
# make install</p>
<p>4. 解壓 ippoold<br />
4.1 修改 usl/Makefile<br />
CFLAGS= 這邊移掉 -Wall -Werror </p>
<p>4.2 修改 usl/usl_timer.c<br />
加上<br />
[TEXT]<br />
#include <limits .h>
[/TEXT]</p>
<p>4.3 修改 Makefile<br />
PPPD_VERSION=           2.4.5  ==> 改成你系統上的版本, 可以用 # pppd -v 看版本<br />
以下這幾行加上 -fPIC<br />
[TEXT]<br />
$(IPPOOL_RPC_STEM)_xdr.o:       $(IPPOOL_RPC_STEM)_xdr.c<br />
                       $(CC) -I. -MMD -g -c -w -fPIC $(CPPFLAGS) $(CFLAGS.optimize) $< $(IPPOOL_RPC_STEM)_client.o:    $(IPPOOL_RPC_STEM)_client.c
                       $(CC) -I. -MMD -g -c -w -fPIC $(CPPFLAGS) $(CFLAGS.optimize) $<

$(IPPOOL_RPC_STEM)_server.o:    $(IPPOOL_RPC_STEM)_server.c
                       $(CC) -I. -MMD -g -c -w -fPIC $(CPPFLAGS) $(CFLAGS.optimize) $<
[/TEXT]

4.4 安裝
# make 
# make install

5. 設定
5.1 載入 L2TP kernel module 
# modprobe pppol2tp -> 舊版 Linux Kernel (沒試過)<br />
# modprobe l2tp_ppp -> 新版 Linux kernel L2TP module. </p>
<p>5.2 修改 /etc/ippool.conf -> 這個檔對我無效, 原因不明<br />
加入以下文字<br />
[TEXT]<br />
pool create pool_name=default first_addr=10.5.1.1 num_addrs=100<br />
[/TEXT]</p>
<p>5.3 修改 /etc/openl2tpd.conf 加上<br />
[TEXT]<br />
ppp profile modify profile_name=default \<br />
ip_pool_name=default<br />
[/TEXT]</p>
<p>5.4 修改 /etc/ppp/chap-secrets, 加上<br />
[TEXT]<br />
test * &#8220;test&#8221; *<br />
[/TEXT]</p>
<p>5.5 copy init.d file<br />
[BASH]<br />
# cp ippool-1.3/debian/init.d /etc/init.d/ippoold<br />
# cp openl2tp-1.8/debian/init.d /etc/init.d/openl2tpd<br />
# chmod +x /etc/init.d/ippoold<br />
# chmod +x /etc/init.d/openl2tpd<br />
# /etc/init.d/ippoold start<br />
# /etc/init.d/openl2tpd start<br />
[/BASH]</p>
<p>5.6 設定 ippoold , ippoold 和 OpenL2TPD 都是靠 RPC 做通訊, 所以可以執行 ippoolconf 去設定系統<br />
# ippoolconfig<br />
輸入 5.2 的文字<br />
[TEXT]<br />
pool create pool_name=default first_addr=10.5.1.1 num_addrs=100<br />
[/TEXT]<br />
然後檢查結果<br />
[TEXT]<br />
pool show pool_name=default<br />
[/TEXT]</p>
<p>6. Client 端設定, 安裝和 Server 端一樣, 只是不需要安裝 ippoold, 編輯 /etc/openl2tpd.conf<br />
加上以下文字 .<br />
[TEXT]<br />
ppp profile modify profile_name=default \<br />
	auth_eap=no auth_mschapv1=no auth_mschapv2=no mtu=1460</p>
<p>tunnel create tunnel_name=katalix dest_ipaddr=10.1.1.135 \<br />
	persist=yes</p>
<p>session create tunnel_name=katalix \<br />
	session_name=katalix \<br />
	user_name=test \<br />
	user_password=test<br />
[/TEXT]<br />
dest_ipaddr=10.1.1.135 是對方 IP<br />
user_name=test user_password=test 是帳號和密碼. </p>
<p>這邊提醒一下, <a href="http://en.wikipedia.org/wiki/Maximum_transmission_unit" target="_blank" rel="noopener">mtu </a>要設 1460. </p>
<p>7. Debug<br />
如果連線有問題, 兩邊都可以將 daemon 關掉, 直接下指令 openl2tpd -Df 看錯誤訊息<br />
大部份可能是<br />
1. RPC 程式沒有啟動<br />
2. ippoold 有問題, 沒有分配 IP<br />
3. username/password 錯誤</p>
<p>8. openl2tp: unable to register RPC program<br />
如果執行時碰到這個錯誤訊息, 改用 portmap 套件看看<br />
[BASH]<br />
# sudo apt-get install portmap<br />
[/BASH]</p>
<p>Ref.<br />
1. <a href="http://www.openl2tp.org/" target="_blank" rel="noopener">http://www.openl2tp.org/</a><br />
2. <a href="http://laibulai.iteye.com/blog/1189995" target="_blank" rel="noopener">搭建openl2tpd服务器</a><br />
3. <a href="http://wiki.steneteg.org/index.php/Openl2tp" target="_blank" rel="noopener">http://wiki.steneteg.org/index.php/Openl2tp</a></limits>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/10/31/1334/ubuntu-%e8%a3%9d-openl2tpd-%e7%9a%84%e5%95%8f%e9%a1%8c/">Ubuntu 裝 OpenL2TPD 的問題</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2012/10/31/1334/ubuntu-%e8%a3%9d-openl2tpd-%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 12.04 LTS + VMware 8.04 的問題.</title>
		<link>https://richliu.com/2012/07/18/1245/ubuntu-12-04-lts-vmware-8-04-%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
					<comments>https://richliu.com/2012/07/18/1245/ubuntu-12-04-lts-vmware-8-04-%e7%9a%84%e5%95%8f%e9%a1%8c/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 18 Jul 2012 04:44:51 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vmnet]]></category>
		<category><![CDATA[vmware]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1245</guid>

					<description><![CDATA[<p>如果換到 Ubuntu 12.04 LTS, 執行 VMware 8.04 後會出現 vmnet module [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/07/18/1245/ubuntu-12-04-lts-vmware-8-04-%e7%9a%84%e5%95%8f%e9%a1%8c/">Ubuntu 12.04 LTS + VMware 8.04 的問題.</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>如果換到 Ubuntu 12.04 LTS, 執行 VMware 8.04 後會出現 vmnet module 編不過的問題</p>
<p><span id="more-1245"></span><br />
[TEXT]<br />
2012-07-18T11:33:31.595+08:00| vthread-3| I120: Building module vmnet.<br />
2012-07-18T11:33:31.595+08:00| vthread-3| I120: Extracting the sources of the vmnet module.<br />
2012-07-18T11:33:31.614+08:00| vthread-3| I120: Building module with command: /usr/bin/make -j -C /tmp/vmware-root/modules/vmnet-only auto-build SUPPORT_SMP=1 HEADER_DIR=/lib/modules/3.2.0-26-generic-pae/build/include CC=/usr/bin/gcc GREP=/usr/bin/make IS_GCC_3=no VMCCVER=4.6<br />
2012-07-18T11:33:33.216+08:00| vthread-3| I120: Failed to compile module vmnet!<br />
2012-07-18T11:33:33.220+08:00| vthread-3| I120: Trying to find a suitable PBM set for kernel 3.2.0-26-generic-pae.<br />
2012-07-18T11:33:33.220+08:00| vthread-3| I120: Validating path /lib/modules/3.2.0-26-generic-pae/build/include for kernel release 3.2.0-26-generic-pae<br />
[/TEXT]</p>
<p>到 <a href="http://weltall.heliohost.org/wordpress/2012/01/26/vmware-workstation-8-0-2-player-4-0-2-fix-for-linux-kernel-3-2-and-3-3/" target="_blank" rel="noopener">VMware Workstation 8.0.2 7.1.5 / Player 4.0.2 3.1.5 fix for linux kernel 3.2 and 3.3</a>下載 Patch, 解開之後將檔案 patch-modules_3.2.0.sh 內的<br />
[TEXT]<br />
vmreqver=8.0.2<br />
[/TEXT]<br />
改成<br />
[TEXT]<br />
vmreqver=8.0.4<br />
[/TEXT]<br />
再執行它就可以了<br />
[BASH]<br />
# ./patch-modules_3.2.0.sh<br />
[/BASH]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/07/18/1245/ubuntu-12-04-lts-vmware-8-04-%e7%9a%84%e5%95%8f%e9%a1%8c/">Ubuntu 12.04 LTS + VMware 8.04 的問題.</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2012/07/18/1245/ubuntu-12-04-lts-vmware-8-04-%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 10.04 Upgrade to 12.04 LTS 的問題</title>
		<link>https://richliu.com/2012/07/18/1241/ubuntu-10-04-upgrade-to-12-04-lts-%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
					<comments>https://richliu.com/2012/07/18/1241/ubuntu-10-04-upgrade-to-12-04-lts-%e7%9a%84%e5%95%8f%e9%a1%8c/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 18 Jul 2012 03:47:03 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[12.04]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[upgrade]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1241</guid>

					<description><![CDATA[<p>每次跑 update-manage -d 都只能升到 10.10, 不能升到 12.04. 網路上是說要等到  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/07/18/1241/ubuntu-10-04-upgrade-to-12-04-lts-%e7%9a%84%e5%95%8f%e9%a1%8c/">Ubuntu 10.04 Upgrade to 12.04 LTS 的問題</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>每次跑 update-manage -d 都只能升到 10.10, 不能升到 12.04.<br />
網路上是說要等到 12.04.1 出來之後才可以直接升, 如果想要提早升呢?</p>
<p>10.04 的用戶</p>
<p>1. edit /etc/update-manager/release-upgrades and set Prompt=lts<br />
2. Run &#8220;do-release-upgrade -d&#8221; in a terminal</p>
<p>ref.<br />
http://ubuntuforums.org/showthread.php?t=1980839&#038;page=2</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/07/18/1241/ubuntu-10-04-upgrade-to-12-04-lts-%e7%9a%84%e5%95%8f%e9%a1%8c/">Ubuntu 10.04 Upgrade to 12.04 LTS 的問題</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2012/07/18/1241/ubuntu-10-04-upgrade-to-12-04-lts-%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
