Friday, March 21, 2014

Pogoplug E02 Arch Linux Arm Installation Step by Step

WARNING: This tutorial is only intended for the POGO-E02.

THIS TUTORIAL ASSUMES

  • POGO-E02
  • 1TB USB powered USB drive

PREP THE POGOPLUG FOR SSH ACCESS

NOTE: by default the pogoplug comes with ssh disabled now so you must activate it first on my.pogoplug.com

  1. Connect an ethernet cable to your router or modem and then to the pogoplug.
  2. With no drives connected, connect the power cord to the pogoplug to turn it on.
  3. Go to my.pogoplug.com. Sign up, then sign in.
  4. Click Activate Device at the bottom of the page. Complete all of the necessary steps to activate your device.
  5. Click the gear in the upper right corner > Settings > Security > select the checkbox for Enable SSH > create a password > click ok.

NOTE: you should now be able to ssh into your pogoplug


FIRST TIME SSH INTO POGOPLUG

  1. Log in to your router or modem and find the page that lists your connected devices and their associated IP addresses. For my c1000a modem it is Modem Status > Resource Table > LAN Device Session Log > Device Name and IP Address.
  2. From this list identify the most likely IP address of your pogoplug.
  3. ssh into your pogoplug:
  4. #  From a linux terminal enter the following command.
    #  Where 192.168.1.19 is the ip address of your pogoplug
    ssh root@192.168.1.19
    #  Enter the password you set up in step 5 above.
    #  Hit Enter
    #  You should now see a prompt similar to this:
    Pogoplug#
    
NOTE: congratulations! you can now install linux on your pogoplug....continue on!


ARCH LINUX ARM INSTALLATION

  1. Stop the pogogplug software otherwise it will interfere with the installation process. This only needs to be done once.
  2. killall hbwd
    
  3. Download and install a bootloader that can boot from USB drives:
    cd /tmp
    wget http://jeff.doozan.com/debian/uboot/install_uboot_mtd0.sh
    #  make it executable
    chmod +x install_uboot_mtd0.sh
    #  run the install script
    ./install_uboot_mtd0.sh
    #  Would you like to disable the Pogoplug services? [Y/n]
    #  n - to keep original Pogoplug software
    #  when booting without USB drives attached
    #  y - to "remove" the original Pogoplug software
    
  4. Connect a 1GB or larger USB drive. This is where we will install Arch Linux Arm. WARNING: This drive will be wiped of all it's data.

  5. Partition your USB drive. We will be using 3 partitions. One for the root partition (/), one for the swap partition, and one for the /home partition.
     !! WARNING: ALL DATA ON THIS DRIVE WILL BE LOST DURING THIS STEP !!
    /sbin/fdisk /dev/sda
    #  list partitions
    p 
    #  new partition
    n 
    #  primary partition
    p 
    #  first partition
    1
    #  default to start block
    #  press enter
    #  10GB root (/) partition
    +10G
    #  list partitions and verify your first partition
    p 
    #  new partition
    n 
    #  primary partition>
    p 
    #  second partition
    2
    #  default to start block
    #  press enter
    #  create 1GB swap partition
    +1G
    #  list partitions verify it's 1GB partition
    p 
    #  change type
    t 
    #  select partition 2 you just created
    2 
    #  changes to linux swap type
    82 
    #  list partitions verify it's linux swap now
    p 
    #  new partition
    n 
    #  primary partition
    p 
    #  third partition
    3
    #  default to start block
    #  press enter
    #  default to end block. use remainder of disk
    #  press enter
    #  list partitions verify all three are correct
    p 
    #  write new partition table to disk
    w 
    
  6. Download linux filesystem creation tool
    wget http://archlinuxarm.org/os/pogoplug/mke2fs
    #  make it executable
    chmod 755 mke2fs
    
  7. Format your first partition to ext3 filesystem and label it ROOTFS
    ./mke2fs -L ROOTFS -j /dev/sda1
    
  8. Mount your root partition into a temporary directory to facilitate installation of Arch Linux into the root partition (/dev/sda1)
    mkdir usb
    mount /dev/sda1 /tmp/usb
    
  9. Download and install Arch Linux ARM.
    cd usb
    wget http://archlinuxarm.org/os/ArchLinuxARM-armv5te-latest.tar.gz
    #  This can take a while
    tar -xzvf ArchLinuxARM-armv5te-*.tar.gz  
    rm ArchLinuxARM-armv5te-*.tar.gz
    sync
    
  10. Clean up and reboot.
    cd ..
    umount usb
    /sbin/reboot
    

INITIAL CONFIGURATION


  1. ssh back into the pogoplug
    #  Note: your ip address might have changed.
    #  check your router again for the ip.
    ssh root@192.168.1.19
    #  this time the password will be root
    
  2. Change the hostname. I'm using tvcloud.
    hostnamectl set-hostname tvcloud
    
  3. Format and label your partitions. Add fstab entries, mount partitions.
    #  add ROOTFS to fstab 
    #  so file system check will run when needed
    echo "LABEL=ROOTFS / ext3 rw,noatime 0 1" >> /etc/fstab
    #  make /dev/sda2 a swap partition with SWAP label
    mkswap -L SWAP /dev/sda2
    #  add entry to fstab for the swap partition
    echo "LABEL=SWAP swap swap defaults 0 0" >> /etc/fstab
    #  turn swap partition on
    swapon -a
    #  check swap
    swapon -s
    #  format/label third partition. 
    #  this will take a while for over 900GB
    mkfs.ext3 -L HOME /dev/sda3
    #  add HOME to fstab 
    #  so file system check will run when needed. 
    #  Also mounts to /home.
    echo "LABEL=HOME /home ext3 defaults,noatime 0 2" >> /etc/fstab
    #  mount all in fstab
    mount -a
    
  4. Upgrade the kernal and install some needed packages
    pacman -Sy linux-kirkwood linux-kirkwood-headers ntp base-devel nano wget
    #  Hit enter when prompted with "Enter a selection (default=all)"
    #  Answer Y when prompted with 
    #  linux-kirkwood and linux are in conflict. Remove linux [y/n]
    #  This might take a while
    
  5. Set your timezone
    #  to list available timezones
    timedatectl list-timezones
    #  once you've identified yours then set it
    timedatectl set-timezone America/Denver
    
  6. Set the network time protocol daemon to autostart since the pogoplug has no hardware clock
    systemctl enable ntpd
    #  start the ntp daemon
    systemctl start ntpd
    
  7. Set a static IP addresss
    cd /etc/netctl/
    #  move the current eth0 config to a backup location
    mv eth0 examples/eth0.old
    #  copy the static example
    cp examples/ethernet-static eth0
    #  edit the current eth0 config
    nano eth0
    #  Change the following sections to match your network. 
    #  My ip address is going to be 192.168.1.252. 
    #  My router is 192.168.1.2.
    Address=('192.168.1.252/24')
    Gateway='192.168.1.2'
    DNS=('192.168.1.2')
    #  CTRL+O to write your changes
    #  CTRL+X to quit
    
  8. Force a time update after the network starts
    echo "ExecUpPost='/usr/bin/ntpdate -u pool.ntp.org'">>/etc/netctl/eth0
    
  9. Install needed apps fw_printenv/fw_setenv is no longer working. Run the install_uboot_mtd0.sh script from within Arch Linux ARM. It will install the applications for you.
  10. Have uboot mount partition as ext3.
    fw_setenv usb_rootfstype ext3
    
  11. Correct machid - make LED Green versus Orange
    fw_setenv machid dd6
    
  12. Check if ethaddr is defined
    fw_printenv ethaddr
    
Possibly necessary if you run into problems:
  1. if you run into issues running fw_setenv and fw_printenv commands
    pacman -Sy uboot-env
    echo "/dev/mtd0 0xc0000 0x20000 0x20000">>/etc/fw_env.config
    
  2. Set ethaddr. replace XX:XX:XX:XX:XX with the MAC found on the bottom of your pogoplug
    fw_setenv ethaddr "XX:XX:XX:XX:XX"
    

SECURE THE INSTALLATION


  1. Reboot the server so it will use the new static ip
    reboot
    
  2. ssh back in using the new ip address
    ssh -p 25000 root@192.168.1.252
    
  3. Change the root password. While logged in as root issue this command and enter the password twice.
    passwd
    
  4.  Add user cloudadmin for all installation apps that don't require root.
    useradd -m -G users,audio,lp,optical,storage,video,wheel,power -s /bin/bash cloudadmin
    #  specify user password
    passwd cloudadmin
    
  5. Test the new user
    #  leave the current terminal open with root logged in
    #  just in case something didn't go right you can change it.
    #  open a new terminal and ssh in as the new user
    ssh cloudadmin@192.168.1.252
    
  6. If the login test in step 3 was successful then change the ssh settings to disallow root login.
    #  change to root
    su
    #  enter password
    #  edit the ssh daemon config file
    nano /etc/ssh/sshd_config
    #  search for and change the following settings
    #  Note: if accessing your pogoplug via ssh from outside
    #  your network you must forward port 25000 inside 
    #  your router to ip address 192.168.1.252
    Port 25000
    PermitRootLogin no
    #  CTRL+O to write your changes
    #  CTRL+X to quit
    #  restart ssh daemon
    systemctl restart sshd
    #  exit root.
    exit
    #  exit cloudadmin ssh session
    exit
    
  7. Test your new ssh settings
    #  leave the current terminal open with root logged in 
    #  just in case something didn't go right you can change it.
    #  open a new terminal and ssh in as the new user. 
    #  Note: we are using the new port set in step 4.
    ssh -p 25000 cloudadmin@192.168.1.252
    

REFERENCES

http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray#qt-platform_tabs-ui-tabs2
http://blog.qnology.com/2013/03/tutorial-pogoplug-e02-with-arch-linux.html

2 comments:

  1. Thanks a lot for such a complete guide.
    One question: what's the difference between the u-boot loader you recommend and the one from archlinuxarm.com guide (http://archlinuxarm.org/os/armv5te/boot/pogo_e02/pogo_e02.sh)? Does it matter which one is used?
    Also, how does the boot loader chooses which usb drive to boot from? If I happen to have two drives plugged in, both with OS installed, which one will it boot?
    Thanks.

    ReplyDelete
    Replies
    1. Sorry for the late reply. The difference in uboot loaders are the partitioning schemes for NAND as well as what the uboot has been configured to boot. Jeff's uboot comes with netconsole enabled and can also boot Arch Linux as well as Debian and the original Pogo Os. However, as of this writing Arch Linux uboot will also have netconsole enabled. The choice of which uboot to use really depends on what you will be doing with your Pogo-E02. Within uboot there are configuration parameters set to search for boot/configuration details on the respective usb connected devices. When it finds one it then loads this and passes it off to the Linux kernel. Since the load occurs in order, it will load the OS located on your first connected device. The pogo e02 has 4 usb ports. I'm not sure which one is considered device 0 but I'm guessing it's the front usb port although I have not reviewed the specs or tested to confirm this. Some say Jeff's uboot is more flexible than Arch's. I believe those people are the ones that switch between OSs (debian, arch, pogo) frequently and need the flexibility. There is also another uboot out there referred to as bodhi's but I haven't tried it myself. And if you're really a diehard you could download the original uboot source code and roll your own! I hope this helps!

      Delete