Sunday, April 24, 2016

Saturday, April 23, 2016

Windows Server 2008 network drive not synchronized

I have Windows 2008 server which have network drive mapped on on every user profile.
Apparently everything is working. Kind Of.

Turns out the files on network drive are not the latest so the network drive are actually not synchronized.
If i test the same network address with simple shortcut then everything is perfect but if i use this resource via mapped network drive then information is not the latest.

This situation can be solved with "Prevent use of Offline File Folder":

Another possible option is add:
reg add "HKLM\System\CurrentControlSet\Services\Lanmanworkstation\Parameters\DirectoryCacheLifetime" /v DirectoryCacheLifetime /t REG_DWORD /d 0 /f

Friday, April 22, 2016

System Restore encountered an error, 0x81000203, Windows 10


This problem occurs when one of these services are disabled:
Volume Shadow Copy
Microsoft Software Shadow Copy Provider
Lets deep more into this situation.
Step one. Open Windows PowerShell in "Run As Administrator" mode
Check the startup type for these two services:
get-service | ? { $_.name -eq "swprv" -or $_.name -eq "vss" } | ft displayname,starttype
This is bad result:
DisplayName                             StartType
-----------                             ---------
Microsoft Software Shadow Copy Provider Disabled
Volume Shadow Copy                      Disabled
Now i will change startup type for these two service with simple command:
"swprv","vss" | Set-Service -StartupType "Automatic"
Execute again:
get-service | ? { $_.name -eq "swprv" -or $_.name -eq "vss" } | ft displayname,starttype
This is good result:
DisplayName                             StartType
-----------                             ---------
Microsoft Software Shadow Copy Provider Automatic
Volume Shadow Copy                      Automatic

Thursday, April 21, 2016

The Volume Shadow Copy service used by System Restore is not working, 0x81000202, Windows 10


This problem occurs when one of these services are disabled:
Volume Shadow Copy
Microsoft Software Shadow Copy Provider
Lets deep more into this situation.
Step one. Open Windows PowerShell in "Run As Administrator" mode
Check the startup type for these two services:
get-service | ? { $_.name -eq "swprv" -or $_.name -eq "vss" } | ft displayname,starttype
This is bad result:
DisplayName                             StartType
-----------                             ---------
Microsoft Software Shadow Copy Provider Disabled
Volume Shadow Copy                      Disabled
Now i will change startup type for these two service with simple command:
"swprv","vss" | Set-Service -StartupType "Automatic"
Execute again:
get-service | ? { $_.name -eq "swprv" -or $_.name -eq "vss" } | ft displayname,starttype
This is good result:
DisplayName                             StartType
-----------                             ---------
Microsoft Software Shadow Copy Provider Automatic
Volume Shadow Copy                      Automatic

Wednesday, April 20, 2016

Recover deleted items from additional mailbox, MS Exchange

Wondering why "Recover Deleted Items" button is grayed out?

This cheat is tested on Outlook 2013 32-bit version.

Using 32-bit Office on 64-bit system use this:
reg add "HKLM\SOFTWARE\Wow6432Node\Microsoft\Exchange\Client\Options" /v DumpsterAlwaysOn /t REG_DWORD /d 1 /f
For native system use:
reg add "HKLM\SOFTWARE\Microsoft\Exchange\Client\Options" /v DumpsterAlwaysOn /t REG_DWORD /d 1 /f
Close and Re-open Micorosft Outlook.

Tuesday, April 19, 2016

Create PostgreSQL child channel, CentOS 7, Spacewalk

Create a new Channel:

Fill the fields!

Channel Name:
postgresql-9-5-rhel-7-x86_64
Channel Label:
postgresql-9-5-rhel-7-x86_64
Parent Channel:
CentOS 7 Base x86_64
Architecture:
x86_64
Channel Summary:
postgresql-9-5-rhel-7-x86_64

Scroll down the page and enter:
GPG key URL:
http://apt.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG
GPG key ID:
442DF0F8
GPG key Fingerprint:
68C9 E2B9 1A37 D136 FE74  D176 1F16 D2E1 442D F0F8
This is the same key from:
curl http://apt.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG > /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
cp /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG /var/www/html/pub/RPM-GPG-KEY-PGDG
gpg --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pub  1024D/442DF0F8 2008-01-08 PostgreSQL RPM Building Project <pgsqlrpms-hackers@pgfoundry.org>
      Key fingerprint = 68C9 E2B9 1A37 D136 FE74  D176 1F16 D2E1 442D F0F8
sub  2048g/D43F1AF8 2008-01-08
Click [Create Channel] at the end

Open [Channels] section, go for [Manage Software Channels],
go for [Manage Repositories], click [Create Repository]

Fill down:
Repository Label:
postgresql-9-5-rhel-7-x86_64
Repository URL:
http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64
Click [Create Repository]

Now open your child channel:

Assing child repository to child channel and press [Update Repositories] button:

Now at the command line execute:
spacewalk-repo-sync -c postgresql-9-5-rhel-7-x86_64

Sunday, April 17, 2016

Remove windows.old from c drive

Open Run and type cleanmgr:

Select drive where windows.old happens to be:

Click Clean up system files:

And again:

Scroll down and select Previous WIndows installation(s):

Click Delete files:

Saturday, April 16, 2016

Visual Basic lessons learned

Apparently i have to fix the code in Visual Basic Language.

Here is things i learned:

Open VBS editor in Microsoft Excel 2002

ALT+F11
It is possible to directly send the content of excel workbook to Microsoft Outlook with simple command:
Application.Dialogs(xlDialogSendMail).Show

Assign string value into variable

variable = "hello world"

Convert %userprofile% windows variable into Visual Basic variable

Set oShell = CreateObject("WScript.Shell")
strHomeFolder = oShell.ExpandEnvironmentStrings("%USERPROFILE%")

Set time stamp into variable

RightNow = Format(Now(), "yyyymmddHHMMSS")

Set custom path by merging together variables

NewFileName = strHomeFolder & "\" & RightNow & ".log"

Save As all excel workbook in new file

ActiveWorkbook.SaveCopyAs (NewFileName)

Remove temporary file

Dim FileToDelete
Set FileToDelete = CreateObject("Scripting.FileSystemObject")
FileToDelete.DeleteFile (NewFileName )

Friday, April 15, 2016

systemctl restart smb.service, Job for smb.service failed because the control process exited with error code. CentOS 7

I have this problem with my CentOS 7.2 server which will not start samba server anymore.

For example if I run:
systemctl restart smb.service
I will receive some garbage value like:
Job for smb.service failed because the control process exited with error code.
See "systemctl status smb.service" and "journalctl -xe" for details.
I read that this command can make sure if my config file is perfectly good:
smbstatus
And I received:
WARNING: Ignoring invalid value 'share' for parameter 'security'
Can't load /etc/samba/smb.conf - run testparm to debug it
So I go to my config file /etc/samba/smb.conf and commented one line which starts with security:
#security = share
Now when I re-launch smbstatus it says:
Samba version 4.2.10
PID     Username      Group         Machine            Protocol Version
------------------------------------------------------------------------------

Service      pid     machine       Connected at
-------------------------------------------------------

/var/lib/samba/locking.tdb not initialised
This is normal if an SMB client has never connected to your server.
After all I try to start samba server again and succed:
systemctl restart smb.service

Thursday, April 14, 2016

Start graphical interface automatically in CentOS 7

I usually play with /etc/inittab to switch between automatic GUI starting or just console mode. This time on CentOS 7 when i open inittab it says:
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#
As the instruction says we can check what is situation now:
systemctl get-default
This will report somthing like:
multi-user.target
To start graphical mode automatically at system startup I have to execute:
systemctl set-default graphical.target
Check again resume:
systemctl get-default
This time it will say:
graphical.target
And now restart the system to check if anything happens:
reboot

Wednesday, April 13, 2016

Running scripts is disabled on this system, PowerShell

To work around this situation i execute this command in the same powershell session:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Now it is possible to run untrusted scripts.

To set back policy use:
Set-ExecutionPolicy Restricted -Scope CurrentUser -force
Here is summary of situation:
1) try executing script. nothing works
2) set Set-ExecutionPolicy to RemoteSigned
3) try script. it works
4) set Set-ExecutionPolicy to Restricted
5) try running script. It does not work anymore
PS C:\Users\Administrator> R:\drivemecrazy.ps1
R:\drivemecrazy.ps1 : File R:\drivemecrazy.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ R:\drivemecrazy.ps1
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\Administrator> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
PS C:\Users\Administrator> R:\drivemecrazy.ps1
46
3
0
PS C:\Users\Administrator> Set-ExecutionPolicy Restricted -Scope CurrentUser -force
PS C:\Users\Administrator> R:\drivemecrazy.ps1
R:\drivemecrazy.ps1 : File R:\drivemecrazy.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ R:\drivemecrazy.ps1
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
Execution Policy Type:
Restricted - No Script either local, remote or downloaded can be executed on the system.
AllSigned - All script that are ran require to be digitally signed.
RemoteSigned - All remote scripts (UNC) or downloaded need to be signed.
Unrestricted - No signature for any type of script is required.

Scope of new Change:
LocalMachine - The execution policy affects all users of the computer.
CurrentUser - The execution policy affects only the current user.
Process - The execution policy affects only the current Windows PowerShell process.

To do these steps via group policy go to:
Computer Configuration -> Administrative Templates ->
Windows Components -> Windows PowerShell

Set policy type to "Allow local scripts and remote signed scripts":

Without group policy:
Open windows command prompt in "Run as administrator" mode and execute:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell" /v EnableScripts /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell" /v ExecutionPolicy /t REG_SZ /d RemoteSigned /f
If nothing works at all then:
Open windows command prompt in "Run as administrator" mode and execute:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell" /v EnableScripts /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell" /v ExecutionPolicy /t REG_SZ /d Unrestricted /f

Tuesday, April 12, 2016

Put mp3 stream into the air, Raspberry Pi

In this tutorial i set up Raspberry Pi to put mp3 stream into the air.
This means that i am creating my very own internet radio.

This solution uses:
mpd which stands for Music Player Daemon,
mpc which stands for Music Player Controller,
icecast2 which put thing together and serve the stream via port 8000

Here is how i implemented it:
#!/bin/sh
#this is tested on fresh 2016-03-18-raspbian-jessie-lite.img

#move to supper user
#sudo su

#move to home direcotry
#cd

#clone repo
#git clone https://github.com/catonrug/raspbian-icecast2-mpd-mpc.git
#cd raspbian-icecast2-mpd-mpc
#chmod +x install.sh
#./install.sh

#update the system
apt-get update -y && apt-get upgrade -y

#set up correct time zone
cp /usr/share/zoneinfo/Etc/GMT-2 /etc/localtime

#install music player daemon
apt-get install mpd -y

#put IP address into the variable
ipaddress=$(ifconfig | grep "inet.*cast" | sed "s/[: ]/\n/g" | grep -m1 "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+")

#set mpd configuration file. you can change 'hackme' password.
#make sure you type the same password as in icecast configuration
cat > /etc/mpd.conf << EOF
 music_directory         "/var/lib/mpd/music"
 playlist_directory      "/var/lib/mpd/playlists"
 db_file                 "/var/lib/mpd/tag_cache"
 log_file                "/var/log/mpd/mpd.log"
 pid_file                "/run/mpd/pid"
 state_file              "/var/lib/mpd/state"
 sticker_file            "/var/lib/mpd/sticker.sql"
 user                    "mpd"
 bind_to_address         "127.0.0.1"


input {
 plugin "curl"
}

audio_output {
 type                    "shout"
 name                    "Algorithm"
 description             "MPD stream on Raspberry Pi"
 host                    "$ipaddress"
 port                    "8000"
 mount                   "/mpd"
 password                "hackme"
 bitrate                 "128"
 format                  "44100:16:2"
 encoding                "mp3"
}

 filesystem_charset      "UTF-8"
 id3v1_encoding          "UTF-8"
EOF

#install music player controller
apt-get install mpc -y

#install samba share
apt-get install samba samba-common-bin -y

#set up samba share public share which will be available without any password 
cat > /etc/samba/smb.conf << EOF
#======================= Global Settings =========================
[global]
workgroup = WORKGROUP
security = share
map to guest = bad user
#======================= Share Definitions =======================
[music]
path = /var/lib/mpd/music
browsable =yes
writable = yes
guest ok = yes
read only = no
EOF

#any user from any system can write into this samba share
chmod -R 777 /var/lib/mpd/music
chmod -R g+s /var/lib/mpd/music
chmod g+w /var/lib/mpd/music /var/lib/mpd/playlists
chgrp audio /var/lib/mpd/music /var/lib/mpd/playlists

#restart sharing service
/etc/init.d/samba restart

#install icecast2 which will host our mp3 stream into the air
#you will be prompted to set up icecast server. shoose [yes]
apt-get install icecast2 -y

#modprobe
modprobe ipv6
sleep 1

#restart music player daemon service
/etc/init.d/mpd restart
sleep 1

/etc/init.d/icecast2 restart
sleep 1

#check output
mpc outputs
# Output 1 (RasPi MPD Stream) is enabled

#Check if the network is listening
netstat -ltpn

#clear playlist
mpc clear

#scan /var/lib/mpd/music for new songs
mpc update

#list all songs in /var/lib/mpd/music and add it to playlist
mpc ls | mpc add

#set shufle on
mpc random on

#set repeat on
mpc repeat on

#show playlist
mpc playlist

#start stream instantly
mpc play

#retry the service if not running every minute
echo "* * * * * root mpc play">> /etc/crontab

#auto refresh playlist at midnight
echo "00 00 * * * root mpc stop && mpc clear && mpc update && mpc ls | mpc add && mpc random on && mpc repeat on">> /etc/crontab

#restart sheduled task service
/etc/init.d/cron restart
To use this code with git use:
sudo su
cd
git clone https://github.com/catonrug/raspbian-icecast2-mpd-mpc.git
cd raspbian-icecast2-mpd-mpc
chmod +x install.sh
./install.sh
Now open Chrome or Firefox and go to:
http://ip.address.goes.here:8000/mpd
Source on github:
https://github.com/catonrug/raspbian-icecast2-mpd-mpc/blob/master/install.sh

Monday, April 11, 2016

associate eml, msg file to use jar applicaition, java

reg add HKCU\Software\Classes\outlookfile\shell\open\command /ve /t reg_expand_sz /d "\"C:\Program Files (x86)\Java\jre1.8.0_111\bin\javaw.exe\" -jar \"C:\MSGViewer\MSGViewer.jar\" \"%%1\" %%"
for %%a in (eml msg) do reg add HKCU\Software\Classes\.%%a /ve /t reg_sz /d outlookfile /f
MSGViewer-1.9.zip
353fa0c6bc11320be82d42c5afcbdaf1
fc9e4c4c0225a076af52444d02f661ea25ecd3c3

Zabbix 3 with sqlite3, nginx on Raspberry Pi

This is my code to build zabbix server on Raspberry Pi.

#move to the super user
sudo su

#install git to download source from github
apt-get install git -y

#move to the home direcotry
cd

#download source from github
git clone https://github.com/catonrug/raspbian-zabbix3-sqlite3-nginx1.git

#move to the source directory
cd raspbian-zabbix3-sqlite3-nginx1

#set script executable
chmod +x agent-install.sh server-install.sh

#execute the script and calculate home much time it takes to complete
time ./server-install.sh
What happens underneath the hood you can see:
https://github.com/catonrug/raspbian-zabbix3-sqlite3-nginx1/blob/master/server-install.sh

P.S.
Once you enable zabbix-agent on server sometimes dashboard shows messages like:
SQLite3::query(): Unable to execute statement: database is locked [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerWidgetHostsView->doAction() → select_config() → DBselect() → SQLite3->query() in include/db.inc.php:427]
Error in query [SELECT c.* FROM config c] Error code [5] Message [database is locked]
or
SQLite3::query(): Unable to execute statement: database is locked [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerWidgetWebView->doAction() → CProfile::get() → CProfile::init() → DBselect() → SQLite3->query() in include/db.inc.php:427]
Error in query [SELECT p.* FROM profiles p WHERE p.userid=1 ORDER BY p.userid,p.profileid] Error code [5] Message [database is locked]
SQLite3::query(): Unable to execute statement: database is locked [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CView->getOutput() → include() → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CHostGroup->get() → DBselect() → SQLite3->query() in include/db.inc.php:427]
Error in query [SELECT DISTINCT g.groupid,g.name FROM groups g,hosts_groups hg WHERE g.groupid=hg.groupid AND EXISTS (SELECT NULL FROM hosts h WHERE hg.hostid=h.hostid AND h.status=0) AND EXISTS (SELECT NULL FROM httptest ht WHERE hg.hostid=ht.hostid AND ht.status=0)] Error code [5] Message [database is locked]
or:
SQLite3::exec(): database is locked [zabbix.php:21 → require_once() → ZBase->run() → ZBase->authenticateUser() → CWebUser::checkAuthentication() → CFrontendApiWrapper->checkAuthentication() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CUser->checkAuthentication() → DBexecute() → SQLite3->exec() in include/db.inc.php:552]
Error in query [DELETE FROM sessions WHERE userid='2' AND lastaccess<1460301234] Error code [5] Message [database is locked]
SQLite3::exec(): database is locked [zabbix.php:21 → require_once() → ZBase->run() → ZBase->authenticateUser() → CWebUser::checkAuthentication() → CFrontendApiWrapper->checkAuthentication() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CUser->checkAuthentication() → DBexecute() → SQLite3->exec() in include/db.inc.php:552]
Error in query [UPDATE sessions SET lastaccess=1460302134 WHERE userid='2' AND sessionid='9d0a8b8bf4c264fa45890b9be67f8b65'] Error code [5] Message [database is locked]
or:
Access denied
You are logged in as "guest". You have no permissions to access this page.
If you think this message is wrong, please consult your administrators about getting the necessary permissions.
or:
Database error
The frontend does not match Zabbix database.
I believe it is because:
https://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked

Sunday, April 10, 2016

Set up nginx on Raspberry Pi

This is tested on fresh 2016-03-18-raspbian-jessie-lite.img.

Here is the code that works well on this image:
#update repositories and upgrade system
apt-get update -y && apt-get upgrade -y

#install additional libraries for nginx
apt-get install php5-fpm libgd2-xpm-dev libpcrecpp0 libxpm4 -y

#install nginx web server
apt-get install nginx -y

#Install the CGI wrapper if you need to run CGI scripts on your server
apt-get install fcgiwrap -y

#Reduce the number of PHP and CGI processes to free up memory
sed -i "s/^.*process\.max = .*$/process.max = 2/" /etc/php5/fpm/php-fpm.conf

#Modify the maximum number of processes. In my case I won't have dozens of connections therefore file 
sed -i "s/^worker_processes .*;$/worker_processes 1;/" /etc/nginx/nginx.conf

#create directory for web server
mkdir -p /var/www/html

#set web server user to be owner of frontent
chown -R www-data:www-data /var/www/html

#create php sample
echo "<?php phpinfo(); ?>" > /var/www/html/index.php

#backup original configuration
cp /etc/nginx/sites-available/{default,original}

#replace active configuration
cat > /etc/nginx/sites-available/default << EOF
server {

listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;

index index.php index.html index.htm;

server_name _;

location ~ \.php\$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}

}
EOF

#restart nginx service
service nginx restart
service php5-fpm restart
service fcgiwrap restart
Or use git instead:
sudo su
git clone https://github.com/catonrug/raspbian-nginx-cgi.git
cd raspbian-nginx-cgi
chmod +x install-nginx.sh
./install-nginx.sh
Source:
http://www.pihomeserver.fr/en/2012/12/10/raspberry-pi-home-server-etape-11-installer-nginx-avec-support-php-cgi-et-scgi/
http://raspbian-france.fr/installer-nginx-raspbian-raspberry/

Saturday, April 9, 2016

Create CentOS 6 i386 Child Channel, Spacewalk

Create a new Channel:

Fill the fields!

Channel Name:
spacewalk-client-2-4-rhel-6-i386
Channel Label:
spacewalk-client-2-4-rhel-6-i386
Parent Channel:
CentOS 6 Base i386
Architecture:
IA-32
Channel Summary:
spacewalk-client-2-4-rhel-6-i386

Scroll down the page and enter:
GPG key URL:
http://yum.spacewalkproject.org/RPM-GPG-KEY-spacewalk-2015
GPG key ID:
B8002DE1
GPG key Fingerprint:
A5FC 508C DD3C C46D 3C3B  4612 DCC9 81CD B800 2DE1
This is the same key from:
curl http://yum.spacewalkproject.org/RPM-GPG-KEY-spacewalk-2015 > /etc/pki/rpm-gpg/RPM-GPG-KEY-spacewalk-2015
cp /etc/pki/rpm-gpg/RPM-GPG-KEY-spacewalk-2015 /var/www/html/pub/RPM-GPG-KEY-spacewalk-2015
gpg --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-spacewalk-2015
pub  1024D/B8002DE1 2015-04-17 Spacewalk <spacewalk-devel@redhat.com>
      Key fingerprint = A5FC 508C DD3C C46D 3C3B  4612 DCC9 81CD B800 2DE1
Click [Create Channel] at the end

Open [Channels] section, go for [Manage Software Channels],
go for [Manage Repositories], click [Create Repository]

Fill down:
Repository Label:
spacewalk-client-2-4-rhel-6-i386
Repository URL:
http://yum.spacewalkproject.org/2.4-client/RHEL/6/i386
Click [Create Repository]

Now open your child channel:

Assing child repository to child channel and press [Update Repositories] button:

Now at the command line execute:
spacewalk-repo-sync -c spacewalk-client-2-4-rhel-6-i386

Friday, April 8, 2016

Create CentOS 6 i386 Base Software Channel, Spacewalk

Open [Channels] section, go for [Manage Software Channels] and click [Create]

Write down:
Channel Name:
CentOS 6 Base i386
Channel Label:
centos-6-base-i386
Architecture:
IA-32
Channel Summary:
centos-6-base-i386

Scroll down the page and enter:
GPG key URL:
http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
GPG key ID:
C105B9DE
GPG key Fingerprint:
C1DA C52D 1664 E8A4 386D  BA43 0946 FCA2 C105 B9DE
This is the same key from:
gpg --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
pub  4096R/C105B9DE 2011-07-03 CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
      Key fingerprint = C1DA C52D 1664 E8A4 386D  BA43 0946 FCA2 C105 B9DE
Click [Create Channel] at the end

Now again Open [Channels] section, go for [Manage Software Channels],
go for [Manage Repositories], click [Create Repository]

Fill down:
Repository Label:
centos-6-base-i386
Repository URL:
http://mirror.centos.org/centos/6/os/i386
Click [Create Repository]

Now we have to create a connection between base channel and repository:
Go for [Channels], open [Manage Software Channels], click on YOUR base channel:

Go for [Repositories] tab, check YOUR repository and click [Update Repositories]:

Open up the command line and type:
spacewalk-repo-sync -c centos-6-base-i386
If you are planing to use kickstart future the use:
spacewalk-repo-sync -c centos-6-base-i386 --sync-kickstart

Thursday, April 7, 2016

Spacewalk 2.4 cobbler, 1 network adapter, CentOS

This tutorial works the same for CentOS 7 as CentoS 6.

Before folowing this tutorial one Base Channel and Child Channel must be created in Spacewalk server.

For CentOS 6 use:

Create CentOS 6 Base Software Channel

Create CentOS 6 Child Channel, Spacewalk


For CentOS 7 use:

Create CentOS 7 Base Software Channel

Create CentOS 7 Child Channel, Spacewalk


Software chennel must be synchronized with --sync-kickstart option.

I am using this mikrotik cheat to boot from PXE.

In this case i only need one network adapter for Spacewalk server. So here is how i prepare cobbler for PXE boot:

#get ip address of eth0 adapter
ipaddress=$(ifconfig | grep "inet.*cast" | sed "s/[: ]/\n/g" | grep -m1 "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+")

#check if something is in varable
echo $ipaddress
#go to the next steps only if the ir correct IP address of spacewalk server

#set up server and next_server in cobbler configuration
sed -i "s/^server:.*/server: `echo $ipaddress`/" /etc/cobbler/settings
sed -i "s/^next_server:.*/next_server: `echo $ipaddress`/" /etc/cobbler/settings

#restart cobbler
service cobblerd restart
#this will show something like
#Stopping cobbler daemon:                                   [  OK  ]
#Starting cobbler daemon:                                   [  OK  ]

#sync cobbler configuration
cobbler sync

#check pre-requsites
cobbler check
#this will show something like
#1 : you need to set some SELinux content rules to ensure cobbler serves content correctly in your SELinux environment, run the following: /usr/sbin/semanage fcontext -a -t public_content_t "/var/lib/tftpboot/.*" && /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"
#2 : you need to set some SELinux rules if you want to use cobbler-web (an optional package), run the following: /usr/sbin/semanage fcontext -a -t httpd_sys_content_rw_t "/var/lib/cobbler/webui_sessions/.*"
#3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'yum install cobbler-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'yum install cobbler-loaders' command is the easiest way to resolve these requirements.
#4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
#5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
#6 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
#7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

#install must have selinux rules
semanage fcontext -a -t public_content_t "/var/lib/tftpboot/.*"
semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"

#do the sync
cobbler sync
#this should report something like
#task started: 2016-04-05_155715_sync
#task started (id=Sync, time=Tue Apr  5 15:57:15 2016)
#running pre-sync triggers
#cleaning trees
#removing: /var/www/cobbler/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization
#removing: /var/lib/tftpboot/pxelinux.cfg/default
#removing: /var/lib/tftpboot/grub/images
#removing: /var/lib/tftpboot/grub/efidefault
#removing: /var/lib/tftpboot/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization
#removing: /var/lib/tftpboot/s390x/profile_list
#copying bootloaders
#copying: /usr/share/syslinux/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
#copying: /usr/share/syslinux/menu.c32 -> /var/lib/tftpboot/menu.c32
#copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
#copying distros
#copying files for distro: centos-6-base-x86_64:1:SpacewalkDefaultOrganization
#trying hardlink /var/satellite/rhn/kickstart/1/centos-6-base-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization/vmlinuz
#trying hardlink /var/satellite/rhn/kickstart/1/centos-6-base-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization/initrd.img
#trying hardlink /var/satellite/rhn/kickstart/1/centos-6-base-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization/vmlinuz
#trying hardlink /var/satellite/rhn/kickstart/1/centos-6-base-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization/initrd.img
#copying images
#generating PXE configuration files
#cleaning link caches
#generating PXE menu structure
#running post-sync triggers
#running python triggers from /var/lib/cobbler/triggers/sync/post/*
#running python trigger cobbler.modules.sync_post_restart_services
#running shell triggers from /var/lib/cobbler/triggers/sync/post/*
#running python triggers from /var/lib/cobbler/triggers/change/*
#running python trigger cobbler.modules.scm_track
#running shell triggers from /var/lib/cobbler/triggers/change/*
#*** TASK COMPLETE ***

Wednesday, April 6, 2016

Cannot Shift objects off sheet, MS Excel


Solution:
1) Move to the last line which has content
2) Select next blank line which are first line which are supposed to have no data
3) Move to the last excel line - 65536
4) Hold down shift key and click to the last line
5) Now all blank lines are selected
6) Press delete to make sure that all blank lines are empty
7) Try insert new line
8) Leave a comment

CentOS 6 minimal install, Spacewalk kickstart

At first uncheck "Don't install @Base package group" option!

Enter package list:
@core --nodefaults
-iwl*firmware
-ivtv*
-kexec-tools
-aic94xx-firmware*
-libertas*
-cronie-anacron
-cronie
-crontabs
-plymouth*
-postfix

Tuesday, April 5, 2016

Network usage trigger, zabbix

Go Configuration -> Templates

Click on Discovery under Template OS Windows or code>Template OS Linux

Click under Trigger prototypes under Network interface discovery

Select Create trigger prototype

Incoming network bandwidth is higher than 60 Mbps


Name:
Incoming packets on {#IFNAME} has been taking the situation over - {ITEM.LASTVALUE}
Trigger for windows:
{Template OS Windows:net.if.in[{#IFNAME}].min(15m)}>61440K
Trigger for linux:
{Template OS Linux:net.if.in[{#IFNAME}].min(15m)}>61440K

Outgoing network bandwidth is higher than 60 Mbps


Name:
Outgoing packets on {#IFNAME} has been taking the situation over - {ITEM.LASTVALUE}
Trigger for windows:
{Template OS Windows:net.if.out[{#IFNAME}].min(15m)}>61440K
Trigger for linux:
{Template OS Linux:net.if.out[{#IFNAME}].min(15m)}>61440K

Monday, April 4, 2016

What is openbox for?

I have question posted in my ask toolbar:
"What is openbox for?"

openbox is like a windows theme which is pretty much the lightest theme to save every MB of RAM. By default openbox do not have start button on the left bootom or top corner. In plain openbox configuration it means that we remove taskbar, system tray, application launcher. There are no icons on desktop. The only way to launch applications is by clicking on desktop with mouse click.

Sunday, April 3, 2016

Install Spacewalk 2.4 on CentOS 7

#!/bin/sh

#install spacewalk repository
wget http://yum.spacewalkproject.org/RPM-GPG-KEY-spacewalk-2015 -P /etc/pki/rpm-gpg
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-spacewalk-2015
rpm -Uvh http://yum.spacewalkproject.org/2.4/RHEL/7/x86_64/spacewalk-repo-2.4-3.el7.noarch.rpm

#install epel repository
wget https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 -P /etc/pki/rpm-gpg
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

#install jpackage repository
cat > /etc/yum.repos.d/jpackage-generic.repo << EOF
[jpackage-generic]
name=JPackage (free), generic
mirrorlist=http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=5.0
failovermethod=priority
gpgcheck=0
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=1
EOF

#update system
yum update -y

#install postgresql database server
yum install spacewalk-setup-postgresql -y

#install spacewalk using postgresql as database server
yum install spacewalk-postgresql -y

#create spacewalk unattanded installation file into root home direcotry
cat > /root/spacewalk-answer-file << EOF
admin-email = root@localhost
ssl-set-org = Spacewalk Org
ssl-set-org-unit = spacewalk
ssl-set-city = My City
ssl-set-state = My State
ssl-set-country = US
ssl-password = spacewalk
ssl-set-email = root@localhost
ssl-config-sslvhost = Y
db-backend=postgresql
db-name=spaceschema
db-user=spaceuser
db-password=spacepw
db-host=localhost
db-port=5432
enable-tftp=Y
EOF

#spacewalk silent install
spacewalk-setup --disconnected --answer-file=/root/spacewalk-answer-file

Saturday, April 2, 2016

Windows XP installation goes blank at very beginning

I have laptop with 2 GB of ram which is suposed to work with windows XP.
I was able to install CentOS 5 on that thing but now i want to test Windows XP with SP4.

Now a have created USB installation and cant get to partition set up screen:
Instead of this screen everything is blank and nothing happens.

I used SARDU to create Windows XP bootable media and that is why this happens.
Once i switchded to create USB media with rufus then everything turns out fine.

Another usefull tips is to use Ranish partition manager to reset master boot record.

Here is instruction how to do it.

Select Dos Programs:

Select Partition Tools:

Select Ranish Partition Manager:

Press F5 to select proper disk:

Hit Enter when you recognize your disk:

Press space to select Standart IPL and hit Enter to apply:

Press F2 to save changes:

Friday, April 1, 2016

Disable Outlook 2013 cached mode

Search and download for:
Office 2013 Administrative Template files (ADMX/ADML)
https://download.microsoft.com/download/5/8/C/58CA3974-1640-4CFC-A991-3904B3B8939C/admintemplates_64bit.exe
b70df48ff1b533c6caf7ba27f4c91690
004734944748ab7e1d4d67466d4a8aaf9e2a1d7c

https://download.microsoft.com/download/5/8/C/58CA3974-1640-4CFC-A991-3904B3B8939C/admintemplates_32bit.exe
669bee1a5c6eced66feee9464ce308aa
3d8f6bce845f958bd547c94404ed7f01ab8dcc1d

Extract content.

Move you language directory and all admx files to C:\Windows\PolicyDefinitions

And now you can disable cached mode via group policy:

To disable Outlook 2013 cached mode for all users per computer without group policy use this hack:
reg add "HKCU\Software\Policies\Microsoft\Office\15.0\outlook\cached mode" /v Enable /t REG_DWORD /d 0 /f
To delete this setting use:
reg delete "HKCU\Software\Policies\Microsoft\Office\15.0\outlook\cached mode" /v Enable /f

Blog Archive