Fix inconsistent/broken pkgng on FreeBSD

Environment:
FreeBSD 10.1-RELEASE-p8 i386

Problem:

  • FreeBSD repository is up-to-date & all repositories are up-to-date, but when I try to install some package, it’ll try to fetch the non-latest version(so … 404 not found)
  • Keep getting message like this : pkg: cached package bind-tools-9.10.2: size mismatch, fetching from remote
  • pkd version said that there are some out-date packages, but pkg upgrade said every thing is up-to-update

pkg update -> not working
pkg clean + pkg update -> still not working
reboot -> of course not working …

So I did this to clean its cache:
$ sudo rm -rf /var/cache/pkg/*
and force update
$ sudo pkg update -f

Fortunately, it works fine now.

Error: Read-only file system on Linux

Today I found that there is a strange situation, in certain mount point on my web server (Debian GNU/Linux 7.8), every process with write behavior will get messages like this (That’s the result from command touch test):

touch: cannot touch `test’: Read-only file system

I don’t think I mount it as read-only, so I check it with(the mount point is /srv):

$ mount | grep srv

And I got:

/dev/sdb1 on /srv type ext4 (ro,relatime,data=ordered)

Very strange … there was something wrong, could I remount it with r/w? I tried:

$ sudo mount -o remount,rw,relatime,data=ordered /srv

Hmmmm …

mount: cannot remount block device /dev/sdb1 read-write, is write-protected

Okay, seems I need to check the filesystem …

$ sudo umount /srv
$ sudo fsck.ext4 /dev/sdb1

The process didn’t take a very long time, just within few mins, and that’s the result:

e2fsck 1.42.5 (29-Jul-2012)
/dev/sdb1: recovering journal
/dev/sdb1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 796453/122077184 files (3.8% non-contiguous), 321192367/488281498 blocks

Let’s mount it again:

$ sudo mount -o rw,relatime,data=ordered /srv 

Oh, I didn’t get any error message this time, let’s check it again:

$ mount | grep srv

And … it’s good again

/dev/sdb1 on /srv type ext4 (rw,relatime,data=ordered)

Okay, nice … it’s very easy this time, I’ve got some disks with damaged partition before, event I can’t not recognize its partition type, though I fixed it, but I didn’t record the process that time, haha.

Virtualization related notes

Guest vs Host:

  • Host – usually runs on physical hardware, lower level.
  • Guest – runs on the virtual/virtualized environment, upper level.

Virtualization types:

  • Full virtualization –  virtualize all the devices!
    • Can run almost all the operating systems without any modifications.
    • Emulate all the devicesn.
    • Slower than Paravirtualization and Operating-system-level virtualization.
    • Software Emulation (Without Hardware-Assisted-Virtualization)
      • Very Slow.
      • Need to do some jobs like binary translation or software instruction decode, will have a heavy overhead, is very inefficiet.
    • Paravirtualization on HVM
      • Full virtualization with paravirtualization drivers.
  • Paravirtualization(PV) – use modified kernel to interact with the special interface
    • Guest knows it’s a guest on the host, the guest will communicate with hypervisor.
    • Use hypercall (call to hypervisor) as its system call.
    • Hard(almost impossible) to modify the kernel of closed-source operating systems like Windows to use this method.
    • Faster than full virtualization but slower than operating-system-level virtualization.
  • Hardware-Assisted-Virtualization (HVM, HAV)
    • Using help from hardware capabilities.
    • Faster than Software Emulation.
    • Technic examples
  • Operating-system-level virtualization – don’t really virtualize the devices
    • Fastest – SUPER FAST!!!
    • Isolate different user space instances.
    • Don’t need hardware support.
    • Must run on the same kernel
      • Means bad compatibility.
    • Examples:
  • Partial virtualization – need be confirmed, not a usual type

Type-1 vs type-2 hypervisor:

Wikipedia also use Application/Environment and OS level to distinguish different types of virtualization:

  • Application-level
    • Sandbox
  • Environment-level
    • Containers
  • OS-level
    • Hypervisors

Common integrated virtualization solutions:

Resources and references:

The paravirtualization spectrum

source : https://blog.xenproject.org/2012/10/31/the-paravirtualization-spectrum-part-2-from-poles-to-a-spectrum/

Still learning, hope that there are not too many wrong things here … comments to point out mistakes/weak points are welcome!

Use Xen Orchestra to manage XenServer from WebUI

Proxmox VE supports Web UI by default, but XenServer
does not, fortunately, there is Xen Orchestra(XOA) to help us manage XenServer via Web UI and support https by default, you can download Xen Orchestra from https://xen-orchestra.com/, they also put the projects on https://github.com/vatesfr.

I just tried the free version of Xen Orchestra, the media is also a template for XenServer, so import it to a XenServer via OpenXenManager or XenCenter, if you wanna use static IP but not dhcp, login and setup its network interface, its default login id/password(for XOA v3.6/3.7) is root/xoa(root/root for XOA v3.5)

OpenXenCenter

after that, you can now visit its panel via your browser, and login, it supports both http and https, the default login id/password is [email protected]/admin

Login screenshot:
Xen Orchestra

More screenshots:

XenServer and user setting:
XOASetting

Tree View:
XOATreeView

Overview of XenServer Host:
XOAHostView

Overview of one of my VM:
XOAVMVIew

Console of VM:
XOAVMConsole

I think Xen Orchestra really makes XenServer more convenient, but it’s not full functional as XenCenter or OpenXenManager.