Monday, December 10, 2012

SpaceWalk Commands

This page contains some Spacewalk or RHN Satellite commands and Tips


Activate or Reactive Satellite Cert 
  • # rhn-satellite-activate --rhn-cert=/path/to/certificate -vvv   
Generate New RHN Satellite Cert
  • https://rhn.redhat.com/rhn/systems/GenerateCertificate.do
Register to Spacewalk (Satellite) 
  • rhn_register or rhnks_reg 

Import GPG 
  • rpm --import path-to-key 

Sync 3rd Party YUM Repo 
  • ]# spacewalk-repo-sync --channel channelName 

Check Registration 
  • rhn_check -vvv 
Check Certificiate
  • # rhn-satellite-activate --sanity-only --rhn-cert=<certificate filename> -v
Rename SpaceWalk Host 
  • spacewalk-rename-hostname 

Increase Default Config File Size 
  • By default, the maximum file size for configuration files is 128 bytes. If you need to change that value, find and modify the following line in the /etc/rhn/default/rhn_web.conf file:  
    • web.maximum_config_file_size=128   
  • You must also find and change the following line in the /etc/rhn/default/rhn_server.conf file to the same value:  
    • maximum_config_file_size=128  (or just add to rhn.conf so it's not overwritten) 
    • Change the value in both files from 128 to the desired value in kilobytes.  

Check SSL Cert 

Install Cert on Client 
  • rpm -Uvh \ http://proxy-or-sat.example.com/pub/rhn-org-trusted-ssl-cert-VER-REL.noarch.rpm  
    • note: copy from /root/ssl-build 

Reboot and Rebuild 
  • launch a reinstall using a remote command "koan --replace-self;shutdown -r 0" 

Hostname - Rename Issues 
  • -> Stop the osa-dispatcher and jabberd service.  
-> #rm -f /var/lib/jabberd/db/*  
   
-> Switch to the oracle user and using sqlplus clear out the client and dispatcher tables.  
  •   sqlplus $(spacewalk-cfg-get default_db 
    •   delete from rhnPushDispatcher 
    • delete from rhnpushclient 
    • commit;  
    •    quit  
  • Now restart the jabberd and osa-dispatcher services   
  • Verify the satellite FQDN in serverURL=https://your-satellite-FQDN/XMLRPC in the file /etc/sysconfig/rhn/up2date  

Fix Cobbler Buildiso 
  • an older version of menu.c32, which doesn't work with the latest syslinux 
  • Booting from ISO gives the error: "menu.c32: not a COM32R image"  
    • Copying /usr/share/syslinux/menu.c32 to /var/lib/cobbler/loaders fixes the menu.  
  • Rerun cobbler buildiso then boot from 'generated.iso' and should have menu. 

Check RHN Client Tools 
  • ]# rpm -qa | grep '^rhn-' | sort rhn-check-1.0.0-87.el6.noarch rhn-client-tools-1.0.0-87.el6.noarch rhn-setup-1.0.0-87.el6.noarch  
If Client is Unable to Check In 
  • Install rhncfg-actions (on client) and run rhn-actions-control --enable-deploy.  
To Deploy Config Files Immediately on Client 
  • rhncfg-actions get   
Check Red Hat GPG Key is Installed 
  • rpm -q --queryformat "%{SUMMARY}\n" gpg-pubkey 

Embedded Database Tablespace Full 

  • Stop satellite 
  • start oracle 
    • [root@mysat init.d]# /etc/init.d/oracle start Starting Oracle Net Listener ...                           [  OK  ] Starting Oracle DB instance "rhnsat" ...                   [  OK  ] [root@mysat init.d]# su - oracle  
  • Check tablespace use 
    • -bash-4.1$ db-control report Tablespace                  Size    Used   Avail   Use% DATA_TBS                    3.9G    3.7G  123.3M    97% SYSAUX                      500M  189.4M  310.5M    38% SYSTEM                      400M  255.2M  144.7M    64% TEMP_TBS                   1000M      0B   1000M     0% UNDO_TBS                   1000M  856.3M  143.6M    86% USERS                       128M     64K  127.9M     0%  
  • Extend tablespace and check, then restart satellite 
    • -bash-4.1$ db-control extend DATA_TBS Extending DATA_TBS... done. -bash-4.1$ db-control report Tablespace                  Size    Used   Avail   Use% DATA_TBS                    4.3G    3.7G  623.3M    86%   
How to Create GPG Key on Virtual Machine 
  • yum install rng-tools 
  •  sed -i 's,EXTRAOPTIONS.*,EXTRAOPTIONS="-r /dev/urandom",' /etc/sysconfig/rngd  
  • service rngd start 
  • gpg --gen-key  

Run script remotely from Spacewalk to update/create new distro on Rocks 
cd /export/rocks/install # rocks create distro 
  
To create new Distro on all Rocks Head Nodes