aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-05-22 13:06:24 +0300
committerFrederick Muriuki Muriithi2023-05-22 13:14:31 +0300
commitf0c32ce4353338c3cfaa3c768fe2efc271059543 (patch)
treef14cd6fd1d1f5f048b41fbe66f87d7d3024f3f6b
parent2d648a1934d3c9f3861fba5f15482911af535aad (diff)
downloadgn-machines-f0c32ce4353338c3cfaa3c768fe2efc271059543.tar.gz
Document getting a shell into container
For some tasks (e.g. debugging the xapian index build), we need to manually queue the job, which means we need a shell into the container. Getting a shell using the default command displayed actually fails with: nsenter: failed to execute /bin/bash: No such file or directory so we need to provide the correct path to bash, and optionally, initialise the shell to setup the correct paths.
-rw-r--r--README.org36
1 files changed, 36 insertions, 0 deletions
diff --git a/README.org b/README.org
index 0712331..60fa594 100644
--- a/README.org
+++ b/README.org
@@ -44,3 +44,39 @@ In containers containing virtuoso instances, it is important to secure
authentication by changing default user passwords and disabling
unnecessary users. See [[https://issues.genenetwork.org/topics/systems/virtuoso][virtuoso gemtext documentation]] on passwords for
more details.
+
+* Getting a Shell into the Container
+
+When you start the container, you can get a shell into the container using the
+~nsenter~ command. You will need the process ID of the container, which your
+can get with something like:
+
+#+BEGIN_SRC sh
+ ps -e | grep shepherd
+#+END_SRC
+
+That will give you output of the form:
+
+#+BEGIN_EXAMPLE
+ 11869 pts/3 00:00:00 shepherd
+#+END_EXAMPLE
+
+From the guix [/operating-system/ Reference](https://guix.gnu.org/manual/en/html_node/operating_002dsystem-Reference.html)
+under the *packages* option, the list of packages installed under the global
+profile are found in */run/current-system/profile*, for example:
+
+#+BEGIN_SRC sh
+ /run/current-system/profile/ls /gnu/store
+#+END_SRC
+
+to list the files under */gnu/store*
+
+With that knowledge, we can now get a shell using ~nsenter~ as follows:
+
+#+BEGIN_SRC sh
+ sudo nsenter -a -t 11869 /run/current-system/profile/bin/bash \
+ --init-file /run/current-system/profile/etc/profile
+#+END_SRC
+
+which will give you a bash shell with the ~PATH~ environment variable setup
+correctly to give you access to all packages in the global profile.