Archive

Fedora

The new Android phones no longer work as USB mass storage devices, and instead use MTP. Not that I really know what this is, or its advantages over the previous system.

Fortunately a very helpful blog post at http://tacticalvim.wordpress.com/2012/12/08/mounting-nexus-4-via-mtp-in-fedora-17/ guided me most of the way (the nexus 4 and galaxy S3 are very similar)
I had to make a couple of changes as the device ids were different, but it’s essentially the same instructions so have a look there first

Firstly install simple-mtpfs:

sudo yum -y install fuse fuse-libs libmtp simple-mtpfs

Check it’s worked with:

ls -l /dev/libmtp*

Which should return a link between libmtp and somewhere in bus/usb. Then create /etc/udev/rules.d/99-galaxyS3.rules, with the following content:

ACTION!="add", GOTO="galaxyS3_rules_end"
ENV{MAJOR}!="?*", GOTO="galaxyS3_rules_end"
SUBSYSTEM=="usb", GOTO="galaxyS3_usb_rules"
GOTO="galaxyS3_rules_end"

LABEL="galaxyS3_usb_rules"

# Galaxy SIII I-9300
ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

LABEL="galaxyS3_rules_end"

Get the correct idVendor (VID) and idProduct (PID) by running simple-mtpfs -l

You can then set commands to mount and unmount by adding the following to your /.bashrc, where ~/mnt/galaxyS3 is the directory your phone’s storage will be mounted to:

alias S3mount="simple-mtpfs ~/mnt/galaxyS3"
alias S3umount="fusermount -u ~/mnt/galaxyS3"

The commands on the right of course can be used to mount and unmount

You’ll need to reboot to get it to work. I had to unplug and plug the phone too. troyengel reports on his tacticalvim blog that he had to run the S3mount command 2-3 times to get it to work

If you’re having trouble I’d recommend looking at the simple-mtpfs documentation

Advertisements

I imported a pdf into inkscape I made in gnuplot which used Times New Roman as a font, however Times wasn’t installed so it substituted the font for sans.
I have a pretty shaky knowledge of how fonts work, and why it was that it worked in gnuplot but Times isn’t available from other programs, but my solution was as follows:

Follow the instructions to use the script to install all msttcorefonts at:
http://blog.andreas-haerter.com/2011/07/01/install-msttcorefonts-fedora.sh

wget "http://blog.andreas-haerter.com/_export/code/2011/07/01/install-msttcorefonts-fedora.sh?codeblock=1" -O "/tmp/install-msttcorefonts-fedora.sh"
chmod a+rx "/tmp/install-msttcorefonts-fedora.sh"
su -c "/tmp/install-msttcorefonts-fedora.sh"

After rebooting this worked, but some of the fonts used by webpages had screwed up (which I believe were trebuchet and verdana)

I fixed this by (as root) navigating to /usr/share/fonts, ensuring out of the newly installed fonts only the times ones are available and refreshing the font cache:

cd /usr/share/fonts
mkdir mstt-times
cp msttcorefonts/times* mstt-times
mv msttcorefonts .msttcorefonts
fc-cache -v

This made a lot of text unrendered in the browser, but after rebooting everything worked as I wanted it to, and I was able to automatically use Times correctly in inkscape

I also found the following page useful: http://www.pwsdb.com/pgm/?p=172

Fedora provides a texlive package (http://fedoraproject.org/wiki/Features/TeXLive), however it is incomplete, usually out of date and I haven’t been able to easily install new latex packages through it. In theory new packages can be installed by issuing the command:

yum install 'tex(epsfig.sty)'

However this never worked for me, and despite some searching I couldn’t work out what was going wrong.

Personally, as someone with plenty of free disk space, I’ve found the best solution is to install the full version of texlive. Certainly, ever since doing so I’ve never had any problems compiling my latex files and haven’t had to think about the install ever since.

This excellent post on the tex StackExchange describes in detail how to do this with Ubuntu:
http://tex.stackexchange.com/a/95373
which I would recommend reading before following any of the advice here

For fedora it may be slightly different (especially in faking packages, see step 1 below), but in summary what I did was as follows:

  1. Install the official package from fedora using ‘yum install texlive’ (so that software with tex as a dependency can be installed)
  2. Download the installer for the full texlive from http://www.tug.org/texlive/acquire-netinstall.html
  3. Run the install-tl script
  4. Make sure the install path is /opt (or /opt/texlive if you’d like)
  5. Add /opt/texlive/2012/bin/x86_64-linux (with the correct year) to the path (see e.g. http://askubuntu.com/questions/60218/how-to-add-a-directory-to-my-path if unsure how to do this) making sure it’s added before /usr/bin so the correct latex programs are used rather than the ones from fedora’s texlive package
  6. If using some software such as texmaker to edit and compile your latex, make sure it is correctly configured to run pdflatex, biber etc. from /opt/texlive/2012/bin/x86_64-linux (e.g for texmaker follow the instructions at http://www.xm1math.net/texmaker/doc.html#SECTION02)

Advantages

  • A lot more packages are included
  • tlmgr is included, which allows incredibly easy installation of new packages from ctan (tlmgr install package-name)

Disadvantages

  • Not integrated into fedora’s package management
    • You’ll now have to manually update using
      tlmgr update –self
      tlmgr update –all
      rather than it simply working through yum (though there may be a way around this, I haven’t looked into it)
  • Uses a lot of space (something like 3-4GiB)

Following the guidance of http://patrakov.blogspot.co.uk/2011/01/writing-systemd-service-files.html it was fairly straightforward to use systemctl on Fedora 17 to start the tinc daemon on startup.

Create a new file /etc/systemd/system/tincd.service containing:

[Unit] 
Description=tinc vpn 
After=network.target 

[Service] 
Type=forking 
ExecStart=/usr/sbin/tincd -n network-name

[Install] 
WantedBy=multi-user.target

Replacing network-name with the name of your network.

Then enable the service to run on startup

sudo systemctl enable tincd

If you’re using the default firewall note you also need to open port 5353 (listed as multicast DNS) to get avahi to work with tinc

From:
http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/
https://help.ubuntu.com/community/SSH/OpenSSH/Keys
http://www.lifelinux.com/setting-up-an-ssh-certificate/

To generate the key pair (on the local machine)

ssh-keygen -t rsa -b 4096

Copy the public key to the host. I found I first need to restart ssh and execute ssh-add to load the newly created key. Execute the following commands on the local machine:

sudo systemctl restart sshd
ssh-add
ssh-copy-id remote-host

Where remote-host is usually of the format user@host

Finally ssh into the host and edit /etc/ssh/sshd_config to stop passwords being accepted for authorisation

PasswordAuthentication no
KbdInteractiveAuthentication no

I found the second line necessary as without it was still able to connect using connectbot on my phone (details on how to set up certificates for this can easily be found elsewhere)