Hosted Raspberry Pi at PCExtreme – Reinstalled with Arch Linux ARM

This is a follow up post for that one: Hosted Raspberry Pi at PCExtreme – Reinstalled with Raspbian.

I crashed my original OS and asked the kind people at PCExtreme to reinstall my RPi. They did and here is what I did when I received the credentials for the newly set up system:

elk:WhatsMyIP pklaus$ ssh root@bigpi
Warning: Permanently added the RSA host key for IP address '36.29.81.60' to the list of known hosts.
root@bigpi.klaus.pw's password: 
Welcome to Arch Linux ARM

     Website: http://archlinuxarm.org
       Forum: http://archlinuxarm.org/forum
         IRC: #archlinux-arm on irc.Freenode.net

Last login: Wed Dec 31 17:01:01 1969 from firewall-gyro.office.pcextreme.nl

OK, so the time is not correct, but that can be fixed. They connected from firewall-gyro.office.pcextreme.nl last time for login.

[root@alarmpi ~]# cat ~/.bash_history 
cd /etc/netctl/
ls
vi eth0 
cd examples/ethernet-static ./eth0 
cd examples/ethernet-static .eth0 
cp examples/ethernet-static /etc/netctl/eth0 
cd ../
cd netctl/
vi eth0 
nano eth0 
reboot
ping google.nl
cd /etc/netctl/
nano eth0 
nano /etc/resolv
nano /etc/resolv.conf 
sync
halt
fdisk -l
passwd root
sync

I don't think this is the whole bash_history. If you reboot without logging out first, entries get lost...

Let's check how they configured the static IP address (I changed the IPs though!):

[root@alarmpi ~]# cat /etc/netctl/eth0
Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('36.29.81.60/24')
Gateway='36.29.81.3'
DNS=('37.29.81.1')
AutoWired=yes
## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

Here's the difference to the template that comes with netctl:

[root@alarmpi ~]# diff /etc/netctl/examples/ethernet-static /etc/netctl/eth0
5,9c5,8
< Address=('192.168.1.23/24' '192.168.1.87/24')
< #Routes=('192.168.0.0/24 via 192.168.1.2')
< Gateway='192.168.1.1'
< DNS=('192.168.1.1')
< 
---
> Address=('36.29.81.60/24')
> Gateway='36.29.81.3'
> DNS=('37.29.81.1')
> AutoWired=yes

What about autostart?

[root@alarmpi ~]# netctl list  
  eth0

[root@alarmpi ~]# netctl status eth0
* netctl@eth0.service - Networking for netctl profile eth0
   Loaded: loaded (/usr/lib/systemd/system/netctl@.service; static)
   Active: inactive (dead)
     Docs: man:netctl.profile(5)

How is the partition table set up? What file systems are set up?

[root@alarmpi ~]# fdisk -l

Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1           2048    186367   92160   c W95 FAT32 (LBA)
/dev/mmcblk0p2         186368   3667967 1740800   5 Extended
/dev/mmcblk0p5         188416   3667967 1739776  83 Linux


Disk /dev/sda: 28.9 GiB, 31009800192 bytes, 60566016 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc3072e18

Device    Boot Start       End   Blocks  Id System
/dev/sda1       8192  60565503 30278656  83 Linux

What DNS server is being used?

[root@alarmpi ~]# cat /etc/resolv.conf
# Generated by resolvconf
nameserver 37.29.81.1

What's the current status of the system?

[root@alarmpi ~]# htop
-bash: htop: command not found

Not installed yet? Then let's do some upgrades:

[root@alarmpi ~]# pacman -Syyu
:: Synchronizing package databases...
 core                         155.8 KiB  1207K/s 00:00 [############################] 100%
 extra                          2.2 MiB  4.51M/s 00:00 [############################] 100%
 community                      2.3 MiB  7.26M/s 00:00 [############################] 100%
 alarm                         28.9 KiB  1113K/s 00:00 [############################] 100%
 aur                           62.5 KiB  1116K/s 00:00 [############################] 100%
:: Starting full system upgrade...
:: Replace lzo2 with core/lzo? [Y/n] 
resolving dependencies...
looking for inter-conflicts...

Packages (66): bash-4.3.024-1  coreutils-8.23-1  cracklib-2.9.1-1  cryptsetup-1.6.5-2
               curl-7.37.1-1  dbus-1.8.6-1  device-mapper-2.02.109-2  dhcpcd-6.4.3-1
               diffutils-3.3-2  dnssec-anchors-20140629-1  e2fsprogs-1.42.11-1
               file-5.19-1  filesystem-2014.07-1  findutils-4.4.2-6  gettext-0.19.2-1
               gnupg-2.0.26-1  gpgme-1.5.1-1  grep-2.20-1  hwids-20140602-1
               iproute2-3.15.0-1  kbd-2.0.2-1  kmod-18-1  krb5-1.12.2-1
               libarchive-3.1.2-8  libdaemon-0.14-3  libdbus-1.8.6-1
               libedit-20140620_3.1-1  libffi-3.1-2  libgcrypt-1.6.2-1  libidn-1.29-1
               libnl-3.2.25-1  libsystemd-216-1  libusb-1.0.19-1  libutil-linux-2.25-3
               licenses-20140629-1  linux-firmware-20140603.a4f3bc0-1
               linux-raspberrypi-3.12.26-1  lvm2-2.02.109-2  lzo-2.08-3
               lzo2-2.06-3 [removal]  man-pages-3.70-1  mdadm-3.3.1-2  mpfr-3.1.2.p10-1
               nano-2.2.6-3  netctl-1.9-1  ntp-4.2.7.p465-1  openresolv-3.5.7-1
               openssl-1.0.1.i-1  pacman-mirrorlist-20140816-1  pam-1.1.8-5
               perl-5.20.0-5  raspberrypi-firmware-bootloader-20140729-1
               raspberrypi-firmware-bootloader-x-20140729-1
               raspberrypi-firmware-tools-20140729-1  s-nail-14.7.6-1  sysfsutils-2.1.0-9
               systemd-216-1  systemd-sysvcompat-216-1  tar-1.28-1
               thin-provisioning-tools-0.3.2-1  tzdata-2014f-1  util-linux-2.25-3
               vi-1:050325-4  which-2.20-7  wpa_supplicant-2.2-2  xfsprogs-3.2.1-1

Total Download Size:    89.23 MiB
Total Installed Size:   302.23 MiB
Net Upgrade Size:       38.66 MiB

:: Proceed with installation? [Y/n] n
synchronizing filesystem...

Can we reach Google? And how quick?

[root@alarmpi ~]# ping google.de
PING google.de (173.194.65.94) 56(84) bytes of data.
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=1 ttl=50 time=5.23 ms
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=2 ttl=50 time=5.11 ms
^C
--- google.de ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 5.115/5.175/5.236/0.094 ms

Check ip addresses:

[root@alarmpi ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
    link/ether 92:36:1e:8b:e8:2c brd ff:ff:ff:ff:ff:ff
3: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
    link/ether e2:78:6f:46:0c:92 brd ff:ff:ff:ff:ff:ff
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 3f:ed:a6:58:f8:00 brd ff:ff:ff:ff:ff:ff
    inet 36.29.81.60/24 brd 92.63.173.255 scope global eth0
       valid_lft forever preferred_lft forever

OK, it looks like we don't have IPv6 yet.

Checking time:

[root@alarmpi ~]# date 
Wed Dec 31 17:58:05 MST 1969

[root@alarmpi ~]# ntpd -gq
31 Dec 17:58:11 ntpd[226]: ntpd 4.2.7p465@1.2483-o Tue Aug 26 02:59:59 UTC 2014 (1): Starting
31 Dec 17:58:11 ntpd[226]: Command line: ntpd -gq
31 Dec 17:58:11 ntpd[226]: proto: precision = 3.000 usec (-18)
31 Dec 17:58:11 ntpd[226]: Listen and drop on 0 v6wildcard [::]:123
31 Dec 17:58:11 ntpd[226]: Listen and drop on 1 v4wildcard 0.0.0.0:123
31 Dec 17:58:11 ntpd[226]: Listen normally on 2 lo 127.0.0.1:123
31 Dec 17:58:11 ntpd[226]: Listen normally on 3 eth0 92.63.173.121:123
31 Dec 17:58:11 ntpd[226]: Listen normally on 4 lo [::1]:123
31 Dec 17:58:11 ntpd[226]: Listen normally on 5 eth0 [2a00:f10:103:201:ba27:ebff:fe91:fa93]:123
31 Dec 17:58:11 ntpd[226]: Listen normally on 6 eth0 [fe80::ba27:ebff:fe91:fa93%4]:123
31 Dec 17:58:11 ntpd[226]: Listening on routing socket on fd #23 for interface updates
27 Aug 05:33:50 ntpd[226]: ntpd: time set +1409135737.475639 s
ntpd: time set +1409135737.475639s

Setting time automatically via these crontab -e entries (of the root user):

# m  h dom mon dow  user  command
@reboot sleep 6; ntpd -gq
11,43 *  *   *   *   root  ntpd -gq

Upgrading packages:

pacman -Syyu
pacman -S htop screen bash-completion bmon git

After changes to /etc/netctl/eth0, follow the steps described in the basic config section of the netctl Wiki entry:

netctl enable profile
netctl reenable profile

Reenabling IPv6 (see Enable IPv6 with Arch Linux on Raspberry Pi and IPv6 on Arch Linux' Wiki):

[root@alarmpi ~]# cat /boot/cmdline.txt
ipv6.disable=1 avoid_safe_mode=1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p5 rootfstype=ext4 elevator=noop rootwait
# Remove  `ipv6.disable=1`  from that line   and reboot

and you get

[root@alarmpi ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
    link/ether ab:77:ff:81:63:00 brd ff:ff:ff:ff:ff:ff
3: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
    link/ether 02:5e:2e:6b:9b:10 brd ff:ff:ff:ff:ff:ff
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 3f:ed:a6:58:f8:00 brd ff:ff:ff:ff:ff:ff
    inet 36.29.81.60/24 brd 92.63.173.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2000:a:b:c:3fed:a6ff:fe58:f800/64 scope global dynamic 
       valid_lft 1730sec preferred_lft 830sec
    inet6 fe80::3fed:a6ff:fe58:f800/64 scope link 
       valid_lft forever preferred_lft forever

Adding the USB pen drive back to the file system:

ls /dev/sd?
ls /dev/sda?
fdisk -l
fsck.ext4 /dev/sda1
cat << "EOF" >> /etc/fstab
/dev/sda1       /mnt     ext4   defaults        0       2
EOF
mount /mnt

Setting up hostname, locale and time zone:

hostnamectl set-hostname bigpi
localectl set-locale LANG="en_US.utf8"
timedatectl set-timezone Europe/Berlin

Next reinstallation

cat ~/.bash_history

logout
su -s
su
ifconfig
systemctl reboot
ifconfig
nano /etc/netctl/static
ifconfig
ifconfig
netctl enable static
ifconfig
ifconfig /all
nano /etc/netcl/static
nano /etc/netcl/example/static
cd /etc
ls
cd /etc/netctl
ls
nano /etc/netctl/static
netctl enable eth0
nano /etc/netctl/static
netctl enable static
ifconfig
systemctl disable dhcpcd@eth0.service
netctl enable static
ifconfig

ifconfig
netctl enable static
ifconfig
netctl start static
nano /etc/netctl/static
netctl start static
netctl enable static
netctl stop static
netctl enable static
netctl start static
ifconfig
nano /etc/netctl/static
ifconfig
ifconfig eth0
nano /etc/netctl/static
netctl start static
systemctl status netctl@static.service
cd /etc/netctl
ls
cd /etc/netctl/interfaces
ls
cd..
cd ..
netctl restart static
netctl reboot static
netctl status static
ifconfig
systemctl start network@interface
service network restart
ifdown eth0
ifup eth0
ls
fdisk -l
nano /etc/systemd/network/eth0.network
nano /etc/conf.d/net-conf-interface
nano /etc/systemd/network/eth0.network
nano /etc/netctl
cd /etc/netctl
ls
nano static
systemctl enable network@static
ifconfig
ifconfig eth0
systemctl status network@static
systemctl disable network@static
ifconfig
systemctl enable static
ifconfig
ifconfig
cd /syctemctl
cd /sytemctl
cd /systemctl
systemctl enable network@interface01
systemctl start network@interface01
cd /usr/local/bin
ls
passwd
exit

[root@alarmpi ~]# uname -a

Linux alarmpi 3.18.6-2-ARCH #1 PREEMPT Sun Feb 8 09:43:43 MST 2015 armv6l GNU/Linux

[root@alarmpi ~]# ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
    link/ether ba:bb:43:ad:aa:76 brd ff:ff:ff:ff:ff:ff
3: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
    link/ether 82:93:52:96:b4:91 brd ff:ff:ff:ff:ff:ff
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:27:eb:91:fa:93 brd ff:ff:ff:ff:ff:ff
    inet 92.63.173.121/24 brd 92.63.173.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a00:f10:103:201:ba27:ebff:fe91:fa93/64 scope global mngtmpaddr dynamic 
       valid_lft 1654sec preferred_lft 754sec
    inet6 fe80::ba27:ebff:fe91:fa93/64 scope link 
       valid_lft forever preferred_lft forever

[root@alarmpi ~]# fdisk -l

Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xec410fbd

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   206847   204800  100M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      206848 31116287 30909440 14.8G 83 Linux

Disk /dev/sda: 28.9 GiB, 31009800192 bytes, 60566016 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc3072e18

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 60565503 60557312 28.9G 83 Linux

[root@alarmpi ~]# cat /etc/netctl/static

Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('92.63.173.121/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='92.63.173.3'
DNS=('109.72.90.52')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

[root@alarmpi ~]# diff /etc/netctl/examples/ethernet-static /etc/netctl/static

5c5
< Address=('192.168.1.23/24' '192.168.1.87/24')
---
> Address=('92.63.173.121/24')
7,8c7,8
< Gateway='192.168.1.1'
< DNS=('192.168.1.1')
---
> Gateway='92.63.173.3'
> DNS=('109.72.90.52')

[root@alarmpi mnt]# cat /etc/resolv.conf

# This file is managed by systemd-resolved(8). Do not edit.
#
# Third party programs must not access this file directly, but
# only through the symlink at /etc/resolv.conf. To manage
# resolv.conf(5) in a different way, replace the symlink by a
# static file or a different symlink.

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001:4860:4860::8888
# Too many DNS servers configured, the following entries may be ignored.
nameserver 2001:4860:4860::8844