(Possibly) useful tech links/notes
Advice and a request: use otter like a jump box
To give yourself and others the best working conditions, when you ssh to
our servers to do your lab work, please just use otter as a stepping stone
to another of the servers and do your work there.
We have machines pup1 -
pup17, cub1 - cub16, and kit1 - kit4 to choose from, e.g. once you're on otter run
"ssh pup13" to jump to pup13.
You still have access to the same set of programs and files (including everything
in your CS account), but your processes are actually allowed to use more
memory and cpu time on those machines, and the machines are also likely to be
faster and be more responsive since there are fewer people on any one machine.
QUICK LINKS
Getting started/connected for CS students @VIU
Comp Sci Help Centre
Student account information (new accounts)
Student password resets (ongoing)
Accessing CSCI machines from home,
Video version:youtube,
viutube
- Ubuntu note: if Windows is asking you to enable a windows subsystem for linux,
check
this microsoft link for instructions
Physical access to CSCI labs
4 tips for ssh/C++ @csci
Accessing VIU Windows lab machines from home
Accessing CSCI machines from smartphones
Transferring files between your laptop/pc and the CSCI servers (pscp or scp)
Official department resources page
Firefox won't start (says already running)
Configuring Linux based laptop to connect to VIU-secure wireless network
Git for CS labs, projects, and assignments
Git project distribution and submission,
Video version: youtube,
viutube
trouble-shooting git submission issues
CSCI GitLab Server Beta
X servers and X forwarding
Humayun's guide to installing X2Go (pdf) Recent change: when using x2go, instead of targetting
the cubs/pups, target tuxworld.csci.viu.ca (new virtual cluster).
Running Debian in a virtual machine on your laptop
Simulating the lab's X-server on your home machine
Humayun's guide to remote access with X forwarding (pdf)
Merlin's tutorial on ssh client configuration (markdown or html)
Merlin's tutorial on ssh tunnelling (markdown or html)
.... and a guide to viewing markdown files in a browser
VS Code 1.49: bug causing ssh connection failure
Tutorials and resources
CSCI tutorials page, and
resources
linux and vim tutorials
List of C++ compilers (from Bjarne Stroustrup)
ExplainShell: tool for explanating specific shell commands
ShellCheck: detecting common errors in shell scripts
Auto-formatting C/C++ program layouts
Other stuff
Using email on the CSCI servers
Accessing Discovery U-drives from CSCI machines
Disk quotas for student accounts (unable to save files)
Sarah's resource collection
for creating your own videos (for projects etc)
|
...and now for a jumble of actual content...
I'm always looking for good introductory linux tutorials, let me know if
you find these helpful (or find others that are better!)
RyansTutorials.net
TuxArena.com
Vim quick ref (pdf) (courtesy of Jonathan Funk)
vim guide (my old vim notes)
Sarah Carruthers has provided the following
collection of video making resouces
(e.g. for creating and posting project demos to viutube).
For students new to CSCI at VIU, you will obtain your linux login id and account information
from one of your CSCI professors. If you are taking multiple CSCI courses in the current
term, the instructor in the lowest numbered course will have your information
(e.g. if you are taking CSCI 112 and 160 this term then the 112 instructor will have your information).
On VIULearn, your instructor will post an assignment named something like
"CSCI Credentials", which will simply ask you for your name and student number.
When the instructor "marks" the assignment, they will return your account information
as the feedback.
This assignment can also be submitted by returning students, but the only account
information the instructor will be able to supply is your linux loginid.
Student password resets Important information about how to initiate communications
that involve privileged information with the CSCI Technician. This includes:
password resets, account problems, unable to connect to server.
NOTE: if your instructor has not yet given you your csci login and password DO
NOT USE THIS PROCESS TO GET IT. Please wait until it is handed out to you by
your instructor. The following is only to be used if there is a problem AFTER
YOU HAVE BEEN GIVEN YOUR CREDENTIALS.
Suppose something goes wrong, and you need to ask Merlin to reset your password
or fix your csci account, what should you do??!!
THE PROCESS HAS CHANGED: I've left the old process underneath, but here is the new one:
A CSCI Tech help ticketing system has been established.
From your @my.viu.ca account, send an email to CSCITechHelp@viu.ca with a descriptive subject line,
and describe the issue in the email body. Both of our techs monitor the incoming tickets,
so they'll get back to you as soon as they're able to.
OLD PROCESS FOR RESETS/TECH HELP
Here's the plan for handling these kinds of requests, so that we can:
1) trust who it is coming from
2) send information in a secure manner
HOW TO INITIATE SENSITIVE REQUESTS WITH TECHNICIAN:
All sensitive account requests (password resets, unable to connect, account
troubles) must go through VIU Learn, as follows:
1. Log into VIU Learn and navigate to one of your courses.
2. Select Communication -> Classlist
3. Locate Merlin Hansen (Instructor) in the list.
4. Click the down arrow beside Merlin's name and select Send Email.
5. Enter an appropriate subject (example: Please reset my CSCI password).
6. Enter an appropriate message in the Body and include your:
1. Name and student number.
2. CSCI Linux username (if known).
3. What CSCI course(s) you are enrolled in.
4. A detailed description of the issue you are having.
7. Note: Do not provide your old password or what you recall as your password.
A good SysAdmin will never need or ask for your password.
8. Click Send
9. Wait for a reply from your Friendly Neighbourhood SysAdmin.
Upon receiving a request such as above the CSCI Technician will
1. Verify the information provided by the student including confirming identity
and enrolment status.
2. For a password reset request:
1. Generate a new one-time-password.
2. Generate a one-time-viewable message containing the new password, the
student's username, or both (as the situation requires).
3. Send a reply to the student via VIU Learn containing a custom URL pointing
to the one-time-viewable message, and/or any relevant information or
queries.
If you have any questions or concerns about this, please forward them to the department
chair (chair@csci.viu.ca) or technician (tech@csci.viu.ca) for clarification.
|
- If you have a mac, win10, or linux laptop/pc
On linux open a terminal window, on a mac go to
Applications->Utilities->Terminal, on windows 10 or 11 run PowerShell.
From those programs you can
use the scp program to transfer file as follows (you will
be prompted to enter your csci password):
to transfer files from the your laptop/pc to the csci server
scp thefilename yourloginid@csci.viu.ca:thefilename
to transfer files from the csci server to your laptop/pc
scp yourloginid@csci.viu.ca:thefilename thefilename
You can specify a path to where the file is/should go
on either machine, e.g.
scp yourloginid@csci.viu.ca:csci123/lab1/lab1.cpp lab1.cpp
If you include the -r option you can copy an entire
directory and its contents at once, e.g.
scp -r yourloginid@csci.viu.ca:somedirectory somedirectory
- If you have an older version of windows
First, download pscp.exe (freely available from
www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Open a command prompt (start/run) and enter one of the commands below
(you will be prompted to enter your csci password):
to transfer files from the your computer to the server
pscp thefilename yourloginid@csci.viu.ca:thefilename
to transfer files from the csci server to your computer
pscp yourloginid@csci.viu.ca:thefilename thefilename
Note that you can also specify a path to where the file is/should go
on either machine
*Note: you may also need to specify the port, e.g. -P 22
Alternatively, check out WinSCP .
OK, after a little playing with the linux 'indent' command,
I've got a set of options that will take poorly-formatted C++ programs
and produce formatting very close to the CSCI 160 standards.
It isn't perfect, but it's pretty good.
First, copy the following file to your home directory:
.indent.pro
The changes will be usable the next time you login.
(You only need to do the copy/save this once.)
Subsequently, whenever you want to auto-reformat your C++ code, use the following command:
indent oldfilename.cpp -o newfilename.cpp
(e.g. indent lab5a.cpp -o lab5b.cpp
If you then wanted to rename the auto-formatted lab5b.cpp to lab5.cpp (for example),
you can then use the move command syntax: mv oldname newname, e.g.
mv lab5b.cpp lab5.cpp
Students can now use the Remote Computer Access Dashboard portal to connect
to VIU's Windows lab machines from home.
The portal is here: remoteaccess.labstats.com/Vancouver-Island-University
And instructions are here: technology.viu.ca/student-online-software
If you wish to connect to our servers from home
you can use virtually any secure shell (ssh) utility. ssh is
already installed on most linux and mac machines.
On a mac, go to Applications->Utilities->Terminal,
and in the window that opens use the command
ssh -l youruserid csci.viu.ca
(after which it will prompt you for your password)
Note: the -l is a lowercase L, not a one
From a linux machine simply open a terminal window and
use the same ssh command shown above.
For use from a phone or tablet, there are often apps
that can be used similarly (e.g. ConnectBot for android) -
Searching for 'ssh' apps is probably the best starting point.
For those running Windows 10, holding down the Windows key and hitting
X will bring up a menu from which you can select PowerShell.
Within the resulting PowerShell window you can enter the same ssh
command as is listed above for linux/mac.
For those on older Windows machines, another commonly used program is
PuTTY,
which is freely available for download.
When connecting use port 22 and the host name csci.viu.ca,
and you'll be prompted to enter your userid and password)
Once connected, you will have your command window to work in,
very much like the terminal windows we open in the labs.
Important note:
the gedit editor won't work
when connecting this way. There are a number of other editors
that can run inside your open terminal window - emacs, nano, and
vim to name a few. vim and emacs both have
a bit of a learning curve to them (but are ultimately worth
knowing), nano
might be the easiest to get started with. Thus to edit a file
you would type nano filename instead of gedit filename
nano uses the control key to issue basic commands, e.g.
control-X to exit, control-G for help, control-O to save (writeout),
etc. A short menu of command options can be seen at the bottom
of the window while you're working in nano.
Alternatively, see
Humayun's guide to installing X2Go,
which will allow you to use tools like VSCode and GEdit on our
servers but using your home machine. Recent change: when using x2go, instead of targetting
the cubs/pups, target tuxworld.csci.viu.ca (new virtual cluster).
|
Connecting from a smartphone is much like the access from home section
above, it's just a matter of getting the correct app installed first.
There are a variety of apps out there, including ConnectBot for android,
ssh for iphone, and BBSSH for blackberry.
Access to the CSCI labs is now controlled by your VIU student id card, and should
be automatically updated periodically during the semester based on your course
registrations, assuming you've picked up your student id card.
Note that the old cardkey system is no longer supported, and
older student ids (issued before July 1, 2019) will need to be replaced
to be usable with the new system.
You can access email from a terminal window on the machines in labs 102 or 115 as
follows:
- (Omit this step if you're already logged in to otter)
Enter the following command to connect to our server otter:
ssh -Y otter
- Type in your password when prompted
- Enter the command
alpine
- You will find yourself in a text-based email program,
with the menu commands listed on screen.
- Once you are finished, quit alpine (Q), and logout of otter
(logout)
Please find appended instructions on accessing your DISCOVERY U:
drive from the Computer Science Linux lab in 315-102.
This document describes how a Computer Science student can access their
DISCOVERY U: drive from an Xterminal in 315-102. The same basic
procedure probably works in 315-115, but this is untested.
Steps:
1. Login to a Linux system in 315-102 or 315-115.
2. From the main menu select: Places->Connect to Server...
3. Select Service Type: Windows share
4. Set Server: dolphin.discovery.mala.bc.ca
5. Set Share: users$
6. The folder name consists of three components based on your student
number - the second last digit, the last digit and the student number
itself, separated by slashes. For example, if your student number is
123456789, set Folder: 8/9/123456789
7. Click Add bookmark
8. Set Bookmark name: UDrive
9. Click Connect - you should get a file browser window with the
contents of your DISCOVERY U: drive.
Notes:
1. To copy files or folders from one system to the other, the only
method that appears to work consistenly is Copy/Paste: right click on
the item you wish to copy and select Copy, then right click where you
wish to move the file and select Paste. You can bring up a file browser
with your home directory, from the main menu select
Places->Home Folder.
2. Some files, such as (some) PDF files, can be opened directly from the
U: drive, others probably need to be copied.
3. On subsequent logins, if you create a file browser (Places->Home
Folder) you should be able to click on UDrive in the lower left pane to
access your DISCOVERY U: Drive.
Getting unexpected messages when trying to submit your lab/assignment in git?
Here are a few common messages/solutions:
- Error message: fatal: not a git repository
*Possible problem/solution: you tried to run "git push" when you weren't in
the directory for that lab/project, cd into the directory then try again
- Error message: fatal: down for backup
*Possible problem/solution: the git server is actually temporarily down while backups
are performed, the only solution for this one is to wait awhile for the backups to
complete then try again.
- Error message: fatal: W any csciNNN/assignment username denied by fallthru
*Possible problem/solution: here NNN would be your course (e.g. 265), assignment would be
whatever the repo is called (e.g. lab1) and the username would be yours. When you try to push,
it should be trying to push to csciNNN/username/assignment (your space for
that assignment on the server). What this message indicates is that you originally cloned the
wrong repo (typically you needed to run git clone csci:csciNNN/$USER/assignment
you probably actually ran git clone csci:csciNNN/assignment). To fix this, we need
to tell it where it should try to push to in the future, which can be done with the command
git remote set-url origin csci:csciNNN/$USER/assignment (substituting the correct
course number for NNN and the real repository name instead of assignment)
- Error message: fatal: out of memory, malloc failed
*Possible problem/solution: your repository contains some large files, and git is trying
to allocate enough memory to include those in your push. Note that the cubs and pups let
you use more memory than otter, so (as with most of our work) you're better off doing your
work (including pushes) on the cubs/pups rather than directly through otter.
*Prevention: in general, avoid using git add . to add files to tracking,
since this adds everything in the current directory. If you use git add filename
on the specific files you want tracked then you can be much more selective.
*Analysis/cleanup: you can see which files git is tracking using the command
git ls-files, which in turn lets you see if any are large and unnecessary,
in which case you can use git rm filename to both get rid of the file and
tell git to stop tracking it.
- Checking git status: if you run the command git status from inside
your repository, it will give you a clear idea of whether or not you have done all the
necessary adds/commits/pushes as far as git knows:
- git status message: up to date with origin/master
*Possible problem/solution: no problem, things look good!
- git status message: ahead of origin/master by N commits
*Possible problem/solution: you've done your adds/commits, but a git push is still needed
- git status message: changes to be committed
*Possible problem/solution: you've done your adds, but still need to do a commit before your push
- git status message: untracked files
*Possible problem/solution: you've created/modified some files but have not done a git add
for them. If you want them to be included in the push then you need to git add them (then
commit, then push)
- git status message: you have unmerged paths
*Possible problem/solution: you've begin merging two different git branches, but
have not yet resolved conflicts in one or more files (the status message will list the filenames).
You need to edit each of the files, making sure they contain the exact content you want,
and save each. Note that git will have added a set of lines like the following, which
need to be removed as part of your editing process.
<<<<<<<<<<<<<<<
===============
>>>>>>>>>>>>>>>
If you're having trouble saving files on your linux account (error messages
when you try to save) it is entirely possible your account is over its
disk quota (typically 1GB for a student account).
You can check your quota and current usage using quota -sp
If you're over the limit you'll need to hunt around for any large
files causing the issue.
A useful pair of commands for finding large files or directories is
du -k | sort -n | tail -20
You can use the rm filename command to get rid
of an offending file, or drag it to the Trash icon and empty the trash
(the space isn't freed until you actually empty the trash).
Problems often come about due to web browsers storing a large
amount of data in the cache - you can dig around the preferences
for your chosen browser to find the right option to limit that
(if desired) or find and remove their cached files
(e.g. for chromimum look in ~/.cache/chromium, for firefox look in ~/.cache/mozilla)
If problems arise from having too many files (a less frequent problem, but students
can sometimes exceed their limit), you can find directories containing many files using
find . -printf '%h\n' | sort | uniq -c | sort -k 1 -n | tail -20
Want to run debian linux on your own laptop, but without changing your laptop OS?
One option is to create a virtual machine on your laptop, and install/run debian
linux "inside" that. One widely-used (free) tool for installing/running virtual
machines is VirtualBox. Installing VirtualBox is
relatively painless, and you can then install/run other operating systems within
virtual environments.
A guide to installing Debian through VirutalBox is available here:
(BrianLinkLetter)
Want to use the csci server's graphical elements but have the display
show up on your home machine?
Two free solutions are to install either
- install cygwin (including its
x windows), configure and start it, or
- install virtualbox
and then do a linux install
You can then start an xserver in whichever you installed, open an xterm window through it,
then run this command to connect to our server:
ssh -Y -l yourusername csci.viu.ca
(that's an uppercase letter Y and a lowercase letter L)
At that point you can start up the tools you would usually use in the lab
(gedit, wish, etc)
and the display will show up properly (though perhaps slowly)
on your home machine.
There is a bug in VS Code 1.49 (August release and latest) which causes ssh
connections to fail. Symptoms include:
- output of ssh connections report:
 - Installation already in progress
 - unable to obtain lock
- when an ssh connection is attempted it hangs on installing server
- if you look in your folder in otter you will see a .vscode-server folder but
it only has 1 file in it and it is empty.
The solution:
- Set the remote.SSH.lockfilesInTmp option to true
File -> Preferences -> Settings
enter "remote.SSH.lockfilesInTmp" in the search bar
Check the option to enable (set it to true)
Your connections should now work.
What happens if the above does not work....
- Shutdown VS Code
- Use the command line or PuTTY or similar to ssh into csci.viu.ca
 - remove or rename the folder ~/.vscode-server
- disconnect and try VS Code again
For those of you interested...
The latest version of VS Code has a problem with locking on NFS mounted file
systems (which is what /student uses). Setting the option to true tells VS Code
to use an alternate method of locking by storing a unique file in /tmp (thus
avoiding the NFS issue).
The bug has been reported to the VS Code folk.
The bug does not seem to exist in previous versions of VS Code.
|
Firefox won't start (already running or no profile)
Often the "already running" arises when firefox has left a stray lock file behind from its last run,
or the "no profile" arises when it cannot find user profile information for you.
In either case we can run firefox from the command line, telling it to ask us
for a profile (instead of just refusing to run). The command is simply:
firefox -p
Firefox will generate a popup giving us a choice between existing profiles
or the opportunity to create a new one.
Configuring Linux based laptop to connect to VIU-secure wireless network
Although IT does not generally support Linux, Android and Linux are close enough
that you can use the information given for Android to configure your Linux box.
The IT page can be found here:
technology.viu.ca/help/wireless
with a section for Android near the bottom.
There are several ways to configure your wireless network using your favorite
application that varies from distro to distro. Whichever application you choose
to use, take the settings from the above link when configuring the wireless.
If you are using iwd (Internet Wireless Daemon) you have two ways to configure
it: via Network Manager gui, or via the command line.
Below we will consider the latter method:
Note: this is not an exhaustive guide of iwd, just enough to get things working.
iwd uses configuration files in "/var/lib/iwd" for each wireless network you
want to connect to. The files names are a combination of the SSID and Security
method used. For VIU-secure you want to create a file called viu-secure.8021x
and place the following contents in it:
[Security]
EAP-Method=PEAP
EAP-Identity=yourstudentnumberhere@viu.ca
EAP-PEAP-Phase2-Method=MSCHAPV2
EAP-PEAP-Phase2-Identity=yourstudentnumberhere@viu.ca
EAP-PEAP-Phase2-Password=yourpasswordpasswordhere
[Setting]
Autoconnect=true
|
You can also choose not to have your password in the file. In that case you will
be prompted for the password when you attempt to connect.
To test the new configuration use iwctl:
$ iwctl
[iwd]# station *device* connect viu-secure
If all goes well you should be
connected.
For more information on using iwctl see the Arch Linux wiki
wiki.archlinux.org/title/Iwd
CSCI GitLab server Beta
Good news from Merlin:
CSCI GitLab server [BETA] available
CSCI now has its own GitLab server available for CSCI faculty and students.Â
You will need to request access to the server by sending a message to the CSCI
Technician via D2L. Once approved you will be able to log into the CSCI GitLab
server using your VIU computer account credentials. NOTE: not your CSCI
credentials, but your student number and VIU password.
Server information:
- By default each student can have up to 10 repositories.
- The server is accessible from both the CSCI network and the Internet.
- The server URL is gitlab.csci.viu.ca
Note: I consider this service to be in Beta. What this means is that although I
will do my best to ensure the server is stable and available 24/7, it is not
guaranteed at this stage. Also, currently the server is not backed up offline.
This means that there is a very small possibility that your repos may be lost at
some point. However, so long as you have a local clone this is not really a
concern. I do not foresee a situation where repos will be lost but you have been
warned.
Future plans: The Beta will last then next few months depending on the adoption
and usage of the server. As time progresses I will fine tune and tweak the
server until it can be considered production ready.
NOTES:
- This GitLab server does not in any way replace the Git Assignment Submission
system used in some CSCI courses.
- Yes you can use this GitLab server to move code between your CSCI account and
your home computer.
If you have questions, please fire away. Please report any issues, no matter how
small, to me so that I can investigate them.
Guide to viewing markdown files in a browser
Another handy-dandy guide from our resident wizard, thanks Merlin!
If you are like me you love Markdown for use in documentation, all over the place. As great as Markdown is, viewing it in a browser as Markdown leaves something to be desired and converting it to HTML is a bit of a pain to maintain.
If you use Google Chrome or Firefox then there is a nice solution... a Firefox and Chrome extension that allows you to view Markdown files as either Markdown or as HTML:
Firefox: https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer-chrome/
Chrome: https://chrome.google.com/webstore/detail/markdown-viewer/ckkdlimhmcjmikdlpkmbgfkaikojcbjk
Of course it is an open source project, and is hosted at https://github.com/simov/markdown-viewer
I've been running this extension for a couple of years now and have found it easy and useful (especially since I keep handing Dave Markdown files to put up on his Tech Notes page and write all of the CSCI documentation in Markdown). If you are interested,
read on...
When you install the extension you will want to configure it to give it access to the websites where you want to view Markdown as HTML. By default it does not have permissions to access any websites, which is good. To give it access to pages hosted on csci.viu.ca
when viewing them:
- click on the extensions icon in Chrome (the puzzle piece shaped icon)
- click on "markdown viewer" to pop up the options page
- click on "Advanced options", which will open a new tab showing the "Allowed Origins" configuration page for the extension
- click on the drop-down and select "*://" instead of "https://"
- enter "csci.viu.ca" (where it says raw.githubusercontent.com), and click "Add"
- the new entry will show up in the list lower in the page
Note: You will also see an entry in the list for "file://" which allows any locally stored Markdown file you view in the browser to be displayed as HTML via the extension.
Aside from Dave:
essentially the same instructions work in Firefox except the symbol
you're looking for is an "m" in italics instead of a puzzle piece
Now to view a Markdown page as html browse to a Markdown page such as: http://csci.viu.ca/~wesselsd/guides/Tutorial-sshClient.md,
click on the puzzle piece and select "markdown viewer" again to bring up the options. Then click on the "HTML/MARKDOWN" toggle button two switch viewing the page in the two modes.
Hope you find this useful.