05 November 2012

Archlinux moves to systemd. My own remarks.

After notice that systemd is now default in new installations I realised that sooner or later I'll be forced to migrate disregarding whether I like this idea or not :)
After some reading I rebooted, edited kernel loading line in my Grub2 with init param pointing to systemd and booted into my Arhclinux. What was noticable that I received to GUI :) Though I was aware that systemd ignores /etc/inittab (my SLiM used to start from inittab) and I wasn't that surprised. I did sudo systemctl enable slim.service (along with couple of other services which made sense for me) and rebooted again (needed not to forget to put init kernel param in place again).
Basically everything went smooth except just a few points, which weren't clear from documentation and which made me post this writing :)


Here I'm talking about pure systemd installations.


1. systemd-sysvcompat

Documentation from Archwiki states that you must not remove this package or you won't be able to boot any more. Though this package doesn't seem to contain any things I may need now (file list for systemd-sysvcompat). And it appeared to be true - if you want to remove this package you need to do the following (instructions for Grub2 loader):
  1. edit /etc/default/grub and make sure you have init kernel param present, like this:
  2. regenerate grub.cfg with
    sudo grub-mkconfig -o /boot/grub/grub.cfg
  3. now when everything went fine you could remove unnecessary things:
    sudo pacman -Rcs sysvinit-tools
    this should remove sysvinit-tools, initscripts, sysvinit and systemd-sysvcompat.

2. PCManFM doesn't show removable drives

While some other tools may show them. If not check documentation first. For me problem was that udisks daemon was inactive. So simple sudo systemctl enable udisks.service fixed this for me.

These seem to be all the troubles with systemd for me, which I find pretty painless! :) And instead of conclusion: if you want to know what else services you could enable (or disable) use systemctl list-unit-files

Update 12.01.2015

After quite some time i concluded that having a /sbin/init makes way more sense in terms of compatibility and stability then having an init= kernel option configured in a boot loader. I just switched to UEFI and had to specify init= again. This time i just symlinked systemd to /sbin/init to end up this fight:
ls -s '../lib/systemd/systemd' /usr/bin/init

24 September 2012

Using multiple input documents for XSLT transformation

I believe I'm not alone when I need to use couple of input documents for a XSLT transformation. It's rather common case to have input data from multiple sources, to process it and to return a single result. Should XSLT be an exception? Not this time.
If we look at data type mapping it obvious that we could accept and return Nodes, NodeLists, etc. We could do the same with transformer parameters as well. Here is an example:

Document doc = ...; // direct input for transformer
Document anotherDoc = ...; // second document to be passed as parameter

TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(xsl);
transformer.setParameter("anotherDoc", anotherDoc);
transformer.transform(new DOMSource(doc), new StreamResult(System.out));

<xsl:stylesheet version="1.0"

  <xsl:param name="anotherDoc" />

  <xsl:variable name="inputDoc" select="/" />

  <xsl:template match="/">
    <xsl:apply-templates select="$anotherDoc/anotherRoot" />

  <xsl:template match="nodeOfAnotherDoc">
    <xsl:value-of select="text()" />
    <xsl:value-of select="$inputDoc/root/@attr" />


That's all the trick, we could operate of another document just on regular xsl:variable containing a node-set.
Just one hint: it may be useful to have a variable referencing input document root (inputDoc in example), because inside context of xsl:template that matched anotherDoc you may have trouble accessing nodes of input document.

28 June 2012

X11 session login with SLiM and no password

Basically task is to allow my mum login to home Linux-box and not to bother her with a password (or I would have to install Windoze again). At same time I want to still have access to same box with my own passworded account and to be able to login (with SLiM) to a X11 session.

I'm not going to dig into security considerations regarding passwordless users here.

So firstly let's create a user for my mum and deprive it a password:
# useradd -m -U username
# passwd -d username

-m force home directory creation
-U automatically creates a group with same name as username and assigns it as primary group for new user
passwd -d removes password from given account

Now you should be able to login with new user into physical terminal session. Though this depends on PAM configuration in your distro (I'm using ArchLinux). You won't be able to su to this user or login into SLiM yet.
To allow SLiM login you with empty password you need to edit /etc/pam.d/slim:
auth    required    pam_unix.so
and change to
auth    required    pam_unix.so nullok

That's it. Same instructions should apply to any login manager, not only SLiM.

12 June 2012

Debugging SSL traffic with socat

Often when developing a client for a remote service using HTTPS (or any SSL-tunneled protocol) it difficult to dig into the data being transferred over the network. That is the case for me and here is another cheat sheet for me:

# socat -v TCP-LISTEN:443,reuseaddr,debug,fork OPENSSL:remote.host.com:443,verify=0

This sets up a SSL tunnel, accepting non-encrypted traffic from one side, encrypting it and passing to remote host.
Then you should use localhost:443 as a connection endpoint from your piece of software and watch all the traffic being sent :)
For detail on socat option take a look at documentation.

07 June 2012

DSRA0080E Data Store Adapter exception on IBM WebSphere EJB client

More like a hint for myself :)

Exception like this:

Caused by: com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException: DSRA0080E: An exception was received by the Data Store Adapter. See original exception message: com/ibm/websphere/rsadapter/DataStoreHelper.doConnectionSetupPerGetConnection(Ljava/sql/Connection;ZLjava/lang/Object;)Z.
  at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getConnection(WSRdbManagedConnectionImpl.java:3503)
  at com.ibm.ws.rsadapter.spi.WSDefaultConnectionManagerImpl.allocateConnection(WSDefaultConnectionManagerImpl.java:91)
  at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:646)
  ... 22 more
Caused by: java.lang.AbstractMethodError: com/ibm/websphere/rsadapter/DataStoreHelper.doConnectionSetupPerGetConnection(Ljava/sql/Connection;ZLjava/lang/Object;)Z
  at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getConnection(WSRdbManagedConnectionImpl.java:3482)
  ... 24 more

may be caused by running EJB client application with different (e.g. non-IBM) Java VM.

24 April 2012

Screensharing in Linux with GoToMeeting

Screensharing appears to be a weak part of Linux desktop. Among solutions that do work I have successful experience with TeamViewer and Mikogo. Both of them are not perfect, but they run more or less natively on Linux.
These two were no the case for the event I needed to share my screen for :). Ideally I needed GoToMeeting and made it to share my screen! This instructions should work with most (if not any) of available screensharing solution for Windows.


In parenthesis I referred to software I was using.
  1. Windows running on either virtual machine (even non-virtual would work if you have spare one) (Windows XP on VirtualBox)
  2. VNC server running on your Linux desktop (x11vnc)
  3. VNC client on your Windows PC (TightVNC)

Basic idea:

You should have guessed what I'm going to do next :) I explain if not. You share the screen of you Windows PC with screensharing tool of your choice. But what the screen will display is fullscreen VNC client connected to your Linux desktop. I suppose there might be some video issues with the way how VNC client draws the picture and the way screensharing tool captures the screen, that's why I mentioned what software I was using.


For sharing my desktop on Linux I ran x11vnc like that:
$ x11vnc -display :0 -auth ~/.Xauthority -forever -nap -noxdamage

Then I had to start another XServer instance to avoid effect of 'endless refraction' (e.g. VNC client shows your desktop running virtual machine with Windows with VNC client showing you desktop...) using:
$ startx -- :1

On the second XServer I ran VirtualBox, started my virtual Windows PC, ran TightVNC and connected to my host Linux box. (At this stage you VNC may not work smoothly, looks like XServer detects that it's not active at the moment and does not update the screen when you try to move windows from within VNC client.) Now start you screen sharing session and once it's started enter fullscreen mode in your VNC client. Now you could minimize you virtual PC window and switch to first XServer (Ctrl+Alt+F7 in my case, your may differ).
That's it and you may lead your presentation :)


  • On dual-screen setup you could share only one screen with
    $ x11vnc -display :0 -auth ~/.Xauthority -forever -nap -noxdamage -clip 1680x1050+0+0
    and thus you may try to avoid switching between different XServer by running VirtualBox instance on second screen.
  • Gnome users may use vino instead of x11vnc, though I haven't tried this.

02 April 2012

Meaningful error message from IBM WebSphere

Seeing this on your WebSphere application server startup?
00000000 ContainerHelp E   WSVR0501E: Error creating component com.ibm.ws.cluster.runtime.ProcessRuntimeImpl
java.lang.NoClassDefFoundError: com.ibm.websphere.cluster.topography.DescriptionManagerFactory (initialization failure)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
        at com.ibm.ws.cluster.runtime.ProcessRuntimeImpl.initialize(ProcessRuntimeImpl.java:366)
        at com.ibm.ws.runtime.component.ContainerHelper.initWsComponent(ContainerHelper.java:1166)
        at com.ibm.ws.runtime.component.ContainerHelper.initializeComponent(ContainerHelper.java:1073)
        at com.ibm.ws.runtime.component.ContainerHelper.initializeComponents(ContainerHelper.java:874)
        at com.ibm.ws.runtime.component.ContainerImpl.initializeComponents(ContainerImpl.java:780)
        at com.ibm.ws.runtime.component.ContainerImpl.initializeComponents(ContainerImpl.java:754)
        at com.ibm.ws.runtime.component.ServerImpl.initialize(ServerImpl.java:350)
        at com.ibm.ws.runtime.WsServerImpl.bootServerContainer(WsServerImpl.java:280)
        at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:214)
        at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:666)
        at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)
        at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)
        at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
        at org.eclipse.core.launcher.Main.run(Main.java:981)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:330)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:108)
Caused by: java.lang.IllegalStateException: java.lang.NullPointerException
        at com.ibm.ws.util.ImplFactory.loadImplFromClass(ImplFactory.java:354)
        at com.ibm.ws.util.ImplFactory.loadImplFromKey(ImplFactory.java:328)
        at com.ibm.ws.util.ImplFactory.loadImplFromKey(ImplFactory.java:332)
        at com.ibm.ws.wlm.Factory$4.run(Factory.java:141)
        at java.security.AccessController.doPrivileged(AccessController.java:251)
        at com.ibm.ws.wlm.Factory.loadImpl(Factory.java:139)
        at com.ibm.websphere.cluster.topography.DescriptionManagerFactory.(DescriptionManagerFactory.java:50)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at com.ibm.ws.cluster.service.ClusterManagementImpl.(ClusterManagementImpl.java:119)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:45)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:515)
        at com.ibm.wsspi.cluster.ClusterManagementFactory.(ClusterManagementFactory.java:62)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at com.ibm.ws.cluster.runtime.WLMDiagnosticModule.ffdcDumpDefaultClusterManagement(WLMDiagnosticModule.java:422)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at com.ibm.ws.ffdc.DiagnosticModule.getDataForDirective(DiagnosticModule.java:305)
        at com.ibm.ws.ffdc.DiagnosticModule.getDataForDirectives(DiagnosticModule.java:279)
        at com.ibm.ws.ffdc.DiagnosticModule.dumpComponentData(DiagnosticModule.java:144)
        at com.ibm.ws.ffdc.impl.DMAdapter.processDM(DMAdapter.java:123)
        at com.ibm.ws.ffdc.impl.DMAdapter.formatTo(DMAdapter.java:114)
        at com.ibm.ffdc.util.provider.IncidentLogger.writeIncidentTo(IncidentLogger.java:63)
        at com.ibm.ws.ffdc.impl.FfdcProvider.logIncident(FfdcProvider.java:135)
        at com.ibm.ws.ffdc.impl.FfdcProvider.logIncident(FfdcProvider.java:92)
        at com.ibm.ffdc.util.provider.FfdcProvider.log(FfdcProvider.java:232)
        at com.ibm.ws.ffdc.impl.FfdcProvider.log(FfdcProvider.java:100)
        at com.ibm.ffdc.util.provider.IncidentEntry.log(IncidentEntry.java:96)
        at com.ibm.ffdc.util.provider.Ffdc.log(Ffdc.java:90)
        at com.ibm.ws.ffdc.FFDCFilter.processException(FFDCFilter.java:114)
        at com.ibm.ws.cluster.ProcessProperties.(ProcessProperties.java:281)
        at com.ibm.ws.cluster.ProcessProperties.(ProcessProperties.java:234)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at com.ibm.ws.cluster.runtime.ProcessRuntimeImpl.initialize(ProcessRuntimeImpl.java:307)
        ... 31 more
Caused by: java.lang.NullPointerException
        at com.ibm.ws.cluster.WLMCustomPropertyUtility.getBBCallbacksEnableWLMThreads(WLMCustomPropertyUtility.java:384)
        at com.ibm.ws.cluster.propagation.bulletinboard.BBDescriptionManager.(BBDescriptionManager.java:165)
        at java.lang.J9VMInternals.newInstanceImpl(Native Method)
        at java.lang.Class.newInstance(Class.java:1325)
        at com.ibm.ws.util.ImplFactory.loadImplFromClass(ImplFactory.java:349)
        ... 70 more

This should probably mean that your PC's hostname couldn't be resolved.