Linux tuning

This is where I document the changes I made to Kubuntu  to fine tune it as I like it.

Browser: bitwarden adblockplus Easy Youtube Video Downloader Express

KDE:

- System monitor dashboard

- Event calendar  = clock + weather + timer + calendar (can be synchronized with google calendar)
  = afsprakenboek in NL versie
    https://github.com/Zren/plasma-applet-eventcalendar/issues/177

pamac install ark arj audacity balena-etcher brscan4 brother-mfc-9970cdw cattqt cpio chromium clonezilla cpupower-gui cups-pdf filelight fx_cast-bin gparted gscan2pdf gwenview kompare imagemagick imagewriter kate kdiff3 kmahjongg krename krusader ksnip kmahjongg kompare kshisen lhasa libpamac-snap-plugin libpamac-flatpak-plugin musescore partclone plasma5-applets-eventcalendar putty pysolfc qbittorrent rosegarden simple-scan simplescreenrecorder spideroak-one sweethome3d tesseract tesseract-data-eng tesseract-data-nld tesseract-data-osd unace unarj unpaper unrar unzip ventoy vlc wireshark-qt wol yakuake youtube-dl zip



Make the serial port available for a user:

  - Check to what group the serial port belongs:    ls -l /dev/ttyUSB*

  - Add the user to that group:                                sudo usermod -a -G dialout marc

  - reboot or logout and login

See what serial port to use:    sudo dmesg | grep tty

In the file /etc/default/grub change

GRUB_CMDLINE_LINUX=“acpi_osi=Linux acpi_backlight=vendor”

to

GRUB_CMDLINE_LINUX=“acpi_osi=Linux acpi_backlight=0”

nmcli con show to list all network connections

nmcli con show 'Your Connection Name' to list the current properties of that connection

-->  nmcli con show 'HassOS default'

nmcli con edit "Your Connection Name" to enter edit mode for that connection

-->  nmcli con edit 'HassOS default'

To add your static IP address (select ‘yes’ for manual method);

nmcli> set ipv4.addresses 192.168.1.4/24

Do you also want to set 'ipv4.method' to 'manual'? [yes]:yes

nmcli> set ipv4.dns 1.1.1.1

nmcli> set ipv4.gateway 192.168.1.1

nmcli> save

nmcli> quit

in /etc/sysctl.conf     add following lines at the end

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

https://askubuntu.com/questions/461825/how-to-connect-to-wifi-from-the-command-line

sudo apt-get install apt-xapian-index

sudo update-apt-xapian-index -vf

If that doesn't work you can try:

sudo apt-get install --reinstall synaptic sudo dpkg-reconfigure synaptic

Create startup USB disk

Use Balena etcher
or   sudo dd if=/path/to/download.iso of=/dev/sdX bs=16M
        sudo sync    #to empty file buffers


Type startx -- :1

In /etc/sddm.conf add following text

[General]
InputMethod=

Save, reboot, problem solved.

In the middle of the page there are instructions to add repositories.

http://ubuntuguide.org/wiki/Ubuntu:Intrepid#Manual_Method_for_Adding_Repositories

Remove the last line (Playonlinux), it does not work.

Add mediabuntu repo:  https://help.ubuntu.com/community/Medibuntu

Repositories ar in /etc/apt/sources.list   you can edit the file with sudo nano or sudo kate /etc/apt/sources.list

My current 11.04 sources.list is attachedat the vottom of this page this page

Change GRUB DEFAULT in /etc/default/grub to the line number you want your PC to start from

For example, on my work PC I wanted Windows to start by default, so I set it to 5

# If you change this file, run 'update-grub' afterwards to update

# /boot/grub/grub.cfg.

# For full documentation of the options in this file, see:

#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=4

In Systemd, we speak of boot targets instead of runlevels.

   ┌─────────┬───────────────────┐    │Runlevel │ Target            │    ├─────────┼───────────────────┤    │0        │ poweroff.target   │    ├─────────┼───────────────────┤    │1        │ rescue.target     │    ├─────────┼───────────────────┤    │2, 3, 4  │ multi-user.target │    ├─────────┼───────────────────┤    │5        │ graphical.target  │    ├─────────┼───────────────────┤    │6        │ reboot.target     │    └─────────┴───────────────────┘

You can edit the grub parameters by pressing e while in the boot menu, and replace the quit command by

systemd.unit=multi-user.target

and press F10

This will boot you once into the desired target, it is not permanent.

To add this to the grub menu:

- copy the first grub menu entry from /boot/grub/grub.cnf into the file /etc/grub.d/40_custom

- replace the quit command by systemd.unit=multi-user.target  (or rescue target)

-  change the menuentry title

and run sudo update-grub

see  http://ubuntuforums.org/showthread.php?t=1287602

make a copy of both grub and 30_os prober files  !!! when something goes wrong, you can put the original files back

I did this to temporarily hide that I had linux running as a dual boot on my laptop.

In /etc/default/grub

GRUB_DEFAULT=4    #set this value to the OS you want to boot

GRUB_HIDDEN_TIMEOUT=0

GRUB_TIMEOUT=0

in /etc/grub.d/30_os-prober,

there is a piece of code that sets grub timeout to 10s if it is set to zero, it prevents hiding the grub menu.

set timeout_style=menu

if [ "\${timeout}" = 0 ]; then

  set timeout=10  # I changed this from 10 to 0

After these changes, run sudo update-grub to generate the new grub boot sequence.

Install numlockx   #"""

for KDE                sudo kate /etc/kde4/kdm/Xsetup      and add the line  /usr/bin/X11/numlockx on

for GNOME           sudo gedit /etc/gdm/Init/Default     and add the line  /usr/bin/X11/numlockx on

-  setxkbmap -option terminate:ctrl_alt_bksp

- Add it to ~/.xinitrc in order to make the change permanent.

- sudo visudo

- add    marc    ALL=(ALL) NOPASSWD: /sbin/shutdown -h now, /sbin/reboot

     at the end of the file

     This give the user marc the right to use the commands sudo shutdown -h  now

     and sudo reboot without sudo password

- CTRL-X to close the file  and Y to save

- right click on the K menu and select menu editor

- Add new item, command = sudo shutdown -h now and select an icon

You need a swap partition that is at least the size of your RAM memory, check it with free -h

create a swap partition with gparted and right click the swap partition/info to see the UUID

In /etc/fstab add a line to make your swap permanent

    UUID=41e86209-3802-424b-9a9d-d7683142dab7 none swap sw 0 0

reboot and check with free -h   if swap has been created correctly

Making the swap partition work for hibernate (optional)

Filename                                Type            Size    Used    Priority /dev/sda2                               partition       2676732 73380   -1

Now you should be able to hibernate and resume!

Older method:  you still need the swap partition

http://www.howtogeek.com/113923/how-to-re-enable-hibernate-in-ubuntu-12.04/

- test if hibernation works via following command    sudo pm-hibernate

- enable hibernation by creating a policikit rule

sudo kate /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

and past this in the file

[Enable Hibernate]

Identity=unix-user:*

Action=org.freedesktop.upower.hibernate

ResultActive=yes

[Re-enable hibernate by default in upower]

Identity=unix-user:*   

Action=org.freedesktop.upower.hibernate

ResultActive=yes

[Re-enable hibernate by default in logind]

Identity=unix-user:*

Action=org.freedesktop.login1.hibernate

ResultActive=yes

Set the s bit to allow non root users to execute a command that is normally only accessible to root

  sudo chmod a+s /sbin/shutdown

 

sudo tune2fs -c 100 /dev/sda2 (= /home )

sudo tune2fs -c 100 /dev/sda1 (= / )

sudo tune2fs -c 100 /dev/sda4 (= /data )

- Make a list of installed packages

        dpkg --get-selections | grep -v deinstall > installedpackages

-  Copy this file and /etc/apt/sources.list to the new PC and execute following commands:

        sudo apt-get update

        sudo apt-get dist-upgrade

        sudo dpkg -–set-selections < installedpackages

        sudo apt-get dselect-upgrade

These packages make it possible to play all kinds of media formats (mp3, mp4, dvd, java, ...)

- Kubuntu restricted extras

- mozilla-mplayer

- non-free codecs

You can either configure Linux to handle TRIM automatically or you can run the TRIM command manually.

I highly recommend setting this up to be automated. Here's how you do it:

UUID=00000000-0000-0000-0000-000000000000  /  ext4  discard,errors=remount-ro  0  1

- To display disk UUIDs, use sudo blkid

- To display available disks/partitions, use parted

- To add a disk in /etc/fstab, use sudo kate /etc/fstab

   and use following syntax   and see man fstab for more info

    UUID={YOUR-UID} {/path/to/mount/point} {file-system-type} defaults,errors=remount-ro 0 1

    Example UUID=7ff5e2fc-aea9-4eb4-85fd-d7dd7eb1ca62     /1500M          ext3    defaults        0       2

- Go to  /home/.kde/autostart 

- Click on the K-menu button, bottom left on the screen

- Drag application into the autostart folder

- Choose the Link Here option

 

dhcpcd eth0 (works in arch)

dhcpcd -k eth0  releases the IP@

In Kubuntu:

In /etc/network/interfaces

auto lo

iface lo inet loopback

address 127.0.0.1

netmask 255.0.0.0

iface wlan0 inet static

address 10.10.10.10

netmask 255.255.255.0

iface eth2 inet dhcp

auto eth2

iface eth2:0 inet static

address 10.0.0.1

netmask 255.255.0.0

auto eth2:0

Restart the network service: # /etc/init.d/networking restart

In Windows:

http://www.networkworld.com/columnists/2004/110104gearhead.html

Regedit

look under the root key "HKEY_LOCAL_MACHINE" for the subkey:

\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\

Under these subkeys you'll find all of the NICs in your PC listed by their COM Class Identifiers otherwise known as Globally Unique Identifiers (GUID). For example: {A8BF419B-8185-4396-B87A-2B6345BBC8E3}

Be careful to correctly identify which NIC the entry refers to - you'll find multiple GUIDs listed under each NIC in the registry.

When you've got the right one, you need to find the key "IPAddress" and double click on it. In the Edit Multi-String dialog that appears, enter in the Value Data field each of the static IP addresses you want to assign to the NIC, one value per line. Note that the first value - for no reason we can fathom - must be "0.0.0.0".

Now find the "SubnetMask" key and edit it exactly the same way you did the "IPAddress" key, again making sure the first value is "0.0.0.0".

Exit regedit and reboot windows

 

https://help.ubuntu.com/community/Grub2/ISOBoot

Ik heb eens nagekeken wat er bij mij van samba gerelateerde software geinstalleerd is:

cifs-utils, smbclient, libsmbclient, libwbclient0, samba, samba-common, samba-common-bin, winbind

De workgroup naam op je nas moet hetzelfde zijn als de workgroup naam in /etc/samba/smb.conf op je linux PC.

# Change this to the workgroup/NT-domain name your Samba server will part of

workgroup = WORKGROUP

sudo mkdir /mijn-nas

Hiermee maak je een directory aan op de plaats waar je de nas in je systeem wil hebben

sudo mount -t cifs -o username=marc,password=marc //192.168.0.101/homes/marc /mijn-nas

Hiermee mount je de nas in de directory die je met het vorige commando aangemaakt hebt

- mount -t cifs -o is het commando om de drive te mounten, cifs is een nieuwere versie van het samba protocol.

als het niet werkt moet je via je packet mgr samba, smbclient en cifs-utils installeren.

- username=xxxx,password=xxxx is de login waarmee je inlogt op je nas

- //192.168.0.101/homes/marc is het netwerkpad waar de bestanden op je nas zitten

- /mijn-nas is de plaats waar je de nas bestanden wil zien op je pc

Als je de nas wil mounten telkens je opstart moet je volgende lijn in het configuratiebestand /etc/fstab toevoegen

//192.168.0.101/homes/marc /mijn-nas cifs credentials=/etc/cifsmarc,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

Je moet dan ook een bestandje aanmaken waar je nas login gegevens staan

Vb /etc/cifsmarc

met onderstaande inhoud

username=xxxxxxx

password=xxxxxxx

Oude Ubuntu methode

sudo apt-get install samba 

Contents of smb.conf

---------------------------------------------------------------------------------------------------------------------------------------------------------

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of

workgroup = WORKGROUP

# server string is the equivalent of the NT Description field

server string = %h server (Samba, Ubuntu)

 

[printers]

comment = All Printers

browseable = no

path = /var/spool/samba

printable = yes

create mask = 0700

# Windows clients look for this share name as a source of downloadable

# printer drivers

[print$]

comment = Printer Drivers

path = /var/lib/samba/printers

[HP_OfficeJet_5610]

printable = Yes

printer name = HP_OfficeJet_5610

guest ok = yes

use client driver = yes

path = /var/spool/samba

printing = cups

[DATA]

path = /data/Data

guest ok = yes

[SHARED]

path = /data/Shared

guest ok = yes

read only = no

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Don't forget to set the sticky bit in the properties of your shared folders, otherwise you won't be able to access files that were put there from your linux machine, because the have the properties from the user who put them there  ???

I may be wronh here

smbpasswd nobody (empty passwd, just push enter) 

In windows, map network drive as other user (nobody)

PRINTING: install the cups printer driver on windows machines

If you want to enable colour printing from Windows edit this file before installing:

cups-windows-6.0i386cups6.ppd

as follows:

Replace the lines:

*ColorDevice: False

*DefaultColorSpace: Gray

with

*ColorDevice: True

*DefaultColorSpace: CMYK

If you have already installed the driver edit the CUPS6.PPD file under the C:WINDOWS directory the same way, delete and reinstall the printer.

You should see:

Color: Yes

In the Features box in the printer properties

 

see also http://ubuntuforums.org/showthread.php?t=202605