Contents
- Linux for Science : or How I set up my Dell laptop
Navigation:
Linux for Science : or How I set up my Dell laptop
Power management
Installed tlp today using
$ sudo apt install tlp tlp-rdw
Still testing to see if power management improves. I was getting about 7-8h of battery life before. That was OK, but the battery could drain rather quickly when sleeping. It once drained almost completely overnight. The laptop was warm when I pulled it out of the case! I am hoping that tlp will be able to stop or reduce the hibernating power draw.
Verdict: No appreciable change in power draw. Sometimes the laptop sleeps well enough without much power draw, but at other times the draw is significant (20-30% per night!).
Problems with Dell XPS touchpad
Basically, the Synaptics driver made my life a mess. The touch pad was excessively sensitive and the cursor would jump places as I typed. This was untenable.
I removed Synaptics and installed libinput. That worked very well. More on this to follow.
Important
Dell has a solution to the problem
See their description on this page as they talk you through the process of removing Synaptics and installing libinput.
Multi-touch gestures
Not yet tried this but have a look at http://askubuntu.com/questions/789915/ubuntu-16-04-multitouch-gestures. In particular see the Github wiki at https://github.com/bulletmark/libinput-gestures.
libinput settings
This file is in /usr/share/X11/xorg.conf.d/90-libinput.conf
# Match on all types of devices but tablet devices and joysticks Section "InputClass" Identifier "libinput pointer catchall" MatchIsPointer "on" MatchDevicePath "/dev/input/event*" Driver "libinput" EndSection Section "InputClass" Identifier "libinput keyboard catchall" MatchIsKeyboard "on" MatchDevicePath "/dev/input/event*" Driver "libinput" EndSection Section "InputClass" Identifier "libinput touchpad catchall" MatchIsTouchpad "on" MatchDevicePath "/dev/input/event*" Driver "libinput" Option "Tapping" "true" Option "NaturalScrolling" "true" Option "ClickMethod" "clickfinger" Option "ScrollMethod" "twofinger" EndSection Section "InputClass" Identifier "libinput touchscreen catchall" MatchIsTouchscreen "on" MatchDevicePath "/dev/input/event*" Driver "libinput" EndSection
libinput settings can be changed using:
- xinput --list : to list devices
xinput list-props <dev number>
xinput set-prop <dev number> <line code> <values>: eg xinput set-prop 12 293 1 0 0
Firewall
Use ufw. Instructions from https://help.ubuntu.com/lts/serverguide/firewall.html
Printers
CUPs
First you need to add yourself to the lpadmin group. In terminal:
sudo usermod -aG lpadmin <username>
Next, restart CUPs. This can be done by typing:
sudo /etc/init.d/cups restart
into the terminal.
To get to the CUPs web interface open up http://localhost:631/ in your web browser. When asked for a user name and password you can use you log-in user-name and password.
If the interface does not open, then CUPs may need to be re/started. First check to see if it is running:
systemctl status cups.service
If not, restart it
systemctl enable cups.service
These commands may need to be sudo'd.
Samsung printers
Before trying to install a Samsung printer, install the PPD files and drivers from Samsung:
Download and install Samsung original printer driver. Visit www.samsung.com and under Support -> Printer, enter your printer model name.Scroll down to the drivers section, and download the Linux print driver. It will most likely be uld-something.tar.gz.
- Open terminal, cd to the download location and untar the file with: tar xvzf uld-something.tar.gz (enter the actual filename) Enter the just unpacked directory (probably uld/) and run: sudo ./install-printer.sh
Problems with a high-res screen
Gnuplot
By default plots were absurdly small and fonts small too. Enlarging the plots was not an option as the graph would get bigger, but line widths, fonts etc. would remain tiny. There is a way of setting up Gnuplot to change defaults so that plots are mostly viewable. You do this by editing the system gnuplotrc file in:
/usr/share/gnuplot5/gnuplot/5.0/gnuplotrc
to include the line:
- set terminal wxt lw 2 size 1800,1200 fontscale 2
The default graph size was something I had to figure out by trial and error. The rest of the settings should be obvious.
Wireless Network
This worked from the start, but would occasionally not show known networks I had previously connected to. This can be resolved by rescanning for available networks using:
sudo iwlist wlp58s0 scan
Wired Network
I have been using a Cable Matters USB-C to multiport dongle that supports an ethernet port. Some issues:
- Power consumption is high. This thing puts a stiff load on the battery and should be used only when plugged in.
Recently, perhaps after an update to Ubuntu 16.04, it kept resulting in DNS server errors. Here's a solution to the problem taken from the second solution on this page: - Open /etc/NetworkManager/NetworkManager.conf in an editor with root rights. - Delete (or comment out with a hash #) the line that reads dns=dnsmasq. - Restart NetworkManager via sudo service NetworkManager restart.
Zotero
I downloaded and installed the code in $HOME/bin/ and start it from there and leave it running.
One Drive: Syncing with a Windows machine
The information below is now old and things seem to have got much better. Here are new instructions from https://www.maketecheasier.com/sync-onedrive-linux/.
For Ubuntu:
sudo apt install libcurl4-openssl-dev git sudo apt install libsqlite3-dev
If you are using Ubuntu 18.04 or newer, use snap to install dmd:
sudo snap install --classic dmd && sudo snap install --classic dub
If not:
sudo wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list sudo apt-get update && sudo apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring sudo apt-get update && sudo apt-get install dmd-compiler dub
After installing the dependencies, fetch the files with git:
git clone https://github.com/abraunegg/onedrive.git
And compile and install it:
cd onedrive make sudo make install
After you have done this, now you need to authorize onedrive with Microsoft so it can access your account. Simply enter the following in the Terminal:
onedrive
And it will prompt you to visit the URL to get authorization. Log in to your OneDrive account, and grant the app permission to access your account.
Once this is done, you will be presented with a blank white page. Copy the URL and paste it into the Terminal at the prompt.
This will complete the setting up.
To start synchronizing OneDrive to your local folder, run
onedrive --sychronize
!Onedrive will start downloading all your files in the cloud to your local folder.
Alternatively, you can run:
onedrive --monitor
to get it to monitor your local folder for changes.
Configuration You can find the “config” file at the onedrive git folder. To make it active, move it to the “~/.config/onedrive/” folder.
mkdir -p ~/.config/onedrive cp ~/onedrive/config ~/ .config/onedrive/config
Open the config file. There are three options that you can configure: “sync_dir” and “skip_files.”
sync_dir: the location to store your OneDrive files. All files placed in/removed from this folder will be synced to the cloud. skip_files: the file type (or file pattern) that won’t be synced. monitor_interval: the time interval between sync operations. Once you have made the changes, save and restart onedrive.
At any time, you can check your configuration with the command:
onedrive --display-config
Old Instructions follow
I have a Surface tablet and use OneDrive a lot. Luckily you can get OneDrive to sync on a Linux machine too. Here's information about !OneDrive on Linux:
The first step to installing onedrive-d is to open a terminal window and clone the source code from git using the following command:
git clone https://github.com/xybu92/onedrive-d.git
If you don’t have “git” installed, you can install it with the command:
sudo apt-get install git
Now change directory into the onedrive-d folder:
cd onedrive-d
And run the install script:
./inst install
Enter your Ubuntu password if prompted. The installation script will download and install any dependencies via “apt-get”. Accept the list of packages to install.
You will then be asked to accept the permissions for onedrive-d so that it can “Access and edit your OneDrive” and “Access your info anytime.” These are necessary for onedrive-d to perform the sync operations.
Next click on “(None)” in the dropdown box just below where it says “The local folder to sync with your OneDrive.” Click “Other…” and use “Create Folder” on the file open dialog to create a new folder called “OneDrive.” Select the “OneDrive” directory as the sync folder.
To finish, click on “Close” and then on “Yes” to confirm that you want to save your preferences. The onedrive-d daemon doesn’t run automatically at system boot, so you need to start it manually by typing the following in a terminal window:
onedrive-d
There is more information and screen-captures at the link above.
Setting up Compiz
Multiple desktops/workspaces
By default Ubuntu gives you 4 desktops/workspaces. I wanted six. Install Compiz Config setting manager
sudo apt-get install compizconfig-settings-manage
See the site for details of setting up more than 4 desktops. This site tells you more about the Unity Tweak Tool that I may have tried.
Stopping the screen flicker on display wake-up
The screen, or some windows in the screen, flickers when the display wakes up. This happens often and is irritating even though it can be stopped by moving between desktops. There is a compiz setting that fixes this issue:
Make sure you have Compiz installed and enable "Don't wait for video sync" and "Force complete redraw on initial damage"
Compiz -> Utility -> Workarounds -> Don't wait for video sync
Compiz -> Utility -> Workarounds -> Force complete redraw on initial damage
Taken from the discussion here.
Python
The basic python modules I need are:
- matplotlib
- numpy
- scipy
- ipython
- These (and others) are needed for python2 and python3
Also needed are:
- Jupyter (for python notebooks)
Jupyter
Information from:
Install Python 2.7, Python Pip, and Python Development:
sudo apt-get -y install python2.7 python-pip python-dev
Something similar will need to be done for python3.x
Installing python2.7 will update to the latest version of Python 2.7, and python-pip will install Pip which allows us to manage Python packages we would like to use. Some of Jupyter’s dependencies may require compilation, in which case you would need the ability to compile Python C-extensions, so we are installing python-dev as well.
To verify that you have python installed:
python2 --version
and, for pip use
pip2 --version
Now install iPython
sudo apt-get -y install ipython ipython-notebook
Now we can move on to installing Jupyter Notebook:
sudo -H pip install jupyter
Python kernel to Jupyter
Jupyter will need a kernel for python2 and python3. This information is from Versions of Python.
Make sure you have ipykernel installed and use ipython kernel install to drop the kernelspec in the right location for python2. Then ipython3 kernel install for Python3. Now you should be able to chose between the 2 kernels regardless of whether you use jupyter notebook, ipython notebook or ipython3 notebook (the later two are deprecated).
Note that if you want to install for a specific Python executable you can use the following trick:
path/to/python -m ipykernel install <options> This works when using environments (venv,conda,...) and the <options> let you name your kernel (see --help). So you can do
conda create -n py36-test python=3.6 source activate py36-test python -m ipykernel install --name py36-test source deactivate And now you get a kernel named py36-test in your dropdown menus, along the other ones.
See Using both Python 2.x and Python 3.x in IPython Notebook which has more recent information.
Information from the above link follows:
Python kernels
The idea here is to install multiple ipython kernels. Here are instructions for anaconda. If you are not using anaconda, I recently added instructions using pure virtualenvs.
Anaconda 4.1.0
Since version 4.1.0, anaconda includes a special package nb_conda_kernels that detects conda environments with notebook kernels and automatically registers them. This makes using a new python version as easy as creating new conda environments:
conda create -n py27 python=2.7 ipykernel conda create -n py36 python=3.6 ipykernel
After a restart of jupyter notebook, the new kernels are available over the graphical interface. Please note that new packages have to be explicitly installed into the new enviroments. The Managing environments section in conda's docs provides further information.
Manually registering kernels
Users who do not want to use nb_conda_kernels or still use older versions of anaconda can use following steps to manually register ipython kernels.
configure the python2.7 environment:
conda create -n py27 python=2.7 source activate py27 conda install notebook ipykernel ipython kernel install --user
configure the python3.6 environment:
conda create -n py36 python=3.6 source activate py36 conda install notebook ipykernel ipython kernel install --user
After that you should be able to choose between python2 and python3 when creating a new notebook in the interface.
Additionally you can pass the --name and --display-name options to ipython kernel install if you want to change the names of your kernels. See ipython kernel install --help for more informations.
Some more kernel suggestions
This worked for me on Ubuntu 16.04:
python2 -m pip install ipykernel python2 -m ipykernel install --user
python3 -m pip install ipykernel python3 -m ipykernel install --user
Reference to the documentation: Kernels for Python 2 and 3. Installing the IPython kernel - IPython Docs.
To choose which version of Python to use
python2 -m ...
or
python3 -m ...
Music and a Music Player
As Music is essential for Science, this needs to go here too.
Disable pops when changing volume
Simply holding Alt and then pressing the volume keys suppresses the pops.
There are other way, but they seem to remove all notifications.
Moving: iTunes to Linux
I just copied the music directories over from my MacPro to ~/Music/ on my Linux laptop. But there were issues: older music from iTunes had DRM protection and there is no reasonable way to remove this. So I used an old trick:
- Burn the music to CD using iTunes. Make a music CD.
- Do this one CD at a time. Make sure you do not get iTunes to burn a playlist to multiple CDs or else the track names will be lost!
- Then rip the music back into iTunes using the highest settings you care for. Either MP3 or AAC will work.
- The ripped music will have track names and album information included as long as you burned the CDs one at a time!
- Now copy these DRM-free files to the Linux laptop.
That's it!
A Music Player
I tried several music players for the laptop and finally settled on Lollypop. Reasons:
- It was easy to install.
Picked up my music from ~/Music/ without a fuss.
- It rejected all *.m4p files that are protected. This saved me the bother of selecting files only to find them unplayable.
- The CPU usage of the player is low.
- Playlists are easy to setup.
- Art-work and organization are cool
On the downside: there is no equaliser by default.
Equalizer
I still don't have one. But the alsamixer proved useful in setting basic settings like L-R balance.
Photo Editing
- Darktable: Superb utility for photo editing, upload, RAW to JPG conversion,...
- Hugin: for photo stacking and panaromas.
DVD Player
While VLC and MPV will play files without encryption, most DVDs use CSS encryption and standard Linux distros cannot (legally) distribute the CSS encryption code. So you need to get libdvdcss from other sites. This has now been automated using the following command:
sudo apt install libdvd-pkg
This will launch an install window and will prompt you for permission to perform the download. After which you will need to make the build using
sudo dpkg-reconfigure libdvd-pkg
Now VLC etc. should be able to play DVDs