Sign a compiled apk for apktool

Create a key:

keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias joel

Sign:

apksigner sign --ks my-release-key.jks --out newsigned.apk newsc.apk

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

How to flash OTA without downloading the full rom in a rooted Oneplus 3

Oneplus updater detects root and offers only the full download (around 1.3GB) even if actually need only around 70 MB if an actual OTA is downloaded. This outlines how to bypass that and install only the OTA.

The thing is you need to temporarily unroot.
Assuming you’ve installed Superuser in a systemless mode (by default it it so), your root part is in your bootloader and certain changes by the Superuser apk. The only changes in your /system is the busybox binary and bash (if you installed it).

So with a root explorer, delete busybox binary and all of its symlinks.
Go to chainfire superuser, and choose to unroot fully.
The phone will reboot.
Next, go to Settings>Apps
Wipe storage for this app.
Now check for updates. It should now download only the small update.
If you have TWRP, flash the stock recovery now, or check whether TWRP can flash the OTA (probably not).
Allow the update downloader to reboot to recovery to install the update.

Yea, I know the flow of words isnt smooth. I’m busy.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Compile mpv player for Ubuntu from source.

mpv is the default player for latest smplayer. Since mplayer didnt work after compiling its latest version from source (see my previous post), I decided to recompile mpv.

Code:

git clone https://github.com/mpv-player/mpv-build.git
cd mpv-build/
sudo apt install libfribidi-dev libfribidi-bin yasm
./rebuild -j4
sudo ./install

Note: There may be other dependencies.
Thus I upgraded my mpv 0.14.0 to 0.25.0-26-gde225e3.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Install latest version of wine on Ubuntu

wget https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
sudo apt-get update
sudo apt-get install --install-recommends winehq-stable

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Install and uninstall gnome shell extensions

Install:

sudo apt-get install chrome-gnome-shell

Now go to https://extensions.gnome.org/
Install required extensions after downloading the browser extension. In case of firefox, you may need to disable extension compatibility checking.
You can control extensions and their settings from gnome-tweak-tool

In case of serious issues preventing booting:

apt-get install --reinstall gdm3 gnome gnome-shell

You may also want to move everything from ~/.local/share/gnome-shell/extensions

The lower left corner legacy icons are an irritation. To move them, install the GNOME shell extension TopIcons. This moves the legacy tray icons shown in this bar to the main GNOME bar, up in the top right by the menu.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Mount your linux partitions at boot automatically, in Ubuntu

Let’s become superuser:
sudo su
mkdir /media/C
mkdir /media/D
Get the unique identifier for each HDD:

blkid
/dev/sda1: UUID="B4DE6B45DE6AFECC" TYPE="ntfs" PARTUUID="1bee7e3a-01"
/dev/sda2: LABEL="STORAGE" UUID="5407-7192" TYPE="vfat" PARTUUID="1bee7e3a-02"
/dev/sda3: UUID="0a716fbe-6568-4727-9e99-5971c18c4643" TYPE="ext4" PARTUUID="1bee7e3a-03"
/dev/sda4: UUID="e754578d-b6bb-4acf-9949-1ad30653579e" TYPE="swap" PARTUUID="1bee7e3a-04"
/dev/sdb1: PARTLABEL="Microsoft reserved partition" PARTUUID="c3203f99-18a3-464d-8e6c-26c044f6ab6b"
/dev/sdb2: LABEL="TOSHIBA EXT" UUID="B0922E94922E5F5A" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="b5dbf614-0ec8-4b50-be08-fd4e12f9f22a"

gedit /etc/fstab &

In that file, add:

UUID="B4DE6B45DE6AFECC" /media/C	ntfs-3g	errors=force
UUID="5407-7192"	/media/D	vfat	rw,umask=0000

The rw,umask=0000 for FAT32 and errors=force for the NTFS drive is required to get read write access on the drive. If ntfs is used instead of ntfs-3g, again, we get only read access.

To mount from this file right now, run:

sudo mount -a

According to arch wiki,

user,rw,umask=111,dmask=000

Quoting a bit from the Ubuntu manual
The file opened contains lines of the form . Every element in this line is separated by whitespace (spaces and tabs):

The first field, (fs_spec), describes the block special device or remote filesystem to be mounted.

For ordinary mounts it will hold (a link to) a block special device node (as created by mknod(8)) for the device to be mounted, like /dev/cdrom or /dev/sdb7. For NFS mounts one will have :

, e.g., knuth.aeb.nl:/. For procfs, use proc.

Instead of giving the device explicitly, one may indicate the (ext2 or xfs) filesystem that is to be mounted by its UUID or volume label (cf. e2label(8) or xfs_admin(8)), writing LABEL=

The second field, (fs_file), describes the mount point for the filesystem. For swap partitions, this field should be specified as none. If the name of the mount point contains spaces these can be escaped as \040.

The third field, (fs_vfstype), describes the type of the filesystem. Linux supports lots of filesystem types, such as adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, and possibly others. For more details, see mount(8). For the filesystems currently supported by the running kernel, see /proc/filesystems. An entry swap denotes a file or partition to be used for swapping, cf. swapon(8). An entry ignore causes the line to be ignored. This is useful to show disk partitions which are currently unused.

The fourth field, (fs_mntops), describes the mount options associated with the filesystem.

It is formatted as a comma separated list of options. It contains at least the type of mount plus any additional options appropriate to the filesystem type. For documentation on the available options for non-nfs file systems, see mount(8). For documention on all nfs-specific options have a look at nfs(5). Common for all types of file system are the options noauto (do not mount when “mount -a” is given, e.g., at boot time), user (allow a user to mount), and owner (allow device owner to mount), and comment (e.g., for use by fstab-maintaining programs). The owner and comment options are Linux-specific. For more details, see mount(8).

The fifth field, (fs_freq), is used for these filesystems by the dump(8) command to determine which filesystems need to be dumped. If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped.

The sixth field, (fs_passno), is used by the fsck(8) program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked.

To learn more about options, type ‘man mount’.

Description

Accessible by everyone

Accessible by a subset of users**

FAT(16/32) partition

user,auto,fmask=0111,dmask=0000

user,auto,fmask=0177,dmask=0077,uid=1000

NTFS partition*

rw,auto,user,fmask=0111,dmask=0000

rw,user,auto,fmask=0177,dmask=0077,uid=1000

Apple Partition

user,auto,file_umask=0111,dir_umask=0000

user,auto,file_umask=0177,dir_umask=0077,uid=1000

*If you want write access to your file system, you should set the filesystem type to ‘ntfs-3g’ instead of ‘ntfs’. You may need to install the package ‘ntfs-3g’ for this to work, so make sure it is installed before you use ntfs-3g.

**uid=1000 restricts access to the user created while installing Ubuntu. 1001 is the user created after that, and so forth. gid=# may be used with or in place of uid to grant access to a group. However, group and user enumeration is beyond the scope of this article.

example

Note for international users: if your filesystem contains funny symbols, you may need to add an option for utf-8 support.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Install Adobe Acrobat on Linux

You can install older version.

sudo add-apt-repository "deb http://archive.canonical.com/ precise partner"
sudo apt-get update
sudo apt install adobereader-enu

After properly installing Adobe Reader, don’t forget to remove the Canonical Partners repository for Precise:

sudo add-apt-repository -r "deb http://archive.canonical.com/ precise partner"

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Hardening my linux server

Install mod-security for apache2

apt-get install libxml2 libxml2-dev libxml2-utils libaprutil1 libaprutil1-dev
sudo apt-get install libapache2-mod-security2
emacs /etc/modsecurity/modsecurity.conf

and change to following:

grep -i SecRuleEngine  /etc/modsecurity/modsecurity.conf
SecRuleEngine On

Restart apache2:

service apache2 restart

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Doing a security audit of linux system

I just discovered lynis which can be done on the local system-it’s a simple script which can be run on the shell without any installation.

Get it from https://cisofy.com/lynis/

wget https://cisofy.com/files/lynis-2.4.8.tar.gz
tar xvf lynis-2.4.8.tar.gz
cd lynis
./lynis audit system

The final log is saved to /var/log/lynis.log


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Fixing a kernel that wont boot in Debian on OVH

During an upgrade my kernel got corrupted and the server went down. Thankfully OVH offers a Netboot and Network mode. I used the network option and chose one of the available kernels, which dropped me in one of my own installation and executed the following:

To reinstall the current linux kernel:

List available kernels

apt-cache search linux-image

Reinstall the kernel:

apt-get install --reintall linux-image-3.16.0-4-amd64

Update grub configuration:

update-grub

And hard reboot server


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.