Fixing mirrorlist on Arch Linux Arm (Raspberry Pi)

I hadn’t updated my Raspberry Pi (a B+ model for my rpi-drd project) in about a year. Pacman -Syu kept complaining about being unable to find files on any of the mirrors.

So I, without thinking, ran reflector on an x86 host and copied it over. Oops. Now it definitely can’t find packages.

The website gave me the hostname I needed, but not the entire URL. Put this in your mirrorlist (as the sole entry) to restore functionality:

Server =$arch/$repo

Installing Arch Linux with an encrypted root

I’ve got a ThinkPad T410. I got it off craigslist in what was a somewhat shady transaction. Regardless, it came with a 300GB spinner. Not interested in finding out how much life was left on it I got a solid state replacement from NewEgg for “Cyber Monday”. A 240GB Intel one for $110, that’s less than 50 cents per GB!

The spinner has a single unencrypted partition with Arch Linux running on it. I wanted to run Arch on an encrypted partition. The main reason: If it’s ever stolen I don’t want to have to worry about any of the data on it. Bonus reason: Geek/spy points.

So, while there are excellent guides for installing Arch, and setting up encryption, and optimizing an SSD, there don’t seem to be any combining the three. In reality it’s not that much more difficult, and if you are motivated to setup encryption on Linux in the first place you probably know what you’re doing. Still, I was disheartened a bit at the lack of information so I decided to note how I went about it in general. Continue reading

Carduino 2.0 – Intel Galileo Setup

Out of the box the Galileo is setup to run sketches uploaded from volatile memory, which is really lame. I didn’t spend much time with it using the stock SPI kernel. So, an SD card is pretty much required to do any serious development with this board. This is not a bad thing (although you aren’t running in real-time anymore), since having a full OS to use has lots of advantages. Plus, this way I can automate the build process in a way I’m more familiar with. Continue reading

Arch Linux on Lenovo ThinkPad T410

I picked up a really cheap ThinkPad T410 from Craigslist. First-gen mobile Core i5, 4GB, 320GB drive and most importantly: 1440×900. A 40% increase in horizontal space (and 17% vertical). Finally I can tune without trying to get TunerStudio to fit.

Installing Arch was quick, as usual. The laptop has a fingerprint reader, which works really well in Linux. Now I can log in with a finger swipe–although you have to press enter after swiping.

The only thing I might change is swapping out the spinner disk for a SSD, since they are pretty cheap. I don’t like the idea of a disk in a moving vehicle.

Moving home server to Arch

I’ve ordered a 2 terabyte hard drive to appropriately serve as a backup drive for my home server. This would normally just require swapping the old backup drive out for it, and then performing a backup. But I figure since I’ll have it down anyway, I’ll have enough drives to swap to Arch Linux and get things going again with the old drive as a … backup.

I’ve got quite a few services setup on it, and I’m not looking forward to moving all the config files over

udev broke, server broke, router broke

I attempted to get a webcam going on our home server. So, I plug it in, and since I’ve done this before I ran a script I made to grab an image from the webcam. Which didn’t work. So, after checking out why (/dev/video0 node was missing), I noticed that the kernel no longer had support built in.

After going through the kernel options, I realized they changed the v4l and webcam support options around and since I just upgrade using “–silentoldconfig” (the bad way to do upgrades), it broke whenever I upgraded to 3.2.12. And 3.2.12 wasn’t in portage’s tree anymore, and I didn’t have the sources for it installed (mistake number 2), so I was pretty much SOL.

So I decided to upgrade. Remotely. 1500 miles remotely. Long story short, a udev upgrade swapped my network device names around and broke the internet on the reboot, and I had to wait until I was home to fix it. I kind of knew this was going to happen, but meh, I like to gamble.

It’s amazing how many config files have references to eth0/1 in them.

Now everything started to work normally again, except after purchasing a game on Steam, my router appeared to drop the connection during the download. As it turns out, the router was at 100% CPU and 99% memory, and I guess was just running out of memory and rebooting due to the download (2-3 MB/s). So, it looks like my internet is faster than my wireless router can handle.

It’s a WRT54G running DD-WRT, and I don’t see any firmware upgrades for it. But DD-WRT’s website is pretty whack, so who knows. I think I’m going to upgrade it in the future, if it keeps crapping out on me.

Home server is back online

I’ve pulled power and cable from the attic and just powered up the home server again. It’s been asleep for 5 months until now. I’ve just done an emerge –sync, and it took about 10 minutes to complete.

However, it went up without any problems, which is good. Considering I turned it off in a working state. I was tempted to backup all my config files and start fresh with, say, Arch Linux, but that would take all weekend. So, I’ll stick with Gentoo until I replace this aging 1.6GHz Atom server.

Well, now to start the long process of updating crucial services and resolving dozens of package conflicts. Fun!

Gentoo on a mid-2012 MacBook Pro

If your sick of your brand new MacBook just working (more or less), and you just feel like modifying your kernel’s source to get your computer to work right, you’ve come to the right place. I (finally) managed to get Gentoo booting on a new MacBook Pro (15″, Core i7, mid-2012) alongside OS X 10.8.2. I suppose it actually wasn’t that bad, it could have been much worse. I only had to reinstall OS X once after a wonky partition editor…. edited a little more than I wanted.

What I have in the end is a MacBook Pro that dual boots Gentoo Linux and OS X using rEFInd. Gentoo boots via EFI, I did not use a boot loader (in the traditional sense).

My first attempt–you know, the one where I left my backup drive at work, was a miserable failure from the get-go. I went with what I was reading online, to use a boot manager/loader. Specifically GRUB/GRUB2 (I tried both). Also I used rEFIt, which has a wobbly gptsync utility, that as far as I can tell, hosed my entire drive. I had even tried building a modified gptsync from source. Although, maybe it was gparted. Since I had problems with that on both occassions.

In either case, I couldn’t get gparted/parted to change the partition type to linux (0x83 or  82 or whatever it is). It kept reporting that the partition I created was ‘MSDOS’. And in both cases, I shrugged it off because as far as I know, the kernel doesn’t really care as long as it has the drivers to load the root filesystem’s actual type.

Where I went wrong in the first case was to attempt to use GRUB/GRUB2 to boot. I had heard that you could use rEFIt to load grub, and then grub would boot the kernel. I didn’t read a whole lot on EFI booting the kernel directly, so I avoided it. Trying this involved setting up the GPT tables along with legacy MBR tables, and then supposedly I had to ‘sync’ them to get rEFIt to see the new partition/OS. Since my OS X partition is encrypted, this caused problems with the gptsync utility. I followed these two guides which ended up in grub sort of working and OS X completely gone. Oops. I had a backup though.

So I retried it this weekend, convinced that with EFI (even Apple’s “EFI”), you shouldn’t need any boot manager or loader (other than the EFI program itself). A little more searching and I managed to get it to work. And this skips the whole gptsync fiasco, the GRUB mess, etc.

My first hurdle though, was getting the partitions right. I swear it was a bug in parted or something. Because the man pages online and the one’s on the minimal Gentoo CD were way different. Any attempts to run the command ‘mkpart’ with any of the FS type options would result in a partition with MSDOS type. I eventually just settled with that for reasons I mentioned earlier.

rEFInd seemed to ignore the command line options it’s own readme specified (specifically, ‘–esp’). So it ended up installing on the root of the OS X filesystem. I had the EFI (ESP) partition mounted at /boot, so I just moved the files there and re-ran the ‘bless’ command.

This is how I did it:

  1. Partition: Use disk utility to make a partition for Linux
  2. Install rEFInd
  3. Plug in to your network and reboot to Gentoo CD: I used gentoo-minimal-amd64
  4. Format the new partition: I chose ext4
  5. Obtain stage, initial package sources and unpack/install
  6. Configure and install kernel
  7. Reboot and pray
  8. BCM4331 wireless
  9. Fixing that annoying ‘applesmc: read arg failed’ kernel error message
  10. ethernet
  11. X, audio, etc.?

I now have a working Gentoo living along side OS X. It’s a pain to switch between them, since rEFInd takes ~20 seconds to show up on boot. Now if only I could get X and nvidia-settings to work well with an additional monitor that isn’t always present, I could do all my work on it.

Config Files

  • .config
  • make.conf
  • xorg.conf


QEMU on Windows

After fumbling around with various downloads and patches, I was able to find a working QEMU build for windows. I am running Windows 7 64-bit, and I wanted to run an ARM system (specifically, to develop for a Stratus plug computer). Before this, I was running a virtualized Ubuntu using VirtualBox and then running QEMU within that. Performance was not noticeably bad.

However, I had problems bridging the QEMU to the Ubuntu host, which was bridged itself. I stumbled upon a page about emulating a Rasberry Pi within QEMU on Windows. The QEMU download link there was the ticket.

Ignore the rest of the post there, all you need is QEMU. Using the kernel and ramdisk here (and instructions from here), you can install Debian on your ARM system.

To launch, first create or download a disk image. Then copy the qemu-system-arm.exe from the bin folder to QEMU’s root folder (it was easier than specifying the paths manually). Then, you can modify the last line in the batch file provided (qemu-win.bat):

qemu-system-arm.exe -M versatilepb -L . -m 256 -hda arm.img.backup -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -localtime -append "root=/dev/sda1"

That’s assuming your image and kernels are named as such. The kernel will crash if you try to specify more than 256MB of RAM, however building a custom kernel is now possible.

My next task will be to see if I can bridge the network interface. If not, I’ll go back and try the virtual virtual machine approach again–since appears to be faster anyway…

Winows(QEMU) vs Windows(Ubuntu(QEMU))