====== Linux notes ====== ===== Subsections ===== ==== Linux on Laptops ==== * [[linux:acer|Acer Aspire 1304LC and Linux]] (September 2002 - November 2005) * [[linux:t43|IBM ThinkPad T43]] (November 2005 - Today) ==== Other ==== * [[linux:dotfiles|Dotfiles]] * [[linux:devilspie|A documentation of the new "Devil's Pie" configuration format]] * [[linux:openwrt|OpenWrt related notes]] * [[linux:e70|Linux and the Nokia E70]] ===== X issues ===== ==== Windows Key is not working as Meta Key for shortcut definitions ==== In ''/etc/X11/XF86Config-4'' or ''/etc/X11/xorg.conf'' (depends on which Xserver you are using) add an ''XkbOptions'' line into the ''InputDevice'' section which defines you keyboard: Section "InputDevice" Identifier "Generic Keyboard" Driver "keyboard" . . . Option "XkbOptions" "altwin:left_meta_win" EndSection The ''altwin:left_meta_win'' keeps the functionality of the AltGr key intact (used on german keyboards for things like |, the euro symbol, the @ and so on). If you don't have an AltGr key you can also use ''altwin:meta_win''. ==== The animated cursors flicker like mad ==== In ''/etc/X11/XF86Config-4'' or ''/etc/X11/xorg.conf'' (depends on which Xserver you are using) set ''HWCursor'' to ''Off'' in your ''Device'' section: Section "Device" Identifier "NVIDIA GeForce 6600 GT" Driver "nvidia" Option "HWCursor" "Off" EndSection ==== The font size in Gaim is too small ==== Install the [[http://gaim-extprefs.sourceforge.net/ep.shtml|Extended Preferences Plugin]] and use it to adjust the font sizes according to your wishes. ==== Uninstalling NVIDIA drivers ==== sh NVIDIA-Linux-xyz-pkg1.run --uninstall ===== Peripherie ===== ==== Setting up auto negotiation on a 3com 3c905C-TX/TX-M ==== * Install ethtool (eg. ''apt-get install ethtool'') * ''ethtool -s eth0 autoneg on'' * Verify: ''ethtool eth0'' Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 24 Transceiver: internal Auto-negotiation: on Current message level: 0x00000001 (1) Link detected: yes * Restart the interface ==== Microsoft Explorer Mice and clones ==== In my case the clone would have been an A4tech WOP-35 Optical Mouse((Substituted for a Logitech MX518 in January 2006)). Additionally to the normal two buttons it comes with two side buttons (one on the left and one on the right side of the mouse), two wheels and a middle button (which would be one of the wheels). I don't use the second wheel (any more), but I set up the side buttons to function as forward/backward keys in Firefox. Configuration [[:linux#logitech_mx518|see here.]] ==== Logitech MX518 ==== First, in ''/etc/X11/XF86Config-4'' or ''/etc/X11/xorg.conf'' (depends on used xserver) we need to configure the mouse as one with seven buttons, as the scrollwheel acts as three (up, down, middle mouse button). The two "buttons" representing the scrollwheel are number 6 and 7. The protocol needed is ''ExplorerPS/2''. The ''InputDevice'' Section should therefore looks like this Section "InputDevice" Identifier "Configured Mouse" Driver "mouse" Option "CorePointer" Option "Device" "/dev/psaux" Option "Protocol" "ExplorerPS/2" Option "Buttons" "7" Option "ZAxisMapping" "6 7" EndSection In order to be able to use the wheel you need to remap the button order with ''xmodmap -e "pointer = 1 2 3 6 7 4 5 8 9 10 11"'' The behaviour of the two thumbbuttons are defined using ''imwheel'' (''apt-get install imwheel''). I made them act as forward/backward buttons in Firefox. Create ''~/.imwheelrc'' like this: ".*" None, Up, Alt_L|Left None, Down, Alt_L|Right See ''man imwheel'' for more info what that little tool can do for you. The ''xmodmap'' and ''imwheel'' commands need to be issued every time you want to use the mouse as described, so adding two lines to your ''.xinitrc'' or ''.xsession'' would be a good idea: xmodmap -e "pointer = 1 2 3 6 7 4 5 8 9 10 11" & imwheel -k -b "8 9" & The buttons used for changing the resolution don't need help from the softwareside to work. ==== No-name USB2.0 4in1 Card Reader and kernel 2.6 ==== Enable the following options in your kernel-config: * Device Drivers > SCSI device support > SCSI device support (''CONFIG_SCSI=m'') * Device Drivers > SCSI device support > SCSI disk support (''CONFIG_BLK_DEV_SD=m'') * Device Drivers > SCSI device support > Probe all LUNs on each SCSI device (''CONFIG_SCSI_MULTI_LUN=y'') Compile and install the new modules. After a reconnect of the cardreader you should be able to mount media inserted into it, ''hotplug'' should make sure of loading the essential modules. Note that the media will be found under ''/dev/sda'', ''/dev/sdb'' and so on. ==== HP LaserJet 1000 ==== In order to have the firmware loaded automatically into the LaserJet on establishing an USB connection to the pc, you need to stick to the following steps: * ''apt-get install foo2zjs'' * ''wget http://foo2zjs.rkkda.com/foo2zjs.tar.gz && tar xvfz foo2zjs.tar.gz && cd foo2zjs'' * ''make'' * ''make install-hotplug'' * ''cp usb_printerid /usr/bin'' * ''./getweb lj1000'' * ''cp sihp1000.img /usr/share/foo2zjs/firmware/sihp1000.dl'' * Edit ''/etc/hotplug/usb/hplj1000'', replace # # Set $DEV to, e.g. /dev/usb/lp0, to force the device you want # Else, leave it null to automatically detect the device # DEV=/dev/usb/lp0 DEV="" with # # Set $DEV to, e.g. /dev/usb/lp0, to force the device you want # Else, leave it null to automatically detect the device # DEV=/dev/usb/lp0 #DEV="" See also: [[http://www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_1000|HP LaserJet 1000 at LinuxPrinting.org]] For a description of how to get this printer working with OpenWRT, take a look [[linux:openwrt#HP_LaserJet_1000|here]]. ===== Security ===== ==== Portknocking for sshd ==== We were tired of the brute force attempts on the local linux router - do you know how annoying it is to see the log getting spammed by script kiddie attempts at breaking into your box? Any interesting messages get simply overrun by "Illegal user 'admin'" messages. The solution: [[wp>port_knocking|Portknocking]] using [[http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki|knockd]]. * ''apt-get install knockd'' * Add the following rules to your iptables, LOCALSUBNET being the local subnet you want to exclude from the rules: iptables -A INPUT -j ACCEPT -p tcp --syn --dport 22 -s $LOCALSUBNET iptables -A INPUT -j DROP -p tcp --syn --dport 22 -s 0/0 * Adjust your ''/etc/defaults/knockd'': # control if we start knockd at init or not # 1 = start # anything else = don't start START_KNOCKD=1 # command line options KNOCKD_OPTS="-i ppp0" * Edit the rules file ''/etc/knockd.conf'': [openSSH] sequence = 7000,8000,9000 seq_timeout = 5 start_command = /sbin/iptables -I INPUT -s %IP% -p tcp --syn --dport 22 -j ACCEPT cmd_timeout = 30 stop_command = /sbin/iptables -D INPUT -s %IP% -p tcp --syn --dport 22 -j ACCEPT tcpflags = syn The portknocking sequence should be adjusted of course, the one used above is just the default entry in a fresh installation of ''knockd''. After a successfull portknock (use ''nmap'' or ''knock'' for this) the rule opens the possibility of a connection initialisation with the ''sshd'' for 30 seconds, and after this time removes the hole in the firewalling rules again. Simple yet effective. ===== Misc ===== ==== Use Beep Media Player with Alsa dmix ==== There is a weird issue with current releases (read: 0.9.7) of the [[http://www.sosdg.org/~larne/w/BMP_Homepage|Beep Media Player]]: If you have an Alsa configuration using dmix it can happen that bmp stops playing due to some tiny load, as in switching the workspace, opening a program, ... you get the pattern. [[http://gimpel.gi.funpic.de/Howtos/xmms_vs_dmix/|Here]] I found the description of a workaround for this problem, which I realised on my Debian box as follows: * Download ''bmp-crossfade_0.2.0-1_i386.deb'' from http://www.phys.ethz.ch/~mweyland/debian/bmp-plugins and install it: dpkg -i bmp-crossfade_0.2.0-1_i386.deb * In bmp, select the crossfade plugin as output plugin to use. * Make it use Alsa output (in the Alsa settings, make sure to disable mmap mode and set buffer time to 200 and period time to 25) * In the crossfade settings on the "Crossfader" tab, select "Reopen output device" as Crossfade type You should be set. ==== Play FLAC files in Beep Media Player ==== As there does not exist a native bmp plugin for supporting the playback of [[http://flac.sourceforge.net/|flac]] files((at the time of writing, February 2006)), one has to use the xmms-flac plugin in order to listen to flac files with bmp. The following steps were extracted from [[http://thpinfo.com/2005/xe4500/|this site about installing Debian Sarge on a HP Omnibook XE4500]] and worked perfectly for me: * Install the xmms-flac plugin: ''apt-get install xmms-flac'' * In your ''~/.bmp/plugin/Input'' folder, make symlinks to the xmms-flac plugin: ''ln -s /usr/lib/xmms/Input/libxmms-flac.la && ln -s /usr/lib/xmms/Input/libxmms-flac.so'' * After a restart, bmp should have support for flac files. ==== Use Firefox as standard browser via the Alternatives System ==== Just set the ''x-www-browser'' alternative into manual mode and select firefox as browser of choice. Instant success. * ''update-alternatives --display x-www-browser'' x-www-browser - status is auto. link currently points to /usr/bin/konqueror /usr/bin/mozilla - priority 80 slave x-www-browser.1.gz: /usr/share/man/man1/mozilla.1.gz /usr/bin/epiphany - priority 85 slave x-www-browser.1.gz: /usr/share/man/man1/epiphany.1.gz /usr/bin/konqueror - priority 100 /usr/bin/mozilla-firefox - priority 70 slave x-www-browser.1.gz: /usr/share/man/man1/mozilla-firefox.1.gz Current `best' version is /usr/bin/konqueror. * ''update-alternatives --config x-www-browser'' There are 4 alternatives which provide `x-www-browser'. Selection Alternative ----------------------------------------------- 1 /usr/bin/mozilla 2 /usr/bin/epiphany *+ 3 /usr/bin/konqueror 4 /usr/bin/mozilla-firefox Press enter to keep the default[*], or type selection number: 4 Using `/usr/bin/mozilla-firefox' to provide `x-www-browser'. ==== Add a new link to the Alternatives System ==== * ''update-alternatives --install linkplace linkname linktarget prority'' * Example: ''update-alternatives --install /usr/bin/java java /usr/local/java/bin/java 100'' ==== Install Japanese fonts for X11 ==== * ''apt-get install xfonts-kappa20 ttf-kochi-mincho ttf-sazanami-mincho'' * Restart the X11 applications you wish to use the fonts (e.g. Firefox) ==== Apache2: "Could not determine the server's fully qualified domain name" ==== When receiving this error, add the following line to your ''/etc/apache2/apache2.conf'': ServerName localhost Of course you can use any other name associated with the machine running the apache. ==== Firefox uses non-antialiased bitmap-fonts under Debian ==== A ''apt-get install msttcorefonts'' should help.