Difference between revisions of "Ubuntu installation guide"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m (13 revision(s))
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{Articles|Kurobox|Debian}}
 +
 +
{{warning|'''Ubuntu dropped support for powerpc on their latest 10.10 deboostrap script. This guide is kept here for archiving purposes.'''}}
 +
 
{{warning|'''Backup ANY Data, because during the installation all partitions will be deleted and your DATA WILL BE LOST.  
 
{{warning|'''Backup ANY Data, because during the installation all partitions will be deleted and your DATA WILL BE LOST.  
 
<br>Use this guide at your own risk!'''}}
 
<br>Use this guide at your own risk!'''}}
Line 10: Line 14:
 
# reboot and see if everything is all right
 
# reboot and see if everything is all right
  
For this guide, you need to have the newer Uboot version, with the netconsole working, available in [[Kurobox support in stock 2.6 kernels]].
+
For this guide, you need to have the newer Uboot version, with the netconsole working, available in [[Kurobox support in stock 2.6 kernels]]. The guide also assumes you are using foonas-em.
  
 
==(Re)Partitioning the drive==
 
==(Re)Partitioning the drive==
 
===Get on EM mode===
 
===Get on EM mode===
Get on EM mode. This is done by pressing the Power button tree times after the device powered on, and while the power light is still slowly blinking. If you can't get on EM mode by this way, you can enter 'run writeng'; 'boot flboot' on the netconsole.
+
Get on EM mode. On foonas-em this is done by pressing the Power button one time after the device powered on, and while the power light is still slowly blinking. If you can't get on EM mode by this way, you can enter 'run fooflboot' on the netconsole.
  
 
===Partition the disk===
 
===Partition the disk===
We will create 3 partitions : one with about 2GB for the Ubuntu system, another one with 256MB for swap, and another one that takes the rest of the disk.
+
We will create 3 partitions : one with about 3GB for the Ubuntu system, another one with 256MB for swap, and another one that takes the rest of the disk.
  
  $ mfdisk -e /dev/hda            (clean the partition table on the disk - THIS WILL ERASE DATA!! - )
+
  # fdisk /dev/sda
$ mfdisk -c /dev/hda            (create a new partition table on /dev/hda)
+
    -> o ( enter )                (clean the partition table on the disk)
     -> n, p, 1, (enter), +2048M;  (New Primary partition in position 1, from start to 2048M after it)
+
     -> n, p, 1, (enter), +3000M;  (New Primary partition in position 1, from start to 2048M after it)
 
     -> a, 1;                      (Set partition 1 as bootable)
 
     -> a, 1;                      (Set partition 1 as bootable)
 
     -> n, p, 2, (enter), +256M;  (New Primary partition in position 2, from the first free spot to 256M after it)
 
     -> n, p, 2, (enter), +256M;  (New Primary partition in position 2, from the first free spot to 256M after it)
Line 27: Line 31:
 
     -> n, p, 3, (enter), (enter); (New Primary partition 3, taking the rest of the disk)
 
     -> n, p, 3, (enter), (enter); (New Primary partition 3, taking the rest of the disk)
 
     -> w                          (write the changes to the disk - THIS WILL REFORMAT YOUR HD! BACKUP YOUR DATA! - )  
 
     -> w                          (write the changes to the disk - THIS WILL REFORMAT YOUR HD! BACKUP YOUR DATA! - )  
  $ mkfs -j /dev/hda1              (Create a new journaled ext3 filesystem on /dev/hda1)
+
  # mkfs.ext3 -j /dev/sda1        (Create a new journaled ext3 filesystem on /dev/sda1)
  $ mkfs -j /dev/hda3              (Create a new journaled ext3 filesystem on /dev/hda1)
+
  # mkfs.ext3 -j /dev/sda3        (Create a new journaled ext3 filesystem on /dev/sda1)
  $ mkswap /dev/hda2               (Create a swap filesystem on /dev/hda2)
+
  # mkswap /dev/sda2               (Create a swap filesystem on /dev/sda2)
  
 
==Install a temporary Debian system on /dev/hda3==
 
==Install a temporary Debian system on /dev/hda3==
 +
{{tip|If you already have a working installation of Gentoo, you can debootstrap Ubuntu from there without having to first install Debian. See [[Debootstrap Ubuntu from Gentoo]]}}
 +
{{tip|If you have the newer foonas-em mode installed, it should be possible to debootstrap and chroot from the EM mode, since it does have a 2.6 kernel.}}
 
Now we will prepare to boot a pre-made image on /dev/hda3, so we can use the debootstrap tool later on to create our final system on /dev/hda1. One could chroot to the image, using the EM Mode, and try to deboostrap from there, but to be able to chroot to the Ubuntu partition, you need to be running a newer kernel, so it's mandatory to boot on a newer kernel. (It said "FATAL : Kernel too old" for me when I tried it)
 
Now we will prepare to boot a pre-made image on /dev/hda3, so we can use the debootstrap tool later on to create our final system on /dev/hda1. One could chroot to the image, using the EM Mode, and try to deboostrap from there, but to be able to chroot to the Ubuntu partition, you need to be running a newer kernel, so it's mandatory to boot on a newer kernel. (It said "FATAL : Kernel too old" for me when I tried it)
  
Line 47: Line 53:
 
  $ cp boot/uImage  boot/vmlinux.UBoot  (U-Boot is configured to boot from vmlinux.UBoot)
 
  $ cp boot/uImage  boot/vmlinux.UBoot  (U-Boot is configured to boot from vmlinux.UBoot)
 
  $ vi etc/fstab                        (make sure everything is ok - /dev/hda3 should mount on /, hda1 should mount on /mnt)
 
  $ vi etc/fstab                        (make sure everything is ok - /dev/hda3 should mount on /, hda1 should mount on /mnt)
 +
 +
Before rebooting, you should check the network settings for this temporary Debian installation. In particular, the contents of:
 +
* /etc/network/interfaces
 +
* /etc/resolv.conf
 +
 +
(The necessary contents of these files are described below in 'Configuring your Ubuntu system')
 +
 
  $ write_ok                            (the box won't boot normally if you don't issue that command)  
 
  $ write_ok                            (the box won't boot normally if you don't issue that command)  
 
  $ reboot
 
  $ reboot
Line 66: Line 79:
 
Note that we need to use a special version from debootstrap, one that has the ubuntu scripts :  
 
Note that we need to use a special version from debootstrap, one that has the ubuntu scripts :  
 
  $ apt-get install debootstrap
 
  $ apt-get install debootstrap
  $ wget http://br.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_0.3.3.3ubuntu4_all.deb
+
  $ wget http://br.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_0.3.3.2ubuntu3_all.deb
  $ dpkg -i debootstrap_0.3.3.3ubuntu4_all.deb  
+
  $ dpkg -i debootstrap_0.3.3.2ubuntu3_all.deb  
 
  $ debootstrap --arch powerpc feisty /mnt http://archive.ubuntu.com/ubuntu/  ([https://wiki.ubuntu.com/Mirrors?action=show&redirect=Archive place to pickup mirrors])
 
  $ debootstrap --arch powerpc feisty /mnt http://archive.ubuntu.com/ubuntu/  ([https://wiki.ubuntu.com/Mirrors?action=show&redirect=Archive place to pickup mirrors])
  
Line 114: Line 127:
 
     ALL : 127.0.0.1                   
 
     ALL : 127.0.0.1                   
 
 
  $ tzconfig (adjust your timezone)
+
  $ dpkg-reconfigure tzdata (adjust your timezone)
 
  $ adduser YourUserName
 
  $ adduser YourUserName
 
  $ passwd (change the root password)
 
  $ passwd (change the root password)
Line 123: Line 136:
 
   
 
   
 
===Building the kernel===
 
===Building the kernel===
# su YourUserName (this part is meant to be run as a normal use)
+
  # apt-get install git git-core make patch unzip bison flex libncurses5-dev gcc  (install the additional packages for compiling kernel)
$ su
+
# chown -R YourUserName:users /usr/src  (you need permission to write on that folder)
+
  # apt-get install git git-core make patch unzip bison flex libncurses5-dev gcc  (install the additional packages we need to compile stuff)
+
 
  # update-alternatives --config git (choose #2: git-scm - we need git to get the sources for dtc)
 
  # update-alternatives --config git (choose #2: git-scm - we need git to get the sources for dtc)
  # exit
+
  # chown -R YourUserName:users /usr/src  (you need permission to write on that folder)
 +
# su YourUserName (this part is meant to be run as a normal use)
 
  $ cd /usr/src
 
  $ cd /usr/src
 
  $ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.tar.bz2 (get the most recent from http://www.kernel.org/pub/linux/kernel)
 
  $ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.tar.bz2 (get the most recent from http://www.kernel.org/pub/linux/kernel)
 
  $ tar xjf linux-2.6.21.tar.bz2
 
  $ tar xjf linux-2.6.21.tar.bz2
 
  $ ln -sf linux-2.6.21 linux  
 
  $ ln -sf linux-2.6.21 linux  
  $ git clone git://www.jdl.com/software/dtc.git dtc  (the git tool is used to compile a required special hardware database file)
+
  $ git clone git://www.jdl.com/software/dtc.git dtc  (the dtc tool is used to compile a required special hardware database file)
 
  $ cd /usr/src/dtc
 
  $ cd /usr/src/dtc
 
  $ make
 
  $ make
  $ su
+
  $ sudo ln -sf /usr/src/dtc/dtc /usr/local/bin/
# sudo ln -sf /usr/src/dtc/dtc /usr/local/bin/
+
  $ sudo apt-get install uboot-mkimage (that is needed to produce kernel images that the u-boot can boot into)
# exit
+
  $ cd /usr/src
+
$ wget http://www.kurobox.com/sylver/u-boot/mkimage (now we'll get mkimage, with is needed to produce kernel images that the u-boot can boot into.)
+
$ chmod 0755 mkimage
+
# su
+
# mv mkimage /usr/local/bin/
+
# apt-get install jigit (mkimage need this tool to work)
+
# exit
+
 
  $ cd /usr/src/linux
 
  $ cd /usr/src/linux
 
  $ cp arch/powerpc/configs/linkstation_defconfig .config
 
  $ cp arch/powerpc/configs/linkstation_defconfig .config
 
  $ make menuconfig
 
  $ make menuconfig
 
  $ make uImage modules
 
  $ make uImage modules
  $ su
+
  $ exit
 +
# cd /usr/src/linux
 
  # make modules_install
 
  # make modules_install
 
  # cp arch/powerpc/boot/uImage /boot/vmlinux.UBoot
 
  # cp arch/powerpc/boot/uImage /boot/vmlinux.UBoot
Line 156: Line 160:
 
  # cd /boot
 
  # cd /boot
 
  # dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts
 
  # dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts
  # exit; exit ; exit
+
  # reboot
$ reboot
+
 
 +
([[User:Mflint]] suspects that 'jigit' package is ''not'' needed -- indeed, maybe it's really not, removed from the guide)
  
 
==Boot your Ubuntu OS==
 
==Boot your Ubuntu OS==
 
===Make the Power/Back button work===
 
===Make the Power/Back button work===
Note - the latest avr_evtd has some problems with Ubuntu. [[User:Wladston]] has emailed the author about the issue. For now, prefer running the older 1.6.2 version.
+
  $ sudo apt-get install avr-evtd
$ cd /
+
  $ sudo vim /etc/default/avr_evtd     (tweak the configuration to suit your needs)
  $ sudo wget http://ufpr.dl.sourceforge.net/sourceforge/ppc-evtd/avr_evtd_1.7.2.release.tar.gz (get the latest from the [https://sourceforge.net/project/showfiles.php?group_id=167880&package_id=190867 avr_evtd site])
+
 
$ tar xzf avr_evtd_1.7.2.release.tar.gz
+
$ cd /usr/src/avr_evtd
+
$ make avr_evtd
+
$ make install
+
$ update-rc.d avr_evtd start 12 2 . stop 95 0 6 .
+
  $ cp Install/avr_evtd.sample /etc/default/avr_evtd
+
$ vim /etc/default/avr_evtd
+
 
===Make Hwclock work===
 
===Make Hwclock work===
 
Hwclock only reads from /dev/rtc, but the system makes /dev/rtc0. Add this command to have udev to link rtc->rtc0 every time the system boots, so you can use the hwclock command. Just add the line to the file:
 
Hwclock only reads from /dev/rtc, but the system makes /dev/rtc0. Add this command to have udev to link rtc->rtc0 every time the system boots, so you can use the hwclock command. Just add the line to the file:
 
  $ sudo vim  /etc/udev/rules.d/50-udev.rules
 
  $ sudo vim  /etc/udev/rules.d/50-udev.rules
 
         KERNEL=="rtc0",        SYMLINK+="rtc"
 
         KERNEL=="rtc0",        SYMLINK+="rtc"
 +
===Fix Perl locale-related problems===
 +
If you see the following error when running perl:
 +
perl: warning: Setting locale failed.
 +
perl: warning: Please check that your locale settings:
 +
        LANGUAGE = (unset),
 +
        LC_ALL = (unset),
 +
        LANG = "en_GB.UTF-8"
 +
    are supported and installed on your system.
 +
perl: warning: Falling back to the standard locale ("C").
 +
Then run:
 +
# locale-gen en_GB.UTF-8 en_US.UTF-8
 +
(be sure to choose an appropriate locale)
 +
===Install popularity-contest===
 +
Inform the repository that you are using the packages related to the Kurobox, so they don't get forgotten, run :
 +
# sudo apt-get install popularity-contest
  
 
==How could this guide be improved==
 
==How could this guide be improved==
 
*Provide a very slim base system, already using the newer u-boot kernel, and already having debootstrap installed;
 
*Provide a very slim base system, already using the newer u-boot kernel, and already having debootstrap installed;

Latest revision as of 18:05, 27 February 2011


Nuvola apps important.png 
WARNING!

Ubuntu dropped support for powerpc on their latest 10.10 deboostrap script. This guide is kept here for archiving purposes.


Nuvola apps important.png 
WARNING!

Backup ANY Data, because during the installation all partitions will be deleted and your DATA WILL BE LOST.
Use this guide at your own risk!


Contents

Plan of action

Installing Ubuntu from scratch is a complex and lengthy process. This is our plan of action :

  1. Partition the drive
  2. boot to a temporary debian system on /dev/hda3, so we can
  3. debootstrap ubuntu, chroot to it, configure it and
  4. compile a vanilla mainstream kernel
  5. reboot and see if everything is all right

For this guide, you need to have the newer Uboot version, with the netconsole working, available in Kurobox support in stock 2.6 kernels. The guide also assumes you are using foonas-em.

(Re)Partitioning the drive

Get on EM mode

Get on EM mode. On foonas-em this is done by pressing the Power button one time after the device powered on, and while the power light is still slowly blinking. If you can't get on EM mode by this way, you can enter 'run fooflboot' on the netconsole.

Partition the disk

We will create 3 partitions : one with about 3GB for the Ubuntu system, another one with 256MB for swap, and another one that takes the rest of the disk.

# fdisk /dev/sda
   -> o ( enter )                (clean the partition table on the disk)
   -> n, p, 1, (enter), +3000M;  (New Primary partition in position 1, from start to 2048M after it)
   -> a, 1;                      (Set partition 1 as bootable)
   -> n, p, 2, (enter), +256M;   (New Primary partition in position 2, from the first free spot to 256M after it)
   -> t, 2, 82;                  (set Type of partition 2 as 82 (Linux Swap)
   -> n, p, 3, (enter), (enter); (New Primary partition 3, taking the rest of the disk)
   -> w                          (write the changes to the disk - THIS WILL REFORMAT YOUR HD! BACKUP YOUR DATA! - ) 
# mkfs.ext3 -j /dev/sda1         (Create a new journaled ext3 filesystem on /dev/sda1)
# mkfs.ext3 -j /dev/sda3         (Create a new journaled ext3 filesystem on /dev/sda1)
# mkswap /dev/sda2               (Create a swap filesystem on /dev/sda2)

Install a temporary Debian system on /dev/hda3

Tip.png
TIP

If you already have a working installation of Gentoo, you can debootstrap Ubuntu from there without having to first install Debian. See Debootstrap Ubuntu from Gentoo

Tip.png
TIP

If you have the newer foonas-em mode installed, it should be possible to debootstrap and chroot from the EM mode, since it does have a 2.6 kernel.

Now we will prepare to boot a pre-made image on /dev/hda3, so we can use the debootstrap tool later on to create our final system on /dev/hda1. One could chroot to the image, using the EM Mode, and try to deboostrap from there, but to be able to chroot to the Ubuntu partition, you need to be running a newer kernel, so it's mandatory to boot on a newer kernel. (It said "FATAL : Kernel too old" for me when I tried it)

Get the Debian image and a kernel image from Debian_sylver. Be sure to grab a kernel image that supports U-boot.

Also, before proceeding, have your netconsole running, we'll need to enter special boot parameters. (Run "nc -u -p 6666 -v -v 192.168.0.100 6666", replacing 192.168.0.100 for your Kurobox Ip. Make sure your kurobox/desktop are ready to use the netconsole)

Have the Debian image ready for boot

$ mount /dev/hda3 /mnt
-> Use your favorite tool to FTP the debian image to /mnt/
-> Use your favorite tool to FTP the kernel image to /mnt/
$ cd /mnt
$ tar xvfz debian_image.tar.gz
$ tar xzf linux-kenel_image.tar.gz
$ cp boot/uImage  boot/vmlinux.UBoot  (U-Boot is configured to boot from vmlinux.UBoot)
$ vi etc/fstab                        (make sure everything is ok - /dev/hda3 should mount on /, hda1 should mount on /mnt)

Before rebooting, you should check the network settings for this temporary Debian installation. In particular, the contents of:

  • /etc/network/interfaces
  • /etc/resolv.conf

(The necessary contents of these files are described below in 'Configuring your Ubuntu system')

$ write_ok                            (the box won't boot normally if you don't issue that command) 
$ reboot

At this point, have your netconsole running on your pc, be ready to stop the boot procedure hitting 's'.

Running debootstrap on the Debian Image

These steps are done on the netconsole :

-> Hit 's' before the timeout comes
=> ext2load ide 0:3 800000 boot/vmlinux.UBoot   (load the kernel on the memory)
=> setenv bootargs root=/dev/hda3               (set that the root file system is on hda3)
=> bootm 800000                                 (finally, boot from that memory address)

Hopefully the Debian image will boot. Back on the normal shell, telnet to it :

$ telnet 192.168.0.100  (username and password :  tmp-kun )
$ su                    (root password : root )
$ apt-get update

Note that we need to use a special version from debootstrap, one that has the ubuntu scripts :

$ apt-get install debootstrap
$ wget http://br.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_0.3.3.2ubuntu3_all.deb
$ dpkg -i debootstrap_0.3.3.2ubuntu3_all.deb 
$ debootstrap --arch powerpc feisty /mnt http://archive.ubuntu.com/ubuntu/  (place to pickup mirrors)

This will setup a base system on /mnt, and it will take a while. Nice time for a coffee :)

Configuring your Ubuntu system

At this point, we will get your Ubuntu system ready to be booted on.

$ cp /etc/fstab /mnt/etc/fstab (just a template that will help us configuring fstab later)
$ chroot /mnt /bin/bash 
$ mount -t proc proc /proc

Note that we will use the mainstream kernel on this system. This means that we have to use the PATA drivers, instead of IDE. So edit your fstab file, make sure sda1 goes to /, and sda3 goes to /mnt. Ensure we have no "hda1", "hda2" or "hda3", replace for "sda1", "sda2", "sda3".

$ vim /etc/fstab

We have to ensure the box will connect to the network. So edit the /etc/network/interfaces file.

$ vim /etc/network/interfaces (configure to use with dhcp or static config)

If you use DHPC :

auto eth0 lo
iface eth0 inet dhcp 
iface lo inet loopback 

If you use a static setting (replace the ips to fit you) :

auto eth0 lo
iface eth0 inet static 
address 192.168.0.100 
network 192.168.0.0 
netmask 255.255.255.0 
broadcast 192.168.0.255 
gateway 192.168.0.1 
iface lo inet loopback 

Ok, let's move on :

$ vim /etc/resolv.conf (make sure that is has your nameserver/router)
$ echo NameOfYourBox > /etc/hostname  (this is the coolest part - name your host! )
$ vim /etc/hosts (Update your hosts file with your new IP & hostname (if using static IP)
    127.0.0.1 localhost               
    192.168.0.100 NameOfYourBox      
$ vim /etc/apt/sources.list ( you can generate one for you on http://www.ubuntu-nl.org/source-o-matic/ )
$ apt-get update
$ apt-get install console-data (reconfigure keyboard, if needed)
$ dpkg-reconfigure console-data 
$ vim etc/hosts.allow (you should add your network there)
    ALL : 192.168.0.0/255.255.0.0 
    ALL : 127.0.0.1                   
$ dpkg-reconfigure tzdata (adjust your timezone)
$ adduser YourUserName
$ passwd (change the root password)
$ visudo           (add the following to the file, and save, so your user can use sudo)
    YourUserName ALL=(ALL) NOPASSWD: ALL
$ apt-get install ubuntu-standard (This set of packages provides a comfortable text-only Unix-like environment)
$ apt-get install ssh    (you'll need this to login to your Kurobox later)

Building the kernel

# apt-get install git git-core make patch unzip bison flex libncurses5-dev gcc  (install the additional packages for compiling kernel)
# update-alternatives --config git (choose #2: git-scm - we need git to get the sources for dtc)
# chown -R YourUserName:users /usr/src  (you need permission to write on that folder)
# su YourUserName (this part is meant to be run as a normal use)
$ cd /usr/src
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.tar.bz2 (get the most recent from http://www.kernel.org/pub/linux/kernel)
$ tar xjf linux-2.6.21.tar.bz2
$ ln -sf linux-2.6.21 linux 
$ git clone git://www.jdl.com/software/dtc.git dtc  (the dtc tool is used to compile a required special hardware database file)
$ cd /usr/src/dtc
$ make
$ sudo ln -sf /usr/src/dtc/dtc /usr/local/bin/
$ sudo apt-get install uboot-mkimage (that is needed to produce kernel images that the u-boot can boot into)
$ cd /usr/src/linux
$ cp arch/powerpc/configs/linkstation_defconfig .config
$ make menuconfig
$ make uImage modules
$ exit
# cd /usr/src/linux
# make modules_install
# cp arch/powerpc/boot/uImage /boot/vmlinux.UBoot
# cp arch/powerpc/boot/dts/kuroboxHG.dts /boot/
# cd /boot
# dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts
# reboot

(User:Mflint suspects that 'jigit' package is not needed -- indeed, maybe it's really not, removed from the guide)

Boot your Ubuntu OS

Make the Power/Back button work

$ sudo apt-get install avr-evtd
$ sudo vim /etc/default/avr_evtd     (tweak the configuration to suit your needs)

Make Hwclock work

Hwclock only reads from /dev/rtc, but the system makes /dev/rtc0. Add this command to have udev to link rtc->rtc0 every time the system boots, so you can use the hwclock command. Just add the line to the file:

$ sudo vim  /etc/udev/rules.d/50-udev.rules
        KERNEL=="rtc0",         SYMLINK+="rtc"

Fix Perl locale-related problems

If you see the following error when running perl:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Then run:

# locale-gen en_GB.UTF-8 en_US.UTF-8

(be sure to choose an appropriate locale)

Install popularity-contest

Inform the repository that you are using the packages related to the Kurobox, so they don't get forgotten, run :

# sudo apt-get install popularity-contest

How could this guide be improved

  • Provide a very slim base system, already using the newer u-boot kernel, and already having debootstrap installed;