console.systems

How to install Intune in Debian 12

Tuesday, March 26, 2024

I wish I didn’t have to use this abomination of a software from Microsoft, but I have to. After spending countless hours I had to document this in case I have to go through this again.

Common misconceptions:

General steps:

  1. Follow Ubuntu 22.04 instructions to install Intune.
  2. apt install msopenjdk-11 (comes from Microsoft’s repository, which you added at the previous step).
  3. ln -s /usr/lib/jvm/msopenjdk-11-amd64 /usr/lib/jvm/java-11-openjdk-amd64
  4. update-alternatives --config java and select the one that points to msopenjdk-11.
  5. Finally run intune-portal.

Troubleshooting:

  1. When clicking “Sign up”, the new window is blank. The content is there but for some reason it fails to render. One workaround is to blindly navigate to the input field. Click the window in the top left corner and press Tab, it should jump to the input field, then type in your corporate email and press Enter. It should open a new window for entering password, which will have its content visible. Another workaround is to run a separate X server with software renderer:
    sudo apt install xserver-xephyr
    Xephyr -ac -br -noreset -screen 1280x1024 :1 &
    # optionaly, run some window manager to be able to change window geometry:
    # DISPLAY=:1 openbox &
    DISPLAY=:1 intune
    
  2. After entering email there is no separate third window to enter password, instead it asks for password in the same second window. Possible reasons:
    • No symlink to msopenjdk-11.
    • Intune fails to create a keyring to store the tokens. See below how to use Seahorse to debug this problem.
  3. You authenticated but it shows “Get the app” button. After clicking the button nothing happens. See the previous step.

  4. You get error [1001]. Most likely you tried too many times to authenticate and the procedure is temporarily blocked. Try again in 10 minutes or later.

  5. If device compliance check asks you to to downgrade to a supported distribution (LOL), grab /etc/os-release from Ubuntu 22.04 installation (you may use this one).

To debug the keyring problem, install and run Seahorse (apt install seahorse). Click the + button in the corner and make sure there is a menu item to create “Password keyring”. If there is no such item, happy debugging. Possibly something is wrong with how dbus daemon is launched.

Merge Git repositories, preserving chronological order of commits

Wednesday, May 22, 2019

Sometimes you want to split a huge monorepo into multiple smaller repositories, like if you were migrating from Subversion. What if you want to do the opposite? I did.

I had a set of tiny git repositories that describe how to build Debian packages in OpenSuse Build Service. The repositories had similar directory structure and even the commits in each repository were alike. Eventually I thought that merging all repositories into a single monorepo would be more efficient.

I started searching if somebody had already achieved something like this. I found few attempts but they all differ in a way how the history is preserved.

Basically all the solutions I found merge repositories with --allow-unrelated-histories option. It allows merging branches that don’t share common ancestor commits. But in result the history of each repository is trapped inside merge commits. Here is how it would look for two repositories:

     A  B  C  D       W  X  Y  Z
     •--•--•--•   +   •--•--•--•

                  |
                  v
     A  B  C  D       W  X  Y  Z
     •--•--•--•   +   •--•--•--•
    /                /
•--•-------------•--•-------------•

Which is inconvenient if you still want to reorder or squash some consequent commits across multiple repositories. This is how I wanted the commits, ordered chronologically:

A  W  B  C  X  Y  Z  D
•--•--•--•--•--•--•--•

Here is the approach I went with:

mkdir -p ~/merge-attempt/repos
cd ~/merge-attempt/repos
git clone git@githost:user/repo1
...
git clone git@githost:user/repo9
cd repos
for R in *; do
  pushd $R
  git format-patch --root --src-prefix=a/$R/ --dst-prefix=b/$R/
  for P in *.patch; do
    grep '^Date: ' $P | \
      sed 's/^Date: \(.*\)/\1/' | \
      date -Iseconds -f - | \
      sed 's/[:+]/-/g' | \
      xargs -I{} mv $P {}.patch
  done
  mv *.patch ../..
  popd
done

Here --src-prefix and --dst-prefix arguments allow us to preconfigure the patches, so when applied, the files would be created in subdirectories named according to original repository.

We should get something like this:

2018-09-23T23-42-02-03-00.patch
2018-12-10T13-51-56-02-00.patch
2019-04-16T20-05-20-03-00.patch
2019-04-16T20-25-31-03-00.patch
2019-04-16T20-35-56-03-00.patch
2019-04-16T20-38-16-03-00.patch
2019-04-16T20-49-06-03-00.patch
mkdir -p ~/merge-attempt/monorepo
cd ~/merge-attempt/monorepo
git init .
git am ../*.patch
git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"'

And that would be it.

SanDisk Sansa Clip Zip with 128GB microSD

Monday, January 7, 2019

If you ever wondered whether Sansa Clip Zip is able to handle microSD cards larger than 32GB, I managed to stick in a 128GB one from Kingston and it worked just fine.

Only had to format it to FAT32.

Handmade screen locker with fade out

Monday, October 10, 2016

Just wanted to share my solution for screen locking that proved itself over the years very practical. As I stepped away from full-blown desktop environments, here and there I had to search how to get some of the features back, but keep it very lightweight on resources. I wanted a very primitive solution with a few dependencies.

Imagine you are watching a long YouTube video and suddenly the screen is locked. Not very user friendly. So fading out notification with possibility to cancel screen locking is a must have feature.

For this recipe we will need:

Here goes the script that will start screen fading out:

#!/bin/bash

SEC=10
[ $# -eq 1 ] && SEC=$1
FRAMES=100
SLEEP=`echo $SEC / $FRAMES | bc -l`

trap "xcalib -clear" EXIT

sleep 0.1

LAST_IDLE=`xprintidle`
for (( i = 1; i <= $FRAMES; i++ )); do
  NEW_IDLE=`xprintidle`
  if [ $LAST_IDLE -gt $NEW_IDLE ]; then
    exit 0
  fi
  LAST_IDLE=$NEW_IDLE
  xcalib -co 95 -a
  sleep $SLEEP
done

xset dpms force off

When executed it will gradually lower the contrast to pitch black. If there is any mouse movement or a key press it will cancel fading out. If you like customization, it also accept a parameter, number of seconds during which screen will be fading out (10 by default). Save it somewhere in the home directory, for example in ~/.bin/.

Screen fader by itself is not enough, we also need a locker tool as well as the tool that will detect when there is no user activity. Add the following line to your script that runs at log in, in case of Openbox it is ~/.config/openbox/autostart.

$ xautolock -time 30 -locker "dm-tool lock" -notify 15 -notifier "$HOME/.bin/screen-fader.sh" &

In here 30 is the number of minutes after which the screen will be locked if no user activity detected. 15 is the number of seconds prior to screen locking when notifier will be executed. In our case the notifier is screen-fader.sh script from above. Replace dm-tool lock with locker of your choice, if you don’t use lightdm.

Then we need to change the setting for the default X screen saver that it doesn’t interfere with ours. So add this line as well to your autostart script:

$ xset s 1800 1800 dpms 1800 1800 1800 # screen blanking after 30 minutes

Finally, set a handler to lock the screen on demand via a hot key. For Openbox that would be in ~/.config/openbox/rc.xml:

<keybind key="C-A-L">
  <action name="Execute">
    <name>Lock Screen</name>
    <command>xautolock -locknow</command>
  </action>
</keybind>

That’s all. Now you are in full control of screen locking. Sweet!

How to disable Power Button in Openbox and Debian 8 Jessie

Sunday, October 9, 2016

This is something that was bothering me for quite a while. Rarely but I happened to press accidentally the power button and shut down my computer, loosing all unsaved work. These few times I tried to search for solution, it never worked. After another undesired power off I decided to sit down and fix it.

Why I never managed to get it working properly is due to the combination of systemd and Openbox. Both are capable to set what the special buttons like power or sleep do. So fixing it in the either one kept the button misbehaving. And the trick was to configure it in both places.

Let’s first disable the button in Openbox. Edit ~/.config/openbox/rc.xml and find the XF86PowerOff piece and comment it out by wrapping it between <!-- and -->:

<!--
<keybind key="XF86PowerOff">
  <action name="Execute">
    <command>systemctl poweroff</command>
  </action>
</keybind>
-->

Reload the Openbox config file:

$ openbox --reconfigure

Time for the systemd part. Open /etc/systemd/logind.conf and find the line with HandlePowerKey in it. By default the value for the power button handler is poweroff. Remove the preceding # symbol and change the value to ignore:

HandlePowerKey=ignore

Lastly, restart logind:

$ sudo systemctl restart systemd-logind

And we’re done. Now the power button is harmless. Of course it will continue working to power on the computer or wake it up from the sleep.

P.S. In case something doesn’t work, check the logs ( -f for real time update):

$ sudo journalctl -f

Older Posts ->