Getting Things Done

Copyright 2013 by Citrix Systems, Inc. This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.


TODO: Currently this page is under the notes section since that is what it is - a collection of notes from Rob Moran. A lot of this information would be really useful in a page under Getting Started but it would need to be cleaned up and organized. It is still quite useful for non-beginners though.

Overview

This page is a bunch of salvaged notes from a former XenClient engineer. There are quite a few useful tips and instructions for just doing things on (Open)XT. It is being splatted here in its original form for now - if folks want to clean it up, re-organize it and add to it, please feel free.

Z Indices

Ideal

  • apply update 6000
  • mouse pointer 5000
  • native screen 4500
  • wait screen 4000
  • menu popup 3000
  • tooltips 2000
  • dialogs 950
  • header 300
  • menu bar 200
  • footer 100
  • content areas 1,0,-1

Current (hacky for X applets)

  • mouse ponter 5000
  • menu popup 3000
  • tooltips 2000
  • header 1800
  • menu bar 1700
  • footer 1600
  • wait screen 1500
  • dialogs 950
  • content area 0

Synchronizer XT

You can test this by logging on to root@autotest-1

$ experiments -m ludo --syncxt-test

if you need to reset the db on your machine (check the help to see if this is correct)

$ experiments -m ludo --wipe-database

Extending xenclient/root disc size

First, delete something (/usr/lib/xui/images is good) to make room to do the resize. Alternatively steal from somewhere else e.g.

$ lvreduce -L -1G xenclient/storage
$ lvextend -L +1G xenclient/root
$ resize2fs -p /dev/xenclient/root

Debugging a daemon

Example using input daemon - you will probably need to extend xenclient/root first, as shown above.

$ opkg update
$ opkg install gdb //installs the debugger program
$ opkg list //lists available packages - find the one you're looking for
$ opkg install xenclient-input-daemon-dbg //we had to run this twice to get it to success
$ /etc/init.d/xenclient-input restart
$ ps auxw | grep input //to find the pid
$ gdb /usr/bin/input_server [pid]

some gdb basics

$ c // to continue
$ where // to get a stack trace
$ q // to quit

Getting Things Done

Enabling ‘Secure Launch’

NOTE: the tpm-setup script is currently broken.

(This was on my HP 8470p so might vary a little bit)

  • Enter BIOS setup
  • Go to Security settings
  • Set BIOS password to !XenR00t (they are zeros)
  • In the security settings - clear security keys (If the option is there)
  • go to TPM Embedded Security
  • Enable Embedded Security Device State
  • Save and reboot
  • Enter BIOS setup again
  • Go to Device Config and set TXT On
  • Save and reboot into XC
  • Open the XC terminal
  • Type:
$ nr
$ tpm–setup
  • Set the password to xenroot
  • It will do it’s thing… then you need to reboot twice.
  • Job done.

Allowing a CD install of XC to upgrade OTA

 vi /config/repo-cert.conf to read:
 ALLOW_DEV_REPO_CERT='true'

Filling a drive

10GB:

$ dd if=/dev/zero of=/storage/temp bs=1M count=$((10*1000))

Turning on touch-screen keyboard in UIVM

 on the device, edit /usr/lib/xui/script/constants.js and set KEYBOARD: true, around line 360

Running webkit JavaScript from GTK

 webkit_web_view_execute_script(web_view, "alert(window.XUICache.Host.publish_topic);");

Checking out source

git pull in these directories:

 build/oe/repos/extra/
 build/oe/xenclient/

Unlocking XT installs (for SSH and v4v-proxy)

$ newrole -r sysadm_r
$ setenforce 0
$ sed -i "s/enforcing/permissive/" /etc/selinux/config

Mounting VM read-write

This works for UIVM

$ db-write "/xenmgr/bypass-sha1sum-checks" true
$ xec-vm -n <name> --disk 0 set mode w

If already running:

$ xec-vm -n <name> reboot

Inside VM:

$ mount -o remount,rw /

Passing Through PCI Devices

put the below into: /etc/modprobe.d/blacklist-sound.conf

 blacklist snd_hda_codec_intelhtml
 blacklist snd_hda_codec_idt
 blacklist snd_hda_intel
 blacklist snd_hda_codec
 blacklist snd_hwdep
 blacklist snd_pcm
 blacklist pcspkr
 blacklist snd_timer
 blacklist snd
 blacklist soundcore
 blacklist snd_page_alloc

reboot the host change the VM config to passthrough the device:

$ xec-vm -u<vm uuid>  add-pt-rule 0x0403 any any

OR

$ xec-vm -n<vmname>  add-pt-rule 0x0403 any any

and start your VM.

For reference: 0x0403 is the PCI class for an audio device. You can see this from looking at the output in dom0 of lspci -vvv to find the PCI bus address of the device and then lspci -vvvn to see the device class of it.

Startup Wizard

$ touch /config/deferred_dom0_password
$ touch /config/deferred_kb_layout
$ touch /config/deferred_eula
$ touch /config/deferred_language

xenmgr Ops

$ tail -f /var/log/xenmgr.log

Using xec

You can work out a lot of this from looking at the IDLhttp://git.uk.xensource.com/cgit.cgi/xenclient/idl.git/tree/interfaces lists all of the properties and methods on xenmgr object. "-o /" specifies the object, and if not supplied is assumed to be "/".

$ xec
$ xec -o /

calls one of the methods listed

$ xec list-vms

lists all of the properties and methods on the host object.

$ xec -o /host

this will Get one of the properties listed

$ xec -o /host Get build-info

to interrogate vms

$ xec-vm

these are equivalent and will show you properties and methods available on VMs

$ xec-vm -o /vm/[uuid]
$ xec -o /vm/[uuid]

if you're getting a property that exists in more than one of the interfaces, then you need to explicitly set the interface

$ xec-vm -o /vm/[uuid] -i com.citrix.xenclient.xenmgr.vm.unrestricted Get state

to get VM by name

$ xec-vm -n "VM Name"

Turning on CTRL+0 tip

$ xec set show-msg-on-vm-start true

Making Status Report appear

$ xec status-report-screen true

Poking VM properties

$ xec-vm -n "Windows XP" set-db-key policies.wired-networking true

Writing XenStore

$ xenstore-write /local/domain/1/report/state 1

dbus-send examples

notifications:

$ dbus-send --system --type=signal /host com.citrix.xenclient.xenmgr.host.storage_space_low int32:5 
$ dbus-send --system --type=signal / com.citrix.xenclient.updatemgr.update_state_change string:"downloaded-files"
$ dbus-send --system --type=signal / com.citrix.xenclient.usbdaemon.device_rejected string:"device" string:"reason"
$ dbus-send --system --type=signal / com.citrix.xenclient.xenmgr.guestreq.requested_attention string:<UUID> objpath:<PATH>

generic notifications:

$ dbus-send --system --type=signal / com.citrix.xenclient.xenmgr.host.generic_message string:"Information" string:"Here is some important information"
$ dbus-send --system --type=signal / com.citrix.xenclient.xenmgr.host.generic_message string:"Information" string:"I will only appear for 5 seconds" int32:5000
$ dbus-send --system --type=signal / com.citrix.xenclient.xenmgr.host.generic_message string:"Warning" string:"I am a warning" int32:5000 int16:1
$ dbus-send --system --type=signal / com.citrix.xenclient.xenmgr.host.generic_message string:"Error" string:"I am an error and have a known ID" int32:5000 int16:2 string:"myid2"
$ dbus-send --system --type=signal / com.citrix.xenclient.xenmgr.host.generic_message string:"Information" string:"The percentage I am showing is:" int32:5000 int16:0 string:"myid2" int16:69

signals:

$ dbus-send --system --type=signal / com.citrix.xenclient.xui.popup_network_menu uint32:1000 uint32:72
$ dbus-send --system --type=signal / com.citrix.xenclient.bed.notify.vm.vm_updated_reboot_required string:"<UUID>"
$ dbus-send --system --type=signal / com.citrix.xenclient.bed.notify.vm.vm_updated_clean_reboot_required string:"<UUID>"
$ dbus-send --system --type=signal / com.citrix.xenclient.bed.notify.vm.vm_lease_near_expiry string:"<UUID>" int16:1000
$ dbus-send --system --type=signal /com/citrix/xenclient/xenmgr/host com.citrix.xenclient.bed.notify.server.auth_required

method:

$ dbus-send --system --type=method_call --print-reply --dest=com.citrix.xenclient.xenmgr /com/citrix/xenclient/xenmgr/host com.citrix.xenclient.xenmgr.host.status

Poking the database

$ db-ls
$ db-ls -f
$ db-ls /xenmgr
$ db-rm /xenmgr/showMsgOnVmStart

gettimeofday trickery

$ ps ax (find midori process)
$ strace -p <pid>
$ (strace -p <pid> 2>&1 | grep gettimeofday > file) & sleep 10; kill %1
$ wc -l file

This was to see how often the javascript was polling for gettimeofday, since it affects power.

Debugging UID

$ killall uid
$ LD_PRELOAD=/usr/lib/libv4v-1.0.so.0.0.0 INET_IS_V4V=1 uid --no-daemonize > /tmp/uid.log

Net Boot

Boot a laptop from network, and either pick one of the options as described, or type in the name of a build that's not mentionned (e.g. cam-oeprod-123456-master)

The old school method is below:

$ ssh user@boiler
 (NIS password)
$ cd /home/xc_tftpboot/pxe/grover
$ ln -sf ../builds/master/cam-prod-008284-master/netboot/pxelinux.cfg

then boot laptop from network

GIT

You MUST set these in the global config

$ git config --global user.name 'Joe Bloggs'
$ git config --global user.email 'Joe.Bloggs@citrix.com'

Optionally, the following will set up any branches you checkout/create in the future with the rebase property set to true, which is useful as this means when you pull, it is the same as running 'git pull --rebase':

$ git config --global branch.autosetuprebase always

To view the global config

$ git config --global -l

To view the local config (i.e. if you're in the directory of a git project it will show you specific config for that)

$ git config --local -l
$ git branch //show branches
$ git branch <name> //create branch called <name>
$ git checkout <name> //switch to branch called <name>
$ git reset --hard <hash> //reset tree to the <hash> of the commit
$ git checkout <filename> //reset <filename> to origin
$ git stash //like diff stack
 :switch branch
$ git stash apply //apply the diff stack on the branch you've switched to
$ git clone <fromtree> <totree>
$ git push <server> <branchfrom>:<branchto> //creates a remote branch based on your local branch
$ git push <server> :<branch> //deletes remote branch
$ git checkout -b test --track origin/test //checkout test branch tracked to test branch locally, create local test branch if not there
$ gitk
$ git commit --interactive
$ git cherry-pick

Debugging Switcher Bar

win-tools.git master change (c7a19d4c9440725f741756485ca3b4ad0d8355eb) mocks out the XenGuestAgent code if debugger attached and either: CITRIX_GUI_DEBUGGING environment variable is defined as non-zero Or File named “IAmACitrixGUIDeveloperAndILikeToTest.txt” is in current working directory.

NIS mount hack on ubuntu

Add this:

 ( sleep 15s ; /etc/init.d/autofs restart ) &

to:

 /etc/rc.local

GRUB Shell

By default the grub shell is disabled in XT. If you want it back you need to add this to your grub.cfg:

 set edit_and_shell=1

Also the grub menu timeout is disabled with:

 set timeout=-1

You can fix that up by commenting out that if/fi block and just set a timeout (in seconds):

 set timeout=5

Core Dumps

Enabling core dumps on OpenXT is not working at the moment. There is a ticket:

OXT-902 - Getting issue details... STATUS

One way around it is to enable them manually from a terminal:

$ ulimit -c unlimited

In the cases where you need to have them enabled before a daemon starts you can add that to the daemon init script before the call to start it:

ulimit -c unlimited >/dev/null 2>&1

It seems SELinux must be disabled too. To disable it for every boot, edit /etc/selinix/config and change enforcing to permissive.