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.






Tuesday, April 14, 2015

Luigi does it again and new OS on my iBook

Luigi Burdo has done a great service in showing how the PowerPC platform is not dead but can still be used in 2015. The video he shared with the Mac Mini running Ubuntu MATE was fantastic. I called it at the time the best Linux on PowerPC video on the web. Well Luigi just raised the bar again with this latest one. In the following video he is displaying Lubuntu 14.04 on Powermac G5 Quad Core with a RadeonHD 6570 video card. Watch and enjoy!



Also I have been using my iBook G4 as a testing machine. Trying different distros and applications. Mostly I have been testing with Debian and Ubuntu, but i have been thinking about trying others as well. Luigi is reporting success with OpenSUSE 13.2 if anyone wants to try. I have decided to install Gentoo. I just got the GUI up and working and still doing more tests before I go into a full review. It is more work to get, but if you have any familiarity with Arch then it is a similar process. More on Gentoo to come!