I see 5 different profiles on my NixOS system; which is which? - nixos

I have a NixOS installation with one user (my-username below) other than root, and I'm trying to understand how to clean up and roll back different aspects of my system.
Digging around in /nix/var/nix/profiles, I can see at least 5 distinct-looking profiles, and I want to be clear on what I'm cleaning up/rolling back when I target each of them:
❯❯❯ nix-env --list-generations --profile /nix/var/nix/profiles/per-user/my-username/channels
7 2020-01-11 14:53:26 (current)
❯❯❯ nix-env --list-generations --profile /nix/var/nix/profiles/per-user/my-username/profile
61 2020-01-22 19:53:12
62 2020-01-26 13:43:10
63 2020-01-26 16:19:39
64 2020-01-26 16:22:40
65 2020-01-26 16:45:32
66 2020-01-26 17:20:41 (current)
❯❯❯ sudo nix-env --list-generations --profile /nix/var/nix/profiles/per-user/root/channels
7 2019-12-09 11:31:07 (current)
❯❯❯ sudo nix-env --list-generations --profile /nix/var/nix/profiles/default
2 2019-10-18 23:19:20 (current)
❯❯❯ sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
108 2020-01-26 16:27:21
109 2020-01-26 16:31:29
110 2020-01-26 16:35:58
111 2020-01-26 16:51:56
112 2020-01-26 17:10:54
113 2020-01-26 17:19:06
114 2020-01-26 17:27:45 (current)
Here's my understanding of each of these:
Channels (references to a collection of versioned packages) my non-root account can install from.
A set of versioned packages my non-root user has installed.
Channels my root account can install from.
A set of versioned packages my root user has installed.
System configurations (managed by root).
Is my understanding of each of these correct, and if not, where am I going wrong?

Related

Static libraries in the way when updating CuDNN minor version

It seems the CuDNN installer looks for the wrong version of CUDA. What am I doing wrong? The story in full:
Ubuntu 16.04
Two versions of CUDA installed, 9.0 and 9.1. /usr/lib/cuda links to the 9.1 installation, and LD_LIBRARY_PATH seems to point to that one:
$ echo $LD_LIBRARY_PATH
/usr/local/cuda/lib64:/usr/local/lib
$ ls -l /usr/local
lrwxrwxrwx 1 root root 8 jan 22 2018 cuda -> cuda-9.1
drwxr-xr-x 15 root root 4096 dec 1 2017 cuda-9.0
drwxr-xr-x 15 root root 4096 jan 22 2018 cuda-9.1
Now I did have CuDNN 7.0 installed, wanted to replace it with version 7.1. (That may have been an unwise decision, but, I already started doing it!)
Downloaded debian installers for CuDNN 7.1.3, to go with CUDA 9.1. Tried to install it thus:
$ sudo dpkg -i libcudnn7_7.1.3.16-1+cuda9.1_amd64.deb
(Reading database ... 261910 files and directories currently installed.)
Preparing to unpack libcudnn7_7.1.3.16-1+cuda9.1_amd64.deb ...
Unpacking libcudnn7 (7.1.3.16-1+cuda9.1) over (7.1.3.16-1+cuda9.1) ...
Setting up libcudnn7 (7.1.3.16-1+cuda9.1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
/sbin/ldconfig.real: /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7 is not a symbolic link
As you can see, the installer looks in the cuda-9.0 directory after the library files. (Why?) The file exists but it is not a symbolic link:
$ ls -l /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so
-rwxr-xr-x 1 root root 287624224 jan 16 2018 /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so
I also tried to remove libcudnn, but I did that after the first attempt of reinstalling, so removal throws the same kind of error:
$ sudo apt-get remove libcudnn7
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
cuda-9-0 cuda-command-line-tools-9-0 cuda-core-9-0 cuda-cublas-9-0
cuda-cublas-dev-9-0 cuda-cudart-9-0 cuda-cudart-dev-9-0 cuda-cufft-9-0
cuda-cufft-dev-9-0 cuda-curand-9-0 cuda-curand-dev-9-0 cuda-cusolver-9-0
cuda-cusolver-dev-9-0 cuda-cusparse-9-0 cuda-cusparse-dev-9-0
cuda-demo-suite-9-0 cuda-documentation-9-0 cuda-driver-dev-9-0
cuda-libraries-9-0 cuda-libraries-dev-9-0 cuda-license-9-0
cuda-misc-headers-9-0 cuda-npp-9-0 cuda-npp-dev-9-0 cuda-nvgraph-9-0
cuda-nvgraph-dev-9-0 cuda-nvml-dev-9-0 cuda-nvrtc-9-0 cuda-nvrtc-dev-9-0
cuda-runtime-9-0 cuda-samples-9-0 cuda-toolkit-9-0 cuda-visual-tools-9-0
libatk-wrapper-java libatk-wrapper-java-jni python-cliapp python-markdown
python-ttystatus
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
libcudnn7 libcudnn7-dev
0 upgraded, 0 newly installed, 2 to remove and 18 not upgraded.
After this operation, 680 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 261909 files and directories currently installed.)
Removing libcudnn7-dev (7.1.3.16-1+cuda9.1) ...
update-alternatives: removing manually selected alternative - switching libcudnn to auto mode
Removing libcudnn7 (7.1.3.16-1+cuda9.1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
/sbin/ldconfig.real: /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7 is not a symbolic link
So, the bigger picture: My goal is to get CuDNN 7.1 properly installed. How do I go about to achieve that goal?
I finally managed! I went in and manually removed the .so files:
$ cd /usr/local/cuda-9.0/targets/x86_64-linux/lib/
$ sudo mv libcudnn.so bak_libcudnn.so
$ sudo mv libcudnn.so.7 bak_libcudnn.so.7
$ sudo mv libcudnn.so.7.0.5 bak_libcudnn.so.7.0.5
then installing with dpkg, and reinstalling my tensorflow-gpu which confirmed that everything finally worked:
2018-11-30 09:40:39.478559: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2123 MB memory) -> physical GPU (device: 0, name: Quadro M2000M, pci bus id: 0000:01:00.0, compute capability: 5.0)

How to remove notepad++ package from Ubuntu 18.04?

Earlier I was using Notepad++ and its not user friendly. So I've installed notepadqq now and trying to remove notepad++.
I tried to do but not able to find the package
root#ahamed:/home/ahamed/snap# sudo apt remove notepad-plus-plus
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package notepad-plus-plus
root#ahamed:/home/ahamed/snap#
Now i can see two packages in my machine
root#ahamed:/home/ahamed/snap# ls -ltr
total 8
drwxr-xr-x 4 ahamed ahamed 4096 Aug 1 12:01 notepadqq
drwxr-xr-x 4 ahamed ahamed 4096 Aug 1 12:13 notepad-plus-plus
root#ahamed:/home/ahamed/snap#
I can see that notepad++ works in .exe format. It really looks weird. Could someone help me on this
root#ahamed:/home/ahamed/snap# ps -ef|grep notepad
ahamed 16309 2113 0 12:14 tty2 00:00:00 bash /snap/notepad-plus-plus/85/bin/notepad-plus-plus
ahamed 16421 16309 0 12:14 tty2 00:00:04 /home/ahamed/snap/notepad-plus-plus/85/notepad-plus-plus/notepad-plus-plus.exe
ahamed 16424 1 0 12:14 ? 00:00:03 /snap/notepad-plus-plus/85/bin/wineserver
root 17134 11542 0 12:23 pts/0 00:00:00 grep --color=auto notepad
root#ahamed:/home/ahamed/snap#
List the installed softwares using the following command, and you will get the list:
kswajih#kswajih:~$ sudo snap list
Name Version Rev Tracking Publisher Notes
core 16-2.33.1 4917 stable canonical core
notepad-plus-plus 7.5.8 85 stable mmtrt -
sublime-text 3176 22 stable snapcrafters classic
vscode 1.25.1-1531323788 44 stable flexiondotorg classic
Now use the following command to remove installed packages, in your case its notepad-plus-plus:
kswajih#kswajih:~$ sudo snap remove notepad-plus-plus
notepad-plus-plus removed
Hope it helps.

Can I access Postgre database on another machine using Perl, DBI, and DBD::Pg?

My machine: Linux RHEL 5.5.56 (64-bit), Perl 5.8.8. Postgres is not on this machine. But I can ping the Postgres machine no problem. And my machine can obviously install Perl modules from CPAN on the internet.
'uname -a' returns: Linux xxx 2.6.18-371.8.1.el5PAE #1 SMP Fri Mar 28 06:00:03 EDT 2014 i686 i686 i386 GNU/Linux
Other machine has Postgres 8.4.
I'm new to installing and using any DBI module. Detailed beginner instructions are needed.
I have root access to my Linux machine.
I think yum reports that I have 'postgresql-libs.i386' installed. `yum install | grep postgres` returns: 'postgresql-libs.i386 8.1.23-10.el5_10 installed'
Is this what I need? This is on my system.
lrwxrwxrwx 1 root root 12 May 1 20:05 /usr/lib/libpq.so.4 -> libpq.so.4.1*
-rwxr-xr-x 1 root root 130K Feb 27 07:36 /usr/lib/libpq.so.4.1*
Goal: I want to grab data from a Postgres server on another machine. I already have a db username, password, IP for the db machine.
Using cpanm I installed DBI just fine, no errors. When I installed DBD::Pg I got an error. CPAN error log follows:
cpanm (App::cpanminus) 1.6941 on perl 5.008008 built for i386-linux-thread-multi
Work directory is /root/.cpanm/work/1405531191.27414
You have make /usr/bin/make
You have LWP 6.04
You have /bin/tar: tar (GNU tar) 1.15.1
You have /usr/bin/unzip
Searching DBD::Pg on cpanmetadb ...
--> Working on DBD::Pg
Fetching http://www.cpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.3.0.tar.gz
-> OK
Unpacking DBD-Pg-3.3.0.tar.gz
Entering DBD-Pg-3.3.0
Checking configure dependencies from META.yml
Checking if you have version 0 ... Yes (0.88)
Checking if you have DBI 1.614 ... Yes (1.631)
Configuring DBD-Pg-3.3.0
Running Makefile.PL
Path to pg_config?
No POSTGRES_HOME defined, cannot find automatically
Configuring DBD::Pg 3.3.0
-> N/A
-> FAIL Configure failed for DBD-Pg-3.3.0. See /root/.cpanm/work/1405531191.27414/build.log for details.
Is it even possible for me to get data from the Postgres db on another machine?
Does anyone have a link to instructions on how to do this? I've already been googling stuff, reading stuff on CPAN, Stackoverflow and Perlmonks with no results.
FAQ at http://dbi.tiddlyspot.com/ has no info specific to installing DBD::Pg.
If I install Postgres via yum, will the installation overwrite any files, like libraries? If so, which ones? We do have other applications we use on this machine.
If I get this working, my first step is to show just very basic info about the DBI driver. Next step would be to show a few fields from one table in a SELECT statement.
I won't be returning millions of records, but returning 100 records is certainly in the ballpark.
Thank you!
If you use the package that is already built and available for your system, then you won't have any of these problems.
$ sudo yum install perl-DBD-Pg
... Lots of output snipped ...
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
perl-DBD-Pg x86_64 1.49-4.el5_8 centos-update 115 k
Installing for dependencies:
postgresql-libs x86_64 8.1.23-6.el5_8 centos-update 197 k
Transaction Summary
================================================================================
Install 2 Package(s)
Upgrade 0 Package(s)
Total download size: 312 k
Is this ok [y/N]:
My example uses Centos 5.8.8, but it should work just the same for RHEL.
Of course you can; it's a client/server architecture, after all!
The error in your log is due to a missing libpq5.

dpkg --list not showing installed kernel version

I am running ubuntu 14.04 with kernel 3.13
I was following eudyptula challenge which asked me to download kernel source from linus's git and build,install, which I did and now I have two kernels, 3.13 and 3.15.
I wanted to verify the installation and read on some website that dpkg --list | grep linux-image would give me list of all installed kernels but I get only 3.13.
I currently booted 3.15
terminal outputs below:
ashish#ashish-PC:~$ uname -r
3.15.0-07913-g64b2d1f
ashish#ashish-PC:~$ dpkg --list | grep linux-image
ii linux-image-3.13.0-24-generic 3.13.0-24.46 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-24-generic 3.13.0-24.46 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.24.28 amd64 Generic Linux kernel image
If you installed from source not creating a .deb package dpkg --list won't show you because it didn't install it and knows nothing about it.
check your /boot directory:
$ ll /boot/
total 30M
-rw-r--r-- 1 root root 773K avr 10 2012 abi-3.2.0-23-generic
-rw-r--r-- 1 root root 137K avr 10 2012 config-3.2.0-23-generic
drwxr-xr-x 3 root root 12K déc 3 2013 grub
-rw-r--r-- 1 root root 21M déc 12 18:16 initrd.img-3.2.0-23-generic
-rw------- 1 root root 2,8M avr 10 2012 System.map-3.2.0-23-generic
-rw-r--r-- 1 root root 4,8M mai 20 2012 vmlinuz-3.2.0-23-generic
Your kernel are the vmlinuz* files.

My cabal packages are FUBAR; how can I purge them and start over?

I forgot to enable building libs for profiling in my ~/.cabal/config before installing a bunch of packages on a new machine and now a --reinstall world to try to fix the situation has left everything broken (naturally).
I think it's a better use of my time to just purge everything. How do I do that correctly?
Cabal doesn't keep track of what it's installed, it just uses ghc's library mechanism (or that of some other compiler if you're not using ghc), so you can use rm -r ~/.ghc to remove all locally-installed libraries.
If you have multiple ghc's installed, and you only want to remove the libs for a specific ghc, delete the subdirectory corresponding to whichever ghc you want to remove.
For example, I could remove everything I've installed for ghc-7.6.0 with rm -r ~/.ghc/x86_64-linux-7.6.0.20120810
You can also use this to preserve your ghci_history if you like.
ll ~/.ghc/
total 24
-rw-r--r-- 1 johnl johnl 2300 Aug 21 11:47 ghci_history
drwxr-xr-x 3 johnl johnl 4096 Jun 17 19:09 x86_64-linux-6.12.3
drwxr-xr-x 3 johnl johnl 4096 May 17 08:17 x86_64-linux-7.2.1
drwxr-xr-x 3 johnl johnl 4096 May 16 17:34 x86_64-linux-7.4.1
drwxr-xr-x 3 johnl johnl 4096 Jun 15 08:21 x86_64-linux-7.4.2
drwxrwxr-x 3 johnl johnl 4096 Aug 15 12:37 x86_64-linux-7.6.0.20120810
Edit: ~/.cabal/world is a list of installed packages with version constraints as specified by the user. So in most cases, it would include e.g. mtl -any. If you've installed packages with specific versions, such as by issuing cabal install mtl-2.1.1, it will record that version. You should be able to either delete the world file and start over, or if you look it over and the dependencies are acceptable, you could try just running cabal install world. Or you could ignore it and not use cabal's world support (that's what I do).
This ghc-pkg-reset shell script cleans both ~/.ghc/ and ~/.cabal/, a little more selectively. (And the accompanying ghc-pkg-clean script can help recover from a confused package installation, perhaps avoiding a reset.) I find these useful.

Resources