Neo Lab : Linux Related
Arch system installation
Arch is a great rolling distribution. It has very good information on most things we need.
Installation and usage
- Download the iso and write the iso to a bootable usb. If on a linux system use dd bs=1M if=pathtoiso of=/dev/sdb
- Boot into the arch system, if required, need to change the boot order
- You will land in the root terminal
- Exaclty follow the arch installation instructions: https://wiki.archlinux.org/index.php/installation_guide
- First biggest problem comes when you connect to network.
- If you are on lan, Arch linux always start DHCP. Sometimes, the DHCP server in your network may require the mac ID to give you an IP ( like that in IIT Kanpur). In such case open /etc/dhcpcd.conf and
comment out first line #Hostname and remove the comments on ClientID and DUID
- restart networking systemctl restart systemd-networkd
This should start the networking. try pinging archlinux.Copyright
- Either lan/wifi, if the link is down, then 'ip link set interface up' should be used. If still link is down, check the cables and see if the driver is installed.
- If you are on wifi, 'ip link set wlan0 up' should bring the interface up. Then you should use wifi-menu to join to a wifi network. DHCP is enabled by default. I actually found that directly running wifi-menu to work.
- See if ip address has been obtained, 'ip address' will give the address. If not, just set up an static ip and get on for now.
- If pingin archlinux.org doesnt work, then you need to: systemctl restart systemd-networkd systemctl restart systemd-resolved
- you will install the base-package using pacman if you follow the instructions. In addition also install NetworkManager, so that nextime when you boot, you will have networking. I also found connMan much better than NetworkManager for managing wifi. So just install that and use it manage the network.
- Also install some X manager: like Gnome/Kde before rebooting the system
- You also will need to install grub. Check if you are on EFI or normal boot. Check the internet and install the right one
The -u option is used to prevent upgradating in the destination a file with same name and the destination file was last modified.
FSTAB entry for mounting a windows file system
UUID=a-Z0-9 mount-point ntfs-3g uid=1000,gid=1000,dmask=022,fmask=133 0 0
uid=1000 mounts the file system as the main user. and dmask and fmask is used consider them as 777 - values. So, 022 will make the directors as 755, so every one as read and open directors. Owner can always do anything. this is the most ideal setting. Always follow this.!
Things to do behind a proxy
- In case your computer is behind a proxy, pacman in arch will not access the internet. So you add the proxy information in /etc/pacman.conf. Change the XferCommand as: XferCommand = /usr/bin/curl -x http://proxyname:port -L -C - -f -o %o %u
- In case the ntp doesnt connect behind a proxy. You need to use the right ntp server in /etc/systemd/timesyncd.conf. In the case of IITD, we have a dedicated ntp server which needs to be added as follows: NTP = ntp1.iitd.ac.in and the fallback FallbackNTP=ntp2.iitd.ac.in
Ubuntu
Ubuntu Installation is mostly straight forward in most systems. In certain systems you will get an error saying the system has Intel RST active. It as to do with RAID being active. Ubuntu, atleast in 2021, doesnt like it and it wants to use the standard ACPI interface with the hard disk. The solution is as given below.
- First go to windows, open 'system configuration' application from start menu.
- Then set the system to boot into safe mode and then reboot
- Before the system goes to boot, get into the bios setup, change the hard disk interface to ACPI/ disable RAID configuration
- Now if you boot into safe mode, windows does some changes in its configuration and now it can use the older ACPI interface
- Once in the safe mode, once again open the 'system configuration' and then disable safe mode and make the windows boot normally
Now windows should boot normally, and ubuntu can be installed safely in dual boot
Ubuntu post installation
- apt wont understand the system proxy settings: so add these to .bashrc
- export http_proxy=http://proxyip:proxy_port
- ofcourse, set other variables as well like https_proxy, ftp_proxy to the appropriate values
- I didnt get the ntp to work. So, I had to change the /etc/systemd/timesyncd.conf to add the iitd ntp server.
- add NTP=ntp1.iitd.ac.in and restart the systemd-timesyncd.service
FSTAB entry for mounting a windows file system
UUID=a-Z0-9 mount-point ntfs-3g uid=1000,gid=1000,dmask=022,fmask=033 0 0
UUID=a-Z0-9 mount-point ext4 defaults 0 0
uid=1000 mounts the file system as the main user. and dmask and fmask is used consider them as 777 - values. So, 022 will make the directors as 755, so every one as read and open directors. Owner can always do anything. this is the most ideal setting. Always follow this.!
Debian
Remeber Debian is a distribution which is very close to mother of ubuntu. I moved to Debian to stop having problems with too many/fast changes in ubuntu.
Certain things that needed attention other than what was done in ubuntu was
Certain packages were installed post minimal installation. this is a collection
- openssh-server, rsync, vim,
- python3-numpy, python3-scipy, python3-matplotlib
- build-essentials
- virtualbox is essential. Atleast for bookworm. It wasnt readily available. Need to do the following
- You typically need debian fasttrack to install virtualbox. So you need to add that to your /etc/apt/sources.list
- Else, you follow the instructions in https://www.virtualbox.org/wiki/Linux_Downloads
- More precisely: Make a file /etc/apt/sources.list.d/oracle_vbox.list with the following content deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian bookworm contrib
- Install the keyring as wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg
- Now apt update and apt install virtualbox-xx
- You download the extension-pack and install via vboxmanage extpack install packagename
- USB wifi was extremely patchy and slow. I had a realtek wifi. The solution that worked was to create a file /etc/modprobe.d/realtek.conf with the following content:
options rtw88_pci disable_aspm=Y
options rtw88_core disable_lps_deep=Y
Raspberry pi
I have recently played around with Raspberry pi for interfacing with the MFC. As usual had some issues
- Use the recommended raspberrypi os. which is debian based
- After installation, I had some trouble updating the system. That was because, I wasnt not connected to the NTP. For that I had to sync my time. Once taht is done, everything works as usual
- For connecting with analog devices CN0554, I had to install pyadi-iio. I was tryign hard to install some softwares from source. Later I realized, there are well packaged softwares. So install libiio-dev, libiio0 and libiio-dev from the original repos.
- Then the errors go away. You can install the pyadi-iio using pip.
- However, the kernel needed to be built from source, to include drivers for the part (CN0554) in our case. This was turning out to be very hard. I then backed out and installed Kuiper linux from analog devices, which came with pre-installed kernel drivers. This made the libiio talk to CN0554.
- In order to enable the kernel driver for a particular board, open /boot/config.txt. Then add line dtoverlay = cn0554 to enable the device tree
- reboot and you should be able to see the cn0544 in the dev folders.
- However, the trouble is still not yet over. It is possible that you see the owner of the device as viewed in /dev/iio:device[0-9]+ is root:root. This means that any other user may not be able to access the registers of the device. This will make it impossible to read/write
- We had to add a new user group and add a udev rule to add the dev device to the group. Any user who is a part of this group can now access the new device
- This was done as follows:
- 1. add a group called iio to your system and add the user you normally use to that group
- Set up a dev rule: create a new file in /etc/udev/rules.d/99_iio.rules
- It should have a rule like: KERNEL=="iio:device[0-9]*", SUBSYSTEM=="iio", GROUP="iio"
- This rule ensures that the dev is assigned to group iio
- However, the actual drivers are located in /sys/bus/iio/devices/iio:device[0-9]
- For this one more rule needs to be added as follows: DRIVER=="ad7298", SUBSYSTEM=="spi", ACTION=="add", PROGRAM="/bin/sh -c 'chgrp -R iio /sys%p; chmod -R g=u /sys%p'"
- The first two terms tells you which device to choose. you need to do udevadm info -a -n /dev/sdb . This will list a bunch of devices. Look for the device you want to add and then choose the appropriate terms in the first two selection keywords. The action term and the program term is used to change the group and the owner.
To get the size of directories use du -s
To get the size of directories in human readable form use du -sh
RHEL related
I started to use RHEL because I wanted to use some TCAD software like Sentaurus. This requires either centos/RHEL. With centos going out of support, I wanted to use a distribution that can remain updated. So, I went to RHEL9 (the latest in Jan 2024). However, it turned out the latest sentaurus (2023.09) cannot run on RHEL 9. What a shame.!
So I had to go to the next long term supported RHEL, that is not RHEL9 - RHEL 8.8.
The installation ISO was a humongous 11.4 GB. I wrote it with dd if= of= bs=1M status=progress command
Thankfully, the bootup and the installation was a breeze.
for RHEL, we had to include a subscription. This was done by sudo subscription-manager register --username --password --auto-attach
Install chrony for the timedatectl management. You need to edit /etc/chrony.conf and add 'server ntp1.iitd.ac.in' and restart the chronyd service
I also wanted to use a custom port for the SSH. For RHEL, the changing SSH port had the following steps
- edit /etc/sshd/sshd_config and add 'Port xxxx' with capital P
- firewall-cmd --add-port xxxx/tcp --permanent
- semanage port -a -t ssh_port -p tcp xxxx
- restart sshd service
VNC Server related
Tigervnc is a well developed simple vnc server. The setup from 2023 onwards have been simplified a lot. There are three config files:
- in /etc/tigervnc/vncserver.users have lines corresponding to display association to users. Eg. 2:krishna
- copy and enable services from /usr/lib/systemd/system/vncserver@:service to /etc/systemd/system/vncserver-krishna@:2.service
- in /etc/tigervnc/vncserver-config-defaults add alwaysshared and session=gnome or equivalent
- in /etc/tigervnc/vncserver-config-mandatory enable everything session,security,geometry, alwaysshared and desktop
- ensure that the port 590x: x is the display selected is opened by the firewall
When we want a vnc for a new user, the user needs to email the adminstrator and the adminstrator will enable the display server for the user
First time user of the vnc, must setup a password by typing vncserver
The user should access the vncserver using ssh command ssh -L 590x:localhost:590x name@serverip -p portno
I struggled for sometime to connect when the tunnel redirection -L was given last. It never worked. So, it is better to give the -L option first, then the port and then the ip addresses
Then use any vncviewer with address: localhost:590x