Tormod Landet

Articles tagged with apt

  1. Installing R in WSL

    Short note for posteriority: the documentation for R tells you to install the key for the Ubuntu 18.04 R repository via the following command:

    sudo apt-key adv --keyserver --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

    Using apt-key in this way does not work on Ubuntu 18.04 on Windows 10 (in WSL, Windows Subsystem for Linux) due to use of an unsupported IPC mechanism for communicating with dirmngr (at least with Windows 10 version 1709). The command gives the following error:

    Executing: /tmp/apt-key-gpghome.Sf0LlrpiEu/ --keyserver --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
    gpg: connecting dirmngr at '/tmp/apt-key-gpghome.Sf0LlrpiEu/S.dirmngr' failed: IPC connect call failed
    gpg: keyserver receive failed: No dirmngr

    Instead run the following command to add the key:

    curl -sL "" | sudo apt-key add

    How did I get the number 0x51716619E084DAB9? Add the repository and run apt update:

    sudo add-apt-repository 'deb bionic-cran35/'
    sudo apt update

    It will complain:

    Err:2 bionic-cran35/ InRelease
      The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9


    The full set of commands to install R from the repositories:

    curl -sL "" | sudo apt-key add
    sudo add-apt-repository 'deb bionic-cran35/'
    sudo apt-get update
    sudo apt-get install r-base

    I'm not really much of an R user, but I needed it this one time and I prefer using WSL when I have to use Windows.

  2. Cleaning cruft in a Ubuntu installation

    I have been running Linux on my laptops for as long as I have been owning laptops. My current one has been through quite a few versions of Ubuntu Linux. There are normally no big changes from version to version, but it steadily improves. In that process some software packages that previously were installed by default are replaced or become obsolete. Most of this software is still updated, but it is no longer present on new installations and it may have no value to me.

    Every time I update to a new version of Ubuntu I have a feeling that the cruft is building up, but there is no obvious way that I have found to remove software that has no longer been found worthy of being part of the default install. So, this time I decided to write a script to identify these packages. The script takes a list of software packages to keep, i.e the software that I use directly when I use my machine. From this list it finds all the packages that must be present for my prefered software to work, and lists all the other that can in princible be removed.

    In reality, it is hard to come up with a list of all the software that is required for a Ubuntu installation to work properly, so I also made the script read the newest list of default packages. Any of these that happen to be installed are also kept along with their dependencies.

    The script itself, can be found on Bitbucket. It does not uninstall any packages by itself, but suggest packages that you can uninstall by running apt purge PCKGNAME or similar. I put it online and write about it here in the hope that it will be useful to someone else.

    I started out with the following list of packages to keep,

    python3 ubuntu-desktop krita thunderbird firefox ubuntu-minimal digikam gimp darktable gedit Downloads/ubuntu-16.10-desktop-amd64.manifest -v

    and after some trial and error I ended up with the following by noticing packages suggested for removal that I in reality wanted to keep and adding them to the command line invocation,

    python3 ubuntu-desktop krita thunderbird firefox ubuntu-minimal digikam gimp darktable gedit clang bcmwl-kernel-source systemsettings enfuse ffmpegthumbs flashplugin-installer gstreamer1.0-nice gstreamer1.0-plugins-bad gstreamer1.0-plugins-bad-faad  gstreamer1.0-plugins-bad-videoparsers gstreamer1.0-plugins-ugly gstreamer1.0-plugins-ugly-amr hugin hugin-tools inkscape gimp-ufraw git  gmsh gphoto2 gstreamer1.0-libav gimp-plugin-registry  ttf-mscorefonts-installer mercurial kipi-plugins gimp-gmic sshfs Downloads/ubuntu-16.10-desktop-amd64.manifest -v

    This allowed me to get rid of approximately 4 GB of cruft without any noticeable problems afterwards. Note that I did not blindly remove all packages suggested by the above final invocation, but I removed maybe 90% of them. The script is not smart, it can easily suggest that you remove your network driver, so use with caution!


    Hoarfrost / Yay!