Gathering system information on Linux – The Basics !

I recently found lsb_release and thought it might be worth sharing on my blog. Although some of the more seasoned Linux users are probably already aware of this command, many other readers could find this to be a useful little tool.

I’m running Ubuntu LTS 18.04, and triple booted it with Fedora 28 and Windows 10 ofcourse(cough!). For a while now, I wondered how to verify that my system is up to date when LTS release updates are issued, for example, from 16.04.3 to 16.04.4. Using inxi -F only shows “Distro: Ubuntu 16.04 xenial”. So, after a bit of searching on the Internet, I found what I really wanted: lsb_release.I have did noticed it during my search on Google that there are pre-installed GUIs for this information, but I’d rather use the CLI way as much as when possible.)

After reading the man page, I found running lsb_release -d -c is exactly what I wanted.
$ lsb_release -d -c


The rest of the commands can be:-

uname -r

uname -a

lsb_release -a

Many times over the years I’ve seen, on forums, where a user needs help with a problem, and is asked to post the results of inxi -F. The output of that command includes the users mac address. So, by running inxi -Fz, the mac address is hidden from public view.

inxi -Fz

Here is a customization trick to change the font colour scheme:

inxi -c 95

Note: 95 is for a terminal, running in X – like xTerm. Running inxi -h will show a short list of choices, from 94 to 99, for different display types in the -c options.

That’s it for now, keep tuned in for more advanced info gathering commands in Linux !

 

 

Ubuntu’s Snappy package manager – A brief introduction to Snapcraft.

Canonical, the UK based organisation which supports Ubuntu, has been developing a new method for working with software packages which many of us are aware of since April 2016. The new technology, which has appeared in some experimental editions of Ubuntu, is called Snappy. Snappy packages are supposed to have a number of advantages over software packages common to most other Linux distributions. Five characteristics of Snappy packages in particular stand out.

= > The OS and application files are kept completely separate, as a set of distinct read-only images.

= > Transnational, image-based delta updates for the system and applications that can always be rolled back.

= > Files are read-only, which means they cannot be tampered with and can be updated perfectly and predictably every time.

= > Delta management keeps the size of downloads to the bare minimum.

= > Signatures and fingerprints ensure you’re running exactly what was published by the developer.

As you keep on reading this article you may want to check this post about Snapcraft.

 

I had been reading a lot about Snappy being used on mobile devices and Snappy packages being developed for embedded devices and the much-hyped Internet of Things. I have also heard rumours Ubuntu’s desktop edition may move to using Snappy packages by default in the near future, depreciating APT and .deb packages. However, it was not until recently that I found time to experiment with Snappy and see how the new package manager compared against other Linux package managers. The Ubuntu website has a tutorial for setting up a virtual machine running a minimal edition of Ubuntu and the Snappy package manager, a brief introduction to snapcraft. I followed the instructions provided and soon had a virtual machine running with a bare bones, text console interface. I was able to sign into the minimal operating system and begin experimenting.

One of the first things I noticed upon logging into my virtual instance of Ubuntu was that there is a welcome message letting us know .deb packages were not being used on the system, instead we should use Snappy. Despite the message, I did find the low-level dpkg package manager was installed and I could bring up a list of about three hundred .deb packages which apparently made up the base system. However, trying to run apt-get to install or remove packages caused a message to be displayed letting me know I should be using Snappy rather than apt-get. I suspect running the two package managers together on the same system is not recommended.

While Snappy can perform several actions, I want to focus on seven core commands the Snappy package manager recognises. The first is snappy info. Running snappy info display some basic information about our operating system and what it is running. The summary is very short, but it can give us an idea of what kind of hardware we are running on and the applications installed. We can extend the command a little and run snappy info <package> in order to get a very brief summary of information concerning a specific package.

The second command I experimented with was snappy list. Running this command will show us a list of packages currently installed on the system. Modifying the command to snappy list -v will display all the installed packages along with their version numbers. Since we can have multiple versions of each package installed, the active version of a package is marked with an *. This means if we have, for example, two copies of a web server on our system, we can identify which version is actually running. We can further extend the list command a little to find out which Snappy packages can be upgraded. Running snappy list -uv shows our installed packages with an * next to items that can be upgraded from Snappy’s software repository.

Speaking of updates, the snappy update command will update all packages installed on the operating system. So far as I can tell, all packages are always upgraded to their latest version. I was unable to find a way to simply upgrade one specific package in my test environment. However, I was able to upgrade all packages and then rollback unwanted upgrades, which brings me to the next command.

When we have upgraded a package and found we preferred the older copy of the software we can rollback to a previous version. This is done using the snappy rollback <package> command. Without any further arguments, Snappy will rollback the given package to its previous version. However, we can also specify which version of the package we want to be using. We can do this by running snappy rollback <package> <version>. Perhaps counter-intuitively, it is possible to use the rollback command to upgrade to a newer version of an installed package. This means the rollback command can activate any version of a Snappy package, whether it is older or newer than the currently active version.

Snappy allows us to search through its repository of software using the search command. Running just snappy search will display all packages currently present in the remote repository. We can hunt for specific types of software by running snappy search <pattern> which will return packages with names similar to the provided pattern.

The two final, and perhaps most important, commands are snappy install <package> and snappy remove <package>. These two commands install software from Snappy’s repository and remove all versions of an installed package, respectively. So far as I can tell, there is no way to remove one version only of a Snappy package. I suspect this is because Snappy installs a base package and then applies delta updates to the package rather than maintaining multiple whole versions of an application.

I made a few observations while experimenting with Snappy. One is that Snappy appears to work fairly quickly. Transactions are not instant, but they do happen rapidly. The packages I downloaded and installed from the software repository appeared to be about an equivalent size to .deb packages. I did not find Snappy packages to be unusually large.

At the moment there appear to be very few Snappy packages available to try. I found a simple terminal echo program, a web server, some hardware specific packages for various embedded devices, but little else. It may be I was using a testing repository just for people who want to experiment, but at time of writing the range of functionality we can get from Ubuntu’s Snappy repository is limited. With regard to the packages in the demo repository, there is not much information to be had about them. The descriptions provided by Snappy for each package are quite short and do not tell us much about what each package does.

When we install new Snappy applications they are stored in the /apps directory. If we wish to, we can explore the /apps directory and browse or run applications stored in this corner of the file system. It appears as though each program gets its own sub-directory, isolating it from other programs and other versions of itself. Most Linux package managers will complain if the user modifies or removes files directly. I experimented to see what would happen if I deleted the directories containing Snappy applications. I found Snappy correctly identified when a piece of software had been manually removed and Snappy considers the package deleted. Snappy does not seem to care how the package was removed, merely that it is no longer present.

At this point I feel it is safe to say Snappy is in its early stages. While the package manager works, it feels limited in some ways. We can install packages, remove them and hunt for new software, but I feel some functionality is missing. Specifically, I wanted more documentation and to be able update just one package while leaving other items at their original versions. Hopefully this feature (or documentation on how to perform the task) will appear later. Locking packages at a specific version would also be a nice feature to have. I was happy to note Snappy does not appear to have any bugs. While Snappy may still need to grow, everything it does do appears to be done correctly and I encountered no problems.

Finally, I like how easy it is to rollback (or roll ahead) packages. Switching between active versions of packages happens quickly and smoothly. I think this will be a very welcome feature on servers and desktops as well as embedded devices.

How can I fix apt error “W: Target Packages … is configured multiple times”? in Google Chrome for Fedora & Ubuntu !

This is what I’ve encountered recently at the time of writing that Google Chrome on Ubuntu and it’s derivatives could not be updated/upgraded via terminal or GUI, that is default package updater as seen in Linux !

The error’s can be any of these:-

W: Target Packages … is configured multiple times

E: Repository ‘http://dl.google.com/linux/chrome-remote-desktop/deb stable Release’ changed its ‘Origin’ value from ‘Google, Inc.’ to ‘Google LLC’
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

Solution:-
It’s quite simple and straight forward in Ubuntu and it’s derivatives just go to
System settings >> Software and Updates >> Other Software and removing each duplicate entry from the list worked fine.
Note the below given screenshot can help and your mileage may vary depending on which OS you’re on.

Just somehow delete the duplicates as seen on the check boxes for Google chrome !

On Fedora just uninstall and reinstall the latest Google chrome package from the official Google’s website. Select a rpm package as usual.

Ubuntu vs Fedora Linux.

So now, here I don’t care where you’ve landed(into the Tux World of course!) but this thing is mostly questioned  when it comes down to Linux distribution or “distros” in short and before we boil down to the differences between the two most popular Linux distributions of all times, let us see what the Wikipedia wants to tell us.

[Note:- This article has no relations or affiliations to distrowatch or any other leading website’s/platform’s which ranks the Linux distro’s for a Newbie to an Expert, the aforementioned contains are as stated per my personal experience and taste, humour etc. So let’s Go]

Ubuntu:- It is developed by a company named Canonical, which is an UK based company founded by a famous entrepreneur named Mark Shuttleworth, whereas Fedora is based on Red Hat, developed by Red Hat, IBM and contributers around the world and Ubuntu is based on Debain(which is popularly called as mother of operating system or an universal free operating system).

Ubuntu releases are every 6 months annd after every two years they launch a LTS(Long Term Release/Support) as the name says it all for 5 years. Fedora on the other hand is most bleeding edge and has the latest kernel possible stable of-course as much as possible but there are no long term releases down here and it has a support of free upgrades upto 13 months.

Fedora and Ubuntu has different binaries so a software or an app written specially for Ubuntu/Debian and it’s derivatives cannot be run on other Linux distros.(the package format is .deb which is an executable). Fedora has .rpm(red hat package manager.)

Ubuntu has an apt package manager also called as apt-get to fetch packages from the repositories over the internet via command line or the GUI. Fedora on the other hand supports the legacy yum(yellow-dog update modifier) or the latest one is dnf(dandified yum), ie. it just fetches the delta updates/upgrades and hence lowers down the bandwidth considerably.

Modern day softwares are now written in Snap or Snapcraft as developed by Canonical. Fedora has developed it’s own technology for package re-distribution called Flatpak. Do note that now Flatpak runs on latest version of Ubuntu and vice-versa, but still yet to be considered in a nascent stage.

Recent studies shows that Fedora is more faster than Ubuntu in shutting down speeds and also has an improved battery life. Ubuntu is faster at boot-up times.

The other difference according to me is that Fedora has a lot of dependencies on it’s packages. Hence it has to fetch and might take some more time to update as compared to Ubuntu which is more streamlined and less dependent on the software dependencies.

Remember Fedora is bleeding edge but better in terms of stability as compared with Arch Linux, manjaro etc. Ubuntu is the most stable OS out there after Debain and Mint.

So now my favorite is Fedora anytime folks and I’ve been using it since version 14. At the time of writing the latest version is 28. I already use Ubuntu LTS 18.04 as my secondary desktop OS too. So folks let me know in the comment section below about what are your thoughts and opinions of Fedora, Ubuntu etc.

 

Simple way to upgrade Ubuntu 16.04 to 18.04 LTS

All the Ubuntu fans out there who wanna upgrade LTS to LTS directly. Here is by far the most simple tried and trusted way to upgrade.

Note:- I have tried this on my personal desktop running Unity desktop Ubuntu 16.04 and all went smooth. Upgrades from LTS releases are scheduled after the first patch – 18.04.1 which is usually a month after the first release. THey need to make sure everything goes smoothly and then the software manager will allow it.So no without wasting any of our time, let us begin. Fire up the terminal and type this:-

sudo apt update && sudo apt dist-upgrade

Please note that if a new kernel is installed while running the above command, you need to reboot system in order to continue the upgrade process. Then issue the following command in terminal.

update-manager -d

Now the OS checks for updates the Graphical way and then all the magic begins soon.


Become root and give sudo privileges as usual.


Just follow the GUI instructions and within an hour or so you will be done and up & running the latest and greatest stable release of Ubuntu release so far.


After you finish downloading repositories and packages, Ubuntu might ask you to remove some obselete packages, do so if required. And now my shiny desktop looks something like this.


Here is to confirm the version


That’s it voila you’re on your shiny new OS !

 

OR if you’re panicking all the way, like most people do, here is a way out:-

fire this command inside your terminal.

sudo do-release-upgrade -d

What I would recommend is a fresh (format) install, since anytime you upgrade you’ll face incompatibility issues.

 

Install Flatpak(Flathub) apps in Linux(any distro).

Flatpak (formerly xdg-app) is a software utility for software deployment, package management, and application virtualization for Linux desktop computers. It provides a sandbox environment in which users can run applications in isolation from the rest of the system. Applications using Flatpak need permission from the user to control hardware devices or access the user’s files.

Now let’s talk about installing all the variety, a plethora amount of free Apps on Linux, seamlessly on any distro. We shall also consider installing the flathub repo in ordered to get our feet accomplished. Visit here, Flathub home, Install Flatpak(Flathub) apps in Linux(any distro).

Install Flatpak for Ubuntu:-
The official Flatpak PPA is the recommended way to install Flatpak. To install it, run the following in a terminal:

sudo add-apt-repository ppa:alexlarsson/flatpak
sudo apt update
sudo apt install flatpak

Install the Software Flatpak plugin
The Flatpak plugin for the Software app makes it possible to install apps without needing the command line. To install, run:

sudo apt install gnome-software-plugin-flatpak

Add the Flathub repository
Flathub is the best place to get Flatpak apps. To enable it, run:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Now for Fedora:-

Flatpak is installed by default on Fedora Workstation. To get started, all you need to do is enable Flathub, which is the best way to get Flatpak apps. Just download and install the Flathub repository file.

For Arch:-

sudo pacman -S flatpak

For Solus:-

sudo eopkg install flatpak

Now, Enable Flathub

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

For rest of the Distros, you shall find the commands here.

 

Note:- That you shall compulsory need to reboot your system in order to get flathub apps running and then install the apps here. For Example Telegram on Ubuntu, via Flatpak.

So now i bet for our command line folks breathing inside the terminal to get those flatpak apps is easy. links here

Official flatpak documentation.

CLI user experience, github

Note:- At the time of writing this article the flathub platform was on beta, so you eager fellows the future may behold the stable very soon, till then enjoy installing flatpak’s. Cheers !

 

How to open a pdf file from terminal.

This is perhaps the most asked and searched questions by people using FOSS software and the one’s who breathe inside the terminal. Well your mileage might vary depending on which Operating System you’re on and the Desktop Environment(DE), etc. But the question here is how to open a pdf file from terminal; so let us begin !

In most certain Desktop Environments, including Ubuntu’s Unity and after 18.04 LTS, Gnome 3.X you can use:

 

xdg-open filetoopen.xxx

 

In Gnome, you also can use:
gvfs-open filetoopen.xxx

 

(xxx = some file extension). With this command the default app for “xxx” will be invoked (for example document viewer in Ubuntu’s Unity DE, if you want to open pdf).

 

Or specifically:

 

evince filetoopen.pdf

 

Or (default for KDE):
okular file2open.pdf

 

That’s it, you’re work is done !