The Gentoo Experience

So it’s been almost a year that I’ve switched to Gentoo Linux, and I’d like to share my experience with those that are curious and want to try it.

Gentoo Linux has a reputation in the Linux community for being the most hardcore Linux distribution there is, second to perhaps “Linux from Scratch”. This reputation is kind of well deserved because a Gentoo Linux user is not your typical Linux user. Essentially a Gentoo Linux user commits to building the entire operating system from scratch, including compiling the Linux kernel and customizing every little detail. Initial installation as a new Gentoo user can take some time as you are learning new things but eventually after you figured everything out it doesn’t take that long.

The main experience with Gentoo is all about learning, you get to learn basically a little bit of everything. If you are the kind of person that usually loses patience when something doesn’t work right, then Gentoo is probably not for you. But on the other hand, if you’re willing to invest the time to learn Gentoo then you will be greatly rewarded.

How will you be rewarded? Well that answer is relative. For example if you use a distribution like Ubuntu and you plugged in a brand new hardware, there’s a chance that the hardware might not work because support for that hardware is not available in the kernel.

Perhaps your hardware requires a special firmware that needs to be downloaded manually and built into the kernel or may be a special FLAG needs to be set in the config file when you are manually compiling the kernel. If you have experience with Gentoo, you probably would be familiar with all these stuff and perhaps can fix the issues on your own for the most part. Thing is compiling the kernel is not as intimidating as it seems, as a Gentoo Linux user you get so used to compiling kernel that it becomes a habit. Sort of like drinking your morning coffee ūüôā

Anyway, the point is investing the time in learning Gentoo is worth it. If you are using an Open Source Operating System like Linux, sooner or later you will definitely run into issues. That is just the nature of how things work in the Linux world ūüôā

The skills that you pick up along the way as a full time Gentoo user are quite useful, so you can pretty much debug the hardware/software issues on your own without relying too much on the developers for support. Not to mention Gentoo forum is one of the best places for getting support. I’ve seen a lot of distributions for example Arch Linux where the community is very strict, you need to be careful when posting in Arch Linux forums as there’s strict rules related to forum etiquette and in general they are not as friendly to newbies. Compared to that Gentoo Linux community is welcoming and friendly to newbies.

Personally I’ve learned a lot using Gentoo, it made Linux fun for me again. At some point (in my early years as a Linux user) I was kind of disappointed with the Linux community because I was unable to debug and fix my hardware / software issues on distributions like Ubuntu. Filing bug reports and expecting them to get fixed was taking too long and I can’t really blame the developers because¬† most of the contribution towards Open Source software is done by people on their free time and a lot of them don’t get paid for doing so. As I gained more experience I realized that it’s not actually them to blame but my mindset or to be more specific my lack of knowledge.

Linux is fun, it is exciting for the advanced users who have invested years learning it and have figured everything out. But at the same time it can also be quite frustrating and intimidating for the beginners. It is just a question of how much time you are willing to invest, either way it is worth it.

Advertisements

Switching to Dvorak (Part-2)

So I’ve had a fair share of typing experience in Dvorak, I’ve learned to touch type and gotten to the point where I could type less than 20 wpm blindfolded. The experience of trying to learn an alternative layout like Dvorak had been fun though, but in the end I decided to revert back to QWERTY.

The major pros that made me try Dvorak in the first place were:

  1. Comfort – Makes maximum utilization of the home row, as the most frequently used alphabets in the English language are located in that region Which also means your fingers would flex less frequently compared to QWERTY. Comfort was one of the key factors that made me try Dvorak.
  2. Touch typing – Although I can touch type in qwerty, I thought learning to touch type in another layout would be a different experience altogether.

 

The cons of Dvorak that made me revert back to QWERTY:

  1. Utilization of both hands, especially the right hand. Since I’ve been using QWERTY layout from the beginning of time, it didn’t occur to me that QWERTY has a strong focus on left arm. Since I am left handed, it bothered me a lot when I had to regularly type using the right hand on Dvorak layout and I had sort of light wrist pain on the right hand.
  2. Slow progress – After a few days of moderate typing on Dvorak, I was not any better than 20 wpm. Which is quite slow in my opinion and it would mean I would have to invest a lot of time getting upto speed, and time is something I definitely don’t have at the moment.
  3. Usability – One of the major drawbacks of just about any alternative keyboard layout is that even though you use an alternate layout but on laptops your key caps are hard coded¬† with qwerty layout, which you can’t change. This is quite distracting because visually you see one key and then you realize you’re not using qwerty layout, therefore you need to backtrack that specific key in your mind and figure it out which key it is on the keyboard (as if you are blind folded).
  4. Support – Most applications, especially Vim (which I use for coding) are optimised for QWERTY layout therefore I will need to forget all the muscle memory I previously had on Vim and relearn it to suit Dvorak.

Well the experience was definitely fun, it gave me a broader view of different features that are available to me in terms of keyboard layouts. As the saying goes, if the cons out weigh the pros, it’s not worth going for it and thus I’ve decided to revert back to QWERTY layout.

I’m not sure exactly why Dvorak’s layout failed to beat QWERTY, but it definitely is not for me that I’m sure of.

Switching to Dvorak (Part-1)

Recently, I’ve noticed that I get a lot of wrist pain after hours of extensive coding.

At first I blamed it on the Acer netbook I owned, specifically the narrow key gaps on the keyboard which kind of makes sense. But then, I decided to research more ways to make my typing more comfortable and I realized that not only can it depend on the type of keyboard you use but also on the keyboard layout.

I had no idea about the real purpose of having keyboard layouts, I initially thought that it was only meant to make your keyboard work according to your set localization options or to differentiate between the different characters depending on which country you are from (pound, dollar, etc.) Only place I saw keyboard layout or I had a choice to select one was during the installation phase of a typical Linux installer.

Anyway, I made a big assumption that since technologies had advanced quite rapidly and we have made so much progress on a technological level surely we have figured out what kind of keyboard layout is optimum for use right? Turns out we haven’t, the main purpose QWERTY style keyboard came into being was because during the 1800’s typists ran into issues while typing on a typewriter as typing multiple keys too fast (simultaneously) would make the keys get stuck on the paper and you would have to deal with paper jam, etc. So to solve the problem of people typing on typewriters, one man came up with the QWERTY keyboard layout to slow them down a bit and solve their problem.

QWERTY layout wasn’t designed from the ground up with modern computers in mind, and also it is not that efficient either because depending on where you are coming from it is not optimized in a way so that you would have the most common characters under your fingers resulting in them moving less to get the job done.

So why do we still use QWERTY based keyboard layout? Well, the main reason for this is adoption. It came first and people grew used to it therefore we haven’t bothered to change it because it would waste people’s time in order to relearn another keyboard layout.

Anyway after some research, I decided to go for Dvorak keyboard layout. Although there are a lot of other layouts like Coleman etc, the reviews related to Dvorak from other users have been quite positive overall. In theory, Dvorak not only allows you to type a bit faster (touch typing) but main purpose of it is that it reduces strain on your fingers specifically when you are typing in English.  In Dvorak, the most frequently used English character(s) are located right where your fingers rest (home row), resulting in them having to move less to get the job done.

Since I own a mechanical keyboard, I decided to take off the key caps and rearrange them manually to suit the Dvorak keyboard layout. Also having a physical Dvorak layout to work with will help me to migrate faster.

P_20160928_224313_LL_p.jpg

P_20160928_224327_LL_p.jpgp_20160929_074618_1_ll_p

I’ve tried typing using online typing tutors catered for Dvorak layout (for an hour or so) and it feels wonderful. Basically using qwerty based layout my fingers move like all over the place but with Dvorak it’s like they are fixed most of the time. Typing using Dvorak is a different feeling (in a good way) because all this time I’ve been doing what other people have been doing without giving it much thought and suddenly I’m starting realize that just because vast majority of the people do the same thing doesn’t necessarily mean that it is correct or the most efficient way of doing it.

The main utility I’ve used to change keyboard layout is setxkbmap on Linux, and I ended up binding keys on my window manager to dynamically switch keyboard layouts on key press.

# Switching between keyboard layouts

bindsym $mod+Shift+F10 exec “setxkbmap lv dvorak”;

bindsym $mod+F10 exec “setxkbmap us”;

Anyway, I expect it will take me a month or so to adapt and become proficient with Dvorak.

Yes it will definitely take a while before I’m even able to match the typing speed that I had on QWERTY layout but it’s a sacrifice I’m willing to make in order be more efficient in the long run. Also after I get used to regular Dvorak layout, I have plans to switch to Dvorak-programmer layout (optimized for writing code) as I have to write code on a daily basis.

 

 

OpenBSD (First impressions)

BSD’s are operating systems that I always had a keen interest in, mostly because unlike Linux (which comprises of mainly the kernel), BSD’s are developed and distributed as a complete operating system.

What I mean to say is that, GNU/Linux consists of a subset of user land tools (GNU) selected by the distribution developers along with the Linux kernel. Not that it is a bad thing, but the choices made by the developers behind these various distributions such as Ubuntu, Fedora, Manjaro, etc. are reflected on the type of experience a user has since the selection of userland tools that end up in the final operating system may vary. There are also no clear guidelines, no right or wrong way to do something. This is exactly where advanced / meta Linux distributions like Gentoo and Arch Linux fit in, as they hand over the decision making process of what and how to the user.

Anyway what I wanted to talk about today is OpenBSD. Firstly, I have zero experience with any previous BSD operating system. They might be a bit similar to Linux, but they are totally different beasts both with their pros and cons. I’m not here to discuss which is better, I like them both and they have different use cases.

So firstly, the reason for me choosing OpenBSD over the more popular FreeBSD is because the main focus of OpenBSD is security and code correctness. Security is a complex topic, and it is tough to get it right. A lot of the modern operating systems including Linux don’t have many of the advanced system security features enabled by default as distributions like Ubuntu aim to be compatible with as much hardware as possible and enabling such features may cause software & hardware issues as well as a lot of headaches. So just having a Linux distribution like Ubuntu doesn’t necessarily mean that you are safe or secure.

Yes, the advanced security features can be configured if you are an experienced Linux user with strong background in security and using a Linux distribution like Gentoo. But setting up everything to be of top notch security standard and trying to compete directly with OpenBSD is nearly impossible because the code base of the Linux Kernel is huge (Millions of lines of code). As we know, with bigger code base comes vulnerabilities and bugs that can be exploited and so far we have seen many vulnerabilities related to the Linux Kernel emerge over the years, perhaps more is yet to follow.

What I’m trying to get here is that, OpenBSD code base is way smaller than that of Linux and they have a team of dedicated developers who just audit their code base on a regular basis and have been doing that for over a decade. Which means their code base is not only clean and stable, but the whole operating system has been designed from the ground up to be a highly secure system with strong focus on Cryptography as well.

Since I have Gentoo Linux system on my current laptop (which took me like weeks to configure and fine tune everything), I decided to leave it as it is and indulge in OpenBSD by investing as little as possible. An embedded device like Beagle Bone (Black) was naturally the perfect choice as it is reasonably cheap and listed as being supported on the OpenBSD website. What I didn’t know at first was that OpenBSD doesn’t support HDMI on Beagle Bone, so I had to wait a while until I finally bought a ttyl to usb serial cable. What it is and how it works is outside the scope of this post but I learned a lot along the way and was successful at making an OpenBSD install.

Anyway, the most impressive thing that I first realized about OpenBSD was the quality of the man pages. It’s so well written that it puts the Linux man pages to shame. There’s a lot of things that I still have to figure out but I’m learning things one step at a time.

The filesystem used by BSD systems in general is ZFS, which I heard is pretty robust and flexible and used by big companies such as NetFlix to manage thousands of terabytes worth of data. The firewall (PF) is also well known and have been used in a variety of commercial firewall appliances. A lot of other things are still new to me, but OpenBSD package management reminds me of Gentoo as it also gives you the option to compile packages from source besides having binary packages.

Apparently on Beagle Bone there is still no support for binary packages on OpenBSD, and since my SDCard has a limit of 8GB I wasn’t also able to compile anything from source due to the limited capacity. I will write a full review related to OpenBSD once I’ve upgraded to a bigger SDCard and had enough time to mess around with it.

In the mean time, feel free to share your opinion or suggestions related to OpenBSD or Linux in general.

Thanks for reading!

 

 

 

Preventing Evil Maid and Rubber Ducky style attacks on Linux

So you are running Linux and you think that perhaps you are relatively secure compared to Windows right? Well actually there’s not much difference when it comes to security of either platforms because there are certain attacks that your operating system will never be able to defend against unless you pro actively take the right security measures to prevent it.

What am I talk about here? Let’s start with hard disk encryption, and let us assume that we are on Linux. So, you have encrypted your default Ubuntu partition with a really strong passphrase during installation (Luks + Dmcrypt) and you must be thinking man am I secure. Well that is true to some extension but the catch here is that your boot partition needs to be left un-encrypted so that it will be able to unlock your drives after entering the correct password.

So here is the dilemma, even on Linux we have an un-encrypted boot partition therefore it is in a way a vulnerability waiting to be exploited. Someone can just mess around with the contents of your boot partition while you are away and perhaps even write a simple shell script that will log the password and send it back to the author?! This is what you call an Evil Maid style of attack. There are not many ways that you can defend against such an attack but a good measure would be to have your boot partition somewhere else, perhaps on a USB drive. Thus whenever you go outside you can keep that USB with yourself at all times and have the peace of mind that the laptop at your home will not be messed around with because all that is there is just a block of encrypted data whose contents can not be tampered with. Today I will not go into details on how you would go about making such a setup because trust me doing this manually will take a lot of work especially if you are on a Distro like Gentoo!

But let me tell you of another attack that is quite common these days and not many people know about it. Have you heard about the USB rubber ducky? If not, go out on the web and Google around a bit. Or if you wanna save time, let me tell you.

Basically, the USB rubber ducky looks like a regular USB…even has a similar size but when you plug it in, it acts as a HID (Human Interface Device). HID is usually reserved for mouse or keyboards, so basically posing as USB and being able to act as a keyboard allows it to interact with an active system in a way that you would least expect. It can own you in a matter of seconds if you haven’t taken the right precautions, especially on a Distro like Ubuntu that allows anything to be automatically mounted by default. This is not just a big threat for Windows but also for Linux.

Perhaps the USB rubber ducky could run as a background process that would spawn a shell and try to sniff the password that you type when you login to your device, after it receives the password it could automatically call home with the new gained credentials.

So I looked around for a bit on how to stop such an attack on Linux, and to my surprise I found that the Linux kernel provides an easy to call interface that would disable the USB ports.

So you could just paste this script and it would disable your USB ports, depending on the number of USB ports you have you may need to modify those commands and follow the instructions in the comments. This script if set correctly, would basically disable USB ports on boot so that you don’t have to worry about manually disabling them (you might forget).

Also you can add this code to your .bashrc or .zshrc, so that you can enable or disable USB manually when necessary.

# Disable usb devices to mitigate rubber ducky style attacks

usboff(){echo 0 > /sys/bus/usb/devices/usb*/authorized_default}

 

#Enable usb devices

usbon(){echo 1 > /sys/bus/usb/devices/usb*/authorized_default}

 

You will need root permission to use these functions so don’t forget to add sudo.

Anyway, this concludes my today’s post and I hope that this will be helpful.

Cheers!

Gentoo Linux Review

So it’s been a month that I’ve switched to Gentoo Linux. I must say that I gave it a very long and careful thought. I was intimidated at first with the idea of even spelling the name of Gentoo Linux and there is a reason for that. Thing is from the very beginning, since the day I first made the switch from Windows to Linux a thought was planted in my brain that Gentoo is the most hardcore Linux distribution there is…but as I learned that is far from the truth.

Basically you compile everything from source, it’s not like a traditional binary Linux distribution. You build it from scratch, step by step and you decide what and how you want things to be built. The end result is that you get a very highly customized Linux operating system¬†that is fine tuned for your hardware and all the software is built on that same machine as well as optimized for your architecture. Not only does it result in a boost of speed but the main benefit I saw using Gentoo was in the customization of software using what they call USE flags.

USE flags are a pretty interesting concept. Let’s say you want to install a software like Firefox. You can see what USE flags it uses and then you can add or remove the flags ¬†to enable or disable certain features like whether it should use pulseaudio or alsa for audio playback. Whether Firefox should have native language support for your country built in or if you want to add gstreamer support to have native video decoding capabilities. There’s hundreds of different USE flags depending on the type of software you are interested in and they can all be tweaked to suit your needs. This customization option is pretty much unavailable on a binary distro unless you are compiling stuff manually which for the most part can break a lot of stuff in your system. Thus this makes Gentoo a really attractive Linux distribution for experienced Linux users.

Anyway for me personally it took me two weeks to have a fully working system with all issues fixed from touchpad to suspend to ram, audio, etc. now working perfectly fine. It was a rather interesting learning experience for me as for the first time I learned how to compile the Linux kernel from scratch…actually I had to do it 5-6 times to have a fully working setup.

If I had to reinstall Gentoo from scratch may be I would have to give it a second thought because it is quite time consuming. Most of your time is spent reading and learning from the wiki, very less time on actually doing something trivial. But once you have figured it all out you know what to do so the subsequent installations should be much faster. A good idea is to always clone the image of your Gentoo install and back it up elsewhere once you have figured everything out.

Is Gentoo for you? Well if you can set aside time for it and you have the patience and the will power to learn then it is definitely worth it. Personally there were times while setting up Gentoo when I felt hopeless, frustrated and was about to give up. But the burning desire in me to cross over to the other side and be with the elites of the Linux world kept me going. Some of the most talented and smartest people I know in the Linux community use Gentoo and you will never understand what Gentoo is like until you have actually installed it. I think if you are a serious Linux user and you just want to learn how all the underlying parts of the Linux operating system fit together then this learning experience is definitely worth it.

After having used Gentoo, I can never look at another Linux distribution the same way again. On my previous Arch Linux install (on my netbook) I had issues with browsers like Chromium and Firefox, they used to crash randomly especially during video playback but after having installed Gentoo it didn’t even crash once. Smooth, stable, fast in my opinion the Gentoo experience is second to none.

Smooth video playback @Youtube [Linux]

So recently I’ve been researching about how to get a better¬†video playback experience on Linux when browsing sites like Youtube. Video playback from the early days of Linux was most of the times a headache, especially because there were¬†not many¬†“good” alternative to a lot of proprietary codecs. Especially now that flashplayer is long dead and is no longer being supported widely,¬†we look up to html5 to solve our media¬†playback woes online.

But the thing is html5 doesn’t solve our problem yet. On sites like Youtube, vp9 is the codec that is being served by default when html5 is enabled on your browser.¬†Vp9 is a successor to vp8 and is about 5-15% improvement over it’s predecessor but on the downside¬†hardware acceleration for vp9¬†is not built onto¬†most hardware other than the latest smartphones like the Samsung Galaxy S6, etc.

Hardware based decoding is important because it is more efficient than software based decoding, not only in terms of raw performance but the overall cpu usage goes down resulting in less energy being used on your laptops or mobile devices. Therefore hardware based decoding also helps conserve battery life by a big margin when watching videos.

Even if hardware acceleration of vp9 is built into your hardware,¬†the software side of things aren’t ready yet on¬†almost all¬†platforms since vp9 is still a pretty recent¬†development and the industry needs¬†some time to catch up.

Anyway long story short, I turned towards various browsers at first without doing much research hoping that they would magically solve my problem but that was not the case. After a while I learned about this open sourced api being developed by intel (vaapi) thats¬†allows hardware decoding of various codecs using the built in intel gpu on most CPUs. Vaapi on Arch Linux can be accessed¬†by installing the packages “libva-intel-driver” and “libva”. On other distros should be something similar.

Another thing I discovered while testing the browsers is that Firefox for some reason uses a lot more cpu during video playback than a Google chrome based browser like Chromium although they both rely on software based decoding methods. It probably has something to do with how Firefox renders the video internally.

Anyway, the bad news is that vaapi doesn’t yet support vp9 decoding but what¬†you can do is install a browser plugin that forces h264 codec only and then take advantage of hardware acceleration using vaapi as h264 decoding is supported. In my case I used an external player (mpv) with my custom config¬†¬†(placed in ~/.config/mpv/config) and a firefox plugin called open-with¬†and I can just right click on any video and select open_with mpv to have awesome video playback with negligible cpu¬†usage.

Before hardware accelerated video playback my average cpu usage on Chromium was around 20-25% where as on Firefox was around 40-50%. After hardware acceleration on my netbook with n3700 processor, cpu usage is less than 10% using Firefox. Power usage dropped from 9-10W to 5-6W. That’s a pretty big improvement not to mention the video playback seemed more crisp compared to the¬†software decoded version.

It might seem that I was complaining about Firefox at the start, but after switching video playback to mpv it seems to be a much better solution than even chromium.

If you have some tricks of your own, feel free to comment and share below! ūüôā

 

Efficient browsing / productivity with Vimium

For quite a while now I’ve been doing pretty much everything on Linux with just keyboard shortcuts. I’ve switched to a tiling window manager called i3 which eliminates the need for a mouse as everything from resizing window frames, making them full screen or tiling them in a certain way can be done with the press of a few buttons. I’ve found that it increased my productivity by quite a big margin and I feel like mouse was just a block in the road towards productivity.

Only place mouse was needed for me was for browsing the web. Luckily, even though a bit late I’ve found a way to even get rid of that by using a plugin called Vimium for Chrome. I’m a big time Vim user and it’s kind of funny that I thought the learning curve that I had to go through for vim and the hours I spent learning it could only be used for stuff like coding / text editing. The time I invested learning vim actually pays off when you consider plugins like¬†Vimium, which allows you to use the same keyboard shortcut like features you’re used to in Vim and works as a replacement for your mouse.

It’s actually difficult to imagine how the experience is like when you consider the fact that there’s no mouse at all, you just press keys and things work the same way as if you had a mouse. From opening links in new tabs, scrolling, interacting with custom frames, clicking on elements, opening older tabs from history or going through your bookmarks; everything works smoothly as if you’re doing it with a real mouse.

I’m starting to get used to it, so far it seems pretty easy to get started and I highly encourage people to try it out and see for yourself how it’s like. You don’t actually need previous experience with vim and the shortcuts can be configured as the plugin is quite flexible. Try it out, who knows you might even like it ūüôā

 

 

 

 

Linux Kernel Module / Hardware Tinkering

When I first got into the Linux world (5-6 years ago), I was a beginner at the time and¬†as usual if something didn’t work out of the box (hardware / software) I used to blame the distro and move¬†on to the next one. I thought it was a “fair” way to do things coming from the Windows world as a Windows user. Given that there were so many distros out there at the time it wasn’t actually a bad move though, but I knew that I’d have to change my mentality if I were to survive in the Linux world.

Slowly, as my experience and skills with Linux matured I realized that I actually enjoyed if things didn’t work and¬†I wanted things to not work as expected so that I can learn how to fix it and make it better.

In most cases just a simple google will work, but if the problem is complex; like something related to hardware perhaps the only way to go about fixing it is by being really persistent. Like the old saying goes “If there’s a will, there’s a way”.

Today I will share some of the little things I’ve learned as a Linux user on how to mess around with kernel modules, learn¬†what features of your hardware are supported by the module and how to disable / enable them.

Mainly I’m documenting this as a self reference in case I forget somethings in the near future.

Okay first of all, if you want to see what hardware you have; which kernel modules are being used by them or in general learn¬†more about what’s happening with your hardware you can use the following commands:

1) lspci -k
2) lshw -short
3) inxi -b
4) lsusb
5) dmesg | grep -i “keyword” //Replace keyword with something specific to your hardware / kernel module

Note that you may have to install inxi and lshw, they’re by default not installed on most distros.

Okay now, let’s say you’ve found the kernel module being used by the hardware you want to debug (Command #1).

You can see what options are supported by the kernel module with the command below.

modinfo -p [module name]

In my case, I wanted to debug my internal atheros wireless card ath9k.

To see what parameters / options are enabled / disabled by the module at the moment you can try:

systool -v -m [module name]

Selection_008

Note that in the section parameters, 1 means enabled and 0 means disabled.

By default most distributions try to have some basic module configs so that your hardware works as expected or so that some other module doesn’t interfere¬†with your hardware by blacklisting them. But it’s not practical to predict what kind of hardware you might have and there’s so many different types of hardware, so it’s better to debug your own hardware and tune the configs to something that is optimal for you.

At the time when I was debugging my wireless card, the powersaving option was disabled (ps_enable=0) and hardware crypt was enabled (nohwcrypt=0) which is why my wireless card was using a lot of power and was slow at the same time.

You can configure them to use the parameters that you want by writing a config file in the /etc/modprobe.d/ directory. What you name the file doesn’t matter,¬†but it needs to have a .conf extension for it to be recognized as a config file.

Usually it’s a good practice to name the file according to the module name, in my case it’s ath9k.conf.

This is the format of how you enter the parameters in the config file:

options [module name] [parameter=value]

Selection_009

You can have multiple parameters side by side separated by space.

After the changes have been written, you can simply remove the module and reload it to have the changes implemented or a reboot works fine too like in windows ūüôā

Removing module:
modprobe -r [module name]

Reloading module:
modprobe [module name]

Another thing that was interesting to learn was that let’s say there are some hardware or module that you want to disable or don’t want running.

For example, I find that I never really use the webcam and bluetooth devices on my laptop so disabling them is also a good way to save power and increase battery life.

You can blacklist modules by just having a config file with they key word blacklist followed by the module name. But in some cases, a module may be a dependency to another module and therefore blacklist feature might not work as expected and the module might end up being loaded anyway.

So to prevent that you can write the config file this way:

install [module name] /bin/false

For those wondering the bluetooth module by default is btusb and webcam module being uvcvideo.

Anyway, that’s it for today. I really didn’t wanna make this post since a lot of this info can be found publicly or in Arch Wiki.

But a part of me insisted that I do since a lot of stuff I learned were by trial and error. Usually Arch Wiki tells you what to do but not why, it is up to you to figure out why and that’s the most important part of the learning process in my opinion.

Hopefully this might be helpful to some of you ūüôā

Using YouTube playlists as your offline music collection [Linux]

youtube

Hi guys! Been so long since I’ve made a post…well over a year now. Work, studies and commitment to life keeps me busy but it’s good to be back every once in a while.

I’m a big music fan and at times I use various YouTube ¬†music playlist to listen to a good collection of cherry picked music that interests me. Also there are times when I don’t have internet connectivity so a thought came to my mind on why not just¬†get the entire playlist backed up locally so that I can listen to good music whenever I want.

So first of all since I’m a coder, I thought to myself on why not just go ahead and create a script to automate the entire process; from parsing and downloading content to batch processing and conversion of the videos to be audio only. But then again one of the things I’ve learned in the long run as a coder is to make good use of code reuse; in other words, why reinvent the wheel when there are already existing solutions out there that addresses the problem. This led me to the excellent feature friendly youtube downloading and conversion software for Linux known as¬†youtube-dl.

You can download youtube-dl from your local linux repo or you can go to their hosting site over here.

TLDR; This is the command format to make youtube-dl download all the tracks along with cover photos from a given playlist and convert it to audio only without going through a hiccup.

youtube-dl –yes-playlist -c –write-thumbnail -x -i [ url ]

The command line flags are pretty much self explanatory; youtube-dl works smooth and with in minutes you will have your favorite genre of music all backed up for your convenience.

Disclaimer: The author is not responsible for violation of youtube’s copyright policy in anyway, what you do with this information is your own responsibility. This post has been made¬†for Educational purposes only.