Wednesday, June 9, 2021

Ubuntu apt-get not showing package list

 I got annoyimh issue when setting up the new server.The apt-get is not showing pakcage list when we press TAB. This article helps to solve the problem, https://askubuntu.com/questions/86375/apt-get-autocomplete-package-name-is-broken. Below is helping me to solve the problem.


# sudo apt-get install --reinstall bash-completion

Wednesday, February 12, 2020

Docker on Ubuntu 18.04

1. Follow the instruction from here
First, update your existing list of packages:
  • sudo apt update
Next, install a few prerequisite packages which let apt use packages over HTTPS:
  • sudo apt install apt-transport-https ca-certificates curl software-properties-common
Then add the GPG key for the official Docker repository to your system:
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to APT sources:
  • sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
Next, update the package database with the Docker packages from the newly added repo:
  • sudo apt update
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
  • apt-cache policy docker-ce
You’ll see output like this, although the version number for Docker may be different:
Output of apt-cache policy docker-ce
docker-ce:
  Installed: (none)
  Candidate: 18.03.1~ce~3-0~ubuntu
  Version table:
     18.03.1~ce~3-0~ubuntu 500
        500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04 (bionic).
Finally, install Docker:
  • sudo apt install docker-ce
Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:
  • sudo systemctl status docker



2. Cannot install docker yii2, follow instructions below:
  1. sudo apt-get remove docker-compose
  2. sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  3. sudo chmod +x /usr/local/bin/docker-compose
  4. sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Saturday, September 1, 2018

Ubuntu WOL not working anymore after apt-get upgrade

I got a problem on my server that it could not be woken up after I did apt-get upgadre and apt-get dist-upgrade to my system.

Quick googling the problem, I found that doing this would solve the problem. The reference was https://help.ubuntu.com/community/WakeOnLan

Enabling WoL in the NIC

Determining whether the NIC supports WoL

First, determine which NIC will be used, and then check whether it supports the Magic Packet™ using
sudo ethtool 
where is the device name of your NIC, e.g. eth0. This command will output some information about your the capabilities of your NIC. If this output contains a line similar to the following:
Supports Wake-on: 
where  contains the letter g, the NIC should support the WoL Magic Packet™ method (for the other letters look at man ethtool).

Enabling WoL in the NIC

To check whether WoL is enabled in the NIC, one could use
sudo ethtool 
and look for
Wake-on: 
If  contains g and not d, then Magic Packet™ is enabled. However, if  does contain d, WoL needs to be enabled by running the following command:
sudo ethtool -s  wol g
On most systems, issuing this command is required after each boot. If the system's networking is configured via ifupdown, then it is easy to add the line up ethtool -s  wol g below the interface's configuration stanza in /etc/network/interfaces. For example:
shahar@shahar-backup:~$ cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface

auto lo
iface lo inet loopback
# The primary network interface

auto eth0
iface eth0 inet static
        address 10.0.0.1
        netmask 255.255.255.0
        gateway 10.0.0.138
        up ethtool -s eth0 wol g

This will ensure that WoL is enabled in the NIC on each boot. Fore more information see the interfaces manual.

However, my network setting was done using Network Manager. I did not dare to follow edit of /etc/network/interfaces since I was afraid it would ruin the network setting. Another googling found this, https://apuntesderootblog.wordpress.com/2015/12/02/enable-wake-on-lan-with-networkmanager/

Enable wake-on-lan with NetworkManager

This little tip enables wake-on-lan on our network interfaces so the computer can be awaken with a magic packet from other host in the same network.
First, identify your connection:
# nmcli connection 
NOMBRE      UUID                                  TIPO            DISPOSITIVO 
virbr0      3ee5c0b6-1030-4609-b087-4ab3d39ccdfa  bridge          virbr0      
br-lan      e7b20dc3-9d8e-4b0e-b56f-27a87f17ebe3  bridge          br-lan      
enp5s0      8581aa55-eead-41d6-a216-41f52b4e0c30  802-3-ethernet  enp5s0      
virbr0-nic  04cc0eff-0b0d-4440-9e7b-1c54418e8ef7  generic         virbr0-ni
Then, activate the wake-on-lan functionality:
# nmcli connection modify enp5s0 802-3-ethernet.wake-on-lan magic
Your BIOS has to support and had enabled waking up from your network card.

Thank you so much for both who provide those references. It as useful for me and I hope also for you.