The Midlife Geek

Ramblings of a middle aged engineer, runner and open source enthusiast

Tag: Howto

Simple Arch Linux Installation

This is a quick post to remind myself of the stuff I do when re-installing Arch. Continue reading

Flashing Nexus 9 factory image

This tablet was super fast when I got it but now it lags and drives me nuts. I’d seen someone post on Reddit that flashing the factory image helped so I gave it a go.

Factory images are available here along with good, clear instructions. One caveat, Arch needs super user for fastboot otherwise you get “< Waiting for device >”. For the same reason run flash-all.sh with sudo too.

As to whether or not it helped, it is hard to say but I feel it has. How do you measure something that is entirely subjective?

Edit. Its been a few days now and it is faster. Much faster and without lag. I’m unclear why though. I’m not completely familiar with Android’s architecture but wonder if it’s a combination of multiple updates being applied (this was I think Android 5.0 when bought) and accumulated futz.

Install Android Studio on Ubuntu

Android Studio is a great development environment and is available on Ubuntu. I’m using Ubuntu Mate 16.10 “Yakkety Yak”.
 
First install a Java Development Kit (JDK). OpenJDK is pre-installed or you can use Oracle Java 8 (there is a great guide here). I don’t wish to argue over your choice – I need to use the latter (my tutor does). Download Android Studio here. – I extracted it to /opt; ran the installer; and used my home folder for the SDK. If you are using 64 bit, you need the 32 bit GNU standard C++ library:
sudo apt install lib32stdc++6

For Arch you need to enable “multilib” repository:

<code><span class="pln">sudo pacman </span><span class="pun">-</span><span class="typ">Syu</span> <span class="pun">&amp;&amp;</span><span class="pln"> sudo pacman </span><span class="pun">-</span><span class="pln">S multilib</span><span class="pun">/</span><span class="pln">lib32</span><span class="pun">-</span><span class="pln">libstdc</span><span class="pun">++</span><span class="lit">5</span><span class="pln"> multilib</span><span class="pun">/</span><span class="pln">lib32</span><span class="pun">-</span><span class="pln">zlib</span></code>

Virtualisation support is interesting. I read two tutorial and Google’s guide. The former makes reference to command line options not in version 2.2.2. These posts suggest this is a bug, but it may now be default behaviour. First enable that virtualisation in BIOS (check if enabled using “kvm-ok”).

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
sudo adduser dougie kvm
sudo adduser dougie libvirtd

This results in an error.
screenshot-at-2016-11-25-21-16-19

Using the system version of libstdc++.so.6 works. Add the following to /etc/environment:

ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

It seems snappy but with no feedback I’m unsure if accelerated.

So I now have a development environment set up for my project. The next hurdle is to choose a title. So far it is a: development project; distributed application; and uses Android.

Repair Samsung NC10 MBR

I removed Ubuntu from a Samsung NC10 yesterday, now the F4 recovery option doesn’t work. Please excuse the lack of screen shots on this Howto but I couldn’t think how to capture from the recovery manager and camera shots look rubbish.

It would appear that Samsung uses a custom Master Boot Record (MBR) – so for Grub all is well because you can choose to boot into the recovery partition and away you go. However if you have followed any of the usual guides to removing grub (such as running an XP CD to a recovery console and typing fixmbr) F4 will not launch the restore tool.

System Rescue CD is a great tool to have handy on a USB key. You can, so booting into it run this command:

fdisk /dev/sda

Now pressing “p” should show you that the recovery partition is 1, so type “a” then “2”, “a” then “1” to make it bootable. Now write the partition table by typing “w” then reboot. At this point you will boot into the recovery manager and be able to recover but the F4 key will not still not be available at boot and of course trying to create a backup will not work either (as Windows will be booted on restart).

Once Samsung Recovery Manager III has loaded up, press Ctrl+Alt+F10 – I had no idea there was a management mode until I read this page (French) but be aware its only available from the recovery partition. It asks for a password – “secos” (without the quotes). Once in management mode, click the “Image” tab and select “Export” then “Select Location”, I used “D:”. Click “Start” and accept the dialogue box that comes up. This is a backup of the recovery partition.

Once this stage is finished, select the “Tools” tab, insert a spare USB stick and click “Admin Tool USB”. It will format the USB stick and then install some utilities. It takes a couple of minutes. Once finished click the close button in the top right and it’ll ask if the computer should be turned off – say yes.

Boot with the USB key we just made, bringing you to a completely different recovery menu. Click “MBR Fix” and then close the application.

Now when you reboot you’ll notice that the MBR has been repaired and F4 once again boots into Recovery Manager III.

Bash

Two things that improve my bash productivity – stopping the cursor keys inserting characters in vim and history search in bash.

Edit ~/.vimrc or /etc/vim/vimrc (for system wide) and add turn off vi compatibility:

1
set nocompatible

The latter can be improved by editing ~/.inputrc (or /etc/inputrc for everyone). Pressing the up key scrolls through all the commands you’ve typed but by adding:

1
2
"e[A":history-search-backward
"e[B":history-search-forward

You can type the first letter or two and get the command you need, so if you typed “mysql -u root -p” last Tuesday but can’t remember the options, typing “my” and pressing the up key will find it.

Building PDF from Ubuntu Documentation

People frequently ask for PDF versions of the Ubuntu System Help. We have a toolchain to build them but why not do it yourself?

This is true of any DocBook – dblatex is in the Ubuntu repositories and can transform DocBook in to many formats, the default being PDF.

Usually it is as simple as:

1
dblatex filename.xml

To generate filename.pdf. Most errors are easy to rectify because dblatex calls other tools and you can step through some (such as pdflatex).

However if you get an error along the lines of:

1
Overfull @hbox (20.76302pt too wide)

Well that is a bit of a pain. The prescribed wisdom is that something (usually a ulink) is just really too long, such as one of those really long URLs. In the case of DocBook, more often than not it’s a table that it just cannot render – so keep them simple!

Using dd to create disk images

Never mind Acronis True Image – you can use the command line to work with disk images and backups, without any extra software.

Continue reading

© 2018 The Midlife Geek

Theme by Anders NorenUp ↑