Frankly, while I’m super happy user of Ubuntu on desktop and servers, I’ve been quite unsatisfied with Ubuntu for Raspberry Pi. Mostly, cause it ruined a few of my SD cards. I’ve realised that writing file access info to the card was one of the key factor here. Unfortunately, Ubuntu for RPi won’t but with noatime… while latest Rasbian has it by defualt.
What I like a lot about Raspbian Stretch Lite, is that beside natively supporting all Raspberry Pi features, it’s also cross platform compatible – it works super well on both, RPi2 and RPi3.
And yes, this blog among few other things is server from RPi2 🙂
It’s been long time since the last post… But time came that I’ve faced serious problem when trying to change MAC address of my USB LAN adapter.
As recommended by numerous pages found by googling
change MAC address Linux, I’ve tried
ifconfig eth0 hw ether NEWMAC and macchanger. It changed MAC of my devices (as seen in ifconfig output), yet after plugging the LAN cable, the MAC was automatically restored to permanent one.
At first, I thought it’s the fault of NetworkManager, so I’ve stopped it. But the problem still persisted. After some tinkering, I’ve realised, the MAC can be specified also in NetworkManager alone by adding to
/etc/NetworkManager/NetworkManager.conf two lines:
and restarting NetworkManager
sudo service network-manager restart
Note, when I’ve changed MAC in NetworkManager using GUI, the permanent MAC was also restored upon LAN cable connection.
Hope this helps someone having similar problem with USB LAN adapter.
For some weeks already, I’ve been annoyed by not working VLSub extension of VLC. It simply hangs during downloading the subtitles. Apparently, this is associated with changes in OpenSubtitles.org remote access. Today, I’ve found simple solution for this issue:
sudo add-apt-repository ppa:videolan/master-daily
sudo apt-get update && sudo apt-get upgrade -y
sudo sed -i.bak 's\HTTP/1.1\HTTP/1.0\g' /usr/lib/vlc/lua/extensions/VLSub.luac
Restart VLC and enjoy!
Solution found on VideoLan forum.
It’s likely you have exFAT filesystem. Execute below and insert your card again 😉
sudo apt-get install exfat-utils exfat-fuse
Solution found on AskUbuntu.
I decided to celebrate 25th B-day of Linux by putting the latest Ubuntu 16.04 on my Raspberry Pi 2 and setting up a webserver.
This is how I did it:
- First, get Ubuntu armf image and prepare memory card
# get image
# make sure your SD card is on sdb ie by df -h
xzcat ubuntu-16.04-preinstalled-server-armhf+raspi2.img.xz | sudo dd of=/dev/sdb
- Configure new user & setup Drupal8 webserver
# create new user & change hostname
sudo adduser USERNAME && sudo usermod -a -G sudo USERNAME
# edit /etc/hostname and add `127.0.1.1 newHostname` to /etc/hosts
# generate locales
sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales
# install software
sudo apt install htop apache2 mysql-server libapache2-mod-php php-mysql php-sqlite3 php-curl php-xml php-gd git sqlite3 emacs-nox
My first impressions?
sudo apt is veeery slow. At first, I thought it’s due to old SD card I’ve been using, but it’s also true for newer SD card.
Some packages are missing (ie. git-lfs), but you can get them using some workarounds.
But everything just works!
You can check the mirror of https://ngschool.eu/ running on RPi2 here.
Maybe it’s not speed devil, but it stable and uses almost no energy 🙂
Inspired by Ubuntu’s Insights.
Unfortunately, the standard way to install git-lfs doesn’t work on RPi2. But there is simple workaround:
# install go
sudo apt-get install golang
# you may want to grab a coffee at this stage... 😉
# get git-lfs from github
go get github.com/github/git-lfs
cp gocode/bin/git-lfs /usr/bin
The github repository of #NGSchool website has grown to over 5GB. I wanted to reduce the size & simplify this repository, but this task turned out to quite complicated. Instead, I have decided to leave current repo as is (and probably removed it soon) and start new repo for existing version. I could do that, as I don’t care about version earlier than the one I’m currently using. This is short how-to:
- Push all changes and remove .git folder
git push origin master
rm -rI .git
- Rename existing repo
Settings > Repository name > RENAME
- Start new repository using old repo name
Don’t need to create any files as all already exists.
- Init your local repo and add new remote
git remote add origin firstname.lastname@example.org:USER/REPO
- Commit changes and push
git add --all . && git commit -m "fresh" && git push origin master
Doing so, my new repo size is below 1GB, which is much better compared to 5GB previously.
I had to generate Abstract book for #NGSchool2016 (). I had spreadsheet generated by Google Forms with all necessary information. I could copy-paste all entries and format it later on, but I found LaTeX more robust for the task.
As I had already LaTeX template, the only missing part was conversion of .xls to .tex. Thus I have written simple script, xls2tex.py, that generate .tex file based on table from .xls file.
This script, among many other things, convert utf into LaTeX escape characters.
xls2tex.py depends on xlrd and utf8tolatex (from pylatexenc/latexencode, but this is given as single file)
# install dependencies
sudo apt-get install python-xlrd
# generate tex
# generate pdf
Do you find typing your password in ssh session multiple times really annoying?
This should help:
# below commands have to be run one after another, otherwise it won't work
Lately, I have had lots of problems with pushing large files to github. I am maintaining compilation of materials and software deposited by other people, so cannot control the size of files… and this makes push to fail often.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 6f0f7f66995a394598595375954732db
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File chip_seq/reads/sox2_chip.fastq.gz is 109.69 MB; this exceeds GitHub's file size limit of 100.00 MB
To remove large files from commit, execute
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch chip_seq/reads/sox2_chip.fastq.gz'
To add large files using git-lfs, execute
# tract by git lfs files larger than 50MB, skipping those in .git folder
find . -type f -size +50M ! -iwholename "*.git*" | rev | cut -f1 -d'/' | rev | xargs git lfs track
git add --all . && git commit -m "final" && git push origin
Make sure that your file are smaller than 2GB, otherwise your push will fail again 😉
Then, to before pull in another machine, make sure to install git-lfs
git lfs install