Just not my day to update Openhab2

Trying to update openhab2 in hope of fixing some problems with installing addons. openhab2-online_2.0.0~20170103034422
This is what I get:

Unpacking openhab2-online (2.0.0~20170103034422) over (2.0.0~20170103034422) …
rm: cannot remove ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/socket.io-client-0.8.2.jar’: Input/output error
rm: cannot remove ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/json-20140107.jar’: Input/output error
rm: cannot remove ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/okio-1.9.0.jar’: Input/output error
rm: cannot remove ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/okhttp-3.4.1.jar’: Input/output error
rm: cannot remove ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/okhttp-ws-3.4.1.jar’: Input/output error
rm: cannot remove ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/engine.io-client-0.8.2.jar’: Input/output error
dpkg: warning: subprocess old post-removal script returned error exit status 1
dpkg: trying script from the new package instead …
dpkg: … it looks like that went OK
Processing triggers for systemd (229-4ubuntu13) …
Setting up openhab2-online (2.0.0~20170103034422) …
chown: changing ownership of ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/socket.io-client-0.8.2.jar’: Input/output error
chown: changing ownership of ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/json-20140107.jar’: Input/output error
chown: changing ownership of ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/okio-1.9.0.jar’: Input/output error
chown: changing ownership of ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/okhttp-3.4.1.jar’: Input/output error
chown: changing ownership of ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/okhttp-ws-3.4.1.jar’: Input/output error
chown: changing ownership of ‘/var/lib/openhab2/tmp/mvn/org/openhab/ui/org.openhab.ui.habmin/2.0.0-SNAPSHOT/engine.io-client-0.8.2.jar’: Input/output error
dpkg: error processing package openhab2-online (–configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
openhab2-online
E: Sub-process /usr/bin/dpkg returned an error code (1)

What OS / system? If Raspberry Pi, perhaps your SD card is corrupt?

Its a Pine64 running Ubuntu 16.04 LT

Could be the same problem as your OS is installed on an SD card as well. Try

sudo fsck /

which should find and point out problems on your filesystem.

Ok. Going to give that a try.
The sd card is a cheap sandisk. Im going to pick up a new one today. Do you recommend a certain kind?
And do you think I can just make a image of the this old one and then write it to the new one without any problems?

I would recommend to actually take a small SSD rather than sd card.
I’ve run RPI’s and pines for some time and sd cards seem to die pretty fast in most instances where writes are common.

So, for your pine, boot from sd (don’t think there is an alternative to that) and run from ssd for the main system.
You’ll have much better stability in the long run and cost (30/40 €) are not extremely more… (considering you would ‘consume’ a sd card each half year)

I was thinking on doing that. This is the second sd card for the pine i have replaced.
Is it easy to setup to boot from the sd and then run off a SSD?

Yes, that’s very easy. pretty much chasing the boot file.
I’m not@home, but can look it up tomorrow if you want

Thanks Marcel, I would really like that.

So the main change is in the /boot/uEnv.txt file where you need to change/add the root argument to pont to the new ssd card instead of the sd card.

console=tty0 console=ttyS0,115200n8 no_console_suspend root=/dev/sda1
kernel_filename=pine64/Image
initrd_filename=initrd.img
ethaddr=8e:21:0d:2e:aa:aa
optargs=disp.screen0_output_mode=720p60
extraargs=root=/dev/sda1
root=/dev/sda1

the 2nd change is to the /etc/fstab (the one one the ssd card). This is my new fstab

# <file system> <dir>   <type>  <options>            <dump>  <pass>
/dev/mmcblk0p1  /boot   vfat    defaults                        0               2
#/dev/mmcblk0p2 /       ext4    defaults,noatime                0               1
# /dev/sda1      /mnt/ssd    ext4    defaults,noatime,noauto,user    0               1
/dev/mmcblk0p2 /mnt/sd       ext4    defaults,noatime,noauto,user    0               1
/dev/sda1      /             ext4    defaults,noatime                0               1

To prepare the fs on the ssd, there are multiple ways. First format the ssd (with parted) The way I did it was to boot from sd card, mount & copy everything. than change the fstab and bootfile. Roughtly the following commands

sudo mkfs -t ext4 -L rootfs /dev/sda1
sudo mkdir /mnt/ssd
sudo mount  /dev/sda1/ /mnt/ssd
sudo rsync -v -ax / /mnt/ssd
sudo nano /mnt/ssd/etc/fstab
sudo mount /dev/mmcblk0p1 /boot
sudo nano /boot/uEnv.txt
sudo reboot

I’m plan to use some flash USB 3.0 for example 128GB with my Raspi3. It’s will enough for me. Will it be better than SD card? What do you think?

USB Flash drives use the same technology as SD cards. You will get a good deal of longevity by having such a large drive (gives it more space to wear level) but it will still eventually fail. SSDs use a slightly different type of technology which makes them not wear out quite so easily.