Touchscreen issues with my phone

For some time now, I had been having touchscreen issues with my phone (a Moto G3), where scrolling registered as a click; finally decided to research it and stumbled upon this thread:

https://forums.lenovo.com/t5/MOTO-G-3rd-Gen/Touch-detection-problems-phantom-touch-ghost-touch/td-p/3277853

Seems like an issue faced by a lot of people regarding this handset, but I am 12 pages in and yet to see any reasonable response from Motorola (Lenovo?).

Trust in this brand eroded and I will likely never buy their phones again.

Native Window Snapping / Window Tiling with Fluxbox, Openbox, and xfwm4 (Xfce)

I find tiling helpful when I have to work with the contents of two windows at once, or when comparing things.

By native window tiling I mean that we will be using only the native commands of a particular window manager and not any external program.

Fluxbox

The following can be added to ~/.fluxbox/keys

# Tiling
Control Mod1 Left :MacroCmd {ResizeTo 50% 100%} {MoveTo 00 00 Left}
Control Mod1 Right :MacroCmd {ResizeTo 50% 100%} {MoveTo 00 00 Right}
Control Mod1 Up :MacroCmd {ResizeTo 100% 50%} {MoveTo 00 00 Up}
Control Mod1 Down :MacroCmd {ResizeTo 100% 50%} {MoveTo 00 00 Bottom}
Control Mod1 Return :ToggleCmd {Maximize} {Restore}

The modifiers above (Ctrl + Alt + Left/Right/Up/Down/Enter) should not conflict with existing modifiers, else they will not work correctly.

Openbox

The following can be added to ~/.config/openbox/rc.xml within the keyboard tags.
http://pastebin.com/z1KcJCkV
(have to use a pastebin as WordPress interprets it as tags)

xfwm4 (Xfce)

Go to Menu -> Settings -> Window Manager -> Keyboard

The commands should already be present, only the keys need to be set.



Using OpenRC on Arch / Archbang / Manjaro Linux.

With the increasing complexity of systemd, I decided to look for alternatives. After some searching and experimentation, I settled upon OpenRC.

OpenRC is a dependency based rc system that works with the system provided init program, normally sysvinit.

Before proceeding furthur, let me list some of the resources available:

1) Manjaro Linux wiki

2) Manjaro Linux forum (new) (old)

3) Arch Linux wiki

4) Arch Linux forum

5) Archbang wiki

6) OpenRC AUR packages

7) PKGBUILDs by artoo: https://github.com/manjaro/packages-openrc

8) Pacman repos for openrc and related stuff, built from above pkgbuilds:

[openrc-eudev]
SigLevel = PackageOptional
Server = http://downloads.sourceforge.net/project/archopenrc/$repo/$arch

9) systemd-free.org (much more up to date than this blog).

Setting Up OpenRC

Step 1)
Add the repos mentioned in the resources section to /etc/pacman.conf

[openrc-eudev]
SigLevel = PackageOptional
Server = http://downloads.sourceforge.net/project/archopenrc/$repo/$arch

Install the openrc-base package group:

sudo pacman -S openrc-base

This installs the binary init system (sysvinit), and the base OpenRC scripts and configuration.

The sysvinit package conflicts with the systemd-sysvcompat, so it will be necessary to remove it in order to install OpenRC.

The output of the command looks like the following:

$ sudo pacman -S openrc-base
:: There are 10 members in group openrc-base:
:: Repository openrc-eudev
   1) cronie-openrc  2) cryptsetup-openrc  3) dbus-openrc
   4) device-mapper-openrc  5) dhcpcd-openrc  6) glibc-openrc
   7) inetutils-openrc  8) lvm2-openrc  9) mdadm-openrc  10) openrc-core

Enter a selection (default=all): 
resolving dependencies...
looking for inter-conflicts...
:: sysvinit and systemd-sysvcompat are in conflict. Remove systemd-sysvcompat? [y/N] y

Packages (13): cronie-1.4.11-2  systemd-sysvcompat-212-3 [removal]
               sysvinit-2.88-16  cronie-openrc-20141002-1
               cryptsetup-openrc-20141002-1  dbus-openrc-20141002-1
               device-mapper-openrc-20141002-1  dhcpcd-openrc-20141002-1
               glibc-openrc-20141002-1  inetutils-openrc-20141002-1
               lvm2-openrc-20141002-1  mdadm-openrc-20141002-1
               openrc-core-0.13.1-3

Total Download Size:    0.32 MiB
Total Installed Size:   1.24 MiB
Net Upgrade Size:       1.24 MiB

:: Proceed with installation? [Y/n]

On installing openrc-base, OpenRC should boot by default instead of systemd.

Note-

If on booting you get an error like “/etc/sysctl.conf not found”, it can be corrected by creating /etc/sysctl.conf with the command sudo touch /etc/sysctl.conf

On shutdown if you get a message like “Warning: /usr/lib/rc/cache is not writable!”, then this directory can be created as sudo mkdir /usr/lib/rc/cache

The boot logs are stored in /var/log/rc.log by default.

Step 2)
Some common services that could be enabled are dbus, which is a system message bus, and cronie, which provides the cron service, by running:

sudo rc-update add dbus default
sudo rc-update add cronie default

For networking dhcpcd is enabled by default via netifrc, for more details have a look here.

dhcpcd worked out of the box on my Arch install in a VM, but on my main laptop I use a Wifi connection, so I installed networkmanager-openrc from the openrc repo.

Nowadays I am using wicd-openrc (available in the repo) as an alternative to networkmanager.

By default, a graphical Display Manager is not enabled; for that one would need to install displaymanager-openrc, configure one’s display manager in /etc/conf.d/xdm, and enable and start the xdm service.

I then installed alsa-utils-openrc for ALSA (audio) support, and acpid-openrc for acpi support.

Note that after installing these packages, the services wont be enabled unless you addded to a runlevel, which is suggested when installing these packages:

installed acpid-openrc (20140527-1)
==> run 'rc-update add acpid default'

(need to be root when doing that)

For example,
sudo rc-update add acpid default

consolekit can be installed to perform root actions like shutting down or restarting system as non-root user from your Desktop Environment.

Consolekit can be installed in the following way:

sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc

The output looks like the following:

$ sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc
resolving dependencies...
looking for inter-conflicts...
:: polkit-consolekit and polkit are in conflict. Remove polkit? [y/N] y

Packages (9): cgmanager-0.37-2  consolekit-1.0.0-3  libnih-1.0.3-2  openrc-core-0.17-2  polkit-0.112-2 [removal]  cgmanager-openrc-20150911-1
              consolekit-openrc-20150911-1  polkit-consolekit-0.113-1

Total Download Size:    0.92 MiB
Total Installed Size:   4.44 MiB
Net Upgrade Size:       2.84 MiB

:: Proceed with installation? [Y/n]

After installing the consolekit service needs to be started and enabled. To enable the consolekit service, sudo rc-update add consolekit can be used.

Consolekit supports multi-user setups, mounting of partitions by unauthorised users, shutting down the system as normal user, etc. See https://wiki.gentoo.org/wiki/ConsoleKit for more details.

To check that consolekit is running and a ck-session was started, the following command can be used:

ck-list-sessions

The output looks like the following:

 Session1:
    unix-user = '1000'
    realname = 'Aaditya Bagga'
    seat = 'Seat1'
    session-type = ''
    active = TRUE
    x11-display = ':0'
    x11-display-device = '/dev/tty7'
    display-device = ''
    remote-host-name = ''
    is-local = TRUE
    on-since = '2014-06-15T13:29:58.652929Z'
    login-session-id = ''

Consolekit sessions are usually started by the display manager when logging in, or via the command line like:

ck-launch-session startxfce4

To get all the desktop related packages in one go (the openrc-desktop package group can be installed as:

sudo pacman -S openrc-desktop

The output of the command looks like the following:

$ sudo pacman -S openrc-desktop
:: There are 9 members in group openrc-desktop:
:: Repository openrc-eudev
   1) acpid-openrc  2) alsa-utils-openrc  3) avahi-openrc  4) consolekit-openrc
   5) cronie-openrc  6) dbus-openrc  7) dhcpcd-openrc  8) displaymanager-openrc
   9) gpm-openrc

Enter a selection (default=all): 
warning: cronie-openrc-20141002-1 is up to date -- reinstalling
warning: dbus-openrc-20141002-1 is up to date -- reinstalling
warning: dhcpcd-openrc-20141002-1 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...
:: polkit-consolekit and polkit are in conflict. Remove polkit? [y/N] y

Packages (14): acpid-2.0.23-1  consolekit-0.4.6-5  js185-1.0.0-2
               polkit-0.112-2 [removal]  polkit-consolekit-0.112-2
               acpid-openrc-20141002-1  alsa-utils-openrc-20141002-1
               avahi-openrc-20141002-1  consolekit-openrc-20141002-1
               cronie-openrc-20141002-1  dbus-openrc-20141002-1
               dhcpcd-openrc-20141002-1  displaymanager-openrc-20141002-1
               gpm-openrc-20141002-1

Total Download Size:    1.96 MiB
Total Installed Size:   10.94 MiB
Net Upgrade Size:       9.31 MiB

:: Proceed with installation? [Y/n] 

The services for the above packages can be enabled after installing. I also installed pm-utils for suspending and hibernating my laptop.

If you were using systemd on a GPT partitioned hard disk, then you may need to enable swap via /etc/fstab. This is so because systemd handled swap automatically on GPT partitions, and gave error if it was mounted via fstab.

Also, systemd used to set a tmpfs by default; to set it manually via /etc/fstab, see https://wiki.archlinux.org/index.php/Fstab#tmpfs

With systemd cron jobs are implemented via systemd timers; for OpenRC a set of cronjobs can be obtained from https://github.com/notfoss/archlinux-cronjobs

Some commonly used services are ssh and cups, to install and enable them have a look here.

Some things that are not working for me are:

  • Partition mounting by clicking on unmounted partition (may work for you if you are in the storage group)
    This was due to my login manager (lxdm) not automatically starting a ck-session. I was advised by artoo to use lightdm as it has runtime detection; using lightdm worked. A patched version of lxdm also works. I have put it in the openrc repo and the AUR as lxdm-consolekit.

My System

Operating System: Manjaro Linux
Desktop Environment: Xfce
Display Manager: lxdm

Note

To boot with systemd instead, when the GRUB menu is encountered while booting, press e to edit, and at the end of the line that starts with linux, add:

init=/usr/lib/systemd/systemd

Part 2) Going full monty:
Removing systemd and installing eudev

With OpenRC being used as init system, the role of systemd is reduced to that of a udev provider, and for compatibility reasons.

eudev, developed by the Gentoo folks, can be used as replacement. Note that removing systemd could cause incompatibilities with existing software, hence its advertised as being for advanced / minimalistic users.

Step 1) Install eudev and eudev-systemdcompat

sudo pacman -S eudev eudev-systemdcompat

The output looks like the following:

$ sudo pacman -S eudev eudev-systemdcompat
resolving dependencies...
looking for inter-conflicts...
:: eudev and libsystemd are in conflict (libgudev-1.0.so). Remove libsystemd? [y/N] y
:: eudev-systemdcompat and systemd are in conflict. Remove systemd? [y/N] y

Packages (5): eudev-1.10-1  libsystemd-212-3 [removal]  systemd-212-3 [removal]
              eudev-systemdcompat-216-2

Total Download Size:    0.90 MiB
Total Installed Size:   6.63 MiB
Net Upgrade Size:       -10.64 MiB

:: Proceed with installation? [Y/n] 

After the above step systemd would be uninstalled and replaced by eudev and its counterparts.

Possible issues

I had to rebuild gvfs as my unmounted partitions were not being displayed (seems to have been solved due to using eudev-systemdcompat).

Some packages now use certain systemd components like systemd-tmpfiles and systemd-sysusers while installing, to maintain compatibility the openrc-systemdcompat package from the repo can be installed.

Further Reading
Blog article by x33a (notfoss): http://blog.notfoss.com/posts/openrc-on-arch-linux/

Update 07/08/14
ISOs available, based on Manjaro Linux.
Details: https://forum.manjaro.org/index.php?board=50.0

Update 02/10/14
Old pacman repo and instructions and replaced with new repo and new instructions.

Update 26/01/15
I have decided to scale back on the efforts of maintaining the repo mentioned at the beginning of the post, people who want to keep more up to date can consider updating their packages by building from the sources mentioned in the beginning.

Update 07/03/15
New repo setup in association with nous from Arch Linux; it succeeds the earlier repo.

[openrc-eudev]
SigLevel = PackageOptional
Server = http://downloads.sourceforge.net/project/archopenrc/$repo/$arch

Update 15/02/16
nous has been maintaining the openrc-eudev repo from some time now (systemd-free.org).


			

Stop Debian from saving to the hardware clock on shutdown / Prevent Debian from messing up the system time (dualboot with Windows)

I’ve been using Debian for some time now, and faced this problem and could not find a solution myself, neither could I find a clearcut solution on the net.
Well now I’ve found it and would like to share it.

Note-
My hardware clock (also known as BIOS clock) is set to local time. I like it to be set to local time, but if anyone wants to set it to Universal Time, I’ll explain about that also.
Linux distributions like Debian and Arch recommend saving the hardware clock to UTC,
while in Windows and most other operating systems its set to local time.
This creates the problem between time settings of Debian/LMDE and Windows/Other OS’

Procedure-
We will use the hwclock command in the command prompt to configure the clock.

Step1
—————-
First of all check whether the hardware clock is set to local time or UTC using the command-
sudo hwclock -D

This will show you the system time(Operating System time), Hardware clock time and whether hardware clock is set to localtime.
By default in Debian Hardware clock is set to UTC.

Now assuming your system time is correct, write it to the hardware clock and set hardware clock to localtime, use the command-
sudo hwclock -w --localtime

This will set the current system time to hardware clock and configure the hardware clock to localtime.

Step2
——————
If your system time is not correct, first of all make sure your time zone is set correctly by using the command-
sudo dpkg-reconfigure tzdata

Now if the system time is correct, goto step1 and set system time to hardware clock

Otherwise to manually set the system time use the date command-
date -s ‚Äú1 JUL 2013 20:30:00‚ÄĚ

Note-
To set the hardware clock to localtime directly using date command as-
hwclock --set --date='07/23/13 21:10:00' --localtime

Step 3
———————
I don’t like Debian to save the system time to hardware clock at every shutdown,so to prevent Debian from doing that edit the file /etc/default/hwclock as-
sudo nano /etc/default/hwclock
and change HWCLOCKACCESS to NO
(also make sure that the line is uncommented)

Now at shutdown it will say-“Not Saving the System Clock”

Alternate solution-

1.Set other linux distributions to use Hardware clock time as UTC by
sudo hwclock -w --UTC
to set the hardware clock to UTC

Note-
I’ve tried editing /etc/default/rcS and setting UTC=no as posted on many sites but it did not work for me.

2.Configure Windows to use Hardware clock time as UTC

To make MS Windows calculate the time from the hardware clock as UTC. Create a file named WindowsTimeFixUTC.reg with the following contents and then double click on it to merge the contents with the registry:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformation]
“RealTimeIsUniversal”=dword:00000001

———————————————————————————-

Furthur Reading
https://wiki.archlinux.org/index.php/Time