Search This Blog

Showing posts with label debian. Show all posts
Showing posts with label debian. Show all posts

Install Chinese input method on Debian 11 (Gnome)

  1. Install ibus-pinyin
    sudo apt install ibus-pinyin
    
  2. Settings -> Region & Language add Chinese (Pinyin) to Input Sources
  3. Log off and

Set up Epson Workforce 435 Printer on Ubuntu 20.04

I. Install Epson WorkForce 435 driver for Ubuntu Linux

  • Install lsb
    sudo apt install lsb
  • Download Epson Workforce 435 driver from OpenPrinting.org: .deb for Debian/Ubuntu x64
  • Install the Epson Workforce 435 driver:
    sudo apt install ~/Downloads/epson-inkjet-printer-201109w_1.0.0-1lsb3.2_amd64.deb
  • Go to Settings -> Printers and select the Workforce-435 printer, click the "Gear" icon then select Printer Details.
  • In the printer details window, click Select from database then select "Epson" from the left side panel, then select "Epson WorkForce 435 Series - epson-inkjet-printer 1.0.0-1lsb3.2" at the bottom of the right side panel.



II. Fix printer error caused by apparmor

At this point, the Epson WorkForce 435 driver has been installed. However, printing to the printer is still not working. You may see error message pops up: "Printer error - connecting to device". This is because the driver we've installed is from 3rd party. The Ubuntu apparmor protects cupsd from accessing this driver. To solve the issue:
  • Install apparmor-utils
    sudo apt install apparmor-utils
  • sudo aa-complain cupsd; sudo aa-complain cups-browsed
  • Restart the computer.
  • Print a test page. If it works, check /var/log/syslog and look for apparmor related lines and see if any permissions need to be added to /etc/apparmor.d/usr.sbin.cupsd or /etc/apparmor.d/usr.sbin.cups-browsed
  • sudo app-enforce cupsd; sudo aa-enforce cups-browsed
  • Restart the computer and make sure the printing is still works.



See also

Debian 10: Gnome auto login

Edit /etc/gdm3/daemon.conf:

  • sudo vi /etc/gdm3/daemon.conf


Add following lines:
[daemon]
# Enabling automatic login
AutomaticLoginEnable=true
AutomaticLogin=USERNAME

Debian 10: sudo without password

  • sudo visudo
  • username   ALL=(ALL) NOPASSWD:ALL

Debian 10 Missing commands

  • reboot
    systemctl reboot
  • shutdown -h
    systemctl poweroff
  • ifconfig
    ip addr
    or install net-tools
    sudo apt install net-tools -y
  • visudo
    /usr/sbin/visudo

VirtualBox for Mac OS: Install Debian 10

  1. Download and install VirtualBox for Mac OS. It's available from http://download.virtualbox.org/virtualbox/
  2. Download Debian 10 Small CD Installation ISO: https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.1.0-amd64-netinst.iso
  3. Start VirtualBox and install Debian 10.
  4. Download and install VirtualBox Guest Additions: http://download.virtualbox.org/virtualbox/6.0.12/VBoxGuestAdditions_6.0.12.iso
    • Attach the VBoxGuestAdditions_6.0.12.iso to CDROM of the virtual machine
    • Install required packages:
      sudo apt update -y && apt upgrade
      sudo apt install dkms linux-headers-$(uname -r) build-essential
    • Install VirtualBox Guest Additions:
      sudo sh /media/cdrom0/VBoxLinuxAdditions.run
  5. After installing VirtualBox Guest Additions, it's possible to change the screen resolution of the guest vm. However, the font size is too small in the guest VM Window. You can change the Display Scale Factor:
    • Select the VM instance in VirtualBox, open "Settings" -> "Display", set "Scale Factor" to 150%
  6. Set up "Shared Folders"
    • After set up shared folders, you need to run the command below in the VM:
      sudo adduser $USER vboxsf
      and restart the VM.






See also

Install thinkfan fan control utility on Lenovo thinkpad laptops

I.Installation

  1. Install thinkfan from repository:
    sudo apt-get install thinkfan
  2. Enable fan control in thinkpad_acpi module configuration:
    sudo echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkpad_acpi.conf
  3. Reload thinkpad_acpi module:
    sudo rmmod thinkpad_acpi; sudo modprobe thinkpad_acpi
  4. Set to start thinkfan automatically at boot time:
    sudo vi /etc/defaults/thinkfan
    START=yes

II.Customization

  1. Install lm-sensors:
    sudo apt-get install lm-sensors
  2. To check the temperatures of the sensors:
    sensors
  3. To modify the thinkfan fan control settings:
    sudo vi /etc/thinkfan.conf

Create a bootable Window 7 installer usb disk on Debian 7

  1. You need to the Windows 7 ISO image file ready. e.g. Win7.ISO
  2. You need to install p7zip-full to extract the ISO image.
    sudo apt-get install p7zip-full
  3. You need to install ms-sys
  4. Plugin your USB disk and check its device name.
    sudo blkid
  5. Make a NTFS partition on the USB drive by using cfdisk, or gparted and apply boot flag to it.
  6. Format the USB partition,
    sudo mkfs.ntfs -n WIN7 /dev/sdX1
  7. Mount the partition by pulling off and re-plug in the USB drive or run
    mount /dev/sdX1 /media/USB
  8. Extract the ISO image to the mounted partition:
    cd /media/USB; 7z x /path/to/Win7.iso
  9. Run ms-sys to install the Window 7 boot sector:
    ms-sys -7 /dev/sdX
    Note: you need to install the boot sector to the USB drive's MBR, so you should use /dev/sdX NOT /dev/sdX1

See also

Install ms-sys on Debian

  1. Download ms-sys from http://ms-sys.sourceforge.net/#Download.
  2. Install required packages:
    sudo apt-get install build-essential gettext
    
  3. Extract the source, and compile, then install:
    cd /tmp; tar zxvf ~/Downloads/ms-sys-2.4.0.tar.gz; 
    cd /tmp/ms-sys-2.4.0
    make
    sudo make install
    

NOTE:

  • You need to install build-essential package to install the compilers.
  • You need to install gettext package to fix the error msgfmt: command not found

Show apt-get (dpkg) history

/var/log/apt/history.log is the log file for apt-get install/remove: for example I want to find the command that I installed okular package:
cat /var/log/apt/history.log | grep Install | grep okular
This is useful if you want to find all the packages that were included automatically when you install a particular package. So that you can remove them all.

If the package was installed using dpkg command, you can find the log in /var/log/dpkg.log
cat /var/log/dpkg.log | grep adobereader

Debian/Ubuntu Gnome: add folder to Places menu (Bookmarks in the left side bar)

There is Bookmarks menu in the file explore. To add a bookmark folder, select the folder then select Bookmarks menu and click Add.

Debian 7 Wheezy: install Chinese fonts

  1. Install Chinese fonts:
    sudo apt-get install fonts-arphic-bkai00mp fonts-arphic-bsmi00lp fonts-arphic-gbsn00lp ttf-arphic-bkai00mp ttf-arphic-bsmi00lp ttf-arphic-gbsn00lp
    sudo apt-get install fonts-droid ttf-droid 
    sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei xfonts-wqy
    sudo apt-get install fonts-arphic-ukai ttf-arphic-ukai fonts-arphic-uming ttf-arphic-uming
    
  2. Font config:
    vi ~/.fonts.conf
    <?xmlversion='1.0'encoding='utf-8'?>
    <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
    <fontconfig>
    <!-- prefered fonts -->
    <alias>
        <family>serif</family>
        <prefer>
            <family>DejaVu Serif</family>
            <family>Bitstream Vera Serif</family>
            <family>Evermore Song</family>
            <family>WenQuanYi Bitmap Song</family>
            <family>AR PL UMing CN</family>
            <family>AR PL ShanHeiSun Uni</family>
            <family>Droid Sans Fallback</family>
            <family>WenQuanYi Micro Hei</family>
            <family>WenQuanYi Zen Hei</family>
        </prefer>
    </alias>
    <alias>
        <family>sans-serif</family>
        <prefer>
            <family>DejaVu Sans</family>
            <family>Bitstream Vera Sans</family>
            <family>Evermore Song</family>
            <family>Droid Sans Fallback</family>
            <family>WenQuanYi Micro Hei</family>
            <family>WenQuanYi Bitmap Song</family>
            <family>WenQuanYi Zen Hei</family>
            <family>AR PL UMing CN</family>
            <family>AR PL ShanHeiSun Uni</family>
        </prefer>
    </alias>
    <alias>
        <family>monospace</family>
        <prefer>
            <family>DejaVu Sans Mono</family>
            <family>Bitstream Vera Sans Mono</family>
            <family>Evermore Song</family>
            <family>WenQuanYi Micro Hei Mono</family>
            <family>WenQuanYi Zen Hei Mono</family>
            <family>Droid Sans Fallback</family>
            <family>WenQuanYi Bitmap Song</family>
            <family>AR PL UMing CN</family>
            <family>AR PL ShanHeiSun Uni</family>
        </prefer>
    </alias>
    <!-- Default Alias -->
    <alias>
        <family>DejaVu Sans</family>
        <default>
            <family>sans-serif</family>
        </default>
    </alias>
    <!-- Generic font families -->
    <match target="pattern">
        <test name="family" qual="any">
            <string>serif</string>
        </test>
        <edit binding="strong" mode="prepend" name="family">
            <string>DejaVu Serif</string>
        </edit>
    </match>
    <match target="pattern">
        <test name="family" qual="any">
            <string>sans-serif</string>
        </test>
        <edit binding="strong" mode="prepend" name="family">
            <string>DejaVu Sans</string>
        </edit>
    </match>
    <match target="pattern">
        <test name="family" qual="any">
            <string>monospace</string>
        </test>
        <edit binding="strong" mode="prepend" name="family">
            <string>DejaVu Sans Mono</string>
        </edit>
    </match>
    <!-- Anti-alias -->
    <match target="font">
        <edit name="embeddedbitmap">
            <bool>false</bool>
        </edit>
    </match>
    <!-- WenQuanYi Bitmap Song -->
    <selectfont>
        <acceptfont>
            <pattern>
                <patelt name="family">
                    <string>WenQuanYi Bitmap Song</string>
                </patelt>
            </pattern>
        </acceptfont>
    </selectfont>
    <match target="pattern">
        <test name="family" qual="any">
        <string>WenQuanYi Bitmap Song</string>
        </test>
        <test compare="less" name="pixelsize" qual="any">
            <double>12</double>
        </test>
        <edit mode="assign" name="family">
            <string>WenQuanYi Micro Hei</string>
        </edit>
    </match>
    <match target="pattern">
        <test name="family" qual="any">
            <string>WenQuanYi Bitmap Song</string>
        </test>
        <test compare="more" name="pixelsize" qual="any">
            <double>16</double>
        </test>
        <edit mode="assign" name="family">
            <string>AR PL ShanHeiSun</string>
        </edit>
    </match>
    <!-- Alias -->
    <alias>
        <family>SimSun</family>
        <family>宋体</family>
        <accept>
            <family>LiHei Pro</family>
            <family>Evermore Song</family>
            <family>WenQuanYi Bitmap Song</family>
            <family>AR PL ShanHeiSun Uni</family>
        </accept>
        <default>
            <family>serif</family>
        </default>
    </alias>
    <alias>
        <family>SimHei</family>
        <family>黑体</family>
        <accept>
            <family>LiHei Pro</family>
            <family>WenQuanYi Micro Hei</family>
            <family>WenQuanYi Zen Hei</family>
        </accept>
        <default>
            <family>sans-serif</family>
        </default>
    </alias>
    <alias>
        <family>微软雅黑</family>
        <family>Microsoft YaHei</family>
        <accept>
            <family>LiHei Pro</family>
            <family>WenQuanYi Micro Hei</family>
            <family>WenQuanYi Zen Hei</family>
        </accept>
        <default>
            <family>sans-serif</family>
        </default>
    </alias>
    <!-- -->
    <match target="font">
        <edit mode="assign" name="rgba">
            <const>rgb</const>
        </edit>
    </match>
    <match target="font">
        <edit mode="assign" name="hinting">
            <bool>true</bool>
        </edit>
    </match>
    <match target="font">
        <edit mode="assign" name="hintstyle">
            <const>hintfull</const>
        </edit>
    </match>
    <match target="font">
        <edit mode="assign" name="antialias">
            <bool>true</bool>
        </edit>
    </match>
    </fontconfig>






If you just need basic chinese fonts. Just install the following:
sudo apt-get install fonts-arphic-bkai00mp fonts-arphic-bsmi00lp fonts-arphic-gbsn00lp ttf-arphic-bkai00mp ttf-arphic-bsmi00lp ttf-arphic-gbsn00lp

apt-get install flashplugin-installer and ttf-mscorefonts-installer via proxy

My desktop has not direct internet access but goes through a proxy. It fails to install the packages like flashplugin-installer or ttf-mscorefonts-installer. There are 2 solutions:
  • edit /etc/wgetrc
    sudo vi /etc/wgetrc
    http_proxy = http://your-proxy.your.org:3128
    substitude the proxy address and the port 3128 with your proxy address and port number. Save the file then run
    sudo apt-get install flashplugin-installer ttf-mscorefonts-installer
  • or for one-off installation:
    sudo http_proxy=http://your-proxy.your.org:3128 apt-get install flashplugin-installer ttf-mscorefonts-installer

Debian Wheezy: Install Microsoft Office 2007 (via WINE)

  1. Install wine and winetricks:
    sudo apt-get install wine winetricks
  2. Download msxml3.msi from cnet.com.
  3. Move msxml3.msi to ~/.cache/winetricks/msxml3:
    mkdir -p ~/.cache/winetricks/msxml3; mv ~/Downloads/msxml3.msi ~/.cache/winetricks/msxml3/
  4. Install msxml3.msi:
    winetricks msxml3
  5. Locate the setup.exe file from the Microsoft Office 2007 installation media/directory and run it with wine:
    wine /path/to/MSOffice2007/setup.exe

add-apt-repository works through a http proxy







Solution:
export http_proxy=http://<proxy>:<port>
export https_proxy=http://<proxy>:<port>
sudo -E apt-add-repository <repository>





Toshiba Studio printer fails to print with error: invalidfont

  • Description:
    Trying to print to Toshiba eStudio 4540C multifunction machine (with official TOSHIBA ColorMFP PPD), got the following error:
    ERROR:
    invalidfont
    OFFENDING COMMAND:
    $definefont
    STACK:
    --nostringval--
    /TVZYWM+Ubuntu-Medium
    --nostringval--
    /TVZYWM+Ubuntu-Medium
    --nostringval--
    --nostringval--
    
  • Solution:
    It was caused by the bug in cups-filters package discussed here. The work around is adding an option pdftops-renderer-default=pdftops, simply run the following command as root:
    sudo lpadmin -p TOSHIBA-ColorMFP -o pdftops-renderer-default=pdftops
    Note: you need to replace TOSHIBA-ColorMFP with your toshiba printer's name. To find out your printer's name, run
    lpstat -a

See also

Install latest Firefox/Iceweasel on Debian wheezy

sudo echo "deb http://mozilla.debian.net/ wheezy-backports iceweasel-release" >> /etc/apt/sources.list
sudo apt-get install debian-keyring pkg-mozilla-archive-keyring
sudo gpg --check-sigs --fingerprint --keyring /etc/apt/trusted.gpg.d/pkg-mozilla-archive-keyring.gpg --keyring /usr/share/keyrings/debian-keyring.gpg pkg-mozilla-maintainers
sudo apt-get update
sudo apt-get install -t wheezy-backports iceweasel

See also

Install Nomachine NX Server Free Edition on Debian Linux

The Nomachine nxserver free edition has limitation: allows only 2 concurrent user sessions. But it is fine for me to connect to my Linux workstation at work. It is easier to setup than the freenx server. See the guide below:
  1. Run the following commands to download and install nomachine nxclient, nxnode and nxserver packages:
    if [[ $(uname -m)=="x86_64" ]]; then export MARC=amd64; else export MARC=i386; fi
    wget http://web04.nomachine.com/download/3.5.0/Linux/nxclient_3.5.0-7_${MARC}.deb
    sudo dpkg -i nxclient_3.5.0-7_${MARC}.deb
    wget http://web04.nomachine.com/download/3.5.0/Linux/nxnode_3.5.0-9_${MARC}.deb
    sudo dpkg -i nxnode_3.5.0-9_${MARC}.deb
    wget http://web04.nomachine.com/download/3.5.0/Linux/FE/nxserver_3.5.0-11_${MARC}.deb
    sudo dpkg -i nxserver_3.5.0-11_${MARC}.deb
    
  2. Setup your own server private key instead of the nomachine key:
    sudo ssh-keygen -t dsa -f /usr/NX/home/nx/.ssh/id_dsa
    sudo chown nx:nx /usr/NX/home/nx/.ssh/id_dsa
    sudo mv /usr/NX/home/nx/.ssh/authorized_keys2 /usr/NX/home/nx/.ssh/authorized_keys2.old
    sudo cat /usr/NX/home/nx/.ssh/id_dsa.pub >> /usr/NX/home/nx/.ssh/authorized_keys2
    
    You can now use the private key in /usr/NX/home/nx/.ssh/id_dsa for your client to connect to the nxserver.
  3. Secure ssh for NX server by editting /etc/ssh/sshd_config as root:
    • Enable PubkeyAuthentication for all:
      PubkeyAuthentication yes
    • Disable PasswordAuthentication for all:
      PasswordAuthentication no
    • Allows PasswordAuthentication only for the FreeNX users by appending the following line to sshd_config:
      Match Group nxusers 
          PasswordAuthentication yes
      or if you want to allow individual users:
      Match User john alex
          PasswordAuthentication yes

Install FreeNX on Debian 7.1 wheezy

  • Download and run the script
  • Secure ssh:
    • Create a group nxusers and add all the users require remote NX access to the group:e.g.
      sudo groupadd nxusers
      sudo usermod -a -G nxusers wilson
    • Edit /etc/ssh/sshd_config as root:
      1. Enable PubkeyAuthentication for all:
        PubkeyAuthentication yes
      2. Disable PasswordAuthentication for all:
        PasswordAuthentication no
      3. Allows PasswordAuthentication only for the FreeNX users by appending the following line to sshd_config:
        Match Group nxusers 
            PasswordAuthentication yes
        or if you want to allow individual users:
        Match User john alex
            PasswordAuthentication yes
    • Restart ssh server:
      sudo /etc/init.d/ssh reload

Openbox/LXDE: default key combinations (shortcut keys)

Openbox default key combinations

  •     Alt-F4 Close the active window
  •     Alt-Space Show the client menu for the active window
  •     Alt-Tab Cycle between windows on the desktop
  •     Alt-Shift-Tab Cycle between windows on the desktop in reverse order
  •     Control-Alt-Tab Cycle between panel and desktop windows on the desktop
  •     Windows-D Hide all windows to show the desktop
  •     Windows-E Run the Konqueror file manager (This is an example of how to run a program with a key binding)
  •     Alt-Escape Lower the active window behind other windows, and activate the last window that was in use
  •     Windows-F1 Go to the first desktop instantly
  •     Windows-F2 Go to the second desktop instantly
  •     Windows-F3 Go to the third desktop instantly
  •     Windows-F4 Go to the fourth desktop instantly
  •     Control-Alt-Left Open the desktop switching dialog, to go to the desktop to the left of the current one
  •     Control-Alt-Right Open the desktop switching dialog, to go to the desktop to the right of the current one
  •     Control-Alt-Up Open the desktop switching dialog, to go to the desktop above the current one (This will only be useful if you use a pager to set up a desktop layout with multiple rows)
  •     Control-Alt-Down Open the desktop switching dialog, to go to the desktop below the current one (This will only be useful if you use a pager to set up a desktop layout with multiple rows)
  •     Shift-Alt-Left Open the desktop switching dialog, to go to the desktop to the left of the current one, and bring the active window with you
  •     Shift-Alt-Right Open the desktop switching dialog, to go to the desktop to the right of the current one, and bring the active window with you
  •     Shift-Alt-Up Open the desktop switching dialog, to go to the desktop above the current one, and bring the active window with you (This will only be useful if you use a pager to set up a desktop layout with multiple rows)
  •     Shift-Alt-Down Open the desktop switching dialog, to go to the desktop below the current one, and bring the active window with you (This will only be useful if you use a pager to set up a desktop layout with multiple rows)
  •     Alt-Left mouse button Move a window
  •     Alt-Right mouse button Resize a window. The window is resized towards the edge that the mouse is nearest to. So use Alt-Right mouse button in the top right corner of a window to resize that corner.
  •     Alt-Scroll wheel Change desktops forward and backward