Displaying items by tag: tutorial

linux-icon-t.jpg

We all know that we use cd command to move from one directory to another. To return back to the previous directory, we use “cd ..” or “cd ” commands. This is how I mostly navigate between directories until I found these trio commands, namely pushdpopd, and dirs. These three commands provides a way faster navigation between directories. Unlike cd command, pushd and popd commands are used to manage a stack of directories. Just enter into a directory and do something you want to do, and “pop” back to the previous directory quickly without having to type the long path name. dirs command is used to show the current directory stack, just like “ls” command. These trio commands are extremely useful when you’re working in a deep directory structure and scripts.

Still confused? No worries! I am going to explain these commands in layman terms with some practical examples.

Use Pushd, Popd And Dirs For Faster Navigation Between Directories

Pushd, popd ,and dirs commands are comes pre-installed, so let us just forget about the installation, and go ahead to see how to use them in real time.

 

Right now, I am in /tmp directory.

1.png

I am going to create ten directories, namely test1test2, …. test10 in /tmp directory.

As may already know, We can easily create multiple directories at once using mkdir command as shown below.

mkdir test1 test2 test3 test4 test5 test6 test7 test8 test9 test10

Or,

mkdir test{1,2,3,4,5,6,7,8,9,10}

Now, let us move to test3 directory. To do so, just type:

pushd test3

 

To know where you are now, just type:

dirs

Sample output:

/tmp/test3 /tmp /tmp

 

As you see in the above output, dirs command shows we have two directories in the stack now. Do something you wish to do in this directory. Once done, you can go back to your previous working directory using command:

popd

 

No need to mention the full path of previous directory. If you use cd command, you should type “cd ..” or “cd ” to go back to the /tmp directory. But, using popd command we can instantly move back to the previous working directory. It’s simple as that.

Let us go again to test8 directory. To do so, run:

pushd test8

Sample output:

/tmp/test8 /tmp /tmp

 

Let us go deep in the stack.

pushd /tmp/test10

Sample output:

/tmp/test10 /tmp/test8 /tmp /tmp

 

We’re now in test10 directory, and we have totally 3 directories (test10, test8 and tmp) in our stack. Did you also notice the direction? Each new directory is getting added to the left. When we start poping directories off, they will come from the left as well.

Now, if you want to move to the previous working directory i.e test8 using cd command, the command would be like below.

cd /tmp/test8

But it is not necessary though. We can do it more quickly by running the popd command.

popd

Sample output:

/tmp/test8 /tmp /tmp

 

As you see in the above output, we moved to the previous working directory without having to type full path (i.e /tmp/test8).

Now, let us pop again?

popd

Sample output:

/tmp /tmp

 

Finally, We came back to the directory where we started.

In this example, I have used just ten directories. So, It may seem it is no big deal. Think about twenty or more directories? Would you type “cd ” or “cd ..” each time to move between directories? Nope. It would be time consuming. Just use pushd command to change to any directory in the stack and move back to your previous working directory using popd command. Also, you can use dirs command at any time to show the current directory stack at any time. You can add a series of paths onto your stack and then navigate to them in the reverse order. This will save you lot of time when you are navigating around stack of directories.


Also read:


You know now how to effectively navigate between directories without using cd command. These commands comes in handy when you’re working with large directory stack. You can quickly move back and forth through x amount of directories, and these commands are much useful working with scripts too.

That’s all for now. If you know any other methods, feel free to share them in the comment section below. I will be here with another interesting guide soon.

Marielle Price

Published in GNU/Linux Rules!

el group computer 685

This has been an interesting experience, in no small part because most of the people aren't at all technical. They know how to use a computer to do what they need to do. Beyond that, they're not interested in delving deeper. That said, they were (and are) attracted to Linux for a number of reasons—probably because I constantly prattle on about it.

 

While bringing them to the Linux side of the computing world, I learned a few things about helping non-techies move to Linux. If someone asks you to help them make the jump to Linux, these eight tips can help you.

1. Be honest about Linux.

Linux is great. It's not perfect, though. It can be perplexing and sometimes frustrating for new users. It's best to prepare the person you're helping with a short pep talk.

What should you talk about? Briefly explain what Linux is and how it differs from other operating systems. Explain what you can and can't do with it. Let them know some of the pain points they might encounter when using Linux daily.

If you take a bit of time to ease them into Linux and open source, the switch won't be as jarring.

2. It's not about you.

It's easy to fall into what I call the power user fallacy: the idea that everyone uses technology the same way you do. That's rarely, if ever, the case.

This isn't about you. It's not about your needs or how you use a computer. It's about the person you're helping's needs and intentions. Their needs, especially if they're not particularly technical, will be different from yours.

It doesn't matter if Ubuntu or Elementary or Manjaro aren't your distros of choice. It doesn't matter if you turn your nose up at window managers like GNOME, KDE, or Pantheon in favor of i3 or Ratpoison. The person you're helping might think otherwise.

Put your needs and prejudices aside and help them find the right Linux distribution for them. Find out what they use their computer for and tailor your recommendations for a distribution or three based on that.

3. Not everyone's a techie.

And not everyone wants to be. Everyone I've helped move to Linux in the last 10 months has no interest in compiling kernels or code nor in editing and tweaking configuration files. Most of them will never crack open a terminal window. I don't expect them to be interested in doing any of that in the future, either.

Guess what? There's nothing wrong with that. Maybe they won't get the most out of Linux (whatever that means) by not embracing their inner geeks. Not everyone will want to take on challenges of, say, installing and configuring Slackware or Arch. They need something that will work out of the box.

4. Take stock of their hardware.

In an ideal world, we'd all have tricked-out, high-powered laptops or desktops with everything maxed out. Sadly, that world doesn't exist.

That probably includes the person you're helping move to Linux. They may have slightly (maybe more than slightly) older hardware that they're comfortable with and that works for them. Hardware that they might not be able to afford to upgrade or replace.

Also, remember that not everyone needs a system for heavy-duty development or gaming or audio and video production. They just need a computer for browsing the web, editing photos, running personal productivity software, and the like.

One person I recently helped adopt Linux had an Acer Aspire 1 laptop with 4GB of RAM and a 64GB SSD. That helped inform my recommendations, which revolved around a few lightweight Linux distributions.

5. Help them test-drive some distros.

The DistroWatch database contains close to 900 Linux distributions. You should be able to find three to five Linux distributions to recommend. Make a short list of the distributions you think would be a good fit for them. Also, point them to reviews so they can get other perspectives on those distributions.

When it comes time to take those Linux distributions for a spin, don't just hand someone a bunch of flash drives and walk away. You might be surprised to learn that most people have never run a live Linux distribution or installed an operating system. Any operating system. Beyond plugging the flash drives in, they probably won't know what to do.

Instead, show them how to create bootable flash drives and set up their computer's BIOS to start from those drives. Then, let them spend some time running the distros off the flash drives. That will give them a rudimentary feel for the distros and their window managers' quirks.

6. Walk them through an installation.

Running a live session with a flash drive tells someone only so much. They need to work with a Linux distribution for a couple or three weeks to really form an opinion of it and to understand its quirks and strengths.

There's a myth that Linux is difficult to install. That might have been true back in the mid-1990s, but today most Linux distributions are easy to install. You follow a few graphical prompts and let the software do the rest.

For someone who's never installed any operating system, installing Linux can be a bit daunting. They might not know what to choose when, say, they're asked which filesystem to use or whether or not to encrypt their hard disk.

Guide them through at least one installation. While you should let them do most of the work, be there to answer questions.

7. Be prepared to do a couple of installs.

As I mentioned a paragraph or two ago, using a Linux distribution for two weeks gives someone ample time to regularly interact with it and see if it can be their daily driver. It often works out. Sometimes, though, it doesn't.

Remember the person with the Acer Aspire 1 laptop? She thought Xubuntu was the right distribution for her. After a few weeks of working with it, that wasn't the case. There wasn't a technical reason—Xubuntu ran smoothly on her laptop. It was just a matter of feel. Instead, she switched back to the first distro she test drove: MX Linux. She's been happily using MX ever since.

Back in 2016, I took down the shingle for my technology coaching business. Permanently. Or so I thought.

Over the last 10 months, a handful of friends and acquaintances have pulled me back into that realm. How? With their desire to dump That Other Operating System™ and move to Linux.

8. Teach them to fish.

You can't always be there to be the guiding hand. Or to be the mechanic or plumber who can fix any problems the person encounters. You have a life, too.

Once they've settled on a Linux distribution, explain that you'll offer a helping hand for two or three weeks. After that, they're on their own. Don't completely abandon them. Be around to help with big problems, but let them know they'll have to learn to do things for themselves.

Introduce them to websites that can help them solve their problems. Point them to useful articles and books. Doing that will help make them more confident and competent users of Linux—and of computers and technology in general.

Final thoughts

Helping someone move to Linux from another, more familiar operating system can be a challenge—a challenge for them and for you. If you take it slowly and follow the advice in this article, you can make the process smoother.

Do you have other tips for helping a non-techie switch to Linux? Feel free to share them by leaving a comment.

Original post at: opensource.com

Published in GNU/Linux Rules!
Tagged under

There are multiple ways of searching for packages available in the Debian, Ubuntu or Linux Mint from the command line, and in this article I'll cover aptapt-cache and aptitude. Use this to search in both package names and package descriptions, useful if either you're looking for a specific package but you don't know the exact package name, or if you need a tool for a particular purpose / task but you don't know the available options.

 

 

The major differences between using aptapt-cache and aptitude to search for available packages is their output and the sort order, as you'll see in the examples below. Also, aptitude may not be installed by default on your Debian-based Linux distribution.

I personally prefer apt-cache because of the easier to read output (and I don't need extra info usually - to see installed/available versions I can use apt-cache policy package-name); it also tends to display the results I'm looking for near the top.

Another thing to note is that apt and apt-cache search the apt software package cache, so they return both packages available in the repositories as well as DEB packages installed manually (not available in the repos), while aptitude only returns packages that are available in the repositories.

 

I. Search available packages using aptitude

aptitude is a Ncurses-based front-end for apt. This tool is usually not installed by default but you can install it in Debian, Ubuntu, Linux Mint and other Debian-based Linux distributions using this command:

sudo apt install aptitude


You can use aptitude to search for packages from the command line, like this:

aptitude search KEYWORD


Example:

$ aptitude search openssh

p   libconfig-model-openssh-perl                           - configuration editor for OpenSsh                                
p   libghc-crypto-pubkey-openssh-dev                       - OpenSSH key codec  
p   libghc-crypto-pubkey-openssh-dev:i386                  - OpenSSH key codec  
v   libghc-crypto-pubkey-openssh-dev-0.2.7-6af0a           -                    
v   libghc-crypto-pubkey-openssh-dev-0.2.7-6af0a:i386      -                    
p   libghc-crypto-pubkey-openssh-doc                       - OpenSSH key codec; documentation                                
p   libghc-crypto-pubkey-openssh-prof                      - OpenSSH key codec; profiling libraries                          
p   libghc-crypto-pubkey-openssh-prof:i386                 - OpenSSH key codec; profiling libraries                          
v   libghc-crypto-pubkey-openssh-prof-0.2.7-6af0a          -                    
v   libghc-crypto-pubkey-openssh-prof-0.2.7-6af0a:i386     -                    
p   libnet-openssh-compat-perl                             - collection of compatibility modules for Net::OpenSSH            
p   libnet-openssh-parallel-perl                           - run SSH jobs in parallel                                        
p   libnet-openssh-perl                                    - Perl SSH client package implemented on top of OpenSSH           
p   lxqt-openssh-askpass                                   - OpenSSH user/password GUI dialog for LXQt                       
p   lxqt-openssh-askpass:i386                              - OpenSSH user/password GUI dialog for LXQt                       
p   lxqt-openssh-askpass-l10n                              - Language package for lxqt-openssh-askpass                       
v   lxqt-openssh-askpass-l10n:i386                         -                    
i   openssh-client                                         - secure shell (SSH) client, for secure access to remote machines 
p   openssh-client:i386                                    - secure shell (SSH) client, for secure access to remote machines 
p   openssh-client-ssh1                                    - secure shell (SSH) client for legacy SSH1 protocol              
p   openssh-client-ssh1:i386                               - secure shell (SSH) client for legacy SSH1 protocol              
p   openssh-known-hosts                                    - download, filter and merge known_hosts for OpenSSH
p   openssh-server                                         - secure shell (SSH) server, for secure access from remote machines
p   openssh-server:i386                                    - secure shell (SSH) server, for secure access from remote machines 
p   openssh-sftp-server                                    - secure shell (SSH) sftp server module, for SFTP access from remote machines
p   openssh-sftp-server:i386                               - secure shell (SSH) sftp server module, for SFTP access from remote machines


You can also use the aptitude Ncurses UI if you wish. Type aptitude to start it:

Aptitude ncurses interface


You can search packages by pressing / and then start typing the keyword.

II. Search available packages using apt-cache

Use apt-cache to to search for packages available in the Debian, Ubuntu or Linux Mint repositories (and installed DEB packages that aren't in the repositories) like this:

apt-cache search KEYWORD


Example:

$ apt-cache search openssh

openssh-client - secure shell (SSH) client, for secure access to remote machines
openssh-server - secure shell (SSH) server, for secure access from remote machines
openssh-sftp-server - secure shell (SSH) sftp server module, for SFTP access from remote machines
python-setproctitle - Setproctitle implementation for Python 2
python3-setproctitle - Setproctitle implementation for Python 3
ssh - secure shell client and server (metapackage)
agent-transfer - copy a secret key from GnuPG's gpg-agent to OpenSSH's ssh-agent

...

ssh-askpass-gnome - interactive X program to prompt users for a passphrase for ssh-add
ssh-audit - tool for ssh server auditing
sshpass - Non-interactive ssh password authentication


I removed some of the output because it can get very long. The visible results order was not changed though.

 

III. Search available packages using apt


Using apt you can search for available packages from the command line as follows:

apt search KEYWORD


Replace KEYWORD with the keyword you want to search for (you can add multiple keywords in quotes).

Here is an example search for "openssh" together with its output:

$ apt search openssh

Sorting... Done
Full Text Search... Done
agent-transfer/bionic 0.41-1ubuntu1 amd64
  copy a secret key from GnuPG's gpg-agent to OpenSSH's ssh-agent

cme/bionic,bionic 1.026-1 all
  Check or edit configuration data with Config::Model

connect-proxy/bionic 1.105-1 amd64
  Establish TCP connection using SOCKS4/5 or HTTP tunnel

...

openssh-client/bionic,now 1:7.6p1-4 amd64 [installed]
  secure shell (SSH) client, for secure access to remote machines

openssh-client-ssh1/bionic 1:7.5p1-10 amd64
  secure shell (SSH) client for legacy SSH1 protocol

openssh-known-hosts/bionic,bionic 0.6.2-1 all
  download, filter and merge known_hosts for OpenSSH

openssh-server/bionic 1:7.6p1-4 amd64
  secure shell (SSH) server, for secure access from remote machines

openssh-sftp-server/bionic 1:7.6p1-4 amd64
  secure shell (SSH) sftp server module, for SFTP access from remote machines

putty-tools/bionic 0.70-4 amd64
  command-line tools for SSH, SCP, and SFTP

python-scp/bionic,bionic 0.10.2-1 all
  scp module for paramiko


Once again, I removed some of the results because the results list is quite long. The results order was not changed though.


For all three, the search results may be very long. In such cases, you can run them through more, for easier reading, like this:

apt-cache search KEYWORD | more


You can also exclude results that don't include a particular keyword (KEYWORD2 in this example) by using grep:

apt-cache search KEYWORD | grep KEYWORD2


grep is case sensitive by default. Add -i (grep -i KEYWORD2) to ignore case.

Published in GNU/Linux Rules!

There are multiple ways of preventing a package from updating in Debian, Ubuntu, Linux Mint, elementary OS and other Debian/Ubuntu-based Linux distributions. This article presents 3 ways of excluding repository packages from being upgraded.

  

 

Why prevent a package from being updated? Let's say you install a package that's older than the version available in Debian, Ubuntu or Linux Mint repositories, or you know some update is causing issues, and you want to upgrade all packages minus one (or two, three...).

Here's an example. I'm using Chromium browser with hardware accelerationpatches from the Saiarcot895-dev PPA, in Ubuntu 18.10. To get hardware acceleration to work with Nvidia drivers, a patched vdpau-va-driver package is needed, and this is not yet available in this PPA for the latest Ubuntu 18.10. Luckily, the Ubuntu 18.04 package can be installed in Ubuntu 18.10, but any upgrade through "apt upgrade" or using the Software Updater will upgrade this package, which I don't want. So in this case, holding this package from upgrades would allow me to upgrade all other packages without having to worry about it.

It should be noted that preventing a package from future upgrades may cause issues in some situations, if the package you're holding is used as a dependency for another package that can be upgraded. So try not to prevent too many packages from upgrades, especially libraries.

Here are 3 ways of preventing a package from updating in Debian, Ubuntu, Linux Mint.

1. Prevent package updates using a GUI: Synaptic Package Manager

Synaptic Package Manager, a Gtk graphical package management program for apt, can lock packages which prevents them from being updated.

It's important to note that using Synaptic to lock packages won't keep them from being updated from the command line - running apt upgrade or apt-get upgrade will still upgrade a package locked in Synaptic. Locking packages in Synaptic will prevent package upgrades using Ubuntu's Software Updater app, and possibly other graphical package managers. It will not prevent updating packages using the Linux Mint Update Manager application though. As a result, I recommend using apt-mark or dpkg (see below) to keep packages from updating.

You can install Synaptic Package Manager using this command:

sudo apt install synaptic


To prevent a package from updating using Synaptic, search for it, select the package and from the Synaptic menu click Package -> Lock Version:

Synaptic lock package version


In the same way you can unlock the package too.

To see all locked packages in Synaptic, click Status in the bottom left-hand side, then click on Pinned above the Status section:

Synaptic show locked (pinned) packages


2. Keep a package from updating using apt-mark

Holding packages from updating with apt-mark should prevent them from updating using Ubuntu's Software Updater, as well as command line upgrades (apt upgrade / apt-get upgrade).

You can hold a package from future upgrades (and from being automatically removed) with apt-mark by using this command:

sudo apt-mark hold PACKAGE


Replacing PACKAGE with the package you want to hold from updating.

You can check which packages marked as hold by using:

apt-mark showhold


To remove a hold (so the package can be updated), use:

sudo apt-mark unhold PACKAGE


For both hold and unhold you can specify multiple packages, just like when installing software with apt (separate the packages by a space).

3. Prevent package updates with dpkg

A while back there were some graphical package managers that ignored the apt-mark hold status. I'm not sure if that's still the case, but just to be safe (and in case you're using an old Debian / Ubuntu / Linux Mint version), here's another way of preventing package updates in Ubuntu, Linux Mint or Debian: dpkg.

To prevent a package from upgrades using dpkg, use:

echo "PACKAGE hold" | sudo dpkg --set-selections


You can see all package holds using this command:

dpkg --get-selections | grep hold


To remove the hold (allow the package to be upgraded), use:

echo "PACKAGE install" | sudo dpkg --set-selections


Unlike apt-mark, this solution doesn't allow specifying multiple packages at once.

Published in GNU/Linux Rules!

There are multiple ways of finding out to which package a particular file belongs to, on Ubuntu, Debian or Linux Mint. This article presents two ways of achieving this, both from the command line.

1. Using apt-file to find the package that provides a file (for repository packages, either installed or not installed) 


apt-file indexes the contents of all packages available in your repositories, and allows you to search for files in all these packages. 

That means you can use apt-file to search for files inside DEB packages that are installed on your system, as well as packages that are not installed on your Debian (and Debian-based Linux distributions, like Ubuntu) machine, but are available to install from the repositories. This is useful in case you want to find what package contains a file that you need to compile some program, etc.

apt-file cannot find the package that provides a file in case you downloaded a DEB package and installed it, without using a repository. The package needs to be available in the repositories for apt-file to be able to find it.

apt-file may not be installed on your system. To install it in Debian, Ubuntu, Linux Mint and other Debian-based or Ubuntu-based Linux distributions, use this command:

sudo apt install apt-file


This tool find the files belonging to a package by using a database, which needs to be updated in order to be able to use it. To update the apt-file database, use:

sudo apt-file update


Now you can use apt-file to find the DEB package that provides a file, be it a package you've installed from the repositories, or a package available in the repositories, but not installed on your Debian / Ubuntu / Linux Mint system. To do this, run:

apt-file search filename


Replacing filename with the name of the file you want to find.

This command will list all occurrences of filename found in various packages. If you know the exact file path and filename, you can get the search results to only list the package that includes that exact file, like this:

apt-file search /path/to/filename


For example, running only apt-file search cairo.h will list a large list search results:

$ apt-file search cairo.h
fltk1.3-doc: /usr/share/doc/fltk1.3-doc/HTML/group__group__cairo.html
ggobi: /usr/include/ggobi/ggobi-renderer-cairo.h
glabels-dev: /usr/include/libglbarcode-3.0/libglbarcode/lgl-barcode-render-to-cairo.h
glabels-dev: /usr/share/gtk-doc/html/libglbarcode-3.0/libglbarcode-3.0-lgl-barcode-render-to-cairo.html
gstreamer1.0-plugins-good-doc: /usr/share/gtk-doc/html/gst-plugins-good-plugins-1.0/gst-plugins-good-plugins-plugin-cairo.html
guile-cairo-dev: /usr/include/guile-cairo/guile-cairo.h
guitarix-doc: /usr/share/doc/guitarix-doc/namespacegx__cairo.html
ipe: /usr/share/ipe/7.2.7/doc/group__cairo.html
libcairo-ocaml-dev: /usr/share/doc/libcairo-ocaml-dev/html/Pango_cairo.html
libcairo-ocaml-dev: /usr/share/doc/libcairo-ocaml-dev/html/type_Pango_cairo.html
libcairo2-dev: /usr/include/cairo/cairo.h
...


However, if you know the file path, e.g. you want to find out to which package the file /usr/include/cairo/cairo.h belongs to, run:

apt-file search /usr/include/cairo/cairo.h


This only lists the package that contains this file:

$ apt-file search /usr/include/cairo/cairo.h
libcairo2-dev: /usr/include/cairo/cairo.h


In this example, the package that includes the file I searched for (/usr/include/cairo/cairo.h) is libcairo2-dev.

apt-file may also be used to list all the files included in a package (apt-file list packagename), perform regex search, and more. Consult its man page (man apt-file) and help for more information (apt-file --help).

2. Using dpkg to find the package that provides a file (only for installed DEB packages - from any source)


dpkg can also be used to find out to which package a file belongs to. It can be faster to use than apt-file, because you don't need to install anything, and there's no database to update. 

However, dpkg can only search for files belonging to installed packages, so if you're searching for a file in a package that's not installed on your system, use apt-file. On the other hand, dpkg can be used to find files belonging to packages that were installed without using a repository, a feature that's not available for apt-file.

To use dpkg to find the installed DEB package that provides a file, run it with the -S (or --search) flag, followed by the filename (or pattern) you want to see to which package it belongs, like this:

dpkg -S filename


For example, to find out to which package the cairo.h file belongs to, use dpkg -S cairo.h:

$ dpkg -S cairo.h
libgtk2.0-dev:amd64: /usr/include/gtk-2.0/gdk/gdkcairo.h
libcairo2-dev:amd64: /usr/include/cairo/cairo.h
libpango1.0-dev: /usr/include/pango-1.0/pango/pangocairo.h
libgtk-3-dev:amd64: /usr/include/gtk-3.0/gdk/gdkcairo.h


Just like for apt-file, this may show multiple packages that have files containing the filename you're looking for. You can enter the full path of the file to get only the package that contains that specific file. Example:

$ dpkg -S /usr/include/cairo/cairo.h
libcairo2-dev:amd64: /usr/include/cairo/cairo.h


In this example, the Debian package that includes the file I searched for (/usr/include/cairo/cairo.h) is libcairo2-dev.


Other notable ways of finding the package a file belongs to is using the online search provided by Ubuntu and Debian:


For both, you'll also find options to find the packages that contain files named exactly like your input keyword, packages ending with the keyword, or packages that contains files whose names contain the keyword.

The Linux Mint package search website doesn't include an option to search for files inside packages, but you can use the Ubuntu or Debian online package search for packages that Linux Mint imports from Debian / Ubuntu.

Published in GNU/Linux Rules!

This article explains how to downgrade a package to a specific version using apt, in Debian, Ubuntu or Linux Mint (from the command line).

 

 

 

Sometimes you may encounter issues with a recently upgraded package, and you want to downgrade it. To be able to downgrade a package in Debian, Ubuntu or Linux Mint (and other Debian/Ubuntu-based Linux distributions), the package version to which you want to downgrade must be available in a repository.

From the same series:


To downgrade a package to a specific version, you'll need to append =version after the package name in the installation command, with version being the version to which you want to downgrade the package:

sudo apt install =


Example 1.

Let's look at a simple example. I currently have Firefox 65 installed in Ubuntu 18.10, and I want to downgrade it using apt. The first thing to do is to look at the available versions, by running apt policy firefox (apt-cache policy works as well):

$ apt policy firefox
firefox:
  Installed: 65.0+build2-0ubuntu0.18.10.1
  Candidate: 65.0+build2-0ubuntu0.18.10.1
  Version table:
 *** 65.0+build2-0ubuntu0.18.10.1 500
        500 http://security.ubuntu.com/ubuntu cosmic-security/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu cosmic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     63.0+build1-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu cosmic/main amd64 Packages


This apt command shows that the Firefox version installed on my system is 65.0+build2-0ubuntu0.18.10.1, and it's available in the cosmic-security and cosmic-updates repositories. There is an older version, 63.0+build1-0ubuntu1, available in the main repository, so Firefox can be downgraded to this version.

To downgrade Firefox from the installed 65.0+build2-0ubuntu0.18.10.1 version, to the 63.0+build1-0ubuntu1 version from the main repository, the command would be:

sudo apt install firefox=63.0+build1-0ubuntu1


This command downgrades Firefox without having to downgrade any other packages, because Firefox doesn't depend on any strict package versions:

$ sudo apt install firefox=63.0+build1-0ubuntu1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be DOWNGRADED:
  firefox
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 51 not upgraded.
Need to get 46.1 MB of archives.
After this operation, 4,243 kB disk space will be freed.
Do you want to continue? [Y/n]


There are cases in which you must resolve some dependencies to be able to downgrade the package though, and we'll look at an example like that below.

Example 2.

Let's look at a more complicated example - a package that can't be directly downgraded using apt without also downgrading some of its dependencies.

$ apt policy chromium-browser
chromium-browser:
  Installed: 72.0.3626.81-0ubuntu1~ppa2~18.10.1
  Candidate: 72.0.3626.81-0ubuntu1~ppa2~18.10.1
  Version table:
 *** 72.0.3626.81-0ubuntu1~ppa2~18.10.1 500
        500 http://ppa.launchpad.net/saiarcot895/chromium-beta/ubuntu cosmic/main amd64 Packages
        100 /var/lib/dpkg/status
     71.0.3578.98-0ubuntu0.18.10.1 500
        500 http://security.ubuntu.com/ubuntu cosmic-security/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu cosmic-updates/universe amd64 Packages
     69.0.3497.100-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu cosmic/universe amd64 Packages


The apt policy command above shows that I currently have Chromium browser beta (version 72) installed from the Saiarcot Chromium Beta PPA, with two older versions being available in the Ubuntu security/updates and main repositories.

Let's try to downgrade chromium browser from version 72.0.3626.81-0ubuntu1~ppa2~18.10.1 to version 71.0.3578.98-0ubuntu0.18.10.1 (from the security/updates repositories) using apt and see what happens:

$ sudo apt install chromium-browser=71.0.3578.98-0ubuntu0.18.10.1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 chromium-browser : Depends: chromium-codecs-ffmpeg-extra (= 71.0.3578.98-0ubuntu0.18.10.1) but 72.0.3626.81-0ubuntu1~ppa2~18.10.1 is to be installed or
                             chromium-codecs-ffmpeg (= 71.0.3578.98-0ubuntu0.18.10.1) but it is not going to be installed
                    Recommends: chromium-browser-l10n but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


Downgrading Chromium browser doesn't work because it depends on chromium-codecs-ffmpeg-extra or chromium-codecs-ffmpeg, with the exact same version as the chromium-browser package itself. In this case, let's also downgrade the chromium-codecs-ffmpeg-extra package to the same version:

$ sudo apt install chromium-browser=71.0.3578.98-0ubuntu0.18.10.1 chromium-codecs-ffmpeg-extra=71.0.3578.98-0ubuntu0.18.10.1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  webaccounts-chromium-extension unity-chromium-extension adobe-flashplugin
Recommended packages:
  chromium-browser-l10n
The following packages will be REMOVED:
  chromium-browser-l10n chromium-chromedriver
The following packages will be DOWNGRADED:
  chromium-browser chromium-codecs-ffmpeg-extra
0 upgraded, 0 newly installed, 2 downgraded, 2 to remove and 51 not upgraded.
Need to get 58.8 MB of archives.
After this operation, 61.5 MB disk space will be freed.
Do you want to continue? [Y/n]


The apt downgrade command output shows that chromium-browser can now be downgraded, but the command wants to remove 2 packages. Those are recommended packages that were automatically installed when chromium-browser was installed (and they too need to be the exact same version as the chromium-browser package), and while they are not required by chromium-browser, you may still need them. So it's a good idea to downgrade those as well, so they are not removed.

In this case, the apt downgrade command becomes:

sudo apt install chromium-browser=71.0.3578.98-0ubuntu0.18.10.1 chromium-codecs-ffmpeg-extra=71.0.3578.98-0ubuntu0.18.10.1 chromium-browser-l10n=71.0.3578.98-0ubuntu0.18.10.1 chromium-chromedriver=71.0.3578.98-0ubuntu0.18.10.1


Let's look at what happens when we use it:

$ sudo apt install chromium-browser=71.0.3578.98-0ubuntu0.18.10.1 chromium-codecs-ffmpeg-extra=71.0.3578.98-0ubuntu0.18.10.1 chromium-browser-l10n=71.0.3578.98-0ubuntu0.18.10.1 chromium-chromedriver=71.0.3578.98-0ubuntu0.18.10.1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  webaccounts-chromium-extension unity-chromium-extension adobe-flashplugin
The following packages will be DOWNGRADED:
  chromium-browser chromium-browser-l10n chromium-chromedriver chromium-codecs-ffmpeg-extra
0 upgraded, 0 newly installed, 4 downgraded, 0 to remove and 51 not upgraded.
Need to get 64.9 MB of archives.
After this operation, 35.8 MB disk space will be freed.
Do you want to continue? [Y/n]


As you can see, the downgrade can be performed, and no packages are about to be removed. Since it all looks good now, we can proceed with the downgrade.

Published in GNU/Linux Rules!
Monday, 28 January 2019 21:21

Install Ubuntu Linux On Any Chromebook

Chromebook Linux

 


I have a HP Chromebook G4 from 2014 that won't receive official Linux (Crostini) support, so I decided to use Crouton to install Ubuntu instead.

I thought some of you might be interested in this, so this article presents step by step instructions for installing Ubuntu on any Chrombook model, using Crouton. There are also a few tweaks / tips, and instructions for removing it.

Crouton, or Chromium OS Universal Chroot Environment, makes it easy to install Ubuntu or Debian in a chroot environment on Chromebooks, no matter the Chromebook model or architecture. Using Crouton, you continue to use Chrome OS, but you can easily switch between Ubuntu and Chrome OS when needed.

Compared to the Crostini solution for Chrome OS offered by Google, Crouton has wider device compatibility, and it enables direct hardware access. Also, compared to virtualization, Crouton has zero speed penalty since it runs natively.

On the other hand, Crostini is an official project and doesn't need enabling developer mode (which is required to be able to install Ubuntu or Debian on a Chromebook using Crouton). Since your Chromebook runs in verified mode, it also means Crostini is more secure.

 

 

Install Ubuntu on a Chromebook using Crouton


Switching your Chromebook to developer mode is insecure! Crouton supports encryption, but as the Crouton wiki page mentions, "the encryption is only as strong as the quality of your passphrase".

Before you proceed:

  • Backup your data. Google backs up your passwords, browser extensions and so on, but you may want to back up the files that you've saved in your Downloads folder though.
  • You may want to create a restore image for Chrome OS by installing the Chromebook Recovery Utility extension. You'll need a 4 GB or larger USB flash drive or SD card.


1. Switch your Chromebook to developer mode.



Installing Ubuntu on your Chromebook with Crouton requires switching the Chromebook to developer mode.

Enabling developer mode may vary depending on the Chromebook model you're using. You can find out the instructions for switching your Chromebook to developer mode by visiting this page, clicking on your Chromebook model, then follow the instructions.

From what I've seen, these are the instructions for most models: invoke Recovery mode by holding down the ESC and Refresh (F3) keys, and poking the Power button. After entering Recovery, press Ctrl + D (there's no information about this displayed on the screen - you have to know this to use it). It will ask you to confirm and then reboot into developer mode.

This may take a while!

From now on, each time your Chromebook boots up, you'll need to press Ctrl + D or wait 30 seconds to continue. Don't press the SPACE key as it will reset!

2. Download Crouton.

Go to the Crouton GitHub project page and click the goo.gl link at the top of the page to download the latest version of Crouton. This is a direct link to the latest Crouton download (it may change though). Leave the downloaded file in the Downloads folder.

3. Install Ubuntu

Crouton install Ubuntu Chromebook


Now it's time to install Ubuntu on your Chromebook. To do this, open the crosh shell by pressing Ctrl + Alt + T. This should open a terminal-like tab. Type:

shell


Now you can type the following command to see the Crouton help text:

sh ~/Downloads/crouton


To install Ubuntu 16.04 with the Xfce desktop (a lightweight desktop environment), and enable encryption, use this command (don't run it before reading what everything does and how to customize it):

sudo sh ~/Downloads/crouton -e -t extension,keyboard,audio,xfce


-e adds encryption and -t specifies installing the following targets: 

  • extension: clipboard synchronization and URL handling between Chrome OS and Linux (requires installing the Crouton Integration Chrome extension)
  • keyboard: adds support for Chromebook keyboard special keys
  • audio: adds support for audio playback via Chromium OS's audio system
  • xfce: the Xfce desktop environment

 

Xfce desktop running on a Chromebook (via Crouton)


You can see all the available targets (which are not just desktop environments, but may also be predefined package lists, like touch for touchscreen gesture support, etc.) by running:

sh ~/Downloads/crouton -t help


Crouton can also install e17, Gnome, KDE, LXDE, and Unity desktops. Also, you can specify multiple targets by separating them using a comma.

You can also install the xiwi target to allow running Ubuntu in a Chrome OS tab or window (unaccelerated). This requires installing the Crouton Integration Chrome extension. A screenshot of this can be found at the top of the article.

While Crouton installs Ubuntu 16.04 by default, you can specify a different Ubuntu version (either older, like 14.04 - trusty, or newer like Ubuntu 18.04 - bionic), and even Debian or Kali Linux. To change the installed Ubuntu (or Debian / Kali) version, append -r  to the installation command. For example, to install Ubuntu 18.04 Bionic Beaver instead of 16.04 Xenial Xerus, the command to install Ubuntu on your Chromebook becomes:

sudo sh ~/Downloads/crouton -e -r bionic -t extension,keyboard,audio,xfce


You can see all the available Ubuntu, Debian and Kali releases that you can install on a Chromebook, use this command:

sh ~/Downloads/crouton -r list


Some versions are not officially supported though, but they may work. This includes Ubuntu 18.04 Bionic Beaver!

How to use Ubuntu installed on a Chromebook using Crouton


To start Ubuntu (with Xfce desktop environment) on your Chromebook, press Ctrl + Alt + T to open a crosh shell, then type:

shell
sudo startxfce4


You'll be prompted to enter your password, encryption password, and then Ubuntu will start.

The command used to start it varies with the desktop environment you've installed, and is displayed after completing the installation. So if you've installed KDE, use sudo startkde, and so on.

Switch between Chrome OS and Ubuntu using Ctrl + Alt + Shift + Back and Ctrl + Alt + Shift + Forward. This way you switch between Ubuntu and Chrome OS without exiting Ubuntu.

To exit Ubuntu, log out from the menu present on the top panel.

A few tweaks for your new Ubuntu (Xfce) desktop running on a Chromebook


1. There's no graphical tool installed by default to find and install new applications. You can install Ubuntu / Gnome Software application by opening a terminal on your Ubuntu desktop running on top of Chrome OS, and typing the following command:

sudo apt install gnome-software


Normally you could now launch the "Software" application from your applications menu (System -> Software). But launching the Software application from the menu doesn't allow you to install any packages, displaying an error about not having permissions to install any packages, and I didn't find any way to fix this. But there is a workaround that can be used. Instead of launching Gnome / Ubuntu Software from the menu, you can launch it like this:

  • In Ubuntu 16.04 Xenial Xerus (default Crouton Ubuntu version):
gksu gnome-software

 

sudo -H gnome-software


If you still can't install applications using the Software app, log out (and make sure you don't enable saving your current session on the Xfce logout screen) and try again. Or try killing any background-running gnome-software instances using killall gnome-software, and try again to install some software.

You will only be able to install regular (DEB) packages using Gnome Software. Installing snap packages doesn't seem to work, or at least I couldn't find a way to make it work. Installing snap packages doesn't using any installation method you may try - using Ubuntu Software or from the command line.

2. You might want to add third-party PPA repositories, which you'll find in many online guides for installing various software that's not available in Ubuntu directly. But this command does not work by default when installing Ubuntu on a Chromebook using Crouton.

To enable the add-apt-repository command you'll need to install a package called software-properties-common. Open a terminal on your Ubuntu desktop and use this command to install it:

sudo apt install software-properties-common


3. The default Crouton setup for Xfce may be a bit... ugly. To fix this, go to the applications menu -> Settings -> Settings Manager and change:

  • Appearance -> Icon tab: change the icon theme to elementary Xfce darker
  • Window Manager -> Style tab: change the theme to Greybird


This is how the window borders and icons will look after this change:

Crouton Xfce theme tweaks


You may also try the other themes to see which one you like the most, or install more themes.

How to uninstall Ubuntu (installed using Crouton) from Chromebook


If you want to completely remove Crouton, you can reboot your Chromebook and press SPACE while booting to turn on OS verification. This will reset the Chromebook / Chrome OS.

You can also recover your original Chrome OS installation, in case you've created a backup using the Chromebook Recovery Utility.

If you only want to delete the chroot created when you installed Ubuntu with Crouton, exit Ubuntu (by logging out), and in Chrome OS press Ctrl + Alt + T, then type:

shell


Next, use this command to remove Ubuntu:

sudo delete-chroot 


Replacing  with the Ubuntu version codename. By default this is xenial. If you've installed Ubuntu 18.04 Bionic Beaver, its codename is bionic

If you don't know the Ubuntu version / chroot name, you can get a list of the chroot names you have installed by using this command:

sudo edit-chroot -a
Published in GNU/Linux Rules!
Page 2 of 2