Thursday, August 4, 2016

Using Arch Linux as router/firewall on the Raspberry Pi3


The last post I explained how I got a Raspberry Pi3 to work as a wifi router/firewall using Gentoo Linux. So this post I will explain how to configure Arch Linux on the RPI3.

OS Install

There is no downloadable images for the RPI at the official Arch Linux site. The ARM port for Arch is maintained independently at the Arch Linux ARM site. The instructions for setting the SD card for the RPI3 are pretty simple and straightforward. The only addition there is needed is to add the following lines to the /boot/config.txt file if you want to use a serial console.

core_freq=250
dtoverlay=pi3-miniuart-bt

The RPI3 should boot normally and if you are using a serial console there should be no issues. Once Arch boots update your system by entering pacman -Syu. It should not take long then proceed to setting up the interfaces.

Interface Configuration

The documentation to set up the network interfaces can be found here. These are the steps.

First cd to the /etc/systemd/network directory. There you see a file called eth0.network. This file controls how the interface is set up. Remember that the RPI3 changes its MAC address after every reboot. So this part needs to be added to the file to prevent this.

[Link]
MACAddress=current mac address

The current mac address can be found with the command ip link. Then to set up the wlan0 interface, make a copy of the eth0.network file and call it wlan0.network with cp eth0.network wlan0.network. Next make the following changes.

[Match]
Name=wlan0

[Network]
Address=192.168.0.1/24 or whatever ip scheme you choose

[Link]
MACAddress=current mac address

Finally reload the systemd-networkd servivce with the command systemctl restart systemd-networkd and the wlan0 interface will come up.

Networking, DHCP, and DNS Configuration

In order to enable networking copy the /usr/lib/sysctl.d/50-default.conf file to /etc/sysctl.d/ directory. Then add these lines at the end.

# Enable routing
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1

Restart sysctl with sysctl -p /etc/sysctl.d/50-default.conf and routing is enabled.

I used dnsmasq for both DHCP and as a local DNS resolver. Install the package by entering pacman -S dnsmasq. Then take the default /etc/dnsmasq.conf file and back it up with mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak. Create a new /etc/dnsmasq.conf file and add the following.

dhcp-range=wlan0,192.168.0.10,192.168.0.250,72h
interface=wlan0

If you try to start the service now it will fail. This is because systemd has it own resolver that will conflict with dnsmasq. This needs to be disabled before you proceed by doing this.

systemctl stop systemd-resolvd
systemctl disable systemd-resolvd

Afterwards add these lines or similar to /etc/resolv.conf

nameserver 208.67.220.220
nameserver 208.67.222.222

Finally you can enable dnsmasq.

systemctl enable dnsmasq
systemctl start dnsmasq

Hostapd Configuration

Install hostapd with  pacman -S hostapd. Then like with dnsmasq make a backup of the default config file and create a blank one and add the following.

interface=wlan0
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=1
country_code=US
ssid=ssid
auth_algs=1
rsn_pairwise=CCMP
wpa=2
wpa_key_mgmt=WPA-PSK  
rsn_pairwise=CCMP
wpa_passphrase=password

Then enable the service.

systemctl enable hostapd
systemctl start hostapd

iptables Configuration

The setup of iptables is pretty similar to what was done on the Gentoo post with some differences. Here are my rules.

iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -I INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i wlan0 -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT
iptables -I FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -i wlan0 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

These rules need to added to the /etc/iptables/iptables.rules file or systemd will not start the service. This is done with the command iptables-save > /etc/iptables/iptables.rules. Then enable the service.

systemctl enable iptables
systemctl start iptables

This should be all you need to get the RPI3 working as a wifi router with Arch Linux.

Final thoughts on systemd

Arch Linux uses systemd as its init system. It is a significant change from the init systems found in other Unix operating Systems (ie the BSDs) as well OpenRC that Gentoo Linux uses. A lot has been written over the change to systemd and the benefit or hurt it has brought to Linux. If you want to read more on it a simple google search will suffice. Here are some of  my thoughts. I have set up routers/firewalls both physical and virtual using Gentoo, FreeBSD, NetBSD, and OpenBSD. In everyone of these OSs the init system did not get in my way. Setting up the services was straightforward, the documentation was easy to find and digest. I did not have that experience with systemd. As a Linux user when the Distros I used moved to systemd, I really did not see what all the fuss was about. I heard how some sysadmins were just not happy at how systemd was in their words 'taking over everything'. It wasn't until I tried to set networking on a distro that used systemd that I began to see their point. Systemd really does reach into a lot. It has its own local resolver that you need to disable if you want to set dnsmasq. The Arch Linux Router page on the wiki does not tell you this or at least let you know how to check beforehand. Setting up the interfaces was not straight forward. Should I use netctl or systemd-networkd? I want to be fair. Once I sifted through the docs I was able to get everything work. Now if I need to do this again I can go through the steps fairly quickly. However with other init systems there was very little sifting needed (if any) and I did not run into the gotchas that I did with systemd. I am not trying to be a systemd hater, what I am saying is that is very different. As systemd grows in adoption makers and administrators of Linux based network appliances will probably need relearn how to set up their systems. 

Tuesday, August 2, 2016

Making a router/firewall with Gentoo and Raspberry Pi3


I have small growing collection of Raspberry Pi2s and 3s to tinker with. ARM SoCs (System on Chips) are low powered yet very resourceful machines. I find these boards really neat to work on. I will show how to take a RPI3 and turn it into a wifi router. I chose the RPI3 over the RPI2 b/c the RPI3 has integrated wifi. The RPI2 needs a USB wifi dongle, which means it is competing with the ethernet port since USB and ethernet share the same system bus. The RPI3 has a separate bus for the integrated wifi which means better performance.

OS Install

Since I am big fan of Gentoo Linux I chose it as the OS for my router. The Gentoo Wiki has fantastic documentation and was a tremendous help in getting the router working. There is a quick start guide in the wiki that will get your SD card ready.

I use a serial console to access the device. Now since the RPI3 has bluetooth there extra work needed to get console access via serial. This has been documented here. Gentoo needs the following.

First you have a /boot/cmdline.txt file with the folllowing:

gentoo-rpi3 rican-linux # cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

Then you need a /boot/config.txt file with the follwing:

gentoo-rpi3 rican-linux # cat /boot/config.txt
# See /boot/overlays/README for all available options

gpu_mem = 64
core_freq=250
dtoverlay=pi3-miniuart-bt

Finally you need to edit the following section of the /etc/inittab file

# SERIAL CONSOLES
s0:12345:respawn:/sbin/agetty -L 115200 ttyAMA0 vt340
#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100

#s1:12345:respawn:/sbin/agetty -L 9600 ttyS1 vt100


With these files in place you should be able to insert the SD card, connect the serial console to the GPIO pins and the OS should boot.

Initial setup

Once you are in you will want to set a root password and update the system. Before the update is performed be sure /etc/portage/make.conf is set the way you want it. Here is my setup:


gentoo-rpi3 rican-linux # cat /etc/portage/make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
CXXFLAGS = "$ {CFLAGS}"
MAKEOPTS="-j2"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.
CHOST="armv7a-hardfloat-linux-gnueabi"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C

Then execute the following commands

emerge --sync
Emerge -avuND @World

This should take a while since Gentoo compiling all the packages from source. Once this is completed you will need to install the linux-firmware package. This is done by typing emerge -av linux-firmware. Finally reboot.

Wireless and Ethernet interface setup

Once Gentoo reboots verify the wireless interface is recognized by entering ifconfig -a. If there is no wlan0 interface then run the following command dmesg |grep brcmfmac. If you see the following then the kernel is not loading the proper firmware:

[    8.963114] brcmfmac_sdio mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.bin failed with error -2
[    9.968646] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[   10.978751] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50

If this occurs first verify that wireless firmware is in the /lib/firmware/brcm directory. If the files are there then try reloading the kernel module. This by done by entering the following commands:

modprobe -r brcmfmac
modprobe brcmfmac

Then run ifconfig -a again to see if wlan0 is recognized. If not then download and install the latest brcm firmware files from the RPI github site. Once the the files are copied to /lib/firmware/brcm reload the kernel module again. The wlan0 interface should be recognized.

Now it is time to configure networking. Gentoo use OpenRC as its init system. OpenRC uses the /etc/conf.d/net file to manage the network interfaces. I will post my config file and then explain:

gentoo-rpi3 rican-linux # cat /etc/conf.d/net
# Set mac address on interfaces
mac_eth0 = "b8: 27: eb: 25: 89: 1e"
mac_wlan0="b8:27:eb:70:dc:4b"

# wlan0 settings
modules_wlan0="!iwconfig !wpa_supplicant"
config_wlan0="192.168.0.1 netmask 255.255.255.0"

The first section sets the mac address of the interfaces. The RPI3 assigns a new mac address to the interfaces after every reboot. This first section will keep that from happening. The next section defines the wlan0 interface.

The first line is what is needed to set wlan0 as an AP. The second line set the ip address of the interface.

Before we activate the interfaces verify that the /etc/resolv.conf is not symlinked to the resolv.conf file found in /lib/systemd by typing ls -l /etc/resolv.conf. If this is the case then unlink the file by typing unlink /etc/resolv.conf.

Finally activate the interfaces.

cd /etc/init.d
ln -s net.lo net.eth0
ln -s net.lo net.wlan0
rc-update add net.eth0 default
rc-update add net.wlan0 default
/etc/init.d/net.eth0 start
/etc/init.d/net.wlan0 start

DHCP, DNS, and Hostapd configuration

A simple dhcp server to use is dnsmasq. It is installed by entering emerge -av dnsmasq. When you install the package there is a default dnsmasq.conf file created in /etc.  Make a backup of the file with mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak.  Now create a blank config file with nano -w /etc/dnsmasq.conf and something similar to what is below.

gentoo-rpi3 rican-linux # cat /etc/dnsmasq.conf
dhcp-range=wlan0,192.168.0.10,192.168.0.250,72h
interface=wlan0

This will take care of both dhcp and dns setting for users who join the AP. 

AP configuration is controlled by hostapd. Installing the daemon is done by  typing emerge -av hostapd.  Like dnsmasq create a backup file for the /etc/hostapd/hosapd.conf file. Here is sample of the config file.

gentoo-rpi3 rican-linux # cat /etc/hostapd/hostapd.conf
interface=wlan0
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=1
country_code=US
ssid=ssid
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK  
rsn_pairwise = CCMP
wpa_passphrase=password

Finally enable these services.

/etc/init.d/dnsmasq start
rc-update add dnsmasq default
/etc/init.d/hostapd start
rc-update add hostapd default

iptables set up

If someone wants the RPI to have the ability to NAT and packet filter then iptables is the tool. It will allow through a series of rules to allow, block, NAT and host of other features that Gentoo has documentation on its iptables wiki, Security Handbook, and Home Router wiki. Iptables is very powerful so be careful when you are editing policies via ssh or you will kick yourself out. For the initial setup I would recommend doing it from the serial console and then testing your rules before saving.

The first thing to do is clear iptables and the nat table before starting. This is done by doing the following.

gentoo-rpi3 rican-linux # iptables -F
gentoo-rpi3 rican-linux # iptables -t nat -F
gentoo-rpi3 rican-linux # iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination      

Chain FORWARD (policy DROP)
target     prot opt source               destination      

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination      
gentoo-rpi3 rican-linux # iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination      

Chain INPUT (policy ACCEPT)
target     prot opt source               destination      

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination      

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination

The first two commands clear the table and second two lists the table. Now that it is verified that the tables are flushed lets begin.

We will is setup packet filtering then move on to NAT. Defining the default policy for the 3 chains that iptables uses is the first thing to do. These chains are INPUT, FORWARD, and OUTPUT. The INPUT chain controls what traffic is allowed to connect to your firewall. FORWARD controls what traffic you allow through the firewall. OUTPUT controls what traffic the firewall sends out. This is how you set this up.

gentoo-rpi3 rican-linux # iptables -I INPUT -p TCP --dport ssh -i eth0 -j ACCEPT
gentoo-rpi3 rican-linux # iptables -P INPUT DROP
gentoo-rpi3 rican-linux # iptables -P FORWARD DROP
gentoo-rpi3 rican-linux # iptables -P OUTPUT ACCEPT
gentoo-rpi3 rican-linux # iptables -vL
Chain INPUT (policy DROP 19 packets, 1729 bytes)
 pkts bytes target     prot opt in     out     source               destination      
  423 28968 ACCEPT     tcp  --  eth0   any     anywhere             anywhere             tcp dpt:ssh

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination      

Chain OUTPUT (policy ACCEPT 135 packets, 13152 bytes)
 pkts bytes target     prot opt in     out     source               destination

If you were doing this via the serial console then the first (which allows ssh traffic to the eth0 interface) rule could be entered later. However if you were editing your policy via shh coming in on the eth0 interface, then you need to add this rule before you lock down your policy. I set the INPUT and FORWARD policies to DROP and the OUTPUT policy to ACCEPT. This setting will mean that any connection that I want to allow to the firewall or through the firewall I need to define or else the firewall will drop it. However any connection the firewall sends out will be allowed.

Now that the default policies are set we can set out access rules.


gentoo-rpi3 rican-linux #iptables -I INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
gentoo-rpi3 rican-linux #iptables -I INPUT 1 -i wlan0 -j ACCEPT
gentoo-rpi3 rican-linux #iptables -I INPUT 1 -i lo -j ACCEPT
gentoo-rpi3 rican-linux # iptables -I FORWARD -i wlan0 -s 192.168.0.0/255.255.255.0 -j ACCEPT

gentoo-rpi3 rican-linux # iptables -A FORWARD -i eth0 -d 192.168.0.0/255.255.255.0 -j ACCEPT
gentoo-rpi3 rican-linux # iptables -vL
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination      
  624 48671 ACCEPT     all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere          
  111  7392 ACCEPT     all  --  wlan0  any     anywhere             anywhere          
 4298  305K ACCEPT     tcp  --  eth0   any     anywhere             anywhere             tcp dpt:ssh

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination      
 1338 82115 ACCEPT     all  --  wlan0  any     192.168.0.0/24       anywhere          
  136 82600 ACCEPT     all  --  eth0   any     anywhere             192.168.0.0/24    

Chain OUTPUT (policy ACCEPT 47 packets, 5574 bytes)

These rules allows the wlan0 network (192.168.0.0/24) to pass through the firewall to anywhere. Now to access the public internet, the local network (192.168.0.0/24) needs to be hidden by the public ip address of your router/firewall (in this case eth0). This is done through a process call Network Address Translation (NAT). When an entire network is translated into one public address this is called Dynamic NAT or Hide NAT. The setup is pretty simple.

gentoo-rpi3 rican-linux # iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
gentoo-rpi3 rican-linux # iptables -t nat -vL
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  all  --  any    eth0    anywhere             anywhere 

The NAT table has two additional chains PREROUTING and POSTROUTING. PREROUTING defines how the router/firewall will nat the traffic before it makes it forwarding decision. POSTROUTING defines how the router/firewall will nat the traffic as its being forwarded out the device. Since a Hide NAT is for outbound traffic it is added to the POSTROUTING chain.

Now just add your devices to the wifi network and you should have connectivity. If you want to see what devices are on your wifi network run the command iw dev wlan0 station dump.

UPDATE I: I forgot to explain how to save your iptables changes so they will be persistent after reboots.


/etc/init.d/iptables save
rc-update add iptables default

UPDATE II: You will need to enable routing by adding the following lines to /etc/sysctl.conf then running the command sysctl -p.

net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1


Tuesday, July 5, 2016

Living the Gentoo life!


It was a while back when I did my Gentoo review on my iBook G4. I was really liked how well it performed but the one drawback was the compile time. Well I have decided to run with Gentoo again. This time I am using my PowerBook G4 (it is back from the dead!!) and my PowerMac G5. It has been a few weeks and it has been both challenging and fun. Pretty much everything I did in my previous review was the same but I would like to take some time and go over some specifics.

Kernel Compiling

When it comes time to compile your kernel, there are two commands that will give you what you need to have a bootable kernel. Then you can go in and make your tweaks.

G3 and G4 machines use: make pmac32_defconfig
G5 machines use: make g5_defconfig


Now that you have your base kernel you can use make menuconfig to make your needed edits. Be sure to follow the Gentoo PPC FAQ for the graphics and sound sections. If you follow that then you should be ok with the kernel. If I would have started using defconfigs from the begging I would have saved hours of work!

Yaboot

The latest version of yaboot is broken and if you try to use to install the boot loader you will not be able to boot. Thankfully the version of yaboot on the live cd works fine and here is how you use it.

First you need to have your fstab file set up. The PPC:Handbook's filesystem section covers this well. At this point of the install you are still chroot in you new enviroment, now you are going to leave by entering exit. Once you are out to set up yaboot use this command: yabootconfig --chroot /mnt/gentoo. Just answer the questions provided and you should have a working yaboot.conf file. Finally since this will be the inital load you will enter this: mkofboot -v -C /mnt/gentoo/etc/yaboot.conf. Now you should be ready to boot. If you do run into issues booting into your system, go back into the live CD and edit the device section of yaboot.conf and set it to hd:. Then reload with ybin -v -C /mnt/gentoo/etc/yaboot.conf. This should be the only change you need.

Final Thoughts

Living in Gentoo has been a lot of work. As time permits I will be sharing some of the challenges I ran into. Yet I must say I have really come to love living in Gentoo. I have learned so much about how Linux works as an OS just by using Gentoo and getting to work on my PowerPC machines. Yes the compile times are sometime long (I left it running overnight to build xorg and xfce). However what you get in the end is a system that you can truely say you built from the ground up. There is a level of satisfaction with that.

Friday, January 29, 2016

Lubuntu 16.04 Alpha 2 is out with LXQT awesomeness!



I have been wanting to test out LXQT for ages. So far it is not in the Debian repos for PowerPC. Thanks to the developers over at Lubuntu that time is now!

So with the release for 16.04 Alpha 2 you too can have LXQT running on your PowerPC iBook or PowerBook. You can find the instructions here and a special thanks to Walter Lapchynski of the Lubuntu Team for using my screenshot. I will post some more below.

I really like the design of the DE plus Lubuntu has added more options to customize it as well. For example they added the LXQT Configuration Center. From there you can do things like edit your keyboard shortcuts. This is a nice change from editing files in vi. Also using compton just adds that nice compositing effect that make DE look even better.

It is still buggy is some areas. The window to manage the panel does not always pop open, two finger scrolling with the trackpad does not work on the windows or Qupzilla. Video playback works but it still more resource heavy than Debian. However some of these should not be an issue if you running a Powermac.

Please give Lubuntu a test drive and go to the QA ISO Tracker, from there run some of their tests and post your results. This is how we keep PowerPC supported under Linux.




Sunday, November 22, 2015

Video Playback on PowerPC Linux


In my testing of Lubuntu and Ubuntu-MATE on my iBook G4 one things that I notice often is that when playing back video using mpv my overall CPU usage spike to the high 90s. The fan on my machine start spinning really loud and fast. I thought I would do a comparison of with Debian to see how they compare. Here are some of my findings.

Machine

iBook G4
1.42 GHz CPU
1.5 GB RAM

These findings are based on lxtask

LXDE and Openbox

Overal CPU average 50%-60%
MPV process 30%-40%
RAM 140MB

The fans not once came one and there only brief spikes to 80%-90% CPU usage.

XFCE

Overal CPU average 70%-80%
MPV process 30%-40%
RAM 240MB

Even with the higher numbers due to XFCE being a heavier desktop than LXDE, video playback did not cause my fans to run. As much as I love Ubuntu based distros Debian is by far the better performer. I believe a lot of it is due how I set up Debian. When I installed the system I manually chose what applications and services were installed on my machine. Ubuntu on the other hand chooses for you what comes with the desktop. The advantage to this is you get a compete working system pretty easily. The cost of this is have a performance hit. On newer machines this may not be a big deal but on older G3 and G4 PPC machines it is a great deal. You get no more than 2GB of RAM on some machines, and a single processor for the iBooks and PowerBooks. I would never say stop using Lubuntu or Ubuntu-MATE, however give Debian a try. Yes it will take some more work than Ubuntu, however the benefits of running it are great.

Thursday, November 12, 2015

Testing Lubuntu 16.04 Xenial Xerus


Now that Wiley has been released, development for Ubuntu 16.04 (Xenial Xerus) has begun. Daily images have already been posted. Both Lubuntu and Ubuntu-MATE have PowerPC images ready for testing. People over at the UbuntuForums have alreasdy begun testing the new images. Also there was hope that the radeon r300 bug was fixed if you looked at the Mesa 11.0.3 release notes. Xenial as of now comes with the Mesa 11.0.4 package. So here are my initial thoughts.

Install

The install was pretty standard. There was nothing that stood out and to be honest this is a good thing. The installer should ask you the questions the app needs to build the system according to what you have requested. I noticed in Wiley that section the manages setting the timezone was broken and you needed to set the timezone after install. This has now been fixed.

Desktop

The desktop had a realy nice default look to it. I made the panel dark using the Lubuntu-Dark theme. The panel apps I tried worked as well. I noticed in 14.04 that the weather panel app did not work. Now in 16.04 it is working. The system resource monitor worked as well. I like seeing the CPU and RAM usage plus the app launches lxtask when you click on it. A lot of the default apps that normall come with Lubuntu were not installed but this is something I expected since it is so early in development and there maybe changes as to what ships in the final release.

Graphics

Sadly eventhough Mesa has stated this bug to resolved it is not the case. You cannot get 3D acceleration with radeon r300 driver with a default depth of 24. Graphics rendering has been an issue for PowerPC since moving to KMS. It is not a show stopper in using Linux on PowerPC, but it is annoying.

Browsing the Web

Firefox worked as expected. I install Midori, Qupzilla, Luakit, and Surf as well. Midori works great! It looks like even downloading files is working better. In the past there were times when that feature would crash. It is really good to see improvement there. Also uploading files is working as well. Luakit has gotten a little buggy. There were times when the browser crashed when I used it. It is something I have seen in 15.10 and I know there is an open bug report on it. Qupzilla has issues when trying to scroll down using the touch pad. Other than that it ran pretty well. Running Surf showed no issues that i could see.

My first impression of Lubuntu 16.04 are pretty optimistic. I will be checking in on it when the Alpha and Beta releases come to see how the distro is doing under PowerPC.



Friday, October 16, 2015

Linux from Scratch Journey part 1


I have installed both Gentoo and Arch Linux in VMs and real hardware. Both are the most customizable Linux distros I have worked on. You basically get a bash shell and build from there. However if you really want a customizable version of Linux that you can say you built then you should take the plunge and try Linux from Scratch.

Linux from Scratch (LFS) is a version of Linux that is built completely from source. What you get from LFS is a document that walks you through how to build your system. I just finish the section where you build your temporary tool-chain that you will use the build the system. The instructions were great. So long as you follow them exactly you should be fine. I am right now building an x86_64 based system, however depending on how successful I am I may try to build a PowerPC version on my iBook G4.

I will be adding posts as I work through LFS. Document both the success and issues that may arise.

Tuesday, October 13, 2015

First dive into BSD land


So I have spent the last few months working through FreeBSD and OpenBSD on my iBook G4 to see how well PowerPC is supported. It has been a mixture of challenge and frustration. I was hoping to make way more progress than I did, but in the future I hope to press on and report better news.

FreeBSD on PowerPC

The one thing that I really like about the BSDs is their initial installs are extremely simple and straightforward. Just like Gentoo, FreeBSD has a handbook that guide you though the set up. The documentation there is fantastic. FreeBSD uses a ports system for installing packages. This means compiling from source everything that is not in the base system. They do have precompiled binaries to install but they are not available for PowerPC. This is where things got really frustrating.

If you want to install Xorg on iBook G4 with a 1.42 Ghz CPU be prepared to wait for at least 2 days to compile. YES TWO DAYS! This is mostly because the process halts when it needs into install a dependency and it will ask if you want the default settings for do you want to change them. Then it will start to compile and install the dependency before it actually install the package you want. If a package has multiple dependencies then you can see why it takes so long.

There were ports that simply crashed and would not build. Packages like drm for graphics and even firefox would either fail to build or require some work to get going. I eventually got XFCE going but I needed to disable hardware acceleration and I had no browser to access the web. I never got chance to work on wireless access. Maybe sometime in the future.

So for a headless server FreeBSD could be used on PowerPC but there is a lot of work that needs to be done before I could recommend as a DE.

OpenBSD on PowerPC

OpenBSD uses a FAQ as their means of documentation. Like the FreeBSD handbook it is a great source of information. The install like FreeBSD was fairly simple. The one area I would recommend you deviate from the defaults is the disk partitioning section. The installer will recommend a partition scheme for you. This scheme creates multiple small partitions for /boot, /home, /usr, etc. The issue is that the chances for a partition (especially /usr since that is where the ports tree ends up) to get full pretty quickly. So I recommend doing a custom layout and have a swap and root partition only. You can find more info on to set up disks in OpenBSD here.

One advantage that OpenBSD has over FreeBSD is their precompiled packages are available for PowerPC. OpenBSD actually prefers you to install their packages over compiling ports. This is from their section in the FAQ on packages and ports,


IMPORTANT NOTE: The ports tree is meant for advanced users. Everyone is encouraged to use the pre-compiled binary packages.

OpenBSD also has Xorg as part of its base system which is a huge help in setting up the DE. I was able to get lumina and xfce working but there was some performance issues that need to be worked on. It looks the radeon r300 driver is supported under 5.8 (current), which is set to release soon.

Apart from a DE, OpenBSD is superb platform for networking. Setting up OpenBSD as a simple router/firewall is pretty straight forward. OpenBSD's pf is an amazing packet filter. There are also plenty of great packages that will help turn OpenBSD into a pretty powerful application layer firewall. I have been really enjoying learning this aspect of OpenBSD even if it is not strictly PowerPC related.

I have yet to try out NetBSD and it is on my list. I will post more on BSD as time permits.

Sunday, October 11, 2015

turning off ipv6 under Linux


Anyone familiar with networking know that the available number public ipv4 addresses is pretty much dried up. So as time goes on the move to ipv6 will only grow. However at least in parts of the US home users may not want to switch just yet. My local provider has ipv6 enabled but the performance is horrible. Pages and downloads simply drag or just stalls. Since the OS will prefer ipv6 over ipv4 when available the only option is to disable it. First check to see if you are receiving an ipv6 address by pulling the interface info from terminal

rican-linux@xubuntu-MacBookPro:~$ ifconfig wlp3s0
wlp3s0       Link encap:Ethernet HWaddr
                   inet addr:10.10.1.20 Bcast:10.10.1.255 Mask:255.255.255.0
                   inet6 addr: fe80::225:ff:fe4f:4961/64 Scope:Link
                  
inet6 addr: 2602:306:8b30:a310:225:ff:fe4f:4961/64 Scope:Global
                  
inet6 addr: 2602:306:8b30:a310::43/128 Scope:Global
                  
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
                   RX packets:41182 errors:0 dropped:0 overruns:0 frame:624154
                   TX packets:21081 errors:0 dropped:0 overruns:0 carrier:0
                   collisions:0 txqueuelen:1000 
                   RX bytes:36444300 (36.4 MB) TX bytes:2165921 (2.1 MB)
                   Interrupt:21



Now to disable ipv6 globally you will need to add this statement to the end of the /etc/sysctl.conf file, net.ipv6.conf.all.disable_ipv6 = 1. Then run the command as root sysctl -p /etc/sysctl.conf. This will disable ipv6 on your system.

Hopefully in time as more places have better ipv6 support this option will not be needed.

Martin Winpress helps keep PowerPC going with Ubuntu-MATE


A great thank you needs to go out Martin Winpress.  First he is part of the team that has given PowerPC users another great Desktop Enviroment to choose from with MATE. Second he has produced a solid distro that has PowerPC support in Ubuntu-MATE.

15.04 was a horrible release for PowerPC under Ubuntu. The release came with a version of xorg that was broken under PowerPC. Many users in the Ubuntufoums were really worried about weather or not it would be fixed. Then the same bug hit Sid right after Jessie was released. Thankfully it was fixed in Debian and the fix made it in time for the 15.10 release of Ubuntu-MATE.

Another fix that made it to Ubuntu was the javascriptcore-gtk bug that crashed browsers like midori and luakit. Now you can browse the web with these lightweight browsers under Ubuntu.

The install for users with the radeon r300 driver is the same as I documented here. Sound, wireless, video playback all worked. One issue I saw and this is because I was testing on my iBook G4 is when you play video with mpv the fans kick off after a minute. This does not happen on my PowerBook G4, but it has a slightly better video card and CPU.

There was an issue with powerd crashing when I plugged in my iPhone, but it looks like that issue has been resolved.

One of really great features that come with this version of Ubuntu-MATE is an app developed by Martin called MATE Welcome. This tool gives you access to documentation, access to the community pages, and allows you to install apps.  You can find more info here.

Another tool is MATE Tweak. It allows to change your window manager without having to logout and back in. It also allows to change your DE layout to with a selection of options. If you like a traditional Windows feel then select the Redmond layout or for OS X choose Cupertino.

With 15.10 there is better iOS support. In 14.04 and even in Debian Jessie if you are running iOS 8 or later shotwell fails to import your videos and photos from your iPhone. This issue is now resolved in 15.10. I am running iOS 9 and can import my photos into shotwell on my iBook G4.

In conclusion I am really excited about Ubuntu-MATE and the option it gives PowerPC users for a modern, secure operating system. If 16.04 is a continuation of I am seeing then the next LTS version of Ubuntu-MATE will be a distro to recommend.

Screenshot with the Cupertino layout:




Wednesday, August 19, 2015

KDE is awesome!



It has been a while since I have posted anything. I have been working on getting FreeBSD working on my iBook G4 and will be posting on that shortly. I wanted to share my thoughts on running a higher end DE in Linux. Most of my posts have been on PowerPC. These machines are older and are better ran more lightweight DEs such as LXDE, XFCE, or even MATE. Running DEs such as GNOME or KDE really do not make much sense on a G4 machine that the most it can have is 2GB of RAM.

However, if you have a more modern machine with good specs then you could go for a more powerful DE. GNOME has been my DE of choice for a while. It is also the DE that my wife really enjoys. One of the features that I really like about GNOME is the keyboard integration. GNOME make it really easy to launch apps and move between workspaces with a few hits on the keyboard. It just has a really clean to look to it. However I have always wanted to try out KDE. So a few days ago a grabbed a Kubuntu 14.04 and 15.04 ISO and went on my way. I was blown away.

The first thing that I noticed right about KDE was how beautiful of a DE it is. Everything from the panel layouts, how notifications are displayed, and the look of the application really show that a lot of work has gone into making KDE aesthetically pleasing. It is also one of the most customizable DE I have seen. Some people would say that is way too customizable and I can how you can get lost in all the options. However, for me I it is not an annoyance at all. It also has a lot of compiz like features built into its window manager, kwin.

If you decide you want to give it a try I would suggest going with Kubuntu 14.04. Normally I would prefer Debian, but the current stable release does not have all the plugins for KDE. So for example I the KDE network-manager applet is not in Jessie so you need to the GNOME applet. If you are using Sid then the plugin is there.

I am currently running Kubuntu 15.04 on my 2009 MacBook Pro and even on this older machine KDE runs well. Now 15.04 is running the newer Plasma5 version of KDE. It is still pretty experimental, which is why I recommend the 14.04 version. One drawback I have found with Kubuntu is using Kontact on a Mac that is a little outdated. It is a productivity suite that manages email, contacts, and calendar. It is very resource intensive so I choose not to use to manage my email.

If you are running KDE in Debian you can choose not to install this suite if you desired. This is an advantage that Debian has over Kubuntu. However Kubuntu does give you an more straightforward out of the box experience. This may be important if someone does not want to spend time installing packages to get the DE working.

Below is a screenshot enjoy!





Saturday, June 27, 2015

Ubuntu-MATE fits my MacBook Pro nicely


I have been an OS X users for years. I was always happy how it performed. Then came Yosemite and all changed. It was just one issue after another. Safari performance was poor, my garmin would no longer work. Then came the news that iPhoto was being replaced with Photos. This new change meant that syncing photos from the iPhone to the MacBook will now require sending your picture to iCloud. No longer was there direct sync from phone to machine.

It was then I decided to move to Linux on my MacBook. Now I have been using Linux on my PowerPC machines, but kept my MacBook running OS X. So now came the decision of what distro to use.

I first started Ubuntu 15.04, but I was not happy with Unity. There was issues that made some web pages barely readable, software center was having css issues and suspend was not working well on Apple hardware. Then I went to Ubuntu-GNOME and still the same issues. Then finally I went with Ubuntu-MATE.

Ubuntu-MATE  works great on this machine. All the issues I had with the previous flavors of Ubuntu were gone. Plus all the features that Ubuntu-MATE team have added like one-click compiz activation and multi panel layout so if you are looking for OS X or Windows layout setting it up is pretty simple. The performance has been great so far. I could not recommend this flavor of Ubuntu more highly. Thanks to Martin Winpress and the team.

Tuesday, June 9, 2015

A simple TrueCrypt alternative on Linux


A lot of people who were security conscious use TrueCrypt for disk encrytion. Sadly it was discovered to contain security vulnerabilities and for a while now it has been deemed unsafe to use. Thankfully there is an effort to audit the code. So hopfully this may be resolved in the future. Till then there is a really simply way to get portable disk encryption under Linux.

First verify that the package cryptsetup is installed. If not then install it, sudo apt-get install cryptsetup. Once this is installed use the command fallacate to create a file of a paticular size (for example 100M).


rican-linux@lubuntu-powerpc:~/Public$ fallocate -l 100M test.img
rican-linux@lubuntu-powerpc:~/Public$ du -h test.img
100M test.img


What the command did was creat the file test.img and allocate 100M of disk space to it. The extension is really not needed you create a drive without it. The next steps will be to use the disk utility that comes with the Linux desktop you installed to make this file into a loopback drive then create and encrpyted partion using LUX.


First open the disk utility and select attach image.




Then goto the directory where the file is located. Before you select the file uncheck the read-only option on the bottom, then select attach. The file should now be seen as a loopback drive in the disk utility.












Once mounted use disk utility to format the loopback device with ext4.









Once the device is formated to created your encrypted partition select create new parttion.


 

Then enter the passphrase used to encrypt the volume. Be sure to make it complicated! Now you have a portable encrypted filesystem.















Saturday, May 30, 2015

Running VMs on G4 machines with LXC

It is really fun testing out different distributions. You get to see their differences and their strength/weaknesses. The one drawback is the need to keep installing ISO over and over again. I have seen people with G5 machine run qemu to host VM guests. However on G4 machine I do not think there are enough resources to really to this with taking some type of perfomance hit. Then I came across using Linux Containers (lxc) and it was exactly what I needed! So what lxc offers is virtualazation at OS level rather than on the hardware level via hypervizors. QEMU, Zen, KVM,and VB all viritalize the hardware, meaning each VM has its own dedicated hardware. Now if you have more than one core and few Gigs of RAM than this is no issue. However G4 machines at the max have 2G of ram and most are single CPU. This greatly limits what can be accomplished using hypervizors. Since lxc virtualizes on the OS level you guests will share your resources. On my iBook G4 with a single 1.42 GHz cpu and 1.5G of RAM running an instance of Debian as an lxc container performed really well. Below I will walk you through the install and set of lxc on PowerPC.

Install and Initial Setup

The following packages were the ones I used to get lxc working.
sudo apt-get install lxc bridge-utils libvirt-bin debootstrap
These will get you lxc working and allow to connect to your home network. Once you have these package installed there are somethings you need to check. First you want to be sure your kernel has all the correct configuration for lxc. The command to use is lxc-checkconfig. This will verify your kernel configuration. The output should be same as below,
rican-linux@iBookG4-Debian9:~$ sudo lxc-checkconfig
[sudo] password for rican-linux:
Kernel configuration not found at /proc/config.gz; searching…
          kernel-configuration-found-at-/boot/config-3.16.0-4-powerpc
Namespaces —-
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enablede
Multiple /dev/pts instances: enabled
—- Control groups —-
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
—- Misc —-
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled
Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
rican-linux@iBookG4-Debian9:~$
All the settings should show enabled. LXC comes with predefined templates that you can use to install containers. These templates can be found in the /usr/share/lxc/templates directory. Since this is on a PowerPC machine you can only install templates that support this architecture. Which leaves you with Debian, Ubuntu, Gentoo, and OpenSUSE. Right now I have been able to successfuly create containers for Debain and Ubuntu. There are some issue with the other two that I am looking into. Now to create a container the command to run is lxc-create. So to create a Debian container this is they syntax to use,
sudo lxc-create -n container_name -t debian
One the proces is complete a root password will be given that you should change one you launch the container and login. Before that step you should set up the networking so that you container can access the internet.

Networking

The process I used to manage my network connections is libvirt. It basically creates a vitual bridge so your VMs in the LXC containers can access the network. If you have libvirt already installed then to see if you bridge is ready run this command sudo virsh net-info default. The output should be as below,
rican-linux@iBookG4-Debian9:~$ sudo virsh net-info default
[sudo] password for rican-linux:
Name: default
UUID: d57736ba-96cc-4798-aefa-1a046fdb1de8
Active: yes
Persistent: yes
Autostart: no
Bridge: virbr0
If the active field is set to no then enable the bridge with this command virsh net-start default. The field should be now set to yes and you should see the interface if you run sudo ifconfig -a.
rican-linux@iBookG4-Debian9:~$ sudo ifconfig -a
….
virbr0 Link encap:Ethernet HWaddr 52:54:00:4a:83:be
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:454898 errors:0 dropped:0 overruns:0 frame:0
TX packets:897541 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:77865967 (74.2 MiB) TX bytes:1259670602 (1.1 GiB)
virbr0-nic Link encap:Ethernet HWaddr 52:54:00:4a:83:be
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
….
The ip address shown is controlled by this configuration file, /var/lib/libvirt/network/default.xml. This file also controls the dhcp scope of the virtual network and where you can set static reservations. You can read more on this on the Debian Wiki here.

LXC running and VNC setup

Now that lxc is install, a Debian container is created, and the networking is set,it is time to run the container and set up VNC. The command to start a container is the following,
sudo lxc-start -F -n container_name
The -F option puts you in the console on your terminal session. Once you login you want to be sure you have an ip address and can reach the internet. Once that is verified, next is to run sudo apt-get update && sudo apt-get upgrade so that the latest packages are installed. Then install the DE you want to login to. The best choice that does consume too much resources is LXDE. The command to install is simply sudo apt-get install lxde for Debain or sudo apt-get install lubuntu-desktop for Ubuntu. Finally it is time to install the VNC server. Follow the steps below,
Install the server
sudo apt-get install vnc4server
create a non-privilaged user
adduser test
su test
as the user start and stop the server
vnc4server :1 -geometry 800x600 -depth 24
vnc4server -kill :1 -geometry 800x600 -depth 24
edit the xstartup file
nano ~/.vnc/xstartup
add at the end (Debian)
/usr/bin/lxsession -s LXDE &
add at the end (Ubuntu)
/usr/bin/lxsession -e LXDE -s Lubuntu &
restart the server
vnc4server :1 -geometry 800x600 -depth 24
The server will ask for a password when it is launch for the first time. The password will be used to login via the VNC client. On the host there are a few choices for a vnc client. There are two good command line client vncviewer and vnc4viewer. When they are installed to start the session using vncviewer by entering the following,
vncviewer ip address:1
enter password
The session should open in a window and you are done! If you want a gui client then remmina is a great choice. Below are some screenshots. If you want more info on lxc check out the Debian Wiki here




Tuesday, May 12, 2015

Noobslabs is an awesome site!

I am currently running Debian Testing (Stretch) on my iBook G4. I posted a brief review of the install here.  I like spending time tweaking it out. Putting in new wallpapers, themes, and icons. Another tool I love is conky. This tool is light system monitor that displays statistics on your desktop. It is very customizable and people have shared their configurations for people to use. Sometimes these configurations are hard to implement and require some tweaking. I do not mind tinkering but sometimes I just want something to work on install. Well I came accross Noobslab and found my answer! This site is designed for people who new to Linux specifically Debian based distros like Ubuntu and Mint. They have PPAs to install themes and icon sets which make setting up themes on your Ubuntu or Mint install so much easier. They also have great start up scripts for conky as well that work any distro. They have some really great designs to choose from and you can download a wired or wireless setup depending on which interface you wish to monitor. Getting this working on my iBook was extremely simple. If you are looking for a nice conky set up then this is definitely a place to check out!.


Tuesday, April 28, 2015

Ubuntu fustrations

There is has been a growing frustration over at the Ubuntu Forums over support for PowerPC. Lubuntu 14.04 LTS is exremely buggy. There are serious issues with firefox, and video playback software like vlc and mpv. Bug reports have been placed here and here. The latest 15.04 release is completely unusable . I installed Ubuntu-MATE 15.04 on my iBook G4 and yaboot failed to install complete making my system unbootable. 15.04 is only a standard release an not LTS, so why not say we are not releasing a PowerPC version for this release cycle till these bugs are resolved? It will at least show there is a desire to get a working PowerPC image out there. I am not trying to bash Ubuntu, I really do want to see Ubuntu produce a reliable PowerPC version. Right now Debian is the most stable PowerPC distribution of Linux. I am typing this from iBook G4 running Debian Testing (Strech).
Nevertheless, I understand the a lot of these issues could be upstream related. I know some guys with G5 machines that are having issues not only with Ubuntu but with Debian Jessie as well. This really saddens me because Jessie works great on G4 machines. The G5s are just as good as a lot modern machines today. I really do hope Ubuntu can get some these issue squared away. Ubuntu-MATE is a great distro and would I love to see a fully working PowerPC version.


UPDATE I: It looks like the firefox issue has been resolved. The most recent updates comes with firefox 38. This version fix all the firefox issue htat have previousl reported. I running Ubuntu-MATE 14.04.2 on PowerMac G4 and so far firefox is running great. I plan on posting a walkthrough on how I set up my PowerMac. Christian Zigotzky has done some great work with Linux on PowerPC. He was able with some hacking to Ubuntu-MATE 15.04 PPC working with some great Compiz action.

PowerBook gave up the ghost

Well this morning I finished manually upgrading my PowerBook G4 to Jessie. I verified all was good then I rebooted. The boot loaded showed everything was fine, then black screen...nothing. Hmm so I thought maybe I did something wrong? So I turned it off and tried to reboot but it would not even go to POST..no apple chime. So I unplugged waited for some time and tried again...still no chime. I fear that my faithful PowerBook has breathed its last...

Saturday, April 25, 2015

Compiz on Lubuntu 14.04

I reinstalled Lubuntu 14.04 on my iBook G4 to see if I can get compiz working on it. The first thing I did was install mesa packages that were patched to enable 3D acceleration on radeon r300 drivers. You can find them here. Then you will need to install the following:


rican-linux@ibookG4-lubuntu:~$ dpkg -l |grep compiz
ii  compiz                                  1:0.9.11.3+14.04.20150313-0ubuntu1    all          OpenGL window and compositing manager
ii  compiz-core                             1:0.9.11.3+14.04.20150313-0ubuntu1    powerpc      OpenGL window and compositing manager
ii  compiz-fusion-bcop                      0.8.4-1.1                             all          Compiz Fusion option code generator
ii  compiz-gnome                            1:0.9.11.3+14.04.20150313-0ubuntu1    powerpc      OpenGL window and compositing manager - GNOME window decorator
ii  compiz-plugins                          1:0.9.11.3+14.04.20150313-0ubuntu1    powerpc      OpenGL window and compositing manager - plugins
ii  compiz-plugins-default                  1:0.9.11.3+14.04.20150313-0ubuntu1    powerpc      OpenGL window and compositing manager - default plugins
ii  compiz-plugins-extra                    1:0.9.11.3+14.04.20150313-0ubuntu1    all          transitional dummy package.
ii  compiz-plugins-main                     1:0.9.11.3+14.04.20150313-0ubuntu1    all          transitional dummy package.
ii  compiz-plugins-main-default             1:0.9.11.3+14.04.20150313-0ubuntu1    all          transitional dummy package.
ii  compizconfig-settings-manager           1:0.9.11.3+14.04.20150313-0ubuntu1    all          Compiz configuration settings manager
ii  libcompizconfig0                        1:0.9.11.3+14.04.20150313-0ubuntu1    powerpc      Settings library for plugins - OpenCompositing Project
ii  python-compizconfig                     1:0.9.11.3+14.04.20150313-0ubuntu1    powerpc      Compizconfig bindings for python
rican-linux@ibookG4-lubuntu:~$


Once you have these installed open compizconfig and enable the following

  1. composite
  2. opengl
  3. gnome compatibility
  4. copy to texture
  5. expose
  6. desktop cube
  7. rotate cube
  8. animations
  9. window decoration
  10. application switcher
  11. maxiumize
  12. move window
  13. resize window
  14. place windows
  15. ring switcher
After you have at least these settings then enter the following compiz --replace ccp &

You will also need to set these to get the cube working goto:

general options ->Desktop Size 
  Horizontal Virtual Size =4
  Vertical Vitual Size =1

Now you can hit super+s to see the expo and CTRL+ALT+L Click to rotate the cube. Most of the plugins work, wobbly windows, fire paint, and show mouse options work as well. I am still working change the default theme (If anyone has suggestions please share!)




Friday, April 24, 2015

Testdriving Gentoo Linux

So I have now Gentoo Linux installed and running on my iBook G4 for a little over a week. I have been wanting to give it a try for a while. Gentoo like Arch is a very  DIY distro. You basically install just as base system and from there it is up to you what you want to install. The fact that you are building your own custom Linux system is the big appeal for Gentoo and Arch. The drawback is that it involves a lot of patience. Both Arch and Gentoo have great documentation that if you pay attention and follow will help get your system going. So I am going to through some of my thoughts about the different stages of getting the system up and going.

The Base Install:

So when you boot from the live cd you get a shell and from there you build your base system. It is very important that you follow the PPC Handbook closely for a successful install. This is an invaluable resource in getting your system going. The handbook will help get you get you hard drive partitioned and formatted but it will also walk you though important concepts in Gentoo such as it package management system Portage. Portage unlike apt or yum install packages by downloading the source code and compiling locally on your system. There is part of the base install that you may need to deviate from the Handbook. In the end where you are setting up Yaboot and preparing to boot into the system you need to create your yaboot.conf file. When you do you need to change the device line to hd:. You conf file should look like this:

rican-linux@ibookG4-gentoo ~ $ cat /etc/yaboot.conf
## yaboot.conf generated by yabootconfig 1.0.8
##
## run: "man yaboot.conf" for details. Do not make changes until you have!!
##
## For a dual-boot menu, add one or more of:
## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ

boot=/dev/hda2
device=hd:
partition=4
root=/dev/hda4
timeout=30
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot

image=/boot/vmlinux
    label=Linux
    read-only
    initrd=/boot/initramfs-genkernel-ppc-3.12.39-gentoo
    initrd-size=8192



If you do not do this yaboot may not boot properly. Also there is a bug that will not allow yaboot utility to install on the base system so to update yaboot.conf with the ybin command you will need to do it from the live cd.

Configuring the Kernel

What appeared to be the most stressful part, but was actually not as bad I originally thought was setting up and compiling the kernel. Basically you are setting up what features you want turned on from what type of Video hardware to if you want routing features you want on. Make sure you start with running this command make pmac32_defconfig. It should help with getting most of the PPC features turned on. While you are configuring the kernel it would be good to visit the Gentoo PPC FAQ section on setting up wireless. There are some kernel settings you nee to verify so why not do that part now rather than later and have recompile. When doing this part it is critical that you follow the handbook. It will guide you though.

Desktop

I have decided to install XFCE as my DE. The first thing you will need to do is install Xorg, then once you get it installed you will need to install the XFCE packages. You can verify everything is working by running startxfce4. If all is good then the next thing would install a display manager. I used lightdm as my display manager, but you there are plenty of DMs you can choose from here. Also you still need to enable KMS once you have the DE installed or you will experiencing your DE freezing. You should not set the yaboot parameters until Xorg is installed or the system will freeze on boot. This means that you will need to boot into the live cd to apply the changes the yaboot.conf file. Here are some screen shots for my desktop..





Wireless

If you have enabled the proper setting while you were configuring the kernel the next set is to download and install the firmware. My iBook uses the Broadcom BCM4318 chipset and usually it is just a simple few steps:

sudo apt-get install firmware-b43-installer
sudo modprobe -r b43
sudo moprobe b43

Now in Gentoo you have to manually grab and install the firmware. Thankfully the PPC FAQ points you a great resource here that walks you through. Once you have followed the instructions you can verify by running dmesg, you should see the follwing

rican-linux@ibookG4-gentoo ~ $ dmesg |grep -e b43 -e Broadcom
[   16.106492] b43-pci-bridge 0001:10:12.0: enabling device (0004 -> 0006)
[   19.719625] b43-phy0: Broadcom 4318 WLAN found (core revision 9)
[   19.761647] b43-phy0: Found PHY: Analog 3, Type 2 (G), Revision 7
[   19.761676] b43-phy0 debug: Found Radio: Manuf 0x17F, Version 0x2050, Revision 8
[   19.785836] Broadcom 43xx driver loaded [ Features: PMNL ]
[   26.661593] b43-phy0: Loading firmware version 666.2 (2011-02-23 01:15:07)
[   26.681602] b43-phy0 debug: Chip initialized
[   26.682597] b43-phy0 debug: 32-bit DMA initialized
[   26.682640] b43-phy0 debug: QoS enabled
[   26.701989] b43-phy0 debug: Wireless interface started
[   26.702046] b43-phy0 debug: Adding Interface type 2
[   28.967573] b43-phy0 debug: Using hardware based encryption for keyidx: 0, mac: 44:e1:37:b4:aa:70
rican-linux@ibookG4-gentoo ~ $

Then run ifconfig to verify you see the wlan0 interface. If not run the command again with the -a option. If you do see it then all it means is that you need to turn the interface on ifconfig wlan0 up if not then you may need to a reboot or verify that the b43 module is active. At this point you need a tool to manage your network connections. Your best choice is NetworkManager, and to install you just need to execute sudo emerge -av net-misc/networkmanager. After it compiles and installs you will notice that there is no gui applet that you would normally expect to see. This is because the applet is another package that needs to be installed(sudo emerge -av gnome-extra/nm-applet). However NetworkManager has a command line tool you can use as well. Just execute nmtui and from there you can join your wifi network.

Final thoughts

Getting Gentoo to work too a lot more effort than Debian or Ubuntu. However if you love challenges and want to learn how an OS works from the ground up then you will definitely get that with Gentoo. Video playback was great with mpv however smtube is not part of the Portage tree. They did have minitube but it would not work (looks like a google api issue). 3D acceleration works if you set the default display to 16 in xorg.conf. The two biggest issues for me was one the cdrom would not auto mount for me and the install time for packages. It take a really long time to install anything  big since Gentoo is downloading the source code and compiling on the local system. There are definite advantages to doing this normally, but for iBook or even later PowerBook this may be way too time consuming. If you have a later dual core Powermac G4 or G5 then you may have some benefit of Gentoo on your system.