Home

last update: 2020-03-30 at 18:00:13 CEST

Notes About Linux Distributions

Arch (Manjaro)

Package Management

Keep Your System Up To Date

sudo pacman -Syu

Remove a Package

sudo pacman -R package

Acarde Emulation

I bought a Xbox 360 PC receiver to get my xbox 360 gamepads work under Linux it shows up as:

lsusb | grep 360
Bus 001 Device 008: ID 045e:0719 Microsoft Corp. Xbox 360 Wireless Adapter

Everything seems to work out of the box. Just plug in the receiver and connect a gamepad. I had a problem as the controller was connected, my mouse was moving to the top of the screen. The xorg driver xf86-input-joystick has taken over control. Cause I dont need to control my mouse with the gamepad in X, I just deinstalled the driver:

sudo pacman -R xf86-input-joystick

If you want to play old acarde games just install higan and configure the gamepad under Settings

sudo pacman -S higan

Setup Kyocera-FS-C5020N-FS-C5020N Network Printer

sudo pacman -S cups libcups
sudo systemctl start cups.service

open http://localhost:631/ in your browser

AdministrationAdd Printer (user: root)

  • AppSocket/HP JetDirect

  • socket://10.200.127.60

  • Kyocera_FS-C5020N

  • locate the ppd file

  • set default options

Tip
forgotten printer ip? nmap 10.200.127.* -p 80

If you get

$sudo systemctl start cups.service
Failed to start cups.service: Unit cups.service failed to load: No such file or directory.

In cups v. 2.0.0 the service name has been changed. Disable the old service and start the new one

sudo systemctl disable cups.service
sudo systemctl enable org.cups.cupsd.service
sudo systemctl daemon-reload
sudo systemctl start org.cups.cupsd.service

Add User To The Print Admins To Manage Printers Over The Webinterface

To login to the cups webinterface the user must have the required privileges. Add a group called printadmin, put the user into the group and tell cups to handle this group as system admins

sudo groupadd printadmin
sudo gpasswd -a timo printadmin
sudo gpasswd -a timo lp
sudo vim /etc/cups/cups-files.conf

Add printadmin+i to the Line: +SystemGroup sys root printadmin

Restart cups:

sudo systemctl restart org.cups.cupsd.service

Installing Arch Linux (Manjaro) on a Sony Vaio Z11Z9E/B

Here are some notes about how I setup Manjaro (Openbox Edition) on this laptop. Manjaro is a Linux distribution based on Arch and is targeted for beginners and advanced users. I have chosen Manjaro cause I am a beginner and most stuff is nicely preconfigured

I downloaded manjaro-cinnamon-0.8.13.1-x86_64.iso and installed it on a USB-stick

cd downloads/
sudo fdisk -l
sudo dd bs=4M if=manjaro-cinnamon-0.8.13.1-x86_64.iso of=/dev/sdb

The installation is pretty simple just boot from a usb stick, click through the installation wizard and use manually partitioning. I was impressed, the advanced partitioning wizard properly detected the internal raid consisting of the 4x64 GB Samsung SSDs. I choosed a GPT partition table and a btrfs filesystem

After a reboot grub failed to locate the root filesystem. The only thing was that I had to include dmraid in the HOOKS section in the initrd section. To do this boot from the stick again and open a terminal

sudo mount /dev/md126p2 /mnt
sudo mount -o bind /sys /mnt/sys
sudo mount -o bind /proc /mnt/proc
sudo mount -o bind /dev /mnt/dev
chroot /mnt

vim /etc/mkinitcpio.conf

MODULES="md_mod raid0 btrfs"
BINARIES="mdmon"
HOOKS="base udev autodetect modconf block keyboard keymap resume mdadm_udev shutdown filesystems fsck"

and then rebuild the initial ramdisk

sudo mkinitcpio -g /boot/initramfs-3.18-x86_64.img
update-grub
exit
sudo reboot

Turn Off Integrated Nvidia GPU on a Sony Vaio Z11Z9E/B

The Vaio Z models come with 2 integrated graphics cards

lspci -vmk | grep -A 8 -B 2 VGA

Device: 00:02.0
Class:  VGA compatible controller
Vendor: Intel Corporation
Device: Core Processor Integrated Graphics Controller
SVendor:        Sony Corporation
SDevice:        Device 905a
Rev:    02
Driver: i915
Module: i915

--

Device: 01:00.0
Class:  VGA compatible controller
Vendor: NVIDIA Corporation
Device: GT216M [GeForce GT 330M]
Rev:    ff
ProgIf: ff
Driver: nouveau
Module: nouvea
sudo cat /sys/kernel/debug/vgaswitcheroo/switch
0:DIS: :Pwr:0000:01:00.0
1:DIS-Audio: :Pwr:0000:01:00.1
2:IGD:+:Pwr:0000:00:02.0

You may want to turn off the high-performance graphics processor to save battery power. The battery reports a discharge rate of 18.1 W in idle mode. To power down the 2nd graphics card do:

sudo su
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

After that The battery reports a discharge rate of 12.5 W (seen in powertop)

Display Brightness

For some reason I could make the display brighter by pressing Fn+F6 but it doesnt go darker. I figured out that the function key calls the command xbacklight -inc 10 which was for some reason not working. But xbacklight -inc 20 works

So I modified the .config/openbox/rc.xml

    <keybind key="XF86MonBrightnessUp">
      <action name="Execute">
        <command>xbacklight -inc 20</command>
      </action>
    </keybind>
    <keybind key="XF86MonBrightnessDown">
      <action name="Execute">
        <command>xbacklight -dec 10</command>
      </action>
    </keybind>

Save Power

run powertop with html output and put the commands suggested there in ur rc.local

sudo powertop --html
chromium powertop.html

I like to turn off powersaving on my logitech usb mouse adapter cause it always needs some seconds to wakeup on a mouse move

lsusb
sudo vim /etc/laptop-mode/conf.d/usb-autosuspend.conf

#add line:
AUTOSUSPEND_USBID_BLACKLIST="046d:c52b"

Power Tunings on Sony Vaio Z11Z9E/B

Gathered via sudo powertop --html and grep echo ' powertop.html | sed 's/.\(echo.\);.*/\1/g

echo 'auto' > '/sys/bus/usb/devices/1-1.6/power/control'
echo 'auto' > '/sys/bus/usb/devices/1-1.3/power/control'
echo 'auto' > '/sys/bus/usb/devices/1-1/power/control'
echo 'auto' > '/sys/bus/usb/devices/2-1/power/control'
echo 'auto' > '/sys/bus/usb/devices/usb1/power/control'
echo 'auto' > '/sys/bus/usb/devices/usb2/power/control'
echo 'auto' > '/sys/bus/usb/devices/1-1.1/power/control'
echo 'auto' > '/sys/bus/usb/devices/1-1.2/power/control'
echo 'auto' > '/sys/bus/usb/devices/2-1.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:19.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:16.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.4/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:3f:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:3f:00.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:3f:02.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:3f:02.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:3f:02.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:3f:02.3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:01.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1e.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.6/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:02:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control'

Connecting a Sony Vaio Z11Z9E/B to a N-BOX B7500 Bluetooth Speaker

install necessary packages

sudo pacman -S bluez bluez-utils bluez-libs alsa-utils pulseaudio-alsa

check bluetooth module is loaded and start the service

lsmod | grep bt
sudo systemctl start bluetooth
sudo systemctl enable bluetooth

start pulseaudio

pulseaudio --start -v

start bluetooth control (if you cant type anything the service may not be running).

bluetoothctl
power on
agent on
default-agent
scan on
pair A0:E9:DB:50:08:5C
trust A0:E9:DB:50:08:5C
scan off
connect A0:E9:DB:50:08:5C

Troubleshooting

systemctl status bluetooth
journalctl -n 20

Install ActiveTrader from .deb Package

ar x AT_Setup_de_Linux_deb.deb
bsdtar xf data.tar.gz
cd opt/ActiveTraderDE/
./ActiveTrader.sh

Gentoo

Prevent the Drive from Spinning Down

My laptop drive was always spinning down this was really annoying. hdparm -iI /dev/sda showed TOSHIBA MK3252GSX. Strangely setting the standby timeout has no effect:

hdparm -S 255 /dev/sda

I had to disable Advanced Power Management at all:

hdparm -B 255 /dev/sda

I also added this line to /etc/conf.d/hdparm to make things persistend after reoot

hda_args="-B 255"

and do a rc-update add hdparm

Syncing the Clock via NTP

In europe use Central Europen Time (CET).

cp /usr/share/zoneinfo/CET /etc/localtime

Now install a ntp client:

emerge -av ntp ntpclient

Check the list of ntp servers in /etc/ntp.conf. Here I have added ntp servers from germany. See here if you are in a different country:

cat /etc/ntp.conf
#server 0.gentoo.pool.ntp.org
#server 1.gentoo.pool.ntp.org
#server 2.gentoo.pool.ntp.org
#server 3.gentoo.pool.ntp.org
server 0.de.pool.ntp.org
server 1.de.pool.ntp.org
server 2.de.pool.ntp.org
server 3.de.pool.ntp.org

Finally add the ntp client to your default run level and start it.

rc-update add ntp-client default
/etc/init.d/ntp-client start

Compiling a Kernel (micro howto)

Compiling a kernel can at first be a heavy task. But if done a couple of times it is not so difficult. Here is my very short way:

  • download a stable release from kernel.org

  • copy it to /usr/src and untar it tar xfj linux-*.tar.bz2

  • update link to kernel rm linux && ln -s linux-x.x.x linux

  • copy the previous config to linux/.config and make oldconfig

  • compile make -j5 && make modules -j5

  • install make modules_install && make install

  • edit /boot/grub/menu.lst

Here is a sample entry for grub:

title Linux vmlinuz-3.6.8
root (hd0,0)
kernel /boot/vmlinuz-3.6.8 root=/dev/sdh1 rootdelay=10
Tip
there are also very smart make targets available if you don’t have a .config available. For example make localmodconfig does generate a .config with (hopefully) autodetected modules preselected. Its a good idea to review things like: filesystems, usb, raid stuff, sata controllers etc. if the kernel does not boot.

Debian 9

Create a Wifi Hotspot

sudo apt-get install hostapd
sudo apt-get install isc-dhcp-server
sudo vim /etc/hostapd/hostapd.conf
interface=wlan0
#bridge=br0
hw_mode=g
driver=nl80211
country_code=DE
ssid=timos_AP
channel=6
wpa=2
wpa_passphrase=XXXXXXXXXXXXXXXXXXXXXXXXXXX
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
sudo vim /etc/dhcp/dhcpd.conf
option domain-name "keilhau.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 86400;
max-lease-time 864000;
ddns-update-style none;
authoritative;
subnet 10.17.27.0 netmask 255.255.255.0 {
  range 10.17.27.17 10.17.27.49;
  option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
}
sudo dhcpd -t
sudo systemctl start isc-dhcp-server
sudo hostapd /etc/hostapd/hostapd.conf
sudo /sbin/ifconfig wlan0 10.17.27.2/24

Debian 8

Prevent Display from going Blank

xset s off         # don't activate screensaver
xset -dpms         # disable DPMS (Energy Star) features.
xset s noblank     # don't blank the video device

Lost Mouse Cursor in X

gsettings set org.gnome.settings-daemon.plugins.cursor active false

Fix Ugly Pixelized Fonts in Chromium

create a new directory somewhere

mkdir chromium_font_fix && cd !$

+vim manifest.json

{
  "name": "Fix Helvetica",
  "description": "Fix Helvetica",
  "version": "0.1",

  "content_scripts": [ {
  "css": [ "Custom.css" ],
  "matches": [ "http://*/*", "https://*/*" ]
  } ],

  "manifest_version": 2
}

vim Custom.css

@font-face { font-family: 'Helvetica'; src: local('Arial')}
  • Go to chrome://extensions in chrome

  • Check the developer mode box

  • Load unpacked extension

  • Load the manifest file

  • Restrat and enjoy

Connecting a Lenovo Thinkpad X300 to a CC-BC SPEAKER Bluetooth Speaker

Install blouetooth stuff and discover the device

sudo apt-get install bluez-tools bluez pulseaudio-module-bluetooth
bt-adapter -d

pair it

bt-device -c 00:75:58:48:1D:67
Connecting to: 00:75:58:48:1D:67
Agent registered
Device: CC-BC SPEAKER (00:75:58:48:1D:67)
Enter PIN code: 0000
Agent released
Done

check status and trust

bt-device -l
bt-device -i 00:75:58:48:1D:67
bt-device --set 00:75:58:48:1D:67 Trusted 1

Playing Sound with a Terratec Aureon 5.1 MKII

Check which sound card is the aureon

$aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: Aureon51MkII [Aureon5.1MkII], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Its card 1 so set: pcm "hw:1,0" and card 1 see below

asoundrc
pcm.dmix51 {
  type dmix
  ipc_key 1024
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
     pcm "hw:1,0"
     channels 6
     period_time 0
     period_size 1024
     buffer_size 8192
     rate 44100
  }
}

ctl.dmix51 {
  type hw
  card 1
}

pcm.stereo {
  type plug
  slave.pcm "dmix51"
  ttable.0.0 1
  ttable.1.1 1
}

pcm.!default {
  type route
  slave.pcm "dmix51"
  slave.channels 6
  ttable.0.0 1
  ttable.1.1 1
  ttable.0.2 1
  ttable.1.3 1
  ttable.0.4 0.5
  ttable.1.4 0.5
  ttable.0.5 0.5
  ttable.1.5 0.5
}

pcm.duplicate {
  type plug
  slave.pcm "dmix51"
  slave.channels 6
  route_policy duplicate
}

play a mp3

mpg123 some.mp3

Upgrading from Debain 7 Wheezy (Crunchbang) to Debian 8 Jessie

sudo vim /etc/apt/sources.list

deb http://httpredir.debian.org/debian jessie main
deb-src http://httpredir.debian.org/debian jessie main

deb http://httpredir.debian.org/debian jessie-updates main
deb-src http://httpredir.debian.org/debian jessie-updates main

deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main

sudo vim /etc/apt/preferences

Package: *
Pin: release a=jessie
Pin-Priority: 1001

sudo vim /etc/apt/apt.conf

//APT::Default-Release "stable";
sudo apt-get update

sudo apt-get dist-upgrade
sudo apt-get -f install
sudo apt-get remove tint2conf
sudo apt-get dist-upgrade
sudo apt-get autoremove

Debian 7

Compile Warzone 2100 from Source

Here I installed it on a Debian 7 wheezy (Crunchbang waldorf)

sudo apt-get install bison flex pkg-config pkg-config libqt4-dev libsdl1.2-dev\
libsdl1.2-dev libtheora-dev libalut-dev libvorbis-dev libglew-dev libphysfs-dev\
libxrandr-dev libfribidi-dev libfontconfig1-dev

tar -xvfJ warzone2100-3.1.0.tar.xz
cd warzone2100-3.1.0/
./configure --prefix=/opt/warzone2100
make -j5 && sudo make install

Reinstall NetworkManager nm-applet

sudo apt-get install network-manager-gnome --reinstall
nm-applet

Setup LCD Display And Remote Control in Silverstone LC16M Case

lsusb | grep -i imon
Bus 002 Device 003: ID 15c2:ffdc SoundGraph Inc. iMON PAD Remote Controller
sudo apt-get install lcdproc lirc
sudo modprobe lirc_imon

for some reason my lcd device was lcd1 and not lcd0.

sudo vim /etc/LCDd.conf

Driver=imon
Device=/dev/lcd1
dmesg|tail
sudo /etc/init.d/LCDd restart
echo "Weee Hi There :D" > /dev/lcd1

If your LCD stays black try to check its power connection, Try to use another usb port.

start the client lcdproc

lcdproc

Setup Kyocera-FS-C5020N-FS-C5020N Network Printer

Right click→System→Printers→Configure Printer

Server→New→Printer

Network Printer→Find Network Printer

Printer is automatically found

FS-C5020N→IPP network printer→Search for a printer to download→Search

just click on forward couple of times

Right click on Printer→Printer Options→Media Size set to A4

Ubuntu

Updating an old EOL (End Of Life) release of Ubuntu

If updating a (very) old release of ubuntu apt will complain that it can’t reach the repository. Thats because the repository moved to old-releases.ubuntu.com instead of the one thats defined in the sources.list. To fix this just edit the file:

sudo vim /etc/apt/sources.list

You can use these new entrys:

## EOL upgrade sources.list
# Required
deb http://old-releases.ubuntu.com/ubuntu/ maverick main restricted universe
multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted
universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-security main restricted
universe multiverse

# Optional
#deb http://old-releases.ubuntu.com/ubuntu/ maverick-backports main restricted
universe multiverse
Note
If updateing from an other release than maverick replace the string with your release and try the update.
sudo do-release-upgrade

You need to install the update-manager if you dont have it:

sudo apt-get install update-manager-core