Arch Linux
Essential Links:
Hardware Specific
Send a message from a client PC to a server PC when booted up and ready
I have a small mini-ITX PC that I use as a NAS and backup. I only periodically turn it on when I need it. There is no use running it 24/7 because electricity isn't free. It takes a little bit of time to fully boot to the point that the Samba share is accessible. I have tried to access the shared folder a few times before it was ready and thought it would be nice if I had a notification on my main PC, which runs EndeavourOS (a derivative of Arch) with the KDE desktop environment, when the NAS is fully ready to go. Here is what I came up with.
Note that since the NAS is connecting to the PC, the NAS is the client and the main PC is the server.
All instructions are to be executed on the CLIENT unless otherwise specified
1. Install / Enable ssh on SERVER:
sudo pacman -S openssh sudo systemctl start sshd sudo systemctl enable sshd
2. Generate Keys for password free operation:
Generate all keys on CLIENT:
ssh-keygen -t rsa -b 8192
DO NOT add a passphrase when prompted!
Copy public key to server:
ssh-copy-id -i ~/.ssh/id_rsa.pub neamerjell@192.168.0.3
3. Edit SERVER's sshd_config file:
sudo cp sshd_config sshd_config.bak sudo nano sshd_config
Contents:
Uncomment and change to 'no'
PasswordAuthentication no
4. Create the script to run at boot:
sudo nano /usr/local/bin/boot-notifier.sh
Contents:
#!/bin/bash ssh neamerjell@192.168.0.3 notify-send "Shoebox Ready"
The notify-send command displays a notification on the KDE desktop.
5. Create a dummy user for the service to use:
sudo adduser --disabled-password --gecos "" boot-notifier sudo mkdir -p /home/boot-notifier/.ssh sudo cp ~/.ssh/id_rsa /home/boot-notifier/.ssh/id_rsa sudo chmod 600 /home/boot-notifier/.ssh/id_rsa sudo chown -R boot-notifier:boot-notifier /home/boot-notifier/.ssh
6. Create the service:
sudo nano /etc/systemd/system/boot-notifier.service
Contents:
[Unit] Description=Runs a script at boot to notify my main PC when the NAS is booted After=network-online.target smbd.service Wants=network-online.target [Service] Type=oneshot User=boot-notifier ExecStart=/usr/local/bin/boot-notifier.sh [Install] WantedBy=multi-user.target
7. CRITICAL STEP! Log in as root on the CLIENT, then switch user to the boot-notifier and execute the script
sudo su
su boot-notifier
ssh will produce a one time prompt to accept the connection to a new computer
boot-notifier.sh The authenticity of host '...' can't be established. ... Are you sure you want to continue connecting (yes/no) ?
8. Restart and enable systemd to execute the service:
sudo systemctl daemon-reexec sudo systemctl daemon-reload sudo systemctl enable boot-notifier.service sudo systemctl start boot-notifier.service
Enable TRIM on SSD in Arch
The fstrim.service and fstrim.timer are included by default in Arch.
sudo systemctl enable fstrim.timer
You can check the status of the timers:
sudo systemctl list-timers --all
Install Bluetooth Drivers on Arch
Install the bluez and bluez-utils packages:
sudo pacman -S bluez bluez-utils
Then start the bluetooth service with:
sudo systemctl start bluetooth
To start at boot:
sudo systemctl enable bluetooth
Setup WiFi in Arch Linux
Log in as root and perform the following tasks:
nano /etc/wpa_supplicant/wpa_supplicant-wlp2so.conf
Add these lines:
ctrl_interface=/run/wpa_supplicant update_config=1
Save, exit then enter the command:
wpa_passphrase dd-wrt password >> /etc/wpa_supplicant/wpa_supplicant-wlp2s0.conf nano /etc/wpa_supplicant/wpa_supplicant-wlp2so.conf
Alter the file replacing "MySSID" and "password" with your actual WiFi SSID and password. BigLongLineOfMeaningLessText will already exist in the file and is a long line of hexadecimal values, presumably a hash of "password".
ctrl_interface=/run/wpa_supplicant update_config=1 network={ ssid="MySSID" proto=RSN key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP #psk="password" psk=BigLongLineOfMeaningLessText }
Save, exit then enter the command:
systemctl wpa_supplicant@wlp2s0.service
Install Arch Linux on VirtualBox
Arch now has an install script!
https://www.youtube.com/c/SavvyNik/videosOld Way:
Create a machine with:
- 15 GB fixed size vdi virtual hard drive
- 4 GB of RAM
- 2 CPU cores
- Enable PAE/NX
- Boot Order: Optical, Hard Drive (remove the floppy)
- ICH9 chipset
- PS/2 mouse
- Display: Enable 3D Acceleration
- Storage: Delete the IDE controller and add an optical drive to the SATA and use the Arch iso file
- Use Host I/O Cache
- Change USB to 3.0 Controller
- Add a shared folder
- Auto-Mount
Install as normal from the Wiki with these exceptions:
This gives a cleaner view than "fdisk -l"
lsblk
This is a more interactive version of "fdisk"
cfdisk /dev/sda
Choose dos label type, then choose New, 15G, Primary, Bootable, Write, type "yes", Quit
This will create a single 15 GB partition - no other partitions needed since Grub will be installed and it is compatible with the ext4 file system.
Set the timezone:
ls -sfd /usr/share/zoneinfo/America/New_York /etc/localtime
Install the Grub bootloader:
pacman -S grub `grub-install --target=i386-pc /dev/sda grub-mkconfig -o /boot/grub/grub.cfg
Make the network setup permanently enabled at boot:
systemctl enable dhcpcd
Install VirtualBox utilities, alsa-utils, and neofetch:
pacman -S virtualbox-guest-utils alsa-utils neofetch
Mount the shared folder:
mkdir /mnt/shared mount -t vboxsf Shared /mnt/shared
Create user for Neamerjell:
useradd -m -g users -G wheel,storage,power -s /bin/bash neamerjell EDITOR=nano visudo
Uncomment this line:
%wheel ALL=(ALL) NOPASSWD: ALL