• Tag Archives Linux
  • TheForeman & Openstack

    Quick note to boast about success!

    Although my business isn’t all that big, I did find enough cash to finally start building up Oliekoets datacenter to a full-fledged private cloud.

    Considering I have no wish yet to pay licensing fee’s of any kind, I Implemented it all with open-source freely available software.

    CentOS , Foreman, Katello & Openstack.

    Thanks all! you guys rock. Time to start building my virtual machines.



  • RHEL Satellite access

    Today I am going to talk about (remote) access with satellite.

    Apparently, there are a few things that you must know in order to get stuff working correctly.

    First of all: Red Hat Identity Manager <-> Satellite coupling for user accounts.
    When you create the coupling as an external LDAP source in satellite, by default users get put in the anonymous group with very little rights within satellite. Luckily you can also provide a “group” DN for Identity servers which can then be used to assign groups in satellite.


    So create a user group (for instance : Admins) in the satellite user interface. Then in the third (external group) tab , assign a coupling between a redhat identity manager (IDM) group and the local admin group. The source however, must be set to “External” instead of your identity server, I am not sure if this is a bug or works as designed. Now, when users login who have the correct LDAP group, will automaticly be added to the new Admins group on satellite. Now you can assign rights (or even check the full admin checkbox) to the Admin usergroup and the remote access is done.

    Now a short paragraph about local webinterface access as the default admin account:

    When satellite needs reconfiguring, or reinstalling, Red Hat notes that the admin password gets reset to a default password and you will simply have to change it again. This is not entirely true. You can put the password of the default admin user in /etc/katello-installer/answers.katello-installer.yaml, but doing so is a security risk according to some people. I am noting that if you have root-access , the security risk of this file is negligant, because you can simply run katello-installer without any arguments and it will printout the admin password on the console after a succesful completion.

    – Mark.


  • Moving a virtualbox to real hardware part II

    After last weekend, the raw hard disk image of the virtual host has been successfully extracted. Now we will use this image, to try and find the PV’s on the disk so that we can extract those and import them back.

    1) Look for volumes on the virtual disk

    [root@hardware /vbox/HDD]# fdisk -l -u virtual.bak.vdi
    last_lba(): I don't know how to handle files with mode 8180
    You must set cylinders.
    You can do this from the extra functions menu.
    Disk virtual.bak.vdi: 0 MB, 0 bytes
    255 heads, 63 sectors/track, 0 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
             Device Boot      Start         End      Blocks   Id  System
    ./virtual.bak.vdi1              63      224909      112423+  83  Linux
    ./virtual.bak.vdi2          224910     4433939     2104515   82  Linux swap / Solaris
    ./virtual.bak.vdi3         4433940    41929649    18747855   8e  Linux LVM
    Partition 3 has different physical/logical endings:
         phys=(1023, 254, 63) logical=(2609, 254, 63)

    2) Now we can extract the volume using DD, note that the first partition is not an LVM volume and the second partition is the swap file. So we need the 3d partition.

    dd if=virtual.bak.vdi of=virtual.pv skip=4433939 count= 37495710 
    Note: Numbers in skip and count are starting location of lvm and lenght of lvm.
    This information is gathered from fdisk.
    The start of the partition is the skip argument, the Blocks*2 is the count argument.
    Note2: Make SURE the bs (block size) is the default fdisk output  ( eg. Units are in 512-byte sectors )
    The sector-size determines the multiplication factor of the blocks. If the Unit size =1024 bytes then
    you do not need to multiply by 2.

    4) check for loopback devices on the system

    [root@hardware /vbox/HDD]# losetup -f
    Note: If LVM probably has a lot of LVs in it you will quickly run
    out of the 8 loop devices linux allows by default. If using GRUB, you
    must pass a max_loop=X argument to set the number of loop devices
    available on boot. LILO probably has something similar.
    Note2: losetup -d [ to unmount the device ]

    5) Map loop device to Image

    losetup /dev/loop0  virtual.pv
    6) Scan for new physical volumes
    [root@hardware /vbox/HDD]# pvscan
      PV /dev/loop0   VG virtual_rootvg   lvm2 [17.88 GB / 2.88 GB free]
      Total: 1 [17.88 GB] / in use: 1 [17.88 GB] / in no VG: 0 [0   ]

    If you get an error like this one below:

    Note: WARNING: Duplicate VG name VolGroup00: gKOBnM-SdmK-V3SO-fI1M-Twlt-tmr6-36IoBs (created here) takes precedence over FXHljU-CSVg-zSRX-snZ2-KHxA-S5UD-3YxJYg

    That means that you have 2 pv’s belonging to a different volume group, but with the same name.

    The solution is easy, just rename the virtual_volumegroup by identifying it with its VG-ID.

    6) export VG

    [root@host system_disk]# vgexport virtual_rootvg
      Volume group "virtual_rootvg" successfully exported

    7) Import VG

    [root@host system_disk]# vgimport virtual_rootvg
      Volume group "virtual_rootvg" successfully imported

    8 ) Make volume active

    [root@hardware /vbox/HDD]# vgchange -ay virtual_rootvg
      1 logical volume(s) in volume group "virtual_rootvg" now active

    9) Try mounting the volume

    [root@hardware /vbox/HDD]# mount /dev/virtual_rootvg/lv_root /mnt/virtdisk


    [root@hardware /vbox/HDD]# ls -l /mnt/virtdisk/
    total 204
    drwxr-xr-x  2 root root  4096 Sep 25 04:02 bin
    drwxr-xr-x  2 root root  4096 Sep 10 07:00 boot
    drwxr-xr-x  4 root root  4096 Sep 10 07:00 dev
    drwxr-xr-x 96 root root 12288 Dec  2 04:02 etc
    drwxr-xr-x 79 root root  4096 Oct 28 00:00 home
    drwxr-xr-x 12 root root  4096 Sep 11 04:06 lib
    drwxr-xr-x  8 root root  4096 Sep 11 04:06 lib64
    drwx------  2 root root 16384 Sep 10 06:58 lost+found
    drwxr-xr-x  2 root root  4096 Sep 10 14:37 lsst
    drwxr-xr-x  2 root root  4096 Oct  6 10:40 media
    dr-xr-xr-x  2 root root  4096 Sep 10 13:05 misc
    drwxr-xr-x  2 root root  4096 Oct 10  2006 mnt
    dr-xr-xr-x  2 root root  4096 Sep 10 13:05 net
    drwxr-xr-x  2 root root  4096 Oct 10  2006 opt
    drwxr-xr-x  2 root root  4096 Sep 10 07:00 proc
    drwxr-x--- 16 root root  4096 Dec  2 14:59 root
    drwxr-xr-x  2 root root 12288 Sep 11 04:07 sbin
    drwxr-xr-x  2 root root  4096 Sep 10 14:02 scr
    drwxr-xr-x  2 root root  4096 Sep 10 07:00 selinux
    drwxr-xr-x  3 root root  4096 Sep 10 14:38 share
    drwxr-xr-x  2 root root  4096 Oct 10  2006 srv
    drwxr-xr-x  2 root root  4096 Sep 10 07:00 sys
    drwxrwxrwt 10 root root  4096 Dec  2 15:41 tmp
    drwxr-xr-x 15 root root  4096 Sep 10 07:03 usr
    drwxr-xr-x 24 root root  4096 Sep 10 07:08 var

    Now, I can unmount the volume, etc. etc. etc.:

    [root@hardware /vbox/HDD]# umount /mnt/virtdisk
    [root@hardware /vbox/HDD]# vgchange -a n
    [root@hardware /vbox/HDD]# losetup -d /dev/loop0

    Finally, I am sure that the PV is healthy and I can move it to the backup host.

    Next step, boot from Live-CD.