Difference between revisions of "Ubuntu: Generic Hints Tweaks and Tips"

From Indie IT Wiki
 
Line 35: Line 35:
  
 
'''https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu'''
 
'''https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu'''
 +
 +
=== Change systemd-resolved for DNS and AdGuard ===
 +
 +
resolved
 +
 +
If you try to run AdGuardHome on a system where the resolved daemon is started, docker will fail to bind on port 53, because resolved daemon is listening on 127.0.0.53:53. Here's how you can disable DNSStubListener on your machine:
 +
 +
Deactivate DNSStubListener and update the DNS server address. Create a new file, '''/etc/systemd/resolved.conf.d/adguardhome.conf''' (creating the /etc/systemd/resolved.conf.d directory if needed) and add the following content to it:
 +
 +
[Resolve]
 +
DNS=127.0.0.1
 +
DNSStubListener=no
 +
 +
Specifying 127.0.0.1 as the DNS server address is necessary because otherwise the nameserver will be 127.0.0.53 which doesn't work without DNSStubListener.
 +
 +
Activate a new resolv.conf file:
 +
 +
sudo mv /etc/resolv.conf /etc/resolv.conf.backup
 +
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
 +
 +
Stop DNSStubListener:
 +
 +
systemctl reload-or-restart systemd-resolved
  
 
=== Apport ===
 
=== Apport ===

Latest revision as of 12:01, 29 November 2024

In an example anything shown in bold similar the following, is not to be run.

sudo apt-get install fish # This is an example

So in the above # This is an example is not to be run in the terminal.

HOWTO: DISABLE

Cloud Init

sudo touch /etc/cloud/cloud-init.disabled

https://askubuntu.com/questions/405442/how-can-i-disable-cloud-init

Disable systemd-resolved for DNS

Disable and stop the systemd-resolved service...

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved

Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf...

dns=default

Delete the symlink /etc/resolv.conf...

sudo rm -fv /etc/resolv.conf

Restart network-manager...

sudo service network-manager restart

https://gist.github.com/zoilomora/f7d264cefbb589f3f1b1fc2cea2c844c

https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu

Change systemd-resolved for DNS and AdGuard

resolved

If you try to run AdGuardHome on a system where the resolved daemon is started, docker will fail to bind on port 53, because resolved daemon is listening on 127.0.0.53:53. Here's how you can disable DNSStubListener on your machine:

Deactivate DNSStubListener and update the DNS server address. Create a new file, /etc/systemd/resolved.conf.d/adguardhome.conf (creating the /etc/systemd/resolved.conf.d directory if needed) and add the following content to it:

[Resolve]
DNS=127.0.0.1
DNSStubListener=no

Specifying 127.0.0.1 as the DNS server address is necessary because otherwise the nameserver will be 127.0.0.53 which doesn't work without DNSStubListener.

Activate a new resolv.conf file:

sudo mv /etc/resolv.conf /etc/resolv.conf.backup
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

Stop DNSStubListener:

systemctl reload-or-restart systemd-resolved

Apport

Apport (much like the Windows Error Reporting tool) is enabled by default, to change this behaviour:

sudo nano /etc/default/apport

Edit the file to match below (changes shown in bold):

# set this to 0 to disable apport, or to 1 to enable it
# you can temporarily override this with
# sudo service apport start force_start=1
enabled=0

To re-enable just revert the 'enabled' line back to '1'

Automatic Mounting Of External Media

By default Ubuntu will automatically mount USB drives/optical disks and open them in the default file manager, to disable this behaviour:

ALT + F2, then type in gconf-editor, and press Enter

Navigate to apps >> nautilus >> preferences, then uncheck 'media_automount_open'

Gnome 2

ALT + F2, then type in gconf-editor and select.

Navigate to: apps >> nautilus (or your file manager of choice >> preferences >> media automount (untick)

Gnome 3 - Unity

ALT + F2, to bring up the Dash, then type dconf-editor and select.

Navigate to: org >> gnome >> desktop >> media-handling >> automount (untick)

DNSMasq

sudo nano /etc/NetworkManager/NetworkManager.conf

Comment out the dns=dnsmasq line using # as shown in the example below:

[main]
plugins=ifupdown,keyfile,ofono
# dns=dnsmasq

[ifupdown]
managed=false

Thanks Ubuntu Geek.

Inodes

How many are being used ...

df -i

How to clear up the usage ...

  • find which folders are the biggest
  • if this is a web site look at cache folders for Joomla and WordPress

Emptying Cache and Buffers in Linux

Clear pagecache:

echo 1 > /proc/sys/vm/drop_caches

Clear dentries and inodes:

sync; echo 2 > /proc/sys/vm/drop_caches

Clear pagecache, dentries, and inodes:

sync; echo 3 > /proc/sys/vm/drop_caches

Thanks to Server Suit

Installation Of Recommended Packages

There is a way to stop installing the so-called “recommends” packages automatically. For single packages, you should use the --no-install-recommends switch with apt-get. To turn off installing recommends for all packages, do one of the following:

  • In Synaptic, go to Settings » Preferences » tab General and uncheck “Consider recommended packages as dependencies”
  • Create the file /usr/apt/apt.conf.d/05norecommends and add the following line in the file:
APT:Install-Recommends "false"

IPv6

sudo nano /etc/modprobe.d/aliases

Find the line:

alias net-pf-10 ipv6

Replace with:

alias net-pf-10 off
alias ipv6 off

Save and close the file. Finally, reboot the system.

Thanks to Cyberciti.

Monitor Screen Power

sudo apt-get install vbetool
sudo vbetool dpms off
sudo sh -c 'vbetool dpms off; read ans; vbetool dpms on'

or

setterm --blank 1

or

sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet consoleblank=60"

Network Printer Auto Discovery - Method 1

Recent version of Ubuntu (systemd?) have added the automatic discovery of networked printers, which is a good thing, unless it is not. If you have a laptop and visit multiple locations you can end up with a barrage of printer installed for which you have no use. To disable the feature:

sudo nano /etc/cups/cups-browsed.conf

Locate:

# BrowseProtocols none

Alter to:

BrowseProtocols none

Save and exit, then:

sudo service cups-browsed restart
sudo service cups restart

A good rule of thumb is when undertaking a fresh installation is to ensure the computer is disconnected from the network, or turn off your printers!

Thanks to Ryan and Debi.

Network Printer Auto Discovery - Method 2

For Ubuntu versions 15.04+ (using systemd)

sudo systemctl stop cups-browsed
sudo systemctl disable cups-browsed
sudo systemctl start cups-browsed
sudo systemctl stop cups-browsed

Thanks to Ask Ubuntu.

Network Route 169.254.0.0

From this...

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    600    0        0 wlp58s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlp58s0
192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp58s0

To this...

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    600    0        0 wlp58s0
192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp58s0

Instructions...

sudo nano /etc/network/if-up.d/avahi-autoipd

## 2020-03-20 commented out by PCL
#if [ -x /bin/ip ]; then
#       # route already present?
#       ip route show | grep -q '^169.254.0.0/16[[:space:]]' && exit 0
#
#       /bin/ip route add 169.254.0.0/16 dev $IFACE metric 1000 scope link
#elif [ -x /sbin/route ]; then
#       # route already present?
#       /sbin/route -n | egrep -q "^169.254.0.0[[:space:]]" && exit 0
#
#       /sbin/route add -net 169.254.0.0 netmask 255.255.0.0 dev $IFACE metric 1000
#fi

sudo route del -net 169.254.0.0 netmask 255.255.0.0 dev <interface> metric 1000

Thanks to AskUbuntu

Optical Drive Auto Close

Quick fix...

sudo sysctl -w dev.cdrom.autoclose=0

...and to survive a reboot...

nano /etc/sysctl.d/60-cdrom-autoclose.conf

# do not autoclose cdrom
dev.cdrom.autoclose = 0

Snap Daemon

sudo systemctl disable snapd.autoimport.service 
sudo systemctl disable snapd.refresh.timer 
sudo systemctl disable snapd.service 
sudo systemctl disable snapd.socket 
sudo systemctl disable snapd.system-shutdown.service

Suspend Item On Session Menu

sudo nano /usr/share/polkit-1/actions/org.freedesktop.upower.policy

There are two sections in this file, the first for suspend and the second for hibernate; as shown below.

<action id="org.freedesktop.upower.suspend">
<action id="org.freedesktop.upower.hibernate">

Near the end of each section will be a line with:

<allow_active>yes</allow_active>

Change this entry from “yes” to “no” to disable hibernate/suspend.

<allow_active>no</allow_active>

Thanks Liberian Geek.

Synaptic Touchpad

synclient TouchpadOff=1 # To disable

synclient TouchpadOff=2 # To enable

List of options:

synclient -l

Output

Parameter settings: # For ease of reading the list I have put it in to alphabetical order

AccelFactor             = 0.0359777
AreaBottomEdge          = 0
AreaLeftEdge            = 0
AreaRightEdge           = 0
AreaTopEdge             = 0
BottomEdge              = 4550
CircScrollDelta         = 0.1
CircScrollTrigger       = 0
CircularPad             = 0
CircularScrolling       = 0
ClickFinger1            = 1
ClickFinger2            = 1
ClickFinger3            = 0
ClickPad                = 0
ClickTime               = 100
CoastingFriction        = 50
CoastingSpeed           = 20
CornerCoasting          = 0
EmulateMidButtonTime    = 75
EmulateTwoFingerMinW    = 7
EmulateTwoFingerMinZ    = 282
FingerHigh              = 30
FingerLow               = 25
GrabEventDevice         = 1
HorizEdgeScroll         = 0
HorizHysteresis         = 27
HorizScrollDelta        = 111
HorizTwoFingerScroll    = 1
LBCornerButton          = 0
LeftEdge                = 1781
LockedDrags             = 0
LockedDragTimeout       = 5000
LTCornerButton          = 0
MaxDoubleTapTime        = 180
MaxSpeed                = 1.75
MaxTapMove              = 244
MaxTapTime              = 180
MinSpeed                = 1
PalmDetect              = 0
PalmMinWidth            = 10
PalmMinZ                = 200
PressureMotionMaxFactor = 1
PressureMotionMaxZ      = 160
PressureMotionMinFactor = 1
PressureMotionMinZ      = 30
RBCornerButton          = 3
ResolutionDetect        = 1
RightEdge               = 5579
RTCornerButton          = 2
SingleTapTimeout        = 180
TapAndDragGesture       = 1
TapButton1              = 1
TapButton2              = 3
TapButton3              = 0
TopEdge                 = 1644
TouchpadOff             = 2
VertEdgeScroll          = 0
VertHysteresis          = 27
VertScrollDelta         = 111
VertTwoFingerScroll     = 1

Thanks to Arch Linux.

Tracker Service

The Tracker project can be found here.

sudo apt-get remove libtracker-extract-0.16-0 libtracker-miner-0.16-0 tracker-extract tracker-miner-fs tracker-utils

User Account

sudo passwd -l username

To re-enable the account:

sudo passwd -u username

White Dots On The Lightdm Log In Screen

The following creates a new user 'lightdm' and logs in to that profile so remember to use CTRL+C to return to your own profile in the terminal.

sudo xhost +SI:localuser:lightdm
sudo su lightdm -s /bin/bash
gsettings set com.canonical.unity-greeter draw-grid false

HOWTO: ENABLE

CTRL+ALT+DEL

This will turn on the keyboard reaction to a key combination of CTRL+ALT+DEL and instantly reboot the computer to confirm it IS working ...

sudo systemctl status ctrl-alt-del.target 
sudo systemctl unmask ctrl-alt-del.target 
sudo systemctl daemon-reload
sudo systemctl status ctrl-alt-del.target 
sudo systemctl start ctrl-alt-del.target 

VPN Via Command Line CLI

nmcli con
nmcli con up uuid (UUID)

Script at Shutdown or Reboot

Switch to root user ...

sudo -i

Write your script ...

nano /etc/init.d/ntfy-down.sh

#!/bin/bash
curl -s -o /dev/null -H "Title: `hostname -f`" -u ":tk_1vvuxxxxxxxxxxxxxx8aaz1bxq" -d "is shutting down." https://ntfy.mydomain.uk/xxxxxxx2JMx
exit;

Make it executable ...

chmod +x /etc/init.d/ntfy-down.sh

Write the systemd script ...

nano /etc/systemd/system/ntfy-down.service

[Unit]
Description=Ntfy at shutdown or reboot
DefaultDependencies=no
Before=shutdown.target reboot.target
[Service]
Type=oneshot
ExecStart=/etc/init.d/ntfy-down.sh
TimeoutStartSec=0
[Install]
WantedBy=shutdown.target reboot.target

Reload the systemd daemon ...

systemctl daemon-reload

Enable the script ...

systemctl enable ntfy-down.service

Created symlink /etc/systemd/system/shutdown.target.wants/ntfy-down.service → /etc/systemd/system/ntfy-down.service.
Created symlink /etc/systemd/system/reboot.target.wants/ntfy-down.service → /etc/systemd/system/ntfy-down.service.

rc.local startup script

No /etc/rc.local file in Ubuntu 18.04 fix

Force FSCK On Next Reboot

sudo touch /forcefsck
sudo reboot

BASH Command Line Smart Completion

Edit the following file and uncomment the lines shown in bold below...

sudo nano /etc/bash.bashrc

Edit the following lines:

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

Later Version 14.04 >

sudo nano /etc/bash.bashrc

    # enable bash completion in interactive shells
    if ! shopt -oq posix; then
     if [ -f /usr/share/bash-completion/bash_completion ]; then
        . /usr/share/bash-completion/bash_completion
      elif [ -f /etc/bash_completion ]; then
        . /etc/bash_completion
      fi
    fi'

The lines shown above will be commented out, uncomment them to match that shown in bold above.

Save (CTRL+o) and exit (CTRL+x)

Restart bash

exec bash

Ctrl-Alt-Backspace Disabled By Default In Xorg 9.04 onwards

The option of Ctrl+Alt+Backspace key combination to force a restart of X is now disabled by default, with the aim of eliminating the problem of accidentally triggering the key combination. The following re-enables the behaviour.

System >> Preferences >> Keyboard >> Layouts (tab)

Click the 'Layout Options' button

Click on "Key sequence to kill the X server" option to expand it

Tick the check box to enable

DVD Menu Navigation

sudo apt-get install libdvdread4
sudo /usr/share/doc/libdvdread4/install-css.sh

GRUB Boot Menu

Edit the following file:-

sudo nano /etc/default/grub

Change the lines in bold to match what is shown below:-

GRUB_DEFAULT=0
# GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

Save and close nano then run the following commands:-

sudo update-grub && sudo reboot

Linux Thermal Daemon (Intel Chipsets)

http://www.webupd8.org/2014/04/prevent-your-laptop-from-overheating.html

Screen Rotation

Via the terminal:

xrandr -o left # To rotate left

xrandr -o right # To rotate right

xrandr -o inverted # To rotate upside down

xrandr -o normal # To go back to normal

Via the GUI

sudo apt install arandr

Thanks to DebugPoint

HOWTO: FIX:

Cheese Error: can't load /usr/lib/x86_64-linux-gnu/spa/support/libspa-support.so

sudo apt install pipewire -y
sudo ldconfig
cheese

LOW Disk Space Eaten By SystemD Logs

sudo -i
journalctl --disk-usage
journalctl --verify
journalctl --vacuum-size=50M

Another option as mentioned in comments is to set SystemMaxUse=50M in /etc/systemd/journald.conf

https://askubuntu.com/questions/1012912/systemd-logs-journalctl-are-too-large-and-slow

apt-key Deprecation Warning

https://www.omgubuntu.co.uk/2022/06/fix-apt-key-deprecation-error-on-ubuntu

Broken Ubuntu Linux Install

sudo rm /var/lib/apt/lists/lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a
sudo apt clean
sudo apt update --fix-missing
sudo apt install -f
sudo dpkg --configure -a
sudo apt upgrade
sudo apt dist-upgrade
sudo reboot

Fix errors in sudoers file using pkexec command

Error in Sudoers file? Here's how you can fix it.

pkexec visudo -f /etc/sudoers

Disk Usage in /var/log/journal

This folder is used by journald to log everything, and can grow to 1 or 2 Gb in size. To prevent this, set the SystemMaxUse parameter to a smaller amount...

journalctl --disk-usage
journalctl --vacuum-size=100M
sudo nano /etc/systemd/journald.conf
  SystemMaxUse=100M
  MaxLevelStore=notice
  MaxLevelSyslog=notice
systemctl restart systemd-journald

ERROR: E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

sudo dpkg --remove --force-remove-reinstreq package
sudo apt-get update
sudo apt-get check
sudo apt-get autoclean
sudo apt-get autoremove
sudo apt-get clean

https://askubuntu.com/questions/525088/how-to-delete-broken-packages-in-ubuntu

ERROR: ubuntu boot failed device or resource busy

Possibly a hard disk fault or the fact that the initraamfs has not given enough time for the RAID devices to assemble properly.

The fix is to add a delay to the boot process.

  1. Hold the right SHIFT key down to bring up the GRUB menu
  2. Select 'Advanced options for Ubuntu...'
  3. Choose 'Ubuntu Recovery Mode'
  4. Press the e key
  5. Add rootdelay=90 on the line just before the root= part
  6. Press F10 to boot into Recovery Mode
  7. FSCK the disks
  8. Drop to root prompt
  9. reboot
  10. Repeat for normal 'Ubuntu' line
  11. When properly booted, do the following...
sudo -i
echo "sleep 60" > /etc/initramfs-tools/scripts/init-premount/delay_for_raid_array_to_build_before_mounting
chmod a+x /etc/initramfs-tools/scripts/init-premount/delay_for_raid_array_to_build_before_mounting
update-initramfs -u
reboot

Thanks to Ubuntu Forums.

Thanks to Linuxtopia.

Printing Issues in 20.04

https://askubuntu.com/questions/1233521/printer-problems-after-installing-ubuntu-20-04

ERROR: systemd-resolved[739]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001

sudo -i
cd /etc
rm resolv.conf
ln -s /run/systemd/resolve/resolv.conf resolv.conf
systemctl restart systemd-resolved.service

ERROR: failed to execute shell

Error...

failed to execute shell: bash -c /usr/share/lighttpd/create-mime.assign.pl: No such file or directory
failed to execute shell: bash -c /usr/share/lighttpd/include-conf-enabled.pl: No such file or directory

Reason...

Because the Ubuntu Release Upgrader has removed PHP during the upgrade process. God knows why.

Solution...

Reinstall the PHP CGI module and the PHP MySQL module.

Fix...

sudo apt-get install php-cgi php-mysql
sudo lighty-enable-mod fastcgi-php
sudo service lighttpd restart

ERROR: unmet dependencies "No space left on device"

Try this command first...

sudo apt-get autoclean
sudo apt-get autoremove

Check to see if you have WAY too many kernels installed! List your kernels with...

sudo apt list --installed | grep 'linux'

Then, remove all of them apart from the latest one you have running now.

sudo uname --kernel-release
sudo dpkg --remove linux-headers-4.4.0-71 linux-headers-4.4.0-71-generic xxxxxx
df -H
sudo apt-get -f install

ERROR: Failed to fetch bzip2:/var/lib/apt/lists/partial/gb.archive.ubuntu.com

Problem...

sudo apt-get update
Failed to fetch bzip2:/var/lib/apt/lists/partial/gb.archive.ubuntu.com_ubuntu_dists_precise_main_source_Sources  Hash Sum mismatch

Fix...

sudo rm -fR /var/lib/apt/lists/*
sudo apt-get update

Missing Items and/or Icons System Settings

sudo apt-get install --reinstall gnome-control-center
sudo apt-get install --reinstall gnome-settings-daemon-schemas
sudo apt-get install --reinstall unity-control-center
sudo apt-get install activity-log-manager-control-center
sudo apt-get install unity-control-center-signon gnome-control-center-unity
sudo apt-get install ubuntu-desktop

Upgrade Items, The following packages have been kept back

When trying to upgrade the system via the terminal you may receive a message similar to the one below:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
 banshee banshee-extension-mirage
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

To force the upgrade of the packages that have been held back run the following:

sudo aptitude safe-upgrade

Aptitude will need to be installed, currently up to and including 10.04 it comes as standard however from the release of 10.10 it will not be included by default, to install it:

sudo apt-get install aptitude

HOWTO: INSTALL

Latest Mainline Kernel

https://wiki.ubuntu.com/Kernel/MainlineBuilds

http://kernel.ubuntu.com/~kernel-ppa/mainline/?C=M;O=D

Latest Approved Kernel

2022-08-04 10:44:47

This will give you the newest available Ubuntu approved Linux kernel for your distribution, which is often not the one that is installed by default. There will be bug fixes and speed improvements. The example below installs the newest available kernel for 22.04 LTS

Update the package list ...

sudo apt-get update

Check if there is anything newer ...

sudo apt-cache search linux-generic | egrep -o '[0-9].*-generic' | sort -t. -n -k2 | uniq | tail -1
sudo uname -r

List and install the newest kernel files ...

sudo apt-cache search linux-generic
sudo apt-get install linux-image-5.15.0-43-generic linux-headers-5.15.0-43-generic linux-modules-5.15.0-43-generic linux-modules-extra-5.15.0-43-generic

Update your bootloader ...

sudo update-grub
sudo update-initramfs -t -u -k all

Reboot the system ...

sudo reboot

Check your kernel version again ...

sudo uname -r

Thanks - https://www.cyberciti.biz/faq/installing-latest-stable-mainline-linux-kernel-on-ubuntu-with-apt-get/

Spectre Meltdown Checker

https://github.com/speed47/spectre-meltdown-checker/releases/latest

Fix for Intel Chipset

Latest Firmware: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The latest Linux Kernel (5.4) will most likely need a newer Firmware for your chipset, otherwise Video, Wireless and USB will not work!

UPDATE JUNE 2020

GUC 9.4

Error...

update-initramfs: Generating /boot/initrd.img-5.4.0-31-generic
W: Possible missing firmware /lib/firmware/i915/tgl_dmc_ver2_04.bin for module i915
W: Possible missing firmware /lib/firmware/i915/skl_guc_33.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_33.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_33.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/glk_guc_33.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_33.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/icl_guc_33.0.0.bin for module i915

Fix...

cd /lib/firmware/i915/
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/bxt_guc_33.0.0.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/cml_guc_33.0.0.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/ehl_guc_33.0.4.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/glk_guc_33.0.0.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/icl_guc_33.0.0.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/kbl_guc_33.0.0.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/skl_guc_33.0.0.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/tgl_dmc_ver2_04.bin
sudo update-initramfs -k all -u

GUC 9.2 and GUC 9.3

Error...

update-initramfs: Generating /boot/initrd.img-4.16.0-041600-generic
W: Possible missing firmware /lib/firmware/i915/skl_dmc_ver1_27.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_dmc_ver1_04.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_39.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver9_29.bin for module i915
W: Possible missing firmware /lib/firmware/i915/skl_guc_ver9_33.bin for module i915

Fix...

cd /lib/firmware/i915/
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/skl_dmc_ver1_27.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/kbl_dmc_ver1_04.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/kbl_guc_ver9_39.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/bxt_guc_ver9_29.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/skl_guc_ver9_33.bin
sudo update-initramfs -k all -u

GUC 9.1

Error...

update-initramfs: Generating /boot/initrd.img-4.15.0-041500-generic
W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_14.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver8_7.bin for module i915

Fix (only for Kabylake chipset)...

Run the following lines of code from the command line...

cd /tmp/
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kblgucver914.tar_1.bz2
tar xvjf kblgucver914.tar_1.bz2 && cd kbl_guc_ver9_14/ && sudo ./install.sh
cd ..
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/bxtgucver87.tar_0.bz2
tar xjvf bxtgucver87.tar_0.bz2 && cd bxt_guc_ver8_7/ && sudo ./install.sh
cd ..
sudo update-initramfs -u -k all
sudo reboot

https://01.org/linuxgraphics/downloads/firmware

DMC 1.01

Error...

update-initramfs: Generating /boot/initrd.img-4.10.0-27-generic
W: Possible missing firmware /lib/firmware/i915/kbl_dmc_ver1_01.bin for module i915

Fix (only for Kabylake chipset)...

Run the following lines of code from the command line...

cd /tmp/
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/sklgucver61.tar.bz2
tar xvjf sklgucver61.tar.bz2 && cd skl_guc_ver6_1/ && sudo ./install.sh
cd ..
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kbldmcver101.tar.bz2
tar xjvf kbldmcver101.tar.bz2 && cd kbl_dmc_ver1_01/ && sudo ./install.sh
cd ..
sudo update-initramfs -u -k all
sudo reboot

https://01.org/linuxgraphics/downloads/firmware

Install Group Software (tasks) such As DNS / Web Server In A Single Click

sudo tasksel

Thanks - http://www.cyberciti.biz/faq/tasksel-install-group-software-in-command-line/

exFAT Support

sudo apt install exfat-utils exfat-fuse

Behind A Proxy

Thanks - http://ask.xmodulo.com/install-ubuntu-desktop-behind-proxy.html

.deb Files

sudo dpkg -i filename.deb
or
sudo dpkg -i --force-depends *.deb

Download But Not Install A Package

sudo aptitude download package-name

Fonts

Up to and including 09.04 - copy the font file to /usr/share/fonts/ directory and run

fc-cache -f -v

09.10 - copy the font file to /usr/share/fonts/ directory and run

From and including 10.04 - right click on font and choose install OR double click and press Install button

Icon Sets

If required unzip your icons set and then copy the folder using the command below in a terminal:

sudo cp -r <the_name_of_your_icon_set> /usr/share/icons

mesa-utils

mesa-utils provides several basic GL utilities, including glxinfo and glxgears.

sudo apt-get install mesa-utils

Restricted Addons & Extras

sudo aptitude install ubuntu-restricted-addons ubuntu-restricted-extras

Microsoft TrueType Core Fonts

sudo aptitude install ttf-mscorefonts-installer

HOWTO: MODIFY:

Locale

http://wiki.indie-it.com/wiki/Ubuntu_Server#Locale

Default Text Editor System Wide

sudo update-alternatives --config editor

The available alternatives will be displayed, enter its number and press return.

HOWTO: UPDATE:

Without Asking About Asking

export DEBIAN_FRONTEND=noninteractive ; apt-get dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes

Upgrade or Dist-Upgrade

Ubuntu_Server#APT-GET_UPGRADE_OR_APT-GET_DIST-UPGRADE.3F

A Single Package Using Aptitude

sudo aptitude safe-upgrade 'packagename'

A Package Group Using Aptitude

sudo aptitude safe-upgrade '~ipartofpackagename'
e.g.
sudo aptitude safe-upgrade -v -s '~iclamav'
sudo aptitude safe-upgrade -y '~iclamav'

HOWTO: UNINSTALL:

Old Versions Of Snap Packages

Save this file as snaps_clean.sh and run it as root ...

#!/bin/bash
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
  while read snapname revision; do
    snap remove "$snapname" --revision="$revision"
  done
exit;

Old Kernel Versions

Check which are 'automatically' installed...

sudo apt-mark showauto 'linux-image-.*'

Check which are 'manually' installed...

sudo apt-mark showmanual 'linux-image-.*'

Remove a 'automatically' installed kernel...

sudo apt-get autoremove --purge

Remove a 'manually' installed kernel...

sudo dpkg --purge linux-image-4.10.0-27-generic linux-image-extra-4.10.0-27-generic 

https://help.ubuntu.com/community/RemoveOldKernels

A Deb Package Without Removing Its Dependencies

Do not use aptitude, use dpkg instead...

sudo dpkg --remove packagename

Packages With Matching Name

sudo aptitude purge '~npackagename'

sudo aptitude purge '~nabiword' # Using Abiword as an example

HOWTO: INFO:

See Journal Log Entries Between Dates

sudo journalctl --since "2024-10-25 11:00:00" --until "2024-10-25 12:00:05"

Verify Network Interface Card NIC Speed

sudo ethtool eth0 | grep Speed

Quickly Access Your Recent Documents

thingy

Date Package Installed

sudo zgrep 'install ' /var/log/dpkg.log* | cut -f2,4 -d':' | sort -d

List Largest Software Packages

sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head -20

Then, you can remove them with ...

sudo apt -y remove packagename

INXI Information Script

Installation

sudo apt install inxi

Display Information

inxi --graphics

Full System Information

sudo inxi --full

Change User Password In Single User Mode

https://www.linux-magazine.com/Online/Features/Resetting-Passwords-with-SystemRescueCd

Alternative To Net Tools

Examples for deprecated commands and their replacements:

arp → ip n (ip neighbor)
ifconfig → ip a (ip addr), ip link, ip -s (ip -stats)
iptunnel → ip tunnel
iwconfig → iw
nameif → ip link, ifrename
netstat → ss, ip route (for netstat -r), ip -s link (for netstat -i), ip maddr (for netstat -g)

The netstat command reads various /proc files to gather information. However this approach falls weak when there are lots of connections to display. This makes it slower. The ss command gets its information directly from kernel space. The options used with the ss commands are very similar to netstat making it an easy replacement.

Statistics provided by ss are superficial but it is considered the better alternative to netstat

Examples

https://linuxize.com/post/check-listening-ports-linux/#check-listening-ports-with-ss

sudo ss -tunlp

ss | less  # get all connections
ss -t      # get tcp connections not in listen mode (server programs)
ss -u      # get udp connections not in listen mode
ss -x      # get unix socket pipe connections
ss -ta     # get all tcp connections
ss -au     # get all udp connections
ss -nt     # all tcp without host name
ss -ltn    # listening tcp without host resolution
ss -ltp    # listening tcp with PID and name
ss -s      # prints statstics
ss -tn -o  # tcp connection with domain host and show keepalive timer
ss -tl4    # ip4 connections

Crontabs For All Users

cat /etc/passwd | cut -f 1 -d : |xargs -I {} crontab -l -u {}

DNS Check

systemd-resolve --status

Lock Version Of Package

sudo apt-get install libssl1.1=1.1.1-1ubuntu2.1~18.04.4
sudo apt-mark hold libssl1.1

Thanks

Debian Package Manager dpkg

https://www.tecmint.com/dpkg-command-examples/

Start or Stop Services

https://askubuntu.com/questions/19320/how-to-enable-or-disable-services#19324

Graphics Chipset

inxi -G

Taken from...

NAME
      inxi  - Command line system information script for console and IRC

SYNOPSIS
      inxi  - Single line, short form. Very basic output.

      inxi [-AbCdDfFGhHiIlmMnNopPrRsSuw] [-c NUMBER] [-v NUMBER]

      inxi [-t (c or m or cm or mc NUMBER)] [-x -OPTION(s)] [-xx -OPTION(s)] [-xxx -OPTION(s)]

      inxi [--help] [--recommends] [--version] [-@ NUMBER]

Boot Time Hogs

sudo systemd-analyze blame | head -n20

The 3 Different Ways To Start Services In Ubuntu

  • SysV
  • Upstart
  • SystemD

Thanks - http://askubuntu.com/questions/19320/how-to-enable-or-disable-services

Location Of Package Files

/var/cache/apt/archives/

View Package Changelog

sudo apt-get changelog packagename

Scan For Wireless WiFi SSIDs On Command Line

sudo iwlist wlan0 scanning | egrep 'Cell |Encryption|Quality|Last beacon|ESSID'

Thanks - http://askubuntu.com/questions/75625/how-do-i-scan-for-wireless-access-points

Nice Documentation On Package Management

http://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/

Learn What The Aptitude Results Mean

i: Installed package
c: Package not installed, but package configuration remains on system
p: Purged from system
v: Virtual package
B: Broken package
u: Unpacked files, but package not yet configured
C: Half-configured - Configuration failed and requires fix
H: Half-installed - Removal failed and requires fix

Thanks to Server Guide

Clear The Apt Get Cache

To clear the unused downloaded packages:

sudo apt-get autoclean

To clear all downloaded packages:

sudo apt-get clean

Handy Commands To Run

After a basic install and addition of repositories the following are handy commands to run:

sudo apt-get dist-upgrade
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get update && sudo apt-get --yes upgrade && sudo aptitude -y safe-upgrade

Take A Video Capture Of Your Desktop

ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 -flags gray /tmp/outputFile.mpg

Ubuntu Versions

   Ubuntu 16.04 is xenial
   Ubuntu 15.10 is wily
   Ubuntu 15.04 is "vivid"
   Ubuntu 14.10 is "utopic"
   Ubuntu 14.04.* is "trusty"
   Ubuntu 13.10 is "saucy"
   Ubuntu 13.04 is "raring"
   Ubuntu 12.04.* is "precise"
   Ubuntu 11.10 is "oneiric"
   Ubuntu 11.04 is "natty"
   Ubuntu 10.10 or Trisquel 4.5 is "maverick"
   Ubuntu 10.04 or Trisquel 4.0 is "lucid"
   Ubuntu 9.10 or Trisquel 3.5 is "karmic"
   Ubuntu 9.04 is "jaunty"
   Ubuntu 8.10 is "intrepid"
   Ubuntu 8.04 is "hardy"
   Debian Etch is "etch"
   Debian Lenny is "lenny"

HOWTO: LIST:

Network Connections

nmcli con

Pending Updates

Nice output...

sudo /usr/lib/update-notifier/apt-check --human-readable

Database output...

sudo /usr/lib/update-notifier/apt-check

This, combined with cron-apt and a daily script will do nicely...

sudo apt-get install cron-apt
sudo nano /etc/cron-apt/config
  MAILON="never"

Applications Where Their Components Are Installed

The first step below will help you identify the system name for the software, that is what the operating systems sees it as not what your call it. In this example we are using Adobe's Flash.

sudo dpkg -l | grep flash

The returned out put will look similar to this:

ii  adobe-flashplugin 11.2.202.228-0oneiric1 Adobe Flash Player plugin version 11

Next:

sudo dpkg -L adobe-flashplugin

The output generated will look similar to the following:

/.
/usr
/usr/lib
/usr/lib/xulrunner
/usr/lib/xulrunner/plugins
/usr/lib/xulrunner-addons
/usr/lib/xulrunner-addons/plugins
/usr/lib/mozilla
/usr/lib/mozilla/plugins
/usr/lib/iceape
/usr/lib/iceape/plugins
/usr/lib/iceweasel
/usr/lib/iceweasel/plugins
/usr/lib/firefox
/usr/lib/firefox/plugins
/usr/lib/midbrowser
/usr/lib/midbrowser/plugins
/usr/lib/adobe-flashplugin
/usr/lib/adobe-flashplugin/libflashplayer.so
/usr/share
/usr/share/icons
/usr/share/icons/hicolor
/usr/share/icons/hicolor/32x32
/usr/share/icons/hicolor/32x32/apps
/usr/share/icons/hicolor/32x32/apps/flash-player-properties.png
/usr/share/icons/hicolor/22x22
/usr/share/icons/hicolor/22x22/apps
/usr/share/icons/hicolor/22x22/apps/flash-player-properties.png
/usr/share/icons/hicolor/24x24
/usr/share/icons/hicolor/24x24/apps
/usr/share/icons/hicolor/24x24/apps/flash-player-properties.png
/usr/share/icons/hicolor/16x16
/usr/share/icons/hicolor/16x16/apps
/usr/share/icons/hicolor/16x16/apps/flash-player-properties.png
/usr/share/icons/hicolor/48x48
/usr/share/icons/hicolor/48x48/apps
/usr/share/icons/hicolor/48x48/apps/flash-player-properties.png
/usr/share/pixmaps
/usr/share/doc
/usr/share/doc/adobe-flashplugin
/usr/share/doc/adobe-flashplugin/copyright
/usr/share/doc/adobe-flashplugin/changelog.Debian.gz
/usr/share/pixmaps/flash-player-properties.png

Repositories and Back Up The Listing

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup # Or to your desired location

Software Dependencies - or What Associated Packages Does A Programme Rely On?

First you will need to install an additional package:

sudo apt-get install apt-rdepends

Once installed in a terminal:

apt-rdepends <packagename>

For example:

apt-rdepends remmina

Most packages will output more data than the standard settings for the terminal will allow, in these instances you can use the pipe command:

apt-rdepends apache2 | more
apt-rdepends apache2 | less

Services Running

service --status-all

Installed Packages And Use It To Reinstall Packages

sudo dpkg --get-selections | grep -v deinstall > ubuntu-files

The file 'ubuntu-files' is created in the root directory of your home folder, save it to a safe place like a USB drive.

Installing packages on another Ubuntu installation.

When you have finished and rebooted, run the following commands to update...

sudo apt-get update
sudo apt-get dist-upgrade

Now copy that special file from your USB drive to the root directory of your home folder, and run the following commands to set the list of software you wish to install to match the first PC...

dpkg --set-selections < ubuntu-files
sudo dselect

Reboot and enjoy the extra time you just saved... :-)

HOWTO: ALTER:

Screen Resolution with HDMI External Monitor

Samsung TV UE49KU6400

xrandr --output HDMI-1 --mode 1440x900

Command Line Aliases

Open a terminal and edit the .bash_aliases file:

nano ~/.bash_aliases

Edit or add the following lines:

alias egrep='egrep --color=auto'
alias empty='rm -rf ~/.local/share/Trash/files/*'
alias fgrep='fgrep --color=auto'
alias get='get_iplayer/get_iplayer'
alias grep='grep --color=auto'
alias hg='history |grep'
alias install='sudo apt-get install'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -lah'
alias ls='ls --color=auto'
alias myip='curl ifconfig.me'
alias ping='ping -c3 -n -i 0.2 -W1'
alias pingg='ping www.google.co.uk'
alias pingp='ping www.paully.co.uk'
alias pingm='ping 10.0.0.1'
alias pings='ping 192.168.0.1'
alias rav='rsync -a -v'
alias remove='sudo apt-get autoremove'
alias rm='rm -iv'
alias search='sudo apt-cache search'
alias ss='gksudo software-properties-gtk'
alias sshg='ssh username@server1.yourserver.com'
alias update='sudo apt update'
alias list='sudo apt list --upgradable'
alias upgrade='sudo apt upgrade'
alias uu='sudo apt update && sudo apt upgrade'
alias uuf='sudo apt update && sudo apt dist-upgrade'

Reload the file:

source ~/.bashrc

To confirm the entries:

alias

Buttons Location On Window

http://www.howtogeek.com/howto/13535/move-window-buttons-back-to-the-right-in-ubuntu-10.04/

Hostname (or what the computer is called) Up To 12.10

The name needs to be changed in the 'hostname' and 'hosts' files.

sudo nano /etc/hostname

Edit the name displayed and required, save changes (CTRL+o) then exit (CTRL+x)

sudo nano /etc/hosts

127.0.0.1       localhost.localdomain   localhost
127.0.1.1       machine_name_1.fish   machine_name_1

Edit the system name to match that which was entered in the 'hostname' file, save changes (CTRL+o) then exit (CTRL+x)

The line starting 127.0.1.1 is required on an Ubuntu system.

Exit the terminal and reboot the system.

Hostname (or what the computer is called) 16.04 (systemd)

sudo hostnamectl set-hostname new_machine_name

MeMenu Displayed Name

To remove the name from the MeMenu altogether:

gconftool -s /system/indicator/me/display --type int 0

To show your real name/’about me’ name:

gconftool -s /system/indicator/me/display --type int 2

To display the default account username:

gconftool -s /system/indicator/me/display --type int 1

Thanks to OMG Ubuntu.

Panel Icons And Applets Defaults For A New User

sudo nano /usr/share/gconf/defaults/05_panel-default-setup.entries

For example, to remove the Workspace Switcher Applet, delete these lines...

         <value>
           <string>workspace_switcher</string>
         </value>

 <-- Workspace Switcher Applet -->

   <entry>
     <key>applets/workspace_switcher/object_type</key>
     <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
     <value>
       <string>bonobo-applet</string>

     ...and all the rest up to (but not including) <-- TrashApplet Applet -->

Save and exit the editor, then run...

sudo update-gconf-defaults

Reboot and add a new user to test.

Update Manager Default Behaviour 9.04 onwards

In previous versions of Ubuntu the Update Manager has displayed an icon in the notification area when updates are available. In 9.04/Jaunty this has been replaced by the Update Manager opening a window, if you find this an intrusion there are two methods to revert its behaviour.

Method One:

gconftool -s --type bool /apps/update-notifier/auto_launch false

To revert the behaviour:

gconftool -s --type bool /apps/update-notifier/auto_launch true

Method Two:

Type 'Alt+F2' to open the run dialogue and enter the following:

gconf-editor

In the right-hand pane navigate to

apps --> update-notifier

In the right-hand pane locate 'auto_launch' and unchecked the tick box.

To revert the behaviour simply repeat the above step, but place a check in the auto_launch box.

HOWTO: TERMINAL/CLI:

Open The Additional Drivers Window

sudo software-properties-gtk --open-tab=4

Switch to Root User

sudo su - root

Enter the password for the user profile you are in.

Burning a CD with Wodim

Scan for the drive...

wodim --devices

wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
0  dev='/dev/scd0'	rwrw-- : 'HL-DT-ST' 'BDDVDRW GGC-H20L'
-------------------------------------------------------------------------

or

wodim -scanbus

scsibus2:
	2,0,0	200) 'HL-DT-ST' 'BDDVDRW GGC-H20L' '1.03' Removable CD-ROM
	2,1,0	201) *
	2,2,0	202) *
	2,3,0	203) *
	2,4,0	204) *
	2,5,0	205) *
	2,6,0	206) *
	2,7,0	207) *

What media or type of disc do I have in the drive?

wodim dev=/dev/scd0 -v -atip

Now burn the CD...

wodim dev=/dev/scd0 -v -data cd_image.iso

or

wodim dev=2,0,0 -v -data cd_image.iso

HOWTO: FIND:

A Package Installed

aptitude search pulseaudio | grep ^i

All Packages Installed

aptitude search '~i!~M'

What CPU Am I Running?

getconf LONG_BIT # Method 1
uname -m  # Method 2
cat /proc/cpuinfo  # Method 3

Thanks to Cyberciti.

What Files Are In The Package X?

apt-file list ffmpeg

or

dpkg-query -L ffmpeg

Why A Package Has Been Installed

sudo aptitude why <packagename>

What Package Is That File In?

dpkg -S whatever

Example

dpkg -S xfce4-terminal
xfce4-terminal: /usr/bin/xfce4-terminal

or

sudo apt-get install apt-file
sudo apt-file update
apt-file search whatever

Example:

which xfce4-terminal
/usr/bin/xfce4-terminal
apt-file search /usr/bin/xfce4-terminal
xfce4-terminal: /usr/bin/xfce4-terminal
xfce4-terminal: /usr/bin/xfce4-terminal.wrapper
xfce4-terminal-dbg: /usr/lib/debug/usr/bin/xfce4-terminal

Which Version Of A Software Package Am I Running?

apt-cache showpkg <package_name>

Replace <package_name> with the name of the package you are investigating, for example to find the version of OpenVPN:

apt-cache showpkg openvpn

Which Version Of Ubuntu Linux Am I Running?

cat /etc/lsb-release

or

cat /etc/issue

or

uname -a && cat /etc/*release

or

lsb_release -a

or

hostnamectl

NETWORKING

HOWTO: NETWORK CARD NAMING:

Renaming On Post 15.10 Systems

First determine the names of your network cards:

ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 61:a3:5c:ad:08:f6 brd ff:ff:ff:ff:ff:ff

In the above example the physical network card is name by systemd/udev as enp3s0.

To alter the name to something more conventional:

sudo nano /etc/udev/rules.d/10-network.rules

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="61:a3:5c:ad:08:f6″,KERNEL=="enp3s0″, NAME="eth1″

The above command replaces then name of the network card issued by the kernel to a friendly name.

Save the file and reboot the system.

Thanks to Ubuntu Geek.

Post System Cloning

After cloning one system to another Ubuntu will see the new PC's network card as 'eth1' as well as retaining the details of the original card. To reset all the network details undertake the following:

> /etc/udev/rules.d/70-persistent-net.rules
reboot

HOWTO: STATIC IP ADDRESS:

Up To 11.04

sudo nano /etc/network/interfaces

Edit the file to read (this example uses 192.168.0.100 for the system and Google's DNS servers):

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4

Save and close the file, then restart the network:

sudo /etc/init.d/networking restart

Edit the 'hosts' file:

sudo nano /etc/hosts

Edit the file to read (Desktop used for this example):

127.0.0.1       localhost.localdomain   localhost
192.168.0.100   Desktop.example.com     Desktop

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Then run:

sudo echo Desktop.example.com > /etc/hostname
sudo /etc/init.d/hostname restart

Check the configuration:

hostname
hostname -f

Both of the above commands should return:

Desktop.example.com

At this point it is possible to remove Network Manager:

sudo gedit /etc/NetworkManager/NetworkManager.conf

Edit the [ifupdown] line to read:

managed=true

Finally remove Network Manager and if you are not using a wireless network card wpasupplicant:

sudo apt-get purge network-manager
sudo apt-get remove wpasupplicant

11.10 onwards

http://adamish.com/blog/archives/315

HOWTO: FIX:

eth0 Missing With NFS Mount

http://www.cyberciti.biz/faq/setting-up-an-network-interfaces-file/

/etc/network/interfaces

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

SOUND

DISABLE:

PulseAudio From Auto Starting

pulseaudio is a stubborn little daemon. man pulseaudio says you can turn it off with the command pulseaudio --kill. But it won't stay killed-- it respawns itself. There is a normal init script to start it at boot, /etc/rc2.d/S50pulseaudio. But when you try controlling this the normal Linux way it doesn't work, because running /etc/init.d/pulseaudio stop doesn't stop it. Removing /etc/rc2.d/S50pulseaudio doesn't prevent it from starting at boot.

To stop its respawning habit, open /etc/pulse/client.conf, change autospawn = yes to autospawn = no, and set daemon-binary to /bin/true. Make sure these lines are uncommented, like this:

autospawn = no
daemon-binary = /bin/true

Login Sound

Method One

sudo -u gdm gconftool-2 --set /desktop/gnome/sound/event_sounds --type bool false

Method Two

System --> Preferences --> Startup Applications --> Startup Programs (tab)

Locate and untick 'GNOME Login Sound' entry

FIX:

ALSA + NVIDIA + ION + HDMI

Unmute all the S/PDIF + S/PDIF Default + S/PDIF 1.

alsamixer

Test to make sure your hardware works first.

aplay -D plughw:0,3 /usr/share/sounds/alsa/Noise.wav

Add the following contents to the file /etc/asound.conf.

pcm.!default {
type plug
slave.pcm {
type hw
card 0
device 3
}
}

Retest it with the following command.

aplay /usr/share/sounds/alsa/Noise.wav

MODIFY:

Sound Menu Default Player

To add media players to the Ubuntu sound menu do:


gsettings set com.canonical.indicator.sound interested-media-players “['media_player']“

To remove media players from the Ubuntu sound menu do:

gsettings set com.canonical.indicator.sound blacklisted-media-players “['media_player']“

Replace 'media_player' with the programme you want to add.

Examples:

Rhythmbox:

gsettings set com.canonical.indicator.sound interested-media-players "['rhythmbox']"

VLC:

gsettings set com.canonical.indicator.sound interested-media-players "['vlc']"

Banshee:

gsettings set com.canonical.indicator.sound interested-media-players "['banshee']"

THEME

HOWTO: SET: Gnome Theme For New Users

sudo nano /usr/share/gconf/defaults/16_ubuntu-artwork

From...

/desktop/gnome/interface/gtk_theme      Ambiance
/desktop/gnome/interface/icon_theme     ubuntu-mono-dark
/desktop/gnome/peripherals/mouse/cursor_theme   DMZ-White
/apps/metacity/general/theme    Ambiance

To... (for example Clearlooks)

/desktop/gnome/interface/gtk_theme      Clearlooks
/desktop/gnome/interface/icon_theme     gnome
/desktop/gnome/peripherals/mouse/cursor_theme   default
/apps/metacity/general/theme    Clearlooks

Save and exit the editor, then run...

sudo update-gconf-defaults

Reboot and add a new user to test.

Have Synaptic Package Manager Use A GTk Theme

If you have set your profile to use a GTk theme when you open the Synaptic Package Manager (SPM) the theme will not be used. This is because essentially it is being run as root so to have it use the theme undertake the following:

sudo cp -r /home/username/.themes/your_GTk_theme/ /usr/share/themes/

HOWTO: do-release-upgrade

Upgrade Policy

Check the file /etc/update-manager/release-upgrades. Prompt=normal is needed when upgrading from any version to a newer version, Prompt=never will never upgrade your OS. Prompt=lts will make sure you upgrade from LTS to LTS. You need to be root to edit this file.

sudo nano -w /etc/update-manager/release-upgrades

Testing

sudo do-release-upgrade -s

HOWTO: Use Ubuntu Nemo File Manager With Specific User Name

Type the following into the address bar of Nemo...

smb://username@123.456.789.0/sharedfolder/

HOWTO: See The Contents Of A Downloaded Debian Package File

sudo dpkg-deb -c package-file.deb

HOWTO: Run A Command On System Startup As Another User

Edit /etc/rc.local and add a line like the following...

# mpdscribble
su -c 'mpdscribble' paully &

# last line
exit 0

http://askubuntu.com/questions/90406/startup-script-for-a-specific-user-on-ubuntu-server

HOWTO: Stop

Blacklist Modules On Grub Boot

You can also blacklist modules from the bootloader.

Simply add modprobe.blacklist=modname1,modname2,modname3 to your bootloader's kernel-line parameter list.

To do this, press the RIGHT SHIFT key on Ubuntu Boot to show the GRUB Menu. Press the e key to edit, then add the modprobe.blacklist=modulename to the end of the kernel line...

linux /boot/vmlinuz-3.8.0-32-generic root=UUID=1726742d-f8ff-4fd2-a0e3-75c1dd57b65a ro noquiet nosplash modprobe.blacklist=wl

...then press CTRL+X to boot with these temporary options.

X Server

Method A

To disable gdm from running during boot, you can either boot with the "text" boot parameter or disable the rc service like this:-

sudo update-rc.d -f gdm remove
sudo update-rc.d -f x11-common remove

Then to re-enable it later:-

sudo update-rc.d gdm defaults
sudo update-rc.d x11-common defaults

This option is useful if gdm or X locks up the system during boot, or if you wish to run X in complete isolation from gdm.

https://wiki.ubuntu.com/X/NonGraphicalBoot

Method B

sudo nano /etc/default/grub

Change the following lines:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="text"

to:

# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="text"
sudo update-grub
sudo reboot

File --> Open --> Cannot See Hidden Files

By default the 'Open' dialogue window does not show hidden files or folders.

To display them press CTRL+H.

This will then temporarily display the hidden files and folders, they will revert to hidden the next time the 'Open' dialogue is used.

Keyboard Indicator

Allow you to add an indicator applet to the Gnome panel which will show whether your Caps, Scroll or Page Lock keys are inactive or active. It is also configurable to show only those keys you are interested in, for instance on my ThinkPad Edge I am only interested in the Caps Lock.

In a terminal:

sudo apt-get install lock-keys-applet
killall gnome-panel

Right click the Gnome panel, click "Add to panel" and add the "Lock Keys" applet. To configure right-click on the applet and select 'Preferences'.

Keyboard Shortcut: Alt+` (or Alt+ the key to the left (on a UK keyboard [correctly known as the Grave accent key]) of the Number 1 Key

This appears to work in Gnome 3 and Unity. Pretty much everyone knows the classic Alt+Tab to scroll through the list of open applications, however using Alt+` will scroll through the open parent and child windows of a particular programme, e.g. Evolution mail with an opened message and a compose window.

Backup / Clone System

On old system...

sudo -i
cd /
tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev /

...then copy the backup.tar.gz to a usb disk drive.

On new system, boot from SystemRescueCD...

mkdir /mnt/sda1
mkdir /mnt/usb
mount /dev/sda1 /mnt/sda1
mount /dev/sdb1 /mnt/usb
tar -xzvpf /mnt/usb/backup.tar.gz -C /mnt/sda1/
mkdir /mnt/sda1/{dev,lost+found,mnt,media,proc,sys}
blkid >> /mnt/sda1/etc/fstab
nano /mnt/sda1/etc/fstab
mount -t proc none /mnt/sda1/proc
mount -o bind /dev /mnt/sda1/dev
chroot /mnt/sda1 /bin/bash
grub-install /dev/sda
update-grub
exit
reboot

The section in bold is where you fix the hard drive UUIDs so that the system will boot.

https://help.ubuntu.com/community/BackupYourSystem/TAR

HOWTO: Run A Script When Computer Is Booted Or Shutdown Or Rebooted

To execute a script at startup of Ubuntu

  • Edit /etc/rc.local and add your commands
  • The script must always end with exit 0

To execute a script upon rebooting Ubuntu

  • Put your script in /etc/rc0.d
  • Make it executable (sudo chmod +x myscript)
  • Note: The scripts in this directory are executed in alphabetical order
  • The name of your script must begin with K99 to run at the right time.

To execute a script at shutdown

  • Put your script in /etc/rc6.d
  • Make it executable (sudo chmod +x myscript)
  • Note: The scripts in this directory are executed in alphabetical order

Thanks - http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdown

OR

Create your script and make sure you have the BASH shebang line at the top as well as the LSB variables...

#!/bin/bash

### BEGIN INIT INFO
# Provides:          scriptname
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: scriptname
# Description:       description line in here
### END INIT INFO

https://help.directadmin.com/item.php?id=379

Make your script executable;

chmod a+x scriptname

Copy your script to the main run-level directory;

sudo cp -a -v scriptname /etc/init.d/

Create symbolic links to the shutdown and reboot run-level directories; make sure you have the preceeding K10 in your link name like the examples below; this will make sure it is run first;

sudo ln -s /etc/init.d/scriptname /etc/rc0.d/K10scriptname
sudo ln -s /etc/init.d/scriptname /etc/rc6.d/K10scriptname

Domain

http://www.markwilson.co.uk/blog/2007/05/using-active-directory-to-authenticate-users-on-a-linux-computer.htm

How To Reset Ubuntu To Factory Defaults

Terminal...

dconf reset -f /

Thanks - http://www.omgubuntu.co.uk/2017/10/how-to-reset-ubuntu-desktop-to-default