Log as well as see error and standard output in Linux Terminal

Quick snippet, as I was searching for this one today.

You can output both standard and error output to both screen and log file with the below command:

my_command.sh 2>&1 | tee my_command.log

Explanation:

  • my_command.sh
    • replace with your command (possibly including arguments)
  • 2>&1
    • redirects standard error to standard output, otherwise only standard output is written to file
  • | tee
    • my_command.log pipes the output to tee, which writes both to screen and file

Linux, thank you for all the good times

This will be quite similar to a lot of stories I’ve read on Reddit, Stack, etc lately. But last week there was a straw which broke the camel’s back.

I’m currently installing my tool set on a macbook, after spending nearly half my life on Linux. As an analogy; it feels like finally trading in that old-timer car, which you know every nook and cranny of the engine bay but it just isn’t up to it’s task in this world.

In the past 20 years I loved how the merry heap of Open Source devvers tackled every (really every) hurdle and created this OS shaped out of hope and dreams. A project started so small and turned to influential by those same characters 🙂 I laughed about the naming of less (less is more), used cowsay on most of my terminal messages and could use this free and open solution to earn money as a self employed engineer.

I installed Warty Warthog and was wondering what I would do with the rest of my day, since it only took 30 minutes instead of a full day compiling in Gentoo.

I found out about so many beautiful solutions built, maintained and cared for by communities which were revolving around the community itself, instead of self-glorifying CEO personalities.

The straw was an email from the customer I’m currently working at, they stated that you need to be MS Intune compliant to be able to login to corporate resources. Which means that I can reach everything (yay openvpn) but not use it (nay intune)

In all those years it has always been corporate policies which broke stuff for me. A customer or client would ask me to join their network and it’s tough to explain that you need to recompile gnome-network-manager to add VPN support. For me myself I can explain why this time is an investment, but when a client/customer is waiting for me to deliver value it’s a different story.

I spent a full day on getting audio to work in MS Teams via Citrix Workspace (both Citrix and MS are very corporate), and that shows where the issue lies; The corporates (not meant as a negative!) don’t care that much about the minority share that Linux users are. They don’t lose (much) money when I can’t use their products, so why bother.

Next to that the companies which develop solutions for Linux are in trouble with testing, the group is abysmally small and the techniques they used are splintered (gnome/kde, ubuntu/fedora/mint/pop_os, cpu architecture, sound subsystems, etc etc) so it’s neigh impossible to test a new release properly to prevent previous bugs to re-appear.

I switched to a Macbook three days ago, ported my whole workspace and most of the tools are working fine. Next to that, I am now compliant, thus can use the corporate facilities without restrictions.

And. It. Just. Works.

Honestly it feels like losing a good friend, who’s been there for most of my life.

Goodbye Linux, it’s been a blast. I’ll see you on all of my servers, so I guess we’ll be neighbours, no longer roommates.

photo of person walking on deserted island
Photo by Tom Swinnen on Pexels.com

Citrix Workspace (ICAClient) no sound/audio in Microsoft Teams

Since last week I am working with a virtual desktop (VDI) through Citrix Workspace (ICAClient) and noticed I can not use Teams to call or join meetings.

This message is displayed in Microsoft Teams:

There’s a problem with your connection.
Still connecting to remote devices. Calling isn’t available yet.

Cause: HDX Optimized audio does not work

If you want to skip straigt to the solution, click here: Solution: Change MSTeamsRedirSupport to zero

How to diagnose if the cause is the same as what I encountered

Log in to your VDI, play some sounds AND talk into your microphone to make sure your audio is actually working. Check this via the sound mixer, that’ll show a moving bar if it’s receiving sound by your microphone. Speakers should work when you watch a random youtube movie.

Next; Open MS Teams and click the “Three dots” settings menu, choose About, then Version. When your Workspace and Teams are expecting HDX to work but it didn’t, you will see this message: Citrix HDX Not Connected

MS Teams, Settings – About – Version: “Citrix HDX Not Connected”

Note: If it would be working, you would have seen Citrix HDX Connected

The third option is if Teams does not expect Citrix HDX to work, then it simply doesn’t show anything about Citrix HDX and tunnels sound over the regular sound channels. This is what we want to accomplish in the next chapter.

There is a registry entry MSTeamsReditSupport, which is set every time you connect to your VDI with Citrix Workspace. From what I understand; Citrix Workspace communicates to your VDI that it is capable to receive HDX optimized audio streams. Next to that MS Teams checks that registry setting when it is started to use/not use HDX optimized audio.

Solution: Change MSTeamsRedirSupport to zero

Change MSTeamsRedirSupport to 0 (zero) in registry. The exact location of this registry entry is here:
HKEY_CURRENT_USER\SOFTWARE\Citrix\HDXMediaStream\MSTeamsRedirSupport

It’s a bit tedious to open Registry Editor every time, so you can also create a registry entry file MSTeamsRedir.reg
In this file you can paste this content:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Citrix\HDXMediaStream]
"MSTeamsRedirSupport"=dword:00000000

Remember; You should run MSTeamsRedir.reg every time you connect to the machine or when you restart MS Teams.

Why is this a problem?

I do not know exactly, but I know that the HDX optimized socket on my laptop can not be reached contact the VDI and I tried searching for a solution for a couple of hours. I then became fed up with HDX optimized sockets and thought about buying a macbook to just make the damn thing work. After that short existential crisis I kept searching for a possible solution and was happy to find this registry setting.

My emotions with Linux after figuring stupid things out which simply work on other OS’s

What I’ve tried and did not work:

1.) Run Citrix supplied hdxcheck.sh and see if you have all the libs installed, I tried installing all libs manually and in the end still had no HDX optimized sound in my VDI. You can run this command via the following path:
/opt/Citrix/ICAClient/util/hdxcheck.sh

2.) Install older version of Citrix Workspace, which didn’t use the HDX optimization and thus sound worked in all applications. I did encounter some bugs with full-screen not working properly on a bigger monitor. The version I used is linked below:
Download icaclient_19.12.0.19_amd64.deb via https://www.citrix.com/downloads/workspace-app/
Direct link to the download: https://www.citrix.com/downloads/workspace-app/legacy-workspace-app-for-linux/workspace-app-for-linux-1912.html

Sources:

Citrix.com: Enable optimization of Microsoft Teams

Citrix.com: How to collect Logs for Citrix Workspace app for Linux?

Create a Java path entry for all users

I install Java on all my machines and used to add the java path and home variables to the user (or my user) bash profile but every time I added another user this is a manual step.

Until I found this small trick. Add a system wide profile path setting by creating a file in:

/etc/profile.d/filename

All files in profile.d are added to every users login. Much cleaner than adding it to every user’s profile.

This is the contents of my file:

/etc/profile.d/java-path.sh

export JAVA_HOME="/opt/java"
export PATH=$JAVA_HOME/bin:$PATH

These variables are set next time you log in with any user on that system.