Notes about open source software, computers, other stuff.

Tag: Linux (Page 3 of 7)

Fixing backlight control with Ubuntu on my ThinkPad T440s

Some time ago I bought a ThinkPad T440s for work. It’s an amazing machine! Before that I used a ThinkPad X121, which served me very well on my daily commute. This machine was getting a bit old, and given that my new job (more about which in a later post) also requires me to have a better machine with more screen real estate, it was high time to upgrade.

Ubuntu (13.10 and 14.04) runs well on the T440s, only two things didn’t work as expected:

  • The WWAN interface (mobile internet, from Ericsson) seems to connect when I select it in the network manager, but the adaptor seems to disappear almost immediately after that. A few seconds it appears again. [edit 20140514]I just found out that it’s working, probably this was fixed in Ubuntu 14.04[/edit]
  • The screen’s backlight brightness can be reduced/increase using the Fn-F5 and Fn-F6 keys, but only in a weird way: several key presses are needed for one unit of decrease/increase.

This last bug can be fixed by booting with the following kernel argument:

  acpi_backlight=vendor

Simply add this to the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub:

  GRUB_CMDLINE_LINUX_DEFAULT="acpi_backlight=vendor quiet splash"

and run sudo update-grub. Reboot and you will be able to change the backlight brightness in finer steps.

I found this solution somewhere on the internet a few weeks ago, wrote it down, but can’t remember anymore what the original URL was. My apologies.

Related Images:

Fixing colours in git output after upgrading to Ubuntu 14.04

After upgrading my Ubuntu 13.10 installation to 14.04, I noticed that the output of several git commands (e.g. git diff and git log) didn’t show colours as they used to, but showed ESC[ ANSI codes instead.
A quick internet search lead to this post on unix.stackexchange.com where the LESS environment variable was ‘blamed’. Indeed, I have my LESS variable (re-) defined in my .bashrc and .zshrc files.

The solution was to add -R to the environment variable, which allows raw control characters to be displayed. I now have the environment variable defined as:

LESS='--quiet -X -F -R'

Related Images:

Using SSH for WordPress updates via the web interface

Note to self: if you want to be able to upgrade WordPress via the web interface using SSH, you need to have the libssh2-php package installed on Debian/Ubuntu Linux.

Don’t forget to restart Apache after installing the package. Reload the WordPress admin pages and you’ll see the SSH option added.

Related Images:

Fixing problems after giving your Samba server a new IP address

While moving my DHCP server to a Raspberry Pi I also changed some of the IPs handed out to my (virtual) servers. This lead to problems when I logged into Windows (which is tied to my Samba domain), Windows complained that my roaming profile wasn’t completely synced and browsing network shares didn’t work, copying from (mounted) network shares didn’t work, etc.

In the Samba log files I noticed some references to the old IP address (192.168.10.23), e.g.:

[2014/03/13 16:22:23,  0] nmbd/nmbd_become_dmb.c:237(become_domain_master_query_success)
  become_domain_master_query_success:
  There is already a domain master browser at IP 192.168.10.23 for workgroup SENW registered on subnet UNICAST_SUBNET.

and

  [2014/03/13 16:20:07,  0] nmbd/nmbd_browsesync.c:248(domain_master_node_status_fail)
  domain_master_node_status_fail:
  Doing a node status request to the domain master browser
  for workgroup SENW at IP 192.168.10.23 failed.
  Cannot sync browser lists.

Even after restarting smbd and nmbd, and checking my smb.conf thoroughly, these kept showing up.

It turns out (thanks a lot Matt Godbolt) that nmbd keeps caches in two files (paths as they are on my Ubuntu 12.04 server):

  • /var/cache/samba/browse.dat
  • /var/lib/samba/wins.dat

Simply stop nmbd, delete them, restart nmbd and you’re happy.

Related Images:

Slackware on the Raspberry Pi

I took some time this week to migrate my DNs and DCHP server from an Ubuntu virtual machine to my Raspberry Pi. I wanted to do this because these two servers are so essential to regular network functioning. Before this change whenever my server was down (for whatever reason) any machine connected to the LAN would stop having a working internet connection. Moreover, since I never got the VM to boot correctly on autostart I had to manually start it every time the server came back up again.
Conclusion: not ideal and pissed of family members ;-).

Since I had my Raspberry Pi lying around and, apart from a few toy projects, hadn’t used it for anything, I decided to use it for this task: low power requirements and hardware that was more than up to the task.

The question was which distribution to use. I could have gone for Raspbian (Debian for the Raspberry Pi), which would have blended well with my otherwise Ubuntu-minded network. However, partly for nostalgic reasons, partly make sure I don’t get too tied to one distribution, I decided to try and install Slackware, the distribution I used for my first steps in Linux Land.

I followed most of the steps from the fatdog.eu tutorial (see link below) to get everything running. It’s a very well written, extensive tutorial. Things where I followed my own judgement/experience were the fact that I didn’t use a USB stick to download the Slackware packages on (I used an NFS share on my server) and the package selection. With a relatively simple selection I now have about 2GB of disk usage.

Only one thing left to migrate to the Pi now: my LDAP server. Unfortunately it’s been several years since I configured OpenLDAP (on Ubuntu) and Slackware doesn’t include the OpenLDAP server by default. So this will be something for a rainy day…

Links:

Related Images:

Fixing the compose key in Emacs on Ubuntu 13.10

After upgrading to Ubuntu 13.10 some time ago I noticed that my compose key (i.e. the key that you press followed by e.g. c and , to create a ç) didn’t work anymore in Emacs. I found two bug reports on this issue [1, 2], both effectively suggesting the same solution: start Emacs like this

XMODIFIERS=@im=none emacs

So I added the following line to my ~/.zshrc and ~/.bashrc files:

alias emacs='XMODIFIERS=@im=none emacs'

(of course somewhere before I set my EDITOR variable). I also changed the command in the launcher I use (GLX-Dock/Cairo-Dock).
This doesn’t make it a system-wide (or even user-wide) fix, e.g. the Firefox add-on “It’s all text” doesn’t get it, but it covers most of my use cases.

Related Images:

Configuring R

I took some time today to configure my R experience. I’m mostly using R from Emacs using ESS (Emacs Speaks Statistics), which means I had to configure some settings there as well.

Previously, my settings only consisted of setting a customised directory in which to install my packages and an alias to start R without asking for saving the histroy when quitting. This I did by setting the following environment variable in my .bashrc and/or .zshrc, as well as an alias:

# Set the library path for R
export R_LIBS_USER=${R_LIBS_USER}:~/Programmeren/R/lib
 
if [ -n "$(/usr/bin/which R 2>/dev/null)" ]; then
alias R="$(/usr/bin/which R) --no-save"
fi

However, Emacs didn’t pick up either of these variables, so high time to fix that. This meant creating two files with the following content:

~/.Rprofile:

# Set the default CRAN repository used by install.packages()
options("repos" = c(CRAN = "http://cran-mirror.cs.uu.nl/"))

~/.Renviron:

R_LIBS="~/Programmeren/R/lib"

I added the following to my .emacs file to start R with the --no-save option:

(setq inferior-R-args "--no-save ")

Additionally I have the following in there to turn on a spelling checker and have line-wraps enabled:

(add-hook 'ess-mode-hook
          (lambda ()
            ;; Set pdflatex as the default command for Sweave (default: texi2pdf)
            (setq ess-swv-pdflatex-commands (quote ("pdflatex"
                                                    "texi2pdf"
                                                    "make")))
            (auto-fill-mode t)
            (flyspell-prog-mode)
            ))

Related Images:

ProbABEL v0.4.2 released

During the Christmas holidays I released a new version of ProbABEL (v0.4.2). The official release announcement can be found here. ProbABEL is a toolset that allows running GWAS (Genome-Wide Association Studies) in a fast and efficient manner. It implements regression using the linear, logistic or Cox proportional hazards models.

This version is mostly a bug fix release. The most important user-visible change is the fact that the ‘official’ name for the wrapper script that runs a GWAS over a range of chromosomes is now called probabel instead of probabel.pl. This change was induced by my attempts to get ProbABEL packaged in the Debian Linux repositories. One of the warnings that occurred during the package creation process was a Lintian warning that said that scripts with ‘language extensions’ are not allowed. There are several reasons for that, but the one I found most compelling was the fact that the user shouldn’t be concerned with the programming/scripting language we used to write it in. Moreover, being ‘agnostic’ in this matter also allows us to write such a script in a different language.
Of course, we have left the original name in place (via a symlink) in order not to disrupt any current pipelines. If the user runs the script with the old name a warning appears, urging him/her to start using the new name and that the old name will be deprecated in the future.

In the mean time, ProbABEL v0.4.1 has been accepted in Debian (unstable) and as of today it is also available in Debian ‘testing’. Lots of thanks to the Debian Med team that helped me a lot in preparing the .deb package. Note that the package has been split up in probabel (architecture-dependent files) and probabel-examples (with architecture independent files: the examples). See the Debian Package Tracking System page for ProbABEL for more details of the package.

From Debian the package has trickled down to Ubuntu as well (Launchpad page here), so it will be available by default in the next Ubuntu release (14.04, a.k.a. Trusty Tahr).

Related Images:

Puppet commands change when upgrading to v3.0.0

After upgrading Puppet from versions < v3 to version 3.0.0 or higher, the main commands have changed, keep this in mind when reading my earlier post. From the ChangeLog:

Pre-2.6 Post-2.6
puppetmasterd puppet master
puppetd puppet agent
puppet puppet apply
puppetca puppet cert
ralsh puppet resource
puppetrun puppet kick
puppetqd puppet queue
filebucket puppet filebucket
puppetdoc puppet doc
pi puppet describe

Some examples

To run puppet on a client puppetd --test is changed to:

puppet agent --test

To show a list of clients waiting for signing of their certificates run the following on the master:

puppet cert list

instead of puppet ca -l. To list all certificates, run (on the master):

puppet cert list --all

To completely remove a client’s certificate on the master run:

puppet cert clean client.localdomain

and to sign a client certificate on the master run:

puppet cert sign client.localdomain

Related Images:

Permantly ban an IP address with fail2ban

Over the last few days I noticed in my logwatch e-mails that one IP address kept trying to log in to my server, even though it was blocked regularly by fail2ban.

Here’s a post that explains how to simply add a list of IP addresses to block permanently. There’s only one catch: the listing provided there contains an error, the word <name> is missing in the iptables command, probably due to HTML conversion. This is the correct line to be insterted into the actionstart section of /etc/fail2ban/action.d/iptables-multiport.conf:

cat /etc/fail2ban/ip.blacklist | while read IP; do iptables -I fail2ban-<name> 1 -s $IP -j DROP; done

Use the following command to check if the IP address is indeed banned:

$ sudo iptables  -L fail2ban-ssh
Chain fail2ban-ssh (1 references)
target     prot opt source               destination         
DROP       all  --  192.168.20.25        anywhere            
RETURN     all  --  anywhere             anywhere 

Related Images:

« Older posts Newer posts »

© 2024 Lennart's weblog

Theme by Anders NorénUp ↑