tmux cheat sheet

I’ve recently started using tmux, so here’s my cheat sheet to remember some of the basic commands:

tmux new -s bob  create new session called ‘bob’
tmux attach (at) -t bob  attach session ‘bob’
tmux list-sessions (ls)  list sessions

Ctrl + b is the action key
$  rename session
c  new window
,  rename window
&  kill current window
x  kill current pane
↑/↓/←/→  go to pane
"  split horizontally
%  split vertically
c  new window
d  detach session
l/n  last/next window
0-9 select window
?  help
: command prompt

In command prompt:

resize-pane -{D|U|L|R} 10  resize pane in direction by 10

Posted in Linux, Software | Tagged , , , | Leave a comment

Puppet trouble with vcsrepo module

After having tried to use the vcsrepo module for Puppet a while back and it not working, then trying tonight and it still doesn’t work; no kind of message even in debug to help understand what’s going on, I finally remembered something form having used another module previously:

# /etc/puppet/puppet.conf
pluginsync = true

And that’s it!

The module simply has a plugin included, and if you don’t sync it, the module won’t run.




Posted in Linux | Tagged , , , , | Leave a comment

Javascript unexpected errors

Today while working on a mini-project, I encountered some problems with JavaScript, notably:

Unexpected end of input
Unexpected token illegal

Oddly, the source file had barely changed (new line, for example) and there was no apparent error. Also, sometimes the file received seen through Chrome Developer Tools didn’t reflect the changes made on the source.

After searching around for a bit, I found this post in StackOverflow which brings to this post, where it appears to be a problem with VirtualBox and its use of the sendfile() function.

The problem appears when using shared folders through VirtualBox, and the fix is to add the following directive to your site description:

For nginx:

sendfile off;

For Apache:

EnableSendfile Off

Extract from the Apache docs:

This directive controls whether httpd may use the sendfile support from the kernel to transmit file contents to the client. By default, when the handling of a request requires no access to the data within a file — for example, when delivering a static file — Apache uses sendfile to deliver the file contents without ever reading the file if the OS supports it.

This sendfile mechanism avoids separate read and send operations, and buffer allocations. But on some platforms or within some filesystems, it is better to disable this feature to avoid operational problems:

  • Some platforms may have broken sendfile support that the build system did not detect, especially if the binaries were built on another box and moved to such a machine with broken sendfile support.
  • On Linux the use of sendfile triggers TCP-checksum offloading bugs on certain networking cards when using IPv6.
  • On Linux on Itanium, sendfile may be unable to handle files over 2GB in size.
  • With a network-mounted DocumentRoot (e.g., NFS or SMB), the kernel may be unable to serve the network file through its own cache.

For server configurations that are vulnerable to these problems, you should disable this feature by specifying:

EnableSendfile Off

For NFS or SMB mounted files, this feature may be disabled explicitly for the offending files by specifying:

<Directory "/path-to-nfs-files">EnableSendfile Off</Directory>

Please note that the per-directory and .htaccess configuration of EnableSendfile is not supported by mod_disk_cache. Only global definition of EnableSendfile is taken into account by the module.

Posted in WebDev | Tagged , , | Leave a comment

Disk passthrough in Proxmox

Recently, I’ve added a few gigs of RAM to my main homeserver, so I figured I could transform it into a VM hypervisor, transfer the original config and then have some room to play with other stuff.

I chose to go with Proxmox, as it’s Debian-based, and I had trouble with both Hyper-V and ESXi (installation from/to USB, network drivers, etc.)

Because I use Puppet to manage all my configuration, I didn’t have do anything particular to backup the original configuration, except saving some dotfiles.


Since I have multiple disks in the server which are used for Samba, I wanted to pass them through to the new VMs, but couldn’t find a way to do so through the web interface. After looking around for a bit, I found two solutions which work together.

The first step is to identify the disk you want to pass through. For this, there are multiple methods:

fdisk -l
ls -l /dev/disk/by-label
ls -l /dev/disk/by-uuid
ls -l /dev/disk/by-id

Note that using /dev/sdX is not a great option since the letter attribution can change, whereas a disk’s uuid will not.

Then, you’ll want to copy whatever label/uuid/id that is relevant, and to allow passthrough there are now two options:

1. Through the Proxmox console

qm set {vmid} -{ide|sata|scsi}# /dev/disk/by-{label|uuid|id}/{reference}

with vmid the ID of your VM, ide or sata the type of disk you want to add.

Note that ide value can be 0-3, sata can be 0-5 and scsi 0-13. Also, ide0 is generally the boot disk and ide2 will be the CD drive; Adjust depending on your configuration.


qm set 101 -sata0 /dev/disk/by-label/data01

This will modify the {vmid}.conf file, which bring us to option 2.

2. By directly modifying the {vmid}. conf file in /etc/pve/qemu-server/

Add a line as follows:

{ide|sata|scsi}#: /dev/disk/by-{label|uuid|id}/{reference}


sata0: /dev/disk/by-label/data01


You’ll want to shutdown then boot the VM (not just a regular restart) for the changes to take effect, after which the disk should be accessible in your VM.

Posted in Linux | Tagged , , , , , , | 1 Comment

SSH won’t use keys / asks for password

Check that no one other than the user has write permissions:

chmod go-w ~/.ssh

Ideally, the rights on .ssh should be chmod 0700

Posted in Linux | Tagged , , , , , , | Leave a comment

Saving RaspberryPi sound configuration

One of the things that’s been bothering me with the Raspberry Pi, even though I’m managing it through Puppet, is the sound configuration.

Sometimes the sound is x% lower for no obvious reason, othertimes it goes through HDMI when I wanted it through the 3.5mm jack. Then I have to go figure out how to set it back all over again.

Turns out, the settings are loaded from a file, located at


This means, that by changing some settings and saving again, it’s possible to see which parameters were modified, and then use this to create a template for use in Puppet.

To save the state:

alsactl store

For example, to change the output between auto/analog/hdmi, one would use the following command:

sudo amixer cset numid=3 1

which isn’t very explicit.

In the file, this will change the number corresponding to “value”:

control.3 {
	iface MIXER
	name 'PCM Playback Route'
	value 1
	comment {
		access 'read write'
		type INTEGER
		count 1
		range '0 - 2'

On a Raspberry Pi, 0=auto; 1=analog; 2=HDMI.

To modify the output volume, you can set the “Value” in the first control to it’s highest value in the range:

control.1 {
	iface MIXER
	name 'PCM Playback Volume'
	value 400
	comment {
		access 'read write'
		type INTEGER
		count 1
		range '-10239 - 400'
		dbmin -9999999
		dbmax 400
		dbvalue.0 400
Posted in Linux, Raspberry Pi, Software | Tagged , , , , , | Leave a comment