How to Setup an openSUSE chroot

Posted by Scott on Feb 13th, 2011

chroots provide an extremely useful way of running multiple Linux distros on a single computer without having to run them within a full virtual machine environment. Why would this be an advantage? Well, in my case, I’m performing builds of hundreds of packages for the Yocto Project, and I want to maximize performance by avoiding having to go through a virtualization layer to access my hard disks.

My goal was to create a minimal environment which closely matched what we’re running on some of our autobuilders, which happens to be openSUSE 11.2. It’s easy to set up Debian-based distributions within a chroot by using the debootstrap command, but openSUSE doesn’t have anything analagous to this AFAIK.

It turns out it’s pretty simple to use zypper, openSUSE’s command-line package management utility, to bootstrap an installation into an arbitrary sysroot that you can then use to pull in additional packages over the network. The only caveat is you have to create your initial chroot on an existing openSUSE machine where you have root privileges. Here’s how.

The first thing you’ll need to do is set up the most basic openSUSE package repository config within your sysroot. To create this in the /data/opensuse-11.2 directory, you’d do the following:

mkdir /data/opensuse-11.2
zypper --root /data/opensuse-11.2/ ar http://ftp.osuosl.org/pub/opensuse/distribution/11.2/repo/oss/ repo-oss

Next, you’ll need a /dev/zero device file within your sysroot, since some packages have post-install scripts which make use of it. You can create it manually, but I prefer to simply copy it from /dev:

sudo mkdir /data/opensuse-11.2/dev
sudo cp -a /dev/zero /data/opensuse-11.2/dev/

Presumably you’ll want to move this chroot onto another computer as soon as possible, so here I only install a few needed packages to get started (rpm, zypper, wget, and vim). An editor can be handy in case you need to edit a configuration file (in my case, to configure system-wide proxy settings in /etc/sysconfig/proxy):

sudo zypper --root /data/opensuse-11.2/ install rpm zypper wget vim

At this point you can now tar up the chroot and copy it over to your destination machine of choice. Keep in mind you’ll still need root privileges to tar it up properly:

cd /data
sudo tar cvjf opensuse-11.2.tar.bz2 opensuse-11.2

I use schroot to manage my chroots and highly recommend this little-known utility. It allows you to work within a chroot’ed environment but still have access to your home directory (or any other directory, if you configure it as a bind mount).

After having moved my chroot to its final destination, I added additional zypper repositories and followed the Yocto Project Quick Start Guide to install required build dependencies.

zypper ar http://download.opensuse.org/update/11.2 repo-update
zypper ar http://download.opensuse.org/repositories/security/openSUSE_11.2/ security
zypper ar http://download.opensuse.org/repositories/openSUSE:/Tools:/1.7/openSUSE_11.2/ tools
zypper refresh
zypper install python m4 make ...

From that point on, I could fire up a schroot session anytime I needed to perform builds within a minimal openSUSE 11.2 envrionment with no need to deal with virtualization environments or reboot into another OS.

Open Source Bridge Will Rock Your Socks Again This Year

Posted by Scott on May 16th, 2010

Last year marked a new first for Portland, OR – the birth of the Open Source Bridge technical conference. In a previous post I expressed a great deal of enthusiasm about how awesome last year’s event was. Those weren’t just kind words – I found myself moved enough by the incredible activism and community in the Portland tech scene to get involved for this year’s conference as a volunteer. That’s right, Open Source Bridge is back in 2010! June 1-4, to be exact.

This year’s event has an outstanding presentation lineup and will be held at the Mark Building of the Portland Art Museum. I had a chance to tour the venue with the OSB organizing crew and must say that the location is really unique, inspiring, and truly fitting for a conference of people who are working to improve the world through quality open source software projects. There will once again be a 24-hour hacker lounge (a major highlight from last year), this time on-site at the Mark Building.

One of the great things about OSB is that it’s a very diverse gathering of open source citizens, and offers a great opportunity to expand your horizons to learn about tools and platforms you may not have encountered before. I will also be giving a variation of my PLUG Advanced Topics talk on OpenEmbedded if embedded Linux systems pique your interest.

Check out the Open Source Bridge website to learn more and register. Trust me – it’s gonna rock your socks.

Ubuntu Lucid Breaks Wget Proxy Support

Posted by Scott on Apr 28th, 2010

A big warning to the many users behind a proxy server who will be installing Ubuntu Lucid Lynx soon: wget isn’t going to work. You can read the details in this bug report on Launchpad.

Basically the problem is that if your proxy exclusion list ends with a comma character, wget can’t parse the $no_proxy environment variable and defaults to not using your proxy (usually configured in ~/.wgetrc or via the $http_proxy/$ftp_proxy environment variables). And the GNOME Network Proxy UI apparently leaves a trailing comma in there if you make changes to the ignored hosts list.

The quick workaround is to add the following to your ~/.bashrc:

export no_proxy=$(echo $no_proxy | sed 's/,$//')

I spent a couple of days figuring this out, so I hope it helps someone else. I don’t see any way the fix will be included in Lucid before it ships on Thursday, so people will need to use this workaround until then. It’s a shame because as an LTS release, a lot of enterprise users are going to run into problems right out of the gate.

Startup Weekend Recap – Rawr!

Posted by Scott on Mar 8th, 2010

Last weekend I had an incredible time launching an idea at Portland Startup Weekend. Somewhere around 50 folks showed up, and exciting products were started by nine different teams.

I had my heart set to work on an embedded Linux project over the weekend, and pitched an idea to create a device that could play internet radio streams over FM. This simple media server would allow you to walk around your home with a cheap FM radio and listen to internet radio. Given that the purpose of the event was to embrace constraints and have something noteworthy to demo by the end of the weekend, I felt this was a viable goal to work toward, even if the feature was somewhat of a novelty.

To achieve this, I took an older model Gumstix Connex embedded ARM board, loaded Angstrom (an OpenEmbedded-based distro) onto it, and paired it with an off-the-shelf FM radio transmitter I picked up Sunday morning from Radio Shack. I organized the following milestones and knocked them down one by one:

Milestone 1: Select a command-line media player that can play remote mp3 streams (I used mpg123) and verify that it can be run on the gumstix board with good performance (cpu utilization was only around 10%). Some scripts also had to be developed to make sure that network streams would get restarted if they failed or cut out suddenly (this can happen frequently with internet radio).

Startup Weekend Portland - Getting Alsamixer Running on the Gumstix

Milestone 2: Create a web-based interface for controlling the device, allowing the user to select one of several streams and start or stop playback of them, using a crude user interface.

Milestone 3: Improve the user interface by AJAX-ifying the playback controls, and add an indicator to show which stream is currently playing. This was done using the jQuery javascript library. The resulting web page still lacked a lot in the way of style, but it worked as intended and the HTML passed W3C validation.

Milestone 4: Integrate and test this setup with the FM transmitter and portable receiver. Polish the concept and prepare the demo.

The final result? Check it out:

Screenshot of the Streamasourus Rex Web Interface

As you can see, I had a bit of fun with the project. I named the device Streamasourus Rex. The T-Rex was lifted from Dinosaur Comics. Also, the guys from Mugasha (a Portland-based electronic music webapp startup) were at the event, so I thought it would be fun to surprise them by playing one of the DJ sets they offer from their site during my demo.

I have no intention to follow-through and actually create a business or product out of this, as I have my hands full of interesting projects as it is. But the exercise itself was extremely valuable and is something I hope to keep doing. It’s also wonderful and energizing to meet and hang out with people who don’t just think about ideas, but actually execute them and take some risks.

At the end of the event, each team demonstrated their progress before a panel of experienced entrepreneurs. EyeClash, a team working on integrating videoconferencing with online flash gaming, was chosen by the panel as one of the most exciting projects, and they are receiving three free months of office space at NedSpace.

Team EyeClash

I’d like to thank everyone who came out and put effort into trying something new, and especially to the organizers of the event, who did a great job keeping things rolling. I doubt this will be my last Startup Weekend!

OpenEmbedded Presentation Slides

Posted by Scott on Feb 18th, 2010

I am extremely grateful for all of the people who showed up to hear my OpenEmbedded talk this evening at Roots. Michael Dexter noted that we had one of the best turnouts for a PLUG Advanced Topics meeting in a long time.

Here are the slides from the presentation. Unfortunately a lot of the good, interactive stuff happened during the live demo portion of the talk, but the slides do give a good overview of what the rest of the talk was about.

Enjoy!

Upcoming OpenEmbedded Presentation

Posted by Scott on Feb 9th, 2010

Next week I’ll be giving a presentation on OpenEmbedded at the Portland Linux User Group’s Advanced Topics meeting:

Getting started in embedded Linux development can be intimidating. Every hardware device vendor seems to have its own embedded Linux distribution and way of developing for it. OpenEmbedded (OE) is a framework for creating highly customizable embedded Linux distributions. It provides a well-designed build system and cross-compilation environment to developers, and a robust package management system for setting up and maintaining your embedded Linux system.

Find out why OpenEmbedded is taking the embedded world by storm and improving the lives of embedded Linux developers.

Feel free to join us at Roots Organic Brewing, 1520 SE 7th Ave in Portland, at 7pm on Wednesday, Feb. 17. We meet in a room toward the back of the building. I’ve noticed the acoustics of the place are pretty poor, so I’ll be borrowing a sound system to help improve the presentation.

Open Source Bridge Conference – One of the Best

Posted by Scott on Jun 22nd, 2009

From June 17 – 19 I attended the Open Source Bridge Conference in Portland. This was a relatively small, all-volunteer run event that really impressed me. The event was created in response to O’Reilly moving a couple of high-profile conferences out of Portland this year, including OSCon and RailsConf.

Open Source Bridge (OSB) focused on the use and development of open source software in many contexts. I really liked that several of the talks were on the theme of using open source in government and business, including making a living from working with open source software. Portland Mayor Sam Adams gave a one of the keynote talks, and I sincerely believe he “gets it” or at the very least wants to get it, and recognizes Portland’s unique positioning as a center for open source software developers to live and work.

I’ve been to a number of conferences before, from tiny ad-hoc “unconferences” such as BarCamp to huge O’Reilly ones such as RailsConf. I have to say OSB was one of the best events I’ve ever been to, and definitely trumps all of the other ones in terms of value. They focused on hosting the conference at a quality venue (the Oregon Convention Center) and had an outstanding 24-hour hacker lounge on the 23rd floor of the downtown Hilton. But to lower costs, they didn’t spend oodles on things that don’t really matter at events, such as catered lunches.

I am deeply grateful for the work of OSB’s organizers and am absolutely certain I’ll be back next year. I attended interesting and relevant sessions, got to meet some great people, and did so without having to spend several hundred dollars.

Here’s a video from the hacker lounge taken on the first night of the conference:

Killer SSH Tip

Posted by Scott on Mar 4th, 2009

I feel the need to spread this ssh tip that saves me from quite a bit of typing on a daily basis. I learned about it from Elliott’s OS X Tips and Tricks post on the Carsonified blog.

Add the following to your ~/.ssh/config file:

Host *
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p

Now when you ssh into a host, subsequent connections to that host use the same TCP socket, and don’t require authentication. This will be the case for as long as that initial connection stays open, and it works for sftp as well as ssh.

I realize another way of avoiding typing your password all the time is to use ssh keys, but I happen to work on embedded systems that get rebuilt very frequently and which I’m not able set up an ssh key as part of the build process. This technique allows me to log into the system once per session and not have to type the password over and over again.

« Prev - Next »

Blog Badges



[FSF Associate Member]

Archives