Archive for category Mac

Macbook Pentoo update

I redid my Pentoo install and got rid of the two partitions and made just one. The instructions are pretty much the same but here they are updated slightly

  • Boot with Leopard DVD
  • Go into Disk Utility and create a 2 partition scheme. For my 160GB I chose 136GB for OS X and 14 for Pentoo. Make the OS X HFS + Journaled and the 14 GB FAT32.
  • I then exited Disk Utility and opened a terminal and typed diskutil list. In the output you should see /dev/sda1 as an EFI partition, /dev/sda2 as your HFS partition and /dev/sda3 as your FAT32 partition. The GPT EFI style systems can only support 4 primary partition and I don’t believe support extended partitions, so you are technically limited to 3 partitions
  • Then I rebooted, booting off the Snow Leopard DVD and installed Snow Leopard to the HFS partition
  • After Snow Leopard installed I downloaded and installed rEFIt. I then rebooted so I could verify that rEFIt was installed correctly
  • I then booted off the Pentoo livecd and logged into X.
  • Inside Pentoo I loaded GParted and removed the FAT32 Partition and created a ext4 (dev/sda3) partition.
  • I then rebooted and when at the rEFIt boot screen I dropped into the rEFIt command terminal and typed gptsync to resync the discs after using GParted
  • Then I rebooted again back into the Pentoo livecd.
  • Once booted for the second time into the Pentoo cd, I followed the simple installation instructions off the Pentoo site but basically I did the following
    mount /dev/sda3 /mnt/gentoo
    cp -Rf /mnt/livecd/* to /mnt/gentoo/
    rm -Rf /mnt/gentoo/etc; rm -Rf /mnt/gentoo/root
    cp -Rf /etc /mnt/gentoo/etc
    cp -Rf /root /mnt/gentoo/root
    cp -Rf /usr/portage /mnt/gentoo/usr/portage
    mount -t proc none /mnt/gentoo/proc
    mount -o bind /dev /mnt/gentoo/dev
    chroot /mnt/gentoo /bin/bash; env-update; source /etc/profile
    vi /etc/fstab
    All I set in there was /dev/sda3 for /boot and for /

    I found Lilo works best on my Macbook so I uninstalled Grub and installed Lilo

    emerge --sync; emerge -C grub; emerge -avt lilo

    I then edited a handful of configs in /etc/conf.d/
    Removed autoconfig from default runlevel

    rc-update del autoconfig default

    Add keymaps to default

    rc-update add keymaps default
    mv /etc/inittab.old /etc/inittab
    mv /etc/init.d/halt.sh.orig /etc/init.d/halt.sh
    passwd root

    I then edited my lilo.conf

    cat /etc/lilo.conf
    # Global LILO settings
    boot=/dev/sda3                            
    timeout=5              
    default=Linux  
    image=/boot/kernel-genkernel-x86-2.6.29-pentoo-r6
    label= Linux       
    root=/dev/sda3

    I then set eth0 to start on boot and configured my wireless and created an ath0 iface, ran lilo, set a password and unmounted.

    ln -s /etc/init.d/net.lo /etc/init.d/net.ath0
    /sbin/lilo
    exit; cd; umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo; init 6

    For my xorg.conf I set the following

    InputDevice "Synaptics"  "AlwaysCore"
    ...
    Section "InputDevice"
            Identifier      "Synaptics"
            Driver  "synaptics"
            #Option "Protocol" "event"
            Option  "Protocol" "auto-dev"
            #Option "Device" ""
            Option  "Device" "/dev/input/mice"
            Option  "LeftEdge" "1900"
            Option  "RightEdge" "5400"
            Option  "TopEdge" "1900"
            Option  "BottomEdge" "4000"
            Option  "FingerLow" "25"
            Option  "FingerHigh" "30"
            Option  "MaxTapTime" "180"
            Option  "MaxTapMove" "220"
            Option  "VertScrollDelta" "100"
            Option  "MinSpeed" "0.3"
            Option  "MaxSpeed" "0.50"
            Option  "AccelFactor" "0.080"
            Option  "SHMConfig" "on"
            Option  "TapButton1" "1"
            Option  "TapButton2" "3"
            Option  "TapButton3" "2"
            Option  "VertTwoFingerScroll"   "true"
            Option  "HorizTwoFingerScroll"  "true"
    EndSection

    I also installed xfce’s terminal cause URxvt is a pain in the ass with copy and paste and when it comes to increasing fonts and such.

  • 2 Comments

    Pentoo on the Macbook

    I bought Snow Leopard the other day and used it as an opportunity to wipe my current dualboot of OS X and Gentoo and dualboot with Pentoo. Below are the basic steps I took to get Pentoo installed as well as Snow Leopard. The only arduous parts are the OS X parts, the Pentoo installation is a breeze.

  • Boot with Leopard DVD
  • Go into Disk Utility and create a 2 partition scheme. For my 160GB I chose 136GB for OS X and 14 for Pentoo. Make the OS X HFS + Journaled and the 14 GB FAT32.
  • I then exited Disk Utility and opened a terminal and typed diskutil list. In the output you should see /dev/sda1 as an EFI partition, /dev/sda2 as your HFS partition and /dev/sda3 as your FAT32 partition. The GPT EFI style systems can only support 4 primary partition and I don’t believe support extended partitions, so you are technically limited to 3 partitions
  • Then I rebooted, booting off the Snow Leopard DVD and installed Snow Leopard to the HFS partition
  • After Snow Leopard installed I downloaded and installed rEFIt. I then rebooted so I could verify that rEFIt was installed correctly
  • I then booted off the Pentoo livecd and logged into X.
  • Inside Pentoo I loaded GParted and removed the FAT32 Partition and then created a 50mb ext2 partition (/dev/sda3) and the rest went to a ext4 (dev/sda4) partition.
  • I then rebooted and when at the rEFIt boot screen I dropped into the rEFIt command terminal and typed gptsync to resync the discs after using GParted
  • Then I rebooted again back into the Pentoo livecd.
  • Once booted for the second time into the Pentoo cd, I followed the simple installation instructions off the Pentoo site but basically I did the following
    mount /dev/sda4 /mnt/gentoo
    cp -Rf /mnt/livecd/* to /mnt/gentoo/
    rm -Rf /mnt/gentoo/boot; mkdir /mnt/gentoo/boot
    rm -Rf /mnt/gentoo/etc; rm -Rf /mnt/gentoo/root
    mount /dev/sda3 /mnt/gentoo/boot
    cp -Rf /mnt/livecd/boot /mnt/gentoo/boot
    cp -Rf /etc /mnt/gentoo/etc
    cp -Rf /root /mnt/gentoo/root
    cp -Rf /usr/portage /mnt/gentoo/usr/portage
    mount -t proc none /mnt/gentoo/proc
    mount -o bind /dev /mnt/gentoo/dev
    chroot /mnt/gentoo /bin/bash; env-update; source /etc/profile
    vi /etc/fstab

    I found Lilo works best on my Macbook so I uninstalled Grub and installed Lilo

    emerge --sync; emerge -C grub; emerge -avt lilo

    I then edited a handful of configs in /etc/conf.d/
    Removed autoconfig from default runlevel

    rc-update del autoconfig default

    Add keymaps to default

    rc-update add keymaps default
    mv /etc/inittab.old /etc/inittab
    mv /etc/init.d/halt.sh.orig /etc/init.d/halt.sh
    passwd root

    I then edited my lilo.conf

    cat /etc/lilo.conf
    # Global LILO settings
    boot=/dev/sda3                            
    timeout=5              
    default=Linux  
    image=/boot/kernel-2.6.29-pentoo-r6
    label= Linux       
    read-only                  
    root=/dev/sda4

    I then set eth0 to start on boot and configured my wireless and created an ath0 iface, ran lilo, set a password and unmounted.

    ln -s /etc/init.d/net.lo /etc/init.d/net.ath0
    /sbin/lilo
    exit; cd; umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo; init 6

    I haven’t done anything to the kernel, xorg.conf or my USE flags (doubt I will there) but if I find the need I will post the adjustments. I will need to set the right click function on my trackpad. But messing with my xorg.conf is one of those tasks I get easily annoyed with and setting mouse functionality is one of those things I can never remember and have to google around for it.

  • No Comments

    Killing time on the macbook

    A couple months ago I was tooling around on the mac causing some kernel panic dumps to see what info the dump file writes out. The panic file wasn’t overly cool, so it caused me to hunt around for more “interesting” items on my machine. Of course, the first interesting item I looked thru was the laptop memory. Unlike a lot of OS X’s Unix brethren, the memory device files aren’t enabled in the kernel so you have to enable them and reboot.

    root# nvram boot-args="kmem=1"

    After reboot, I dumped the memory to a file which took about 67 seconds for my 2GB of ram. I’m not sure what the Bad address issue is. I haven’t looked into it but it still dumps the file.

    root# dd if=/dev/mem of=/var/root/memdump bs=1024
    dd: /dev/mem: Bad address
    2097152+0 records in
    2097152+0 records out
    2147483648 bytes transferred in 67.244043 secs (31935671 bytes/sec)

    Then I filtered out the “readable” stuff by just running strings against it, only grabbing the ascii strings 4 characters or greater.

    strings -n 4 memdump > memdump-ascii

    Like memory dumping on other OS’es, there isn’t anything new here but they are always some useful and interesting items to browse thru and reading the memory is always worth a look but I moved on and started to poke around at other files. In my case the hibernation file and the swap files were pretty juicy, definitely better than my memory dump.

    # cd /var/vm/
    # strings -n 4 sleepimage > sleepimage-ascii
    # strings -n 4 swapfile0 > swapfile0-ascii
    # strings -n 4 swapfile1 > swapfile1-ascii

    Reading the sleepimage-ascii file I was able to find my regular account and the root user passwords, plus a ton more interesting things.
    The swapfile had some cool items too. I noticed some MobileMe calls. I am not sure what kicked off the MobileMe since I don’t use it and believe I have disabled it in iTunes and such but this was a fairly new installation so it could have been pre-configuration leftovers. But I do wonder, does this mean if I had a MobileMe account the password could show up in the swapfile? I might have to sign up for MobileMe and give it a whirl.

    http://www.apple.com/SyncServices
    Failed to login to account: %@
    initWithCredentials: username is missing!
    /SourceCache/DotMacSyncManager/DotMacSyncManager-308/src/SMSession.m
    initWithCredentials: password is missing!

    While the panic file created using dtrace was a little disappointing it got me thinking of “evil” uses of it. I’ve been to my local Apple store a lot lately, so I started envisioning all their demo machines crashing at the same time every day but that wouldn’t be too cool and everyone I have dealt with at the store is pretty cool, so I wouldn’t want to tick them off. Doing this to a friend on the other hand might but worth the repercussions. Not that I would do such an immature thing but let’s say you wanted to mess with your friend’s bright and shiny macbook here is what I would do. Depending on your typing skills you might need 5-10 minutes alone with the laptop. First reboot the laptop and enter into single user mode by pressing the Command (Apple) key + s (or F2 if using refit). Once in single user mode create a little script to run in OS X’s crontab replacement, launchd. I like calling a script instead a specifying the program and arguments in the launchd task because I always find it easier to troubleshoot if something isn’t working nicely.

    # vi evil.sh

    In the script add the following and then change the perms to be executable.

    #!/bin/bash
    dtrace -w -n "BEGIN{ panic();}"
     # chmod 700 evil.sh

    Next create a plist file (an overly complex xml file just to add a cronjob) in the LaunchDaemons dir, putting it in the LaunchDaemons dir will allow it to execute during it scheduled time without the need for a particular user to be logged in.

     # cd /Library/LaunchDaemons
    # vi com.apple.evilcron.plist

    In the plist file add

        Label
        com.apple.evilcron
        ProgramArguments
       
            <string/var/root/evil.sh
       
            StartCalendarInterval
             
            Minute
            60

    Then initiate the newly created plist file.

     # launchctl load com.apple.evilcron.plist

    Now every 60 minutes the laptop will kernel panic causing a hard reboot.
    While you are in single user mode and if you have the time, you might as well have some more fun with their laptop and poke thru the swapfile and sleepimage. You could also enable the memory device driver file so you can poke thru there but you would need to reboot.

     root# nvram boot-args="kmem=1"

    Kernel Panic

    No Comments