2022-12-12

GitLab runner on Windows with bash shell on windows contianer on Docker

As part of your pipeline, you may need to perform browser testing across different platforms/environments. To minimize testing time, it's best to use a consistent shell scripting language across platforms.

One solution is to use the bash shell on Windows with the shell executor, which you can implement by following this guide: https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/3503. Alternatively, you can use pwsh across all platforms.

If you plan to use the docker-windows executor, you'll need a GitLab helper container image with bash support. You can create one for yourself by following this guide: https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/3779.

For building the application image, consider using the windowscore or windowsserver (for GUI applications) base image. To manage and install applications, use choco.

 

FROM mcr.microsoft.com/powershell:lts-windowsserver-ltsc2022

ARGS CHROME_VERSION=
108.0.5359.99

RUN choco install -y google-chrome-stable --version $Env:
CHROME_VERSION







2018-09-21

glusterfs on fedora on break geo-replication






glusterfs geo-replication break on Fedora


From /var/log/glusterfs/geo-replication/gv0_node1/gsyncd.log

   class Changes(object):
  File "/usr/libexec/glusterfs/python/syncdaemon/libgfchangelog.py", line 19, in Changes
    use_errno=True)
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 361, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libgfchangelog.so: cannot open shared object file: No such file or directory


From /usr/libexec/glusterfs/python/syncdaemon/libgfchangelog.py
class Changes(object):
    libgfc = CDLL("/usr/lib64/libgfchangelog.so", mode=RTLD_GLOBAL,
                  use_errno=True)

On Fedora/RHEL , .so symlink is provided by -devel packages. To fix install, install glusterfs-devel package.


reference: https://bugzilla.redhat.com/show_bug.cgi?id=1631595

2016-11-16

building Canon MF3010 driver on Fedora25

Building Canon MF3010 driver from source, download the source from http://support-in.canon-asia.com/contents/IN/EN/0100270810.html for UFR II/UFR II LT Printer Driver for Linux V3.20 .

[ritesh@x230t SPECS]$ diff -Naurp cndrvcups-common.spec.orig cndrvcups-common.spec
--- cndrvcups-common.spec.orig 2016-11-16 14:37:13.341877857 +0530
+++ cndrvcups-common.spec 2016-11-16 14:34:40.674461102 +0530
@@ -1,5 +1,6 @@
 %define VERSION 3.60
 %define  RELEASE 1
+%global __requires_exclude ^libcaiousb.so$

 %ifarch x86_64
 %define libs32 /usr/lib
@@ -19,6 +20,7 @@ Vendor: CANON INC.
 Group: Applications/Publishing

 Source: cndrvcups-common-%{version}-%{release}.tar.gz
+Patch0: cndrvcups-common-gmodule.patch

 BuildRoot: %{_tmppath}/%{name}-root

@@ -27,6 +29,8 @@ BuildRoot: %{_tmppath}/%{name}-root
 %prep
 %setup -q

+%patch0 -p1
+
 cd buftool
 ./autogen.sh --prefix=%{_prefix} --enable-progpath=%{_bindir} --libdir=%{_libdir} --disable-shared --enable-static


For Fedora25, gmodule needs to be added to build dependency
 
[ritesh@x230t SPECS]$ cat ../SOURCES/cndrvcups-common-gmodule.patch
--- cndrvcups-common-3.60/cngplp/configure.in 2014-12-05 15:26:04.000000000 +0530
+++ cndrvcups-common-3.60/cngplp/configure.in 2016-11-16 14:17:32.517073588 +0530
@@ -11,7 +11,7 @@ AM_PROG_CC_STDC
 AC_HEADER_STDC
 AM_PROG_LIBTOOL

-pkg_modules="gtk+-2.0 >= 2.0.0"
+pkg_modules="gtk+-2.0 >= 2.0.0 gmodule"
 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
 AC_SUBST(PACKAGE_CFLAGS)
 AC_SUBST(PACKAGE_LIBS)


rpmbuild away and install. 

2016-09-01

Running Sky from tel.red on Fedora25

 
On Fedora 25, sky crash up on start in QT.
 
Program received signal SIGABRT, Aborted.
0x00007ffff112692f in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff112692f in raise () at /lib64/libc.so.6
#1  0x00007ffff112852a in abort () at /lib64/libc.so.6
#2  0x00007ffff200dcb1 in  () at /usr/lib/sky/lib/libQt5Core.so.5
#3  0x00007ffff24ee835 in QGuiApplicationPrivate::createPlatformIntegration() () at /usr/lib/sky/lib/libQt5Gui.so.5
#4  0x00007ffff24ee955 in QGuiApplicationPrivate::createEventDispatcher() () at /usr/lib/sky/lib/libQt5Gui.so.5
#5  0x00007ffff21cea64 in QCoreApplicationPrivate::init() () at /usr/lib/sky/lib/libQt5Core.so.5
#6  0x00007ffff24f2340 in QGuiApplicationPrivate::init() () at /usr/lib/sky/lib/libQt5Gui.so.5
#7  0x00007ffff2be62b9 in QApplicationPrivate::init() () at /usr/lib/sky/lib/libQt5Widgets.so.5
#8  0x0000000000434e41 in main ()
(gdb) quit
A debugging session is active.
 
 
Once workaround, is to let sky use the system provided qt5 libraries. 
$ rpm -q sky
sky-2.1.6327-1.fc24.x86_64
$ cd /usr/lib/sky
$ sudo mkdir old
$ sudo mv libQt5* old
$ sky


Would be nicer, if sky could use system libraries by default.



$ rpm -Uvh sky-system-qt ( meta package,installs sky and qt deps)
$ cat sky.sh
 
if shibboleet and ~/config/sky/.version is older than install
  use system library and start sky
  if start failed, disable shibboleet
else
  ld library jazz
  sky
fi

2016-08-07

installing splunkforwarder using ansible

The vars
---
  splunk_home: /opt/splunkforwarder
  splunk_exec: "{{ splunk_home }}/bin/splunk"


The playbook
---

- name: install splunk forwarder
  yum: name=splunkforwarder
       state=latest
  become: yes

# check for first time run
- stat:
    path: "{{ splunk_home }}/ftr"
  register: result_splunk_ftr_stat

- block:
    - name: setup splunk for first time run
      shell: |
        ps aux|grep splunkd && pkill -9 splunkd || true
        {{ splunk_exec }} start --accept-license --answer-yes --no-prompt
        {{ splunk_exec }} enable boot-start
  when: result_splunk_ftr_stat.stat.exists
  become: yes


# Only add servers which are not in list
# shell: /opt/splunkforwarder/bin/splunk list forward-server -auth user:pass
# register: current_fwd_list
#- block:
#    shell: "{{ splunk_exec }} add forward-server {{ splunk_server }}:{{ splunk_server_port }} -auth user:pass"
# when: item not in current_fwd_list
#  become: yes
# with_items: splunk_fwd_server

# same logic for adding logs
#    - shell: "{{ splunk_exec }} add monitor {{ item.path }} -index {{ item.idx }} -sourcetype {{ item.path }} || true"
#  with_items:  "{{ splunk_log_files }}"

and profit !

2016-06-22

adding authorized keys using ansible


You can use jinja template engine to set this

vars:
  ssh_user_key:
    - user: ritesh
      exclusive: no
      keys:
        - ritesh.centos
        - ritesh.fedora

- name: ssh user key upload
  authorized_key:
    user: "{{ item.user }}"
    exclusive: "{{ item.exclusive if item.exclusive is defined else 'no' }}"
    key: "{% for file_name in item['keys'] %} {{ key|default('') + lookup('file', file_name) }}{% if not loop.last %}{{ '\n' }}{% endif %} {% endfor %}"
  become_user: "{{ item.user }}"
  become: yes

  with_items:
    - "{{ ssh_user_key }}"
  tags:
    - setup-user-ssh-client-key



adding authorized keys using ansible


You can use jinja template engine to set this

vars:
  ssh_user_key:
    - user: ritesh
      exclusive: no
      keys:
        - ritesh.centos
        - ritesh.fedora

- name: ssh user key upload
  authorized_key:
    user: "{{ item.user }}"
    exclusive: "{{ item.exclusive if item.exclusive is defined else 'no' }}"
    key: "{% for file_name in item['keys'] %} {{ key|default('') + lookup('file', file_name) }}{% if not loop.last %}{{ '\n' }}{% endif %} {% endfor %}"
  become_user: "{{ item.user }}"
  become: yes

  with_items:
    - "{{ ssh_user_key }}"
  tags:
    - setup-user-ssh-client-key



2016-05-07

zabbix 3.0.2 for RHEL6 is built

A follow up on using zabbix30 on el6 . zabbix 3.0.2 packages for RHEL6.x64 has been pushed out.

I have switched to IUS repository, over webtatic.

phpipam behind a load balancer which handles ssl offloading


phpipam has support for ssl offloading, via X-Forwarded-For header .
  public function createURL () {
                # reset url for base
                if($_SERVER['SERVER_PORT'] == "443")            { $url = "https://$_SERVER[HTTP_HOST]"; }
                // reverse proxy doing SSL offloading
                elseif(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')      { $url = "https://$_SERVER[SERVER_NAME]"; }
                elseif(isset($_SERVER['HTTP_X_SECURE_REQUEST'])  && $_SERVER['HTTP_X_SECURE_REQUEST'] == 'true')        { $url = "https://$_SERVER[SERVER_NAME]"; }
                // custom port
                elseif($_SERVER['SERVER_PORT']!="80")           { $url = "http://$_SERVER[SERVER_NAME]:$_SERVER[SERVER_PORT]"; }
                // normal http

Unfortunately, some don't follow this or have been configured for this, which results in phpipam loading incorrectly. To workaround this issue, edit config.php

$_SERVER['HTTP_X_FORWARDED_PROTO'] = "https";


And now, back to life.


2016-03-31

python : disabling SSL verification on pyvmomi on python


  • self signed certificate ? 
  • RHEL6 ? python 2.6 and 2.7.10 mixed environment ?
  • pyvmomi 5.5+ ?

Looking for a quick fix ?
...
File "/usr/lib/python2.6/site-packages/requests/adapters.py", line 447, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:492: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

[root@fb7a3cd8c69d ~]# vim my_script.pyt
...
    context = None
    try:
        # Disabling SSL certificate verification       
        context = ssl.SSLContext(ssl.PROTOCOL_SSLv3)
        context.verify_mode = ssl.CERT_NONE
    except AttributeError:
        rget = requests.get
        requests.get = lambda obj, *args,**kwargs: rget(obj,verify=False)
        requests.packages.urllib3.disable_warnings()

    si = SmartConnect(host=args.host,
            user=user,
            pwd=args.password,
            port=int(args.port), sslContext=context)


And you are good to go. This will resolve the issue, and allow you to focus on your life

PS: You would still need to fix this to use basic auth.

2016-03-28

BSNL redirecting to “http://domain-error.com”

To work around this ISP spam, I have forced NM to use google dns .

cat  /etc/NetworkManager/system-connections/Auto\ Ethernet 
...
[ipv4]
dns=8.8.8.8;8.8.4.4;
dns-search=
method=auto
ignore-auto-dns=true
...


Alternatively, install and use nmtui


refence: 
https://developers.google.com/speed/public-dns/ 
https://askubuntu.com/questions/708762/redirecting-to-http-domain-error-com 
https://www.hogarthuk.com/?q=node/8 

2016-03-23

Using zabbix 3.0 on EL6

zabbix 3.0 requires php5.4 or above, and consequently is not available on EL6. To workaround this, you would need to install php562 from webtatic.

I prefer to use mariadb , with php56u on my zabbix server.  The prebuilt packages can be downloaded from copr:ritz/zabbix30

 This is a rebuild against mariadb 10.1.x, with php56-5.6.19 for zabbix-3.0.1 .

Instructions for manual install - https://www.zabbix.com/documentation/3.0/manual/installation/install_from_packages

sql scripts can be grabbed from  svn - https://zabbix.org/wiki/Get_Zabbix

2016-03-13

Using C++ REST on Fedora Linux

Microsoft has release Casablanca ( C++ REST) to github. I have pushed Fedora packages for these to copr .

Happy -lcpprest




2016-01-17

Increase the offline storage quota for Kindle in epiphany

You can install Amazon's Kindle Cloud reader as a webapp on Fedora Linux using epiphany from gnome-software.



This just leaves you with one issue, the default offline storage quota for Database is a measly 6m, which you hit real quick.





Turns out, webkitgtk3 used to offer an api webkit_get_default_web_database_quota with webkitgtk3, which has been removed from webkitgtk4 used by epiphany.

To manually update this quota, locate the folder used by epiphany in application mode for Kindle.

$ ls ~/.local/share/
...
epiphany-kindlecloud-xxx
...


Open up the Database file here, and manually set the quota

$ cd ~/.local/share/epiphany-kindlecloud-xxx/databases
$ sqlite3 Database.db
sqlite3 > SELECT * FROM origins;
https_read.amazon.com_0| 6164480
sqlite3 > UPDATE origins SET quota=102400000 WHERE origin=https_read.amazon.com_0;


And now back to life.


2015-07-13

Lync on Linux

If you are looking to run Lync, aka Skype on Business on Linux you are in luck. Fisil has a client for Linux hosted at http://tel.red/ .

Unfortunately, this came with a bit of a hitch. The application failed to run on Fedora 23 (rawhide). Sky is bundling its own libraries !
$ sky
/opt/sky_linux/sky: symbol lookup error: /lib64/libXxf86vm.so.1: undefined symbol: _XEatDataWords

The solution, would be to load system library
$ LD_PRELOAD=/lib64/libX11.so sky

reference:

_XEatDataWords was add to fix an issue - http://cgit.freedesktop.org/xorg/lib/libXxf86vm/commit/id=284a88e21fc05a63466115b33efa411c60d988c9


Edit: Fixed with 381 ( http://tel.red/beta/sky_redhat64_v2.0.381.rpm ) and above.

2014-06-07

Tizen on rawhide fedora 21

Been a fun trip trying to run tizen ide on fedora 21 ( rawhide).

  •  Follow steps on http://rtg.in.ua/blog/tizen-sdk-on-fedora-19-x64/
  • Download pristine-tar source, and rebuild with Requirement update to support tar 1.27.2 ( anything greater than 1.27.3 ).
  • install mics and gbs ( if you are looking for platform dev ).
     
  • cd ~/tizen/sdk/tools/emulator/remote/
    mv libspice-server.so.1 libspice-server.so.1.orig
    ln -s /usr/lib64/libspice-server.so.1 .
  • Have fun, and do check out the extensive documentation via ide->Help->Help content 
reference:
  • https://bugs.tizen.org/jira/browse/TDIST-659


2014-05-07

Using middle click with Windows8 on Lenovo x230


with regedit , navigate to:
 HKEY CURRENT USER\Software\Synaptics\SynTPEnh\UltraNavPS2 (note HKCU, not HKLM)Change "TrackPointMode" to dword:00002214 from the previous value of 00001214

 Open the mouse properties and on the UltraNav tab, disable the TrackPoint by clearing it's check mark, click apply. With the keyboard, track pad or other pointing device, re-enable the TrackPoint and hit apply. 

Your middle button should now function correctly.

reference:  http://forums.lenovo.com/t5/Windows-8-and-8-1/Win8-trackpoint-third-button-middle-click-action/td-p/866779/page/2 

2014-05-05

recovering LUKS encrypted Ubuntu LV Group when mounting on a different Ubuntu system

I mirror my hdd, and keep swapping them in and out of test system. Often I mirror ( using external dock, such as - http://www.ebay.in/itm/Anker-Uspeed-USB-3-0-and-ESATA-To-SATA-External-Hard-Drive-Docking-Station-/161201311080 ). This leads to an issue.

 Ubuntu during installl with luks+lvm configuration will name the vg as "ubuntu--vg". And when you plug in another drive on which ubuntu was installed, would lead to a naming conflict and failure to activate the lvm after luks open.

) Ubuntu will give you a passphrase dialog when you plug the device in (if you're in a gui) but will fail to mount after the password is entered. The reason for this is that the volume group of your old partition, and your current OS partition are the same. However, if you enter the password, it will still create a node in /dev/mapper/. If you run ls -la /dev/mapper/ you should see a luks-xxxxxx-xxxxx-xxxx or some such file. That's the mapping that was created when the password dialog failed. Note, that all the dialog did was to call: luksOpen and map it to that /dev/mapper/luks-xxx file.
1) Make sure your physical volume is available by running the pvdisplay command. It should be /dev/mapper/luks-xxx-whatever. Notice that the VG Name of both drives is the same; this is problematic and will prevent you from being able to mount the drives both at the same time (very frustrating).

2) To fix this, get the uuid of the volume by running "pvs -o +vg_uuid". The uuid will be the value displayed all the way to the right, containing 7 dash-delimited values. Copy those somewhere as we'll be using them in the next step. DO NOT CONFUSE UUIDS AND COPY DOWN THE WRONG ONE. Only copy the one for your current luks-xxx-whatever device.
3) Change the volume group for your old disk by running the following command "vgrename UUIDOFYOURDISKHERE oldhd" You can change the "oldhd" to whatever you want so long as it's differing from the volume group name of your current disk. Performing this step removes the conflict with volume group names which will allow you to now make volumes available.
4) Run the command "vgchange -a y" to make the volumes active.
5) Create a mount point somewhere, for example create mount point /mnt/oldhd/ by running mkdir /mnt/oldhd/.
6) Now, mount the root partition of the oldhd volume group by running the following command: "mount /dev/oldhd/root /mnt/oldhd"
7) You should now be able to cd into /mnt/oldhd and acc

reference:
http://www.reddit.com/r/Ubuntu/comments/1wjhzf/recover_luks_encrypted_ubuntu_lv_group_from/


2014-01-13

Shrink VMs on virt-manager/KVM


  I tend to use rsync to backup my system ( including VMs) thanks an anoying bug[1] . Turns out, this would sync the entire sparse file, expanding from 11gb on disk to 64gb on target system.

 To "fix" this I now use qcow2 for disk image, based of instructions from here[2].


  •  Move existing images to qcow2 , if not done. This also would allow us to use snapshots via virt-manager [3]



  • Fill VMs with zeros to allow them to be compressed


  • Shut down the VMs, and run from host 

$ mv original_image.qcow2 original_image.qcow2_backup
$ qemu-img convert -O qcow2 original_image.qcow2_backup original_image.qcow2

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1259829
[2] http://www.jamescoyle.net/how-to/323-reclaim-disk-space-from-a-sparse-image-file-qcow2-vmdk
[3] http://www.phoronix.com/scan.php?page=news_item&px=MTQ0NjM

GitLab runner on Windows with bash shell on windows contianer on Docker

As part of your pipeline, you may need to perform browser testing across different platforms/environments. To minimize testing time, it'...