Author Archives: ryan

Preventing PXE Linux installation boot loop

If a system is set to boot from PXE first, if you have your pxelinux symlink pointed at your OS installer, after initial installation the system will reboot and go right back into the installer, over and over again, and you’re stuck in an install loop. To prevent that, host this PHP script on your provisioning system, and ensure the pxelinux.cfg directory is recursively owned by apache/nginx.


// Reset a symlink in /tftpboot/pxelinux.cfg to point to harddisk instead of normal OS install. So we don't get caught in a boot reinstall loop.
// Written by Ryan Gehrig, 12/9/2013
$ip = $_GET['ip'];
if(empty($ip)) die('No IP Address provided (?ip=x.x.x.x)! Exiting.');
if(!preg_match('/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/', $ip)) die('Invalid IP Address specified! Exiting.');
$pxe_dir = '/tftpboot/pxelinux.cfg';

$hex_ip = trim(exec('gethostip -x '.$ip));

// Only run this if there's already a symlink
if(!file_exists($hex_ip)) die('No symlink for this IP ('.$hex_ip.'), exiting.');
# Create new link to localdisk
echo exec("rm -f $hex_ip");
echo exec("ln -s localdisk $hex_ip");

Next, make sure apache or nginx owns the pxelinux files so the webserver can manage them.

chown apache: /tftboot/pxelinux.cfg -R

Lastly, in your kickstart file or AutoYast file, wget the install host/php script.

wget -q

Arch Linux – MacBook Air 2013

I found it very difficult to get Arch booting via EFI as all directions I found were inconsistent. You can also try REFind, as I was able to at least get that to boot up instead of my old broken grub prompt, but I got nowhere with Refind, so I went with reinstalling grub in this article. This is what my system currently uses. No MBR, grub is booted via EFI. For partitioning, you can use a 200MB HFS+ partition to store your EFI data, or you can use FAT32 (vfat). I went the VFAT route and it worked for me, so this guide assumes you have a VFAT partition for EFI, with the scheme like this:

[root@mac ~]# fdisk -l

Disk /dev/sda: 113 GiB, 121332826112 bytes, 236978176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: xxxx

Device Start End Size Type
/dev/sda1 2048 411647 200M Microsoft basic data
/dev/sda2 411648 935935 256M Linux filesystem
/dev/sda3 935936 9324543 4G Linux swap
/dev/sda4 9324544 236978142 108.6G Linux filesystem

I used the following to setup the filesystems:

mkfs.vfat -F 32 /dev/sda1
mkfs.ext2 /dev/sda2
mkswap /dev/sda3
swapon /dev/sda3
mkfs.ext4 /dev/sda4

mount /dev/sda4 /mnt
mkdir /mnt/boot

mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/efi

mount /dev/sda1 /mnt/boot/efi

Finish your installation according to the main guide (skipping anything after the bootloader), now chroot into your installation, and setup Grub:

arch-chroot /mnt

pacman -S grub efibootmgr

# The directory paths are everything here.
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck --debug
grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg
cp /boot/efi/EFI/grub/grub.cfg /boot/grub/grub.cfg

# Not necessary but hey, helped me out
cp /boot/efi/EFI/grub/grubx64.efi /boot/efi/EFI/boot/bootx64.efi

Note that above, –efi-directory means that grub will append a directory named “EFI” (caps, yes) to whatever you specify. As for –bootloader-id, this gets a directory created in the –efi-directory you specified, so in this example, it’d create the directory /boot/efi/EFI/grub.

If you need to wipe out your MBR for some reason, see this page:


Install broadcom-wl from the AUR: broadcom-wl

Then I installed wpa_supplicant and used netctl to configure my home wifi network, worked quickly and easily.


Speakers work perfectly with kernel 3.12.1 out of the box, no configuration needed. Just turn up the volume (I didn’t even use ALSA, just had pulseaudio). If you’ve read that they “still haven’t gotten audio working” on this macbook, ignore that. Linux kernel 3.12 fixes the inherent issues with this 2013 / 6.2 macbook air.

Easiest USB Audio Interface on Linux

After tinkering trying to get the Tascam US-122MKii working under Fedora, I gave up.  This thing does not follow standards, and the only driver which is provided by the community is for an older Tascam (US122L).

Thus far, the easiest plug-and-play USB audio interface I have found that works under Linux:

M-Audio MobilePre

M-Audio has a history of following standards, and many of their products work very well under Linux.  You can also try the M-Audio FastTrack, which is a more recent product.  This also should work easily under Linux.

How Does it work (Fedora 18)?

  • Plug in the USB cable
  • Start Qjackctl, select the MobilePre as the Input device on the right, start Jack.
  • Start Ardour2 to use the Jack connection, create a new track, record your song.

I did ZERO tinkering to get this working.  Didn’t have to load any modules manually, it just works.

Tascam US122MKii on Fedora 18

NOTE: After tons of tinkering,  I still am unable to get this device working on Fedora.  I had it working in the past with Gentoo and Arch with minimal efforts, but for some reason I just couldn’t get it going on Fedora.

If you want an interface you can just plug in and go with, get the M-Audio MobilePre (  I just bought one, plugged it in, set qjackctl to use it as an input, and boom, it works, no configuration or toying necessary.  This device only hits 48khz, vs the 96khz the Tascam gives, but hey, this thing is plug and play on Linux.

This is for a Tascam Us-122-mkII / MK2.

Install packages

yum install alsa-firmware alsa-tools-firmware alsa-tools alsa-plugins-usbstream alsa-plugins-pulseaudio alsa-plugins-jack jack-audio-connection-kit jack-audio-connection-kit-dbus

Plug in your US122MKii

At this point, you can plug in your USB Tascam device.  Give it about 5-10 seconds for the green USB light to come on at the top right.  If this light comes on, you are in business.

Reset modules

To be safe, I remove any loaded modules.

# rmmod snd_usb_us122l
# rmmod snd_usb_audio
# modprobe snd_usb_us122l

Now, check if you can see your card in /proc/asound/modules:

# cat /proc/asound/modules
0 snd_hda_intel
1 snd_usb_us122l

If you see the snd_usb_us122l, you’re all set.  If you don’t, just remove the module again (rmmod snd_usb_us122l ; modprobe snd_usb_us122l) and you can try the cat again.  Sometimes I have to remove / reload the module 2 or 3 times before it works properly, not sure why.  Make sure to unplug any other USB audio devices like a USB mic or headset so there are no conflicts.

Setup Jack

This is the command I use to run Jackd.  The important part here is the -Cusbstream:1 and the -Phw:0.  The 1 in usbstream:1 corresponds to the number you saw in the “cat /proc/asound/modules” for your mic, the input device.  The same goes for the hw:0, but that is for the output module (probably your main sound card).

jackd -v -r -u -dalsa -r96000 -p1024 -n2 -D -Cusb_stream:1 -Phw:0 -o2


I am not 100% sure if this is needed anymore, but for some reason, before I could only get things working if I had this file in place (in the file /root/.asoundrc).  So here it is:

pcm.!usb_stream {
@args [ CARD ]
@args.CARD {
type string
default "0"

type usb_stream

card $CARD

ctl.!usb_stream {
@args [ CARD ]
@args.CARD {
type string
default "0"

type hw

card $CARD

Hopefully that gets things going in the right direction.