Archives For jimingkui

Linux Kernel

For LVM, encrypted, or limited-storage systems, you need to regularly remove old kernels to prevent your computer (/boot partition) from running out of storage space.

Removing old kernels is easy. You can do it manually, or set unattended-upgrades to do it automatically. For details, open terminal from App Launcher or via Ctrl+Alt+T shortcut keys, and follow the steps below:

Remove Automatically Installed Kernels:

1. To remove the kernels that were automatically installed via regular system updates, open terminal and run:

sudo apt autoremove --purge

It will ask you to type in user password and then remove old kernels as well as other automatically installed packages that are no longer needed.

2. To enable automatic removing of old kernels:

  • Run command to enable unattended upgrades. For Desktop Ubuntu 16.04, this is enabled by default.
    sudo dpkg-reconfigure unattended-upgrades
  • Edit the config file via command (first install gksu via sudo apt install gksu):
    gksudo gedit /etc/apt/apt.conf.d/50unattended-upgrades
  • When the file opens, uncomment the following line and change the value to true:

    //Unattended-Upgrade::Remove-Unused-Dependencies "false";

    So it looks like:

    Remove Manually Installed Kernels:

    If you install latest kernels from Kernel PPA, or build your own kernels with patches, a “purge-old-kernels” script is the best and the easiest way to remove old kernels.

    1. The script is maintained in byobu package, so first install it via:

    sudo apt install byobu

    2. Then run the script regularly to remove old kernels:

    sudo purge-old-kernels

    Remove Old Kernels via DPKG

    If your /boot partition has already full while doing an upgrade or package install, and apt (the script above uses apt) can’t remove packages due to broken dependency, here you can manually find out the old kernel packages and remove them via DPKG:

    1. Run command to check out current kernel and DON’T REMOVE it:

    uname -r

    2. List all kernels excluding the current booted:

    dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)

    Example output:

    rc  linux-image-4.4.0-15-generic               4.4.0-15.31                                         amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
    ii  linux-image-4.4.0-18-generic               4.4.0-18.34                                         amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
    rc  linux-image-4.6.0-040600rc3-generic        4.6.0-040600rc3.201604120934                        amd64        Linux kernel image for version 4.6.0 on 64 bit x86 SMP

    There will be three status in the listed kernel images:

    • rc: means it has already been removed.
    • ii: means installed, eligible for removal.
    • iU: DON’T REMOVE. It means not installed, but queued for install in apt.

    3. Remove old kernel images in status ii, it’s “linux-image-4.4.0-18-generic” in the example above:

    sudo dpkg --purge linux-image-4.4.0-18-generic

    If the command fails, remove the dependency packages that the output tells you via sudo dpkg --purge PACKAGE.

    And also try to remove the respective header and common header packages (Don’t worry if the command fails):

    sudo dpkg --purge linux-image-4.4.0-18-header linux-image-4.4.0-18

    Finally you may fix the apt broken dependency via command:

    sudo apt -f install

    Ubuntu Tweak Officially Discontinued

    Last updated: May 5, 2016

    Ubuntu Tweak, one of the most popular Ubuntu configuration tools, now is officially discontinued!

    Tualatrix Chou, the creator and maintainer, finally announced the discontinuation of Ubuntu Tweak in his Chinese blog a few days ago, though the last software update was more than one year ago.

    The website Ubuntu-Teak.com has been redirected, and it will be shut off one year later, though it’s still getting 4000+ visits per day. Moreover, the Github and Launchpad page has been added a line said “This project is no long under maintenance”.

    Ubuntu Tweak Alternative:

    The best alternatives are Unity Tweak Tool for Unity Desktop and Gnome Tweak Tool for Gnome Shell. Both can be installed via Ubuntu Software App.

    Unity Tweak Tool for Unity

    Gnome Tweak Tool for Gnome Shell

    Code::Blocks is an open-source, cross-platform, full-featured C, C++, and Fortran IDE designed to be very extensible and fully configurable.

    While Ubuntu provides the old Code::Blocks 13.12 release in its universe repository, this tutorial shows you how to install the latest stable Code::Blocks 16.01 using PPA.

    1. Add Code::Blocks Stable PPA, so you can receive future software updates along with system updates using Software Updater.

    Open terminal from Unity Dash or by pressing Ctrl+Alt+T combination key. When it opens, paste the command below and hit run:

    sudo add-apt-repository ppa:damien-moore/codeblocks-stable

    Type in password (no visual feedback) when it asks and hit Enter to add PPA.

    2. If you have Synaptic Package Manager, you can now launch it, search for and install the IDE after clicking Refresh.

    Or just run the commands below one by one to do update and install the software:

    sudo apt update
    
    sudo apt install codeblocks

    You may need to log out and log in back after installation to make it available in Unity Dash/App Launcher.

    3. (Optional) To remove Code::Blocks IDE, use Synaptic Package Manager or run the command below in terminal:

    sudo apt remove codeblocks && sudo apt autoremove

    And the PPA can be removed via Software & Updates utility -> Other Software tab.

    Enpass is a password management program for Linux, Windows, Mac OS, Web, and Mobile devices. All desktop versions are absolutely free while mobile apps are limited to 20 items unless a life-time license ($9.99) is bought.

    Enpass now is at version 5.2, which features TOTP support, autorun on startup, import from 1Password OPVault, Pocket and Password Depot.

    An official Linux repository is available for Ubuntu 12.04 and later (Ubuntu 16.04 is supported now), so you can follow the steps below to install it:

    1. Add Enpass repository.

    Launch Software & Updates from Unity Dash, or System Settings window. When it opens, navigate to Other Software tab, and click Add button to add the line below:

    deb http://repo.sinew.in/ stable main

    2. Open terminal (Ctrl+Alt+T), paste the command below and hit run to get the keyring, so your system will trust the packages from the repository:

    wget -O - http://repo.sinew.in/keys/enpass-linux.key | sudo apt-key add -

    You’ll be asked to type in password to be able to add the key, and there’s no visual feedback while typing your password.

    3. Now if you have Synaptic Package Manager installed, launch it and search for and install enpass after clicked Refresh.

    Or you can run the commands below one by one to do the refresh and install things:

    sudo apt update
    
    sudo apt install enpass

    Once installed, you need to log out and back in to be able to launch the software from Unity Dash.

    4. (Optional) To uninstall Enpass password manager, use Synaptic Package Manager or run the command below in terminal:

    sudo apt remove enpass

    To remove Enpass repository, use Software & Updates -> Other Software.

    Here’s a brief tutorial that shows how to install Komodo Edit with Unity integration in Ubuntu 16.04 LTS via PPA.

    Komodo Edit is an open-source code editor based on Komodo IDE. Its website provides official Linux packages, but lacks global menu and application shortcut for Ubuntu Unity desktop.

    Mystic-Mirage is maintaining a PPA contains unofficial Komodo Edit packages with patches for Ubuntu integration. Support for Ubuntu 16.04 was added a few days ago.

    1. To add PPA

    Open terminal (Ctrl+Alt+T), paste following command and hit run:

    sudo add-apt-repository ppa:mystic-mirage/komodo-edit

    Type in your password (no visual feedback) when it asks and then hit Enter to continue.

    2. After added the PPA, search for and install komodo-edit via Synaptic Package Manager after clicking Refresh.

    Or run following commands one by one:

    sudo apt update
    
    sudo apt install komodo-edit

    For those who don’t want to add PPA, grab the .deb installer from PPA file archive.

    Mozilla Firefox has reached the 46 release, which features GTK3 integration for GNU/Linux, security improvement for the JavaScript, and some fixes:

    • Correct rendering for scaled SVGs that use a clip and a mask
    • Various security fixes
    • Screen reader behavior with blank spaces in Google Docs corrected
    • WebRTC fixes to improve performance and stability
    • For details, see the release note.

    Upgrade Firefox in Ubuntu:

    The new release has been made into universe repositories of all current Ubuntu releases and derivatives. Just run Software Updater and install the available update for Firefox after checking for updates.

    Cinnamon 3.0, the GTK3 desktop environment developed by (and for) Linux Mint, was released yesterday afternoon.

    Here’s a quick overview of some of the changes in Cinnamon 3.0 according to the release note:

    • Window management improvements on tiling, mapping and unmapping windows, compositor’s window groups and tracking of full screen windows
    • Improved out of the box touchpad support (edge-scrolling and two-finger-scrolling can now be configured independently and are both enabled by default)
    • New accessibility and sound settings (both rewritten as native cinnamon-settings modules)
    • Battery powered devices can be renamed
    • Different favorite applications can now be set for plain-text, documents and source code files
    • Panel launchers now include application actions
    • Animation effects are now enabled by default on dialogs and menus
    • Favorites and system options can now be disabled in the menu applet
    • The photo-frame desklet now also scans subdirectories
    • Improved support for GTK 3.20, Spotify 0.27, Viber

    How to Install Cinnamon 3.0 in Ubuntu:

    Linux Mint users can upgrade to Cinnamon 3.0 via the update-manager. For Ubuntu, there’s a PPA contains unofficial (though probably closest to official) builds of Cinnamon releases for Ubuntu 16.04, Ubuntu 15.10, and a little old version of Ubuntu 14.04.

    1. Add Cinnamon PPA

    Open teriminal (Ctrl+Alt+T), paste below command and hit run:

    sudo add-apt-repository ppa:embrosyn/cinnamon

    After typing your password, take a look at the PPA description in terminal output and hit Enter.

    2. Then update and install the Cinnamon desktop via:

    sudo apt-get update
    
    sudo apt-get install cinnamon

    3. If everything goes OK, log out and select log in with Cinnamon session (or Cinnamon (Software Rendering) session if you want it use software rendering to do more of the graphical work).

    (Optional) To uninstall the Cinnamon session, use Synaptic Package Manager or run commands:

    sudo apt-get remove cinnamon && sudo apt-get autoremove

    And the PPA can be removed via Software & Updates -> Other Software utility.

    The default network manager in Ubuntu 16.04 now supports to create WiFi hotspot for Android devices.

    You can create a Wireless access point in Ubuntu 14.04 using Unity’s default network manager, but a little hack on the configuration file is required.

    In Ubuntu 16.04, there’s a Hotspot mode in the WiFi connection editings page that works directly for Android devices. Here’s the step by step how to guide:

    1. First disable WiFi and connect your laptop to a wired network, so your network menu looks like:

    2. Click Edit Connections on the menu shown in above picture. Then click Add to add a new connection:

    3. Choose WiFi from the drop-down box in the next window and click Create button.

    4. When the editing window popup, do:

    • Type in connection name, SSID, select Hotspot mode.
    • In Wifi Security tab, select WPA & WPA2 Personal and type in a password.
    • In IPv4 Settings tab, select mode “Share to other computers”

    5. After clicked the save button, enable WiFi and click Connect to Hidden Wi-Fi network and select connect to the connection you just created.

    6. Your network menu now looks like:

    Finally connect to this hotspot from your Android device and enjoy!

    On the new released Ubuntu 16.04 desktop, you may get a few error popups that asks you to report problems. Some popups has already been reported so you may want to disable these error popups before they are fixed by upstream.

    To do so, you can either temporarily stop the Apport service on current boot, or manually edit the config file to disable error reporting system permanently

    1. To stop the Apport service, open terminal (Ctrl+Alt+T) and run command:

    sudo service apport stop

    Type in password when it asks and hit Enter. There’s no visual feedback while typing your password.

    2. To disable the apport system so you’ll never see the error popups, run command to edit config file:

    sudo gedit /etc/default/apport

    When the file opens, change the value to 0 and save it.

    That’s it. Enjoy!

    How to Enable SSH in Ubuntu 16.04 LTS

    Last updated: April 22, 2016

    Here’s how to enable Secure Shell (SSH) service in Ubuntu 16.04 Xenial Xerus, the new LTS release, to allow secure remote login and other network communications.

    Ubuntu provides OpenSSH (OpenBSD Secure Shell) in its universe repositories, which is a suite of security-related network-level utilities based on the SSH protocol.

    1. To install it, open terminal (Ctrl+Alt+T) or log in Ubuntu server and run command:

    sudo apt-get install openssh-server

    2. After that, you should have SSH service enabled in your system, you may check its status by running command:

    sudo service ssh status

    3. You may change some settings (e.g., the listening port, and root login permission) by editing the configuration file via command:

    sudo nano /etc/ssh/sshd_config

    On Ubuntu desktop, you may use gedit instead of nano:

    Finally apply the changes by restarting or reloading SSH:

    sudo service ssh restart

    For more, read the official manual page.