Showing posts with label Guide. Show all posts
Showing posts with label Guide. Show all posts

Wednesday, March 14, 2018

Displaylink Woes

A few months ago, I purchased one of those USB portable monitors for my laptop. This one to be exact. I followed the Arch wiki on getting displaylink up and running and everything was great! Well, I couldn't control the brightness or the screen rotation, but the fact it was working at all had me pretty stoked. That is, up until a few days ago.

Some update (I've poured through my pacman.log and couldn't pin-point which one) broke the entire portable display functionality. It took me about three hours to get my computer to even recognize the device again when it was plugged in and another three to get it to display anything. When it finally worked again I nearly flipped my table over out of excitement.

So, if any other Arch users are struggling to get this thing fixed again, here's what I did:

1. Uninstall evdi and displaylink (assuming you installed the packages from the AUR).

2. Follow this guide to manually install the evdi-pre-release package and blacklist udlfb and load udl.

3. Reinstall displaylink from the AUR, but edit the PKGFILE and remove the evdi dependency.

4. Enable and start the displaylink systemd service.

5. Run 'lsmod' to check if the evdi module is loaded (if not, run modprobe and get it on in there!)

6. Reboot

Not gonna lie, I have no idea why this worked. It doesn't really make any sense. But the important part is that it did! Hopefully it will work for you too.

Cheers.

EDIT: I did manage to figure out what was breaking it. It was the evdi-pre-release 1.5.0-9 package in the AUR. So what is outlined here is effectively downgrading evdi-pre-release to version 1.4.1-8. I also added displaylink and evdi-pre-release to IgnorePkg in /etc/pacman.conf to prevent this from happening again.

tl;dr Downgrade evdi-pre-release





StumbleUpon

Tuesday, November 29, 2016

Part 1 - PoisonTap: Setting up the backend

This is the first in a series on how to set up PoisonTap, by Samy Kamar.
Poison Tap, a USB device that costs no more than $5, can hack into web browser cookies and other parts of any computer just by being plugged into a spare USB port, claims Samy Kamkar, the developer of the USB device. Kamkar built the device out of a Raspberry Pi microcomputer. [Source] 

This guide will cover setting up the backend server, which the Raspberry Pi communicates with to transmit data back to the attacker. This guide assumes you're familiar with using ssh along with being comfortable editing some text files.

1. Setting up a VPS

In order to run PoisonTap, you will need a server for the device to communicate with once it infiltrates the target device. In this guide, I'm using Digital Ocean to host the server. Thanks to the folks over at Jupiter Broadcasting, you can use the promo code "heresthething" to get a $10 credit toward your account which can be used for two free months of service.

Once you're signed up, follow Digital Ocean's easy-to-use interface to deploy an Ubuntu 14.04 x64 server with Node.js pre-installed. They will email you your ssh password and use this to log into the server. Once you're in the server, run the command:

apt-get update && apt-get install nginx git

Note: For the purpose of this guide, all commands must be run as root.

This will install nginx and git along with updating the package list.

2. Setting up nginx

The first thing you'll need to do is set up nginx. Create a new file called 'nginx.conf' in '/etc/nginx/conf.d/' and add the following code to it:


server {
    listen 80;

    server_name brighbox.tk;

    root /usr/share/nginx/html/node;
    index index.html index.htm;

    client_max_body_size 10G;

    location / {
        proxy_pass http://localhost:1337;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    }
}

The post 1337 can be changed to any port but by changing the port, you will need to edit various config files which I'll go over later.

Then, run the following command to ensure that pm2 is installed on your VPS:


npm install pm2 -g

3. Launching the node.js application

Now that you're all set up, head over to Samy Kamar's github to download PoisonTap, or pull it using git by running the command:

git clone https://github.com/samyk/poisontap.git

Then, change your working directory to the poisontap directory:


cd poisontap

Once in the working directory, we can check that the .js application will run properly by running:


node backend_server.js

If any errors are thrown here, do not fret. There is excellent documentation available regarding node.js and Digital Ocean. You can find this information here.

Once the node.js application is running correctly, you can launch it by running:


pm2 start backend_server.js

Then, you'll need to restart the nginx service:


service nginx restart

And finally, you can make sure that the application is running using the command:


pm2 list

You should see the following:

Expected output from the pm2 list command
pm2 list

And there you have it! Now the backend server for PoisonTap is set up and you're ready to set up your Raspberry Pi Zero to communicate with it! Stay tuned for my guide on setting up the Raspberry Pi Zero with PoisonTap. Please feel free to leave any comments or ask any questions, I'm more than happy to help folks out.

Notes:

The first thing to realize is that it is a Federal crime in the United States to gain unapproved access to digital media. This guide exists for educational purposes only. If you choose to disregard this warning, know that the services running on a target computer will point to your Digital Ocean server, making it very easy for someone to track you down, probably resulting in jail time. Use at your own risk!



StumbleUpon

Sunday, September 11, 2016

i3 Window Manager Configuration

As of late, I've been rather obsessed with tweaking my i3 Window Manager configuration. I'm utilizing i3blocks for the i3bar and of course, these config files are dependent on having the proper packages installed that are called in execution.

Here's a screenshot of my desktop:

i3 window manager desktop configuration
Desktop




Some highlights of my configuration:

-Key bindings for the volume, brightness, play/pause buttons.

-Sshuttle VPN notifier. Sshuttle allows me to bypass my school's firewall that prevents VPN connections.

-Pastel colors for a soft and appealing desktop.

-Display of both local IP address and external IP address.

-Active window notification.

-Source Code Pro font package for improved appearance.

Notes:

-Some of the config file and scripts are tweaked versions of scripts created by others. In order to insure intellectual integrity, the proper attributions were left in the script files.

-Some blocks are on a long refresh interval to reduce system resource use. In order to keep them current, I use '$mod + Shift + r' to load them upon change.

-There is a one second lag on the brightness and volume changes but the settings for quicker updating ate up too much of my processor to be viable.

-I do not use a compositor. I tried compton but I actually noticed a performance drop. I attribute this to having an Intel video card, which is supported in the kernel.

-I am also using kupfer instead of dmenu.


If you have any questions or comments, please feel free to share them!

Also, if you too are struggling with aggressive firewalls, I am willing to offer a free user account on my digital ocean droplet for use with sshuttle for those that ask!



StumbleUpon

Wednesday, September 7, 2016

i3Blocks Show External IP Address

To continue my series about tinkering with i3Blocks, I created a script that utilizes wget to return my external (or public) IP address and display it in the status bar. Read more about the i3 Window Manager here.

It's a very simple script that uses an external server to identify the IP address and prints it to that status bar.


#!/bin/bash

IP=$(wget http://ipinfo.io/ip -qO -)
echo $IP


I will be keeping a complete collection of my scripts on my github.

Please feel free to comment or to ask questions!




StumbleUpon

Friday, August 19, 2016

Fix Steam using Alias

In an earlier post, I talked about utilizing aliases to shortcut commonly used commands. Today I'm going to share share my fix to a common error with Steam.

The error stems from the Steam run-time libraries  being older libraries than what are installed by default in Arch. More can be read about this error here. Every time Steam updates, it causes an error as it adds those out-of-date libraries back to the Steam run-time.

Now, to fix this, I chose to delete the libraries that steam adds. This can become a tedious task as Steam seems to update every two days. I fixed this problem by adding the following alias to my '~/.bash_aliases' file:

#Fix steam
alias fixsteam='find ~/.steam/root/ \( -name "libgcc_s.so*" -o -name "libstdc++.so*" -o -name "libxcb.so*" -o -name "libgpg-error.so*" \) -print -delete &&  find ~/.local/share/Steam/ \( -name "libgcc_s.so*" -o -name "libstdc++.so*" -o -name "libxcb.so*" -o -name "libgpg-error.so*" \) -print -delete'


So now, whenever Steam updates, I run the 'fixsteam' command afterwards to immediate fix this error and get right back into gaming!

Please feel free to post your thoughts/comments/hatred!



StumbleUpon

Friday, August 12, 2016

How to write a "Best Linux Distros" post

flowchart
StumbleUpon

Easy First Time Kernel Compilation for Arch Linux

If you have a deep understanding of kernel compilation and the necessary steps to take to support your hardware from scratch using a kernel straight from kernel.org, then this article is not for you. If you've never compiled the Linux kernel before and want a safe and straightforward way to do so, keep reading. Will this significantly speed up your system? Not particularly. But if you're itching to compile your own kernel just for the sake of doing so, this is definitely the place to start.

All of these steps can be found on the Arch Wiki Kernel Compilation page. It is really clear and easy to follow but sometimes, step-by-step guides that don't show you a bunch of different methods of accomplishing each task are helpful. This guide will be aimed specifically at the Dell XPS 13 Developer Edition but is applicable to all computers running Arch Linux.

Set-up:

The first step is to make and enter a directory to work in while compiling the kernel, as per the Arch Wiki.


mkdir ~/kernelbuild && cd ~/kernelbuild

The next step is to download the kernel you wish to compile. This guide will be using the mainline kernel, which at the time of writing this article, is 4.7.0. If you wish to work with a different kernel, simply right-click the tar.xz link next to the one you wish to use and click Copy Link Address and place it after wget.


wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.7.tar.xz

Now, extract the tarball and change directory to the unpacked tarball


tar -xvJf linux-4.7.tar.xz && cd linux-4.7

Even though its a freshly unpacked tarball, the Arch wiki recommends making sure the directory is clean anyways.


make clean && make mrproper

As an easy starting point, copy over your config from your current Arch installation.


zcat /proc/config.gz > .config

Arch is known for their kernel stability so it will be sure to include you need for your system to boot as a starting point. Instead of adding to what you will be compiling, you will be taking unnecessary options out. This way, if you are unsure about anything, DO NOT REMOVE IT.

Configuration:

Now, you have a couple of tools for going about setting options. I chose to go with 'make gconfig' since I'm running GNOME and like that it automatically describes what each option does at the bottom of the interface. So, go ahead and run your preferred configuration.


make gconfig

There are three states for the boxes. Blank means the option is not chosen, a check-mark means it will be compiled into the kernel, and a dash means it will be compiled as a module. Double click the box to cycle through these options. NOTE: I'm not sure if double-clicking is standard or only the case for my system so it may take some playing around to see how changing options works.

1. Processor Types and Features:
Since the XPS 13 uses a 6th generation Intel processor, I removed all other processors. Expand 'Processor Types and Features' and uncheck the AMD processors. If your running an AMD processor, this can be done inversely. Under the same menu, expand 'Processor Family' and chose your processor, in my case this was 'Core2/newer Xeon'. Also, as it currently stands, my processor doesn't support 'Hibernation', so I also disabled this. Also, when it comes to CPU frequency scaling, my processor only supports 'powersave' and 'performance'. I changed these from modules to enabled options and disabled the others, such as 'ondemand'.

2. General Options:
Expand 'General Options'. The only things I touched in this section was the 'Default Hostname' and 'Local Version' since I wanted to feel cool and put my own hostname into the kernel. Click on the option then single click on the text to the right. For example: click 'Local Version' and move over to where it says '-ARCH' and click it once. Double clicking will enable and disable editing the text rapidly and make it seem like you can't change this option. I changed mine to '-CUSTOM'.

3. Device Drivers:
Expand 'Device Drivers' then expand 'Graphics Support'. Disable all options that you KNOW aren't your graphics card. If you're unsure about anything, DO NOT DISABLE it. But things you are sure about, such as support for NVIDIA cards, disable.

4. Security Options:
The only thing I added here was 'Restrict unprivileged access to the kernel syslog'.


These are only a few of many options. As I mentioned earlier, you can read about each option at the bottom of the interface so go through and do some research to see what each one is/does and if you should disable/enable it. THIS WILL TAKE SOME TIME! But, it can end up being one of the most rewarding parts of learning about how the kernel operates. Once you have finished, click the save button at the top and kill gconfig.

Compiling:

This part is easy but takes quite some time so be prepared for that:


make

And wait. Then keep waiting. Then wait a little more. Now its done!

From this point on all commands MUST be run as root in order to work.


sudo su

then


make modules_install


Now, you'll copy over the image you just made to your boot partition and name it as you so desire.


cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-[YOURKERNELNAME]

Finally, you'll generate the initramfs files. I chose the manual method of accomplishing this task. It is structured like so:


mkinitcpio -k <kernelversion> -g /boot/initramfs-<file name>.img

Replace file name with your kernel name and if you are unsure about what to put for the kernel version, check the output of:


ls /lib/modules/

This will list all available module directories and you should see the one that you created earlier in this process. If you don't go back and make sure 'make modules_install' ran correctly. This is crucial! Without the proper modules, you system will not boot!

The final step is to edit you boot settings to boot your new kernel! Check the documentation for your specific boot process, or if you are using systemd boot, continue reading.

Simply edit your '/boot/loader/entries/arch.conf' file to include both your new vmlinuz file and your new initramfs file. If for some reason your system doesn't boot, you can boot with a LiveUSB and edit this file back to its original state. For this reason, do not remove your old kernel files from the boot partition!

And there you have it! A simple guide to compiling your own kernel. Now that wasn't so hard, was it? Of course, there is a lot more to kernel compilation than this guide covers but like I said earlier, this can help you feel more comfortable with the overall process. If you follow this guide, please don't let this be the "end all" for your experiences with kernel compilation! There is still a lot more left to learn, such as making a PKGBUILD so that future updates don't accidentally change your system state to using the old kernel. Look out for a simple PKGBUILD guide here in the future!

Questions/comments/hate mail? Please feel free to use the comment box below this post! I'd love to hear from you, even if it is just about how much you hate me and everything I stand for!





StumbleUpon

Thursday, August 4, 2016

GNOME Shell Extensions: A short guide

Today I want to talk about GNOME Shell extensions. Specifically because it took me a while to get turned onto them and once it happened, it really changed my workflow.

The GNOME Tweak Tool, available in the AUR, makes activating Shell extensions very simple. Simply open the Tweak Tool interface, navigate to the Extentions tab, and click 'User Themes'.

From here, you can either download specific extensions or you can utilize the AUR to automatically download and install the packages. I chose the latter.

A problem I ran into was that I would activate extensions in the Tweak Tool and they wouldn't load. I was running a newer version of GNOME than specified in the extensions that I had downloaded. This can be fixed by navigating to /usr/share/gnome-shell/extensions/ directory, entering the directory for the particular extension that isn't working, and editing the metadata.json for that extension to include the version of GNOME you're using (in my case 3.28.3).

All of the extensions I used are available in the AUR and I found all of them to be excellent contributions to my work-flow along with helping give my desktop environment a more modern feel.

Drop Down Terminal:

The Drop Down Terminal extension is by far my favorite. This adds a terminal emulator to your desktop that you can easily access by hitting the '~' button. Its dynamic in the sense that if your cursor is activated to type, such as in LibreOffice Writer or Chromium, it doesn't accidentally pull down the terminal when you need to utilize the "~" button. This extension has added so much productivity to my workflow as I can easily pull down a terminal and hide it as I go about tasks. It's available for download through the AUR as gnome-shell-extension-drop-down-terminal. 



drop down terminal



Dynamic Top  Bar:

If you've played around with Elementary OS, when you know how beautiful their desktop interface looks. One of my favorite aspects is the transparent top bar that dynamically becomes solid once you maximize an application. the Dynamic Top Bar extension brings this function to the GNOME desktop. It's available through the AUR as gnome-shell-extension-dynamic-top-bar.

Open Weather:

The Openweather extension adds your local weather to the top bar of your GNOME desktop right next to the time in the center of the top bar. It's easily configurable and provides you with the current weather, the day's forecast, and the previous day's weather. 


weather


It's available for installation through the AUR as gnome-shell-extension-openweather-git.

Top Icons:

One of the few things that I dislike about the GNOME desktop is that it displays tray icons from a pull-out panel on the bottom left of the screen. It feels counter-intuitive to me and always seems to confuse non-Linux users when I am trying to show off my desktop. I would sometimes forget it was there and the find that I have three or four programs running that I had forgotten to completely exit out of. The Topicons extension moves those icons up to your top bar so that you can always see them. In the previous pictures, you'll notice that Hexchat is up in my top panel and that's exactly what this extension does. It's simple yet something that I really appreciate. Its available for installation through the AUR as gnome-shell-extension-topicons-plus-git.


Pomodoro:

This extension is based on the Pomodoro Technique, "The Pomodoro Technique is a time management method developed by Francesco Cirillo in the late 1980s. The technique uses a timer to break down work into intervals, traditionally 25 minutes in length, separated by short breaks. These intervals are named pomodoros, the plural in English of the Italian word pomodoro (tomato), after the tomato-shaped kitchen timer that Cirillo used as a university student. The method is based on the idea that frequent breaks can improve mental agility" (taken from Wikipedia).  This extension adds a plugin that utilizes this technique which I find useful for when I'm working on big projects. You can configure exactly how long you want each shot-break to be along with how long the long-break to be, as well as setting how many short breaks you want to have before a long break. 


pomodoro


Once the timer runs out, it darkens your screen and displays a count-down timer that shows you what type of break you're currently taking.


pomodoro

This extension is available for installation through the AUR as gnome-shell-pomodoro.

Conclusion:

There are many more extensions that can be added and they can all be found at https://extensions.gnome.org/. I'd suggest browsing through and seeing if there are any other extensions the pique your interest. Please feel free to post any comments regarding what you think about these extensions along with any suggestions you have. Thanks for reading!



StumbleUpon

Tuesday, August 2, 2016

Fun with the alias command

While researching ways to maintain Pacman on my Arch Linux installation, I stumbled across someone's suggestion to create an alias to shorten an otherwise lengthy and hard to remember command. I gave this a shot but when I ran the command, I was getting an error. I double checked that the alias package was indeed installed in my system and after some research, found that I needed to edit my ~/.bashrc profile by adding the following text:


if [ -e ~/.bash_aliases ]
then
. ~/.bash_aliases
fi


From here, I needed to create the ~/.bash_aliases file:


touch ~/.bash_aliases


Finally, I set up as many random custom aliases I could think of to improve my workflow. Here is the output of the aliases I set up:


##Custom aliases##

#Auto-clean Pacman
alias pacclean='sudo pacman -R $(pacman -Qdtq)'

#Chdir to Downloads
alias cdd='cd ~/Downloads/'


#chdir up 2
alias up2='cd .. && cd ..'

#chdir up 3
alias up3='cd .. && cd .. && cd ..'

#cdhir home
alias cdhome='cd ~'

#Pacman Upgrade
alias pacgrade='sudo pacman -Syyu'

#Watching Netflix
alias netflixon='gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 7200 && gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 7200'

#Done with Netflix
alias netflixoff='gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 2700 && gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 900'

 

The Netflix aliases are due to the fact that I never seem to be able to get the Caffeine plugin to work and I would rather address this from the terminal anyways. netflixon sets auto-suspend to two hours for both A/C and battery. netflixoff sets it back to my preferred settings, 15 minutes on battery and 45 minutes on A/C. Note: the Netflix aliases will only work for GNOME.

Let me know what you think! Or if you see any errors or have other any useful aliases!

StumbleUpon