Sunday, October 6, 2019

So near to a Desktop..............Raspberry Pi 4

Its been a long time since I wrote anything technical. This particular piece has been long overdue. The public network is full of ideas of what not can be achieved with a raspberry pi. After owning the original pi and surprising plenty of people with its capability to output videos at full HD, You know, I was eagerly awaiting a pi with 4k capabilities. Many people were surprised at the announcement of the rpi 4 and its capabilities. I for one thought that the maker and I have a connection. But, yes, the connection lost lots of packages between. So, what have we got in terms of what I really wanted

1. 4k desktop(I don't know which monitor gets the capability at 60Hz. My monitor defaults to 30Hz whatever I try. I think we are talking about the latest HDMI standards)
2. 4k movie playback is still patchy. I think it will get better with the foundation/users/developers hacking away at it
3. USB 3.0 support is a major leap(We will discuss below how, this is a radical decision)
4. USB C charging is also welcome with more power headed its way(But not enough)

The best OS to run on a rpi4 is no doubt raspbian. Yes, it is still a 32 bit OS. But, wait, the foundation is supporting all the pi's dating back to the first one. Kudos to the team.There are plenty of options for running 64 bit OS developed by groups and hobbyist OS enthusiasts. They are limited by the quirks in the hardware and its hardware acceleration. The memory limit issues have been resolved. Now it is only about video output performance to be bought on par with the 32 bit raspbian. As we are speaking there is a thread testing out a 64bit kernel with 32 bit userland. For running the latest Firefox, a 64 bit kernel is now a prime requirement and the rpi hackers are getting there. Tried all of them out there. They all have certain polish out there. They run faster, they are stable enough. But, video output performance has not reached the 32 bit raspbian level. I always came back to raspbian by restoring the backup.

The foundation was little brave this time and touted the rpi 4 as a desktop replacement. That claim, is very gutsy. If your desktop requirement is to run a browser and not wanting to watch High Def videos multitasking with office suites, then, the rpi 4 is good enough. Oh, oh, wait. Before telling me otherwise, I do agree that ou can improve the performance and extract more juice out of the pi by investing a little more of your time an accessories. To bring the performance of the rpi 4 to a desktop level, you would require

1. A heat sink with fan(money) This is a necessary investment. Your rpi 4 runs very hot. It has to be cooled down or else you will feel the throttling. Even opening one single application raises the temperature to the max.
2. An sd card with highest transfer rate possible with corruption resistance(I came up with that)(money money)
3. Buy the original usb c charger. There have been reports that the rpi4 is picky when it comes to usb c chargers(money money money)

With the above items, and a little bit of overclocking and some software optimizations the rpi 4 is definitely nearing a desktop feature set.

A real desktop will definitely demand storage space. Here the usb ports come into play. The two usb 3.0 ports are a god send. Just connect your external HDD's and you have the storage capability of a desktop. A good desktop also has Bluetooth connectivity and 3.5mm jack connectivity. You are completely covered here. A good desktop of course has to have a keyboard and mouse connected. Your are covered here also with the two usb 2.0 ports. So you have to connect more usb devices, like another external HDD. Your Pi will die here. Now, it is time to invest in a powered usb hub(money X 4). Be careful here and buy a good one and check the power distribution among the ports in the hub.

A monitor. What is a desktop without a monitor. You definitely will have an old monitor lying in the attic. It is time to brush it off and connect it to the pi. Oh, you are far ahead and have a 4k monitor a 4k tv, rpi has you covered. The pi is very picky when it comes to supporting 4k. You might be out of luck for older ones. Buy a good hdmi cable. Or, better buy the official one. The desktop feels snappy. Choose your apps properly. Prefer functionality over eye candy. In this way you can get more out of your pi. Yeah, I heard you. You can always get a "mini" desktop from various vendors. But, I would like to stop you here. Will it be as hackable as the pi. Will it have the whole world building things for it. Will you be able to search the public network for issues and resolutions. Will you get to run Debian GNU/Linux as well as the pi can run. Will it be credit card sized. Will you enjoy it. Will it give you joy.......

Now, coming to the most costliest investment to extract more from your pi. The ssd. This is a must. The loading of applications from the sd card is pathetically slow. Opening word processors/modern web browsers will be slow(When I say slow, I meant in comparison with a desktop with the latest desktop processors from the big guys). I recommend strongly to invest in an ssd. All of a sudden, the rpi 4 becomes a "real" candidate for desktop space. Suddenly the pi feels snappier. It boots faster. The copying, installing, upgrading are faster. Applications load faster. The UI is very responsive. I can go on. It is highly recommended to go for a ssd on immediately buying the rpi 4. What would be the size? Well, you have been running your pi from an 8 bit card(Yes, even now that is enough). I dont think you get an ssd less than 32 GB. So go for the minimum sized ssd, if you are hard pressed for money otherwise, go the full monty and go for a bigger drive with enough space for all your data. It is upto you. But buy an ssd. Though I am stressing the requirement of an ssd, it is important that you appreciate its requirement. I suggest you run your pi from an sd card and then after a couple of months upgrade for an ssd. Then you will appreciate what I am talking about here and also why I spent a paragraph in influencing you to upgrade to an ssd. If you are seeing degraded performance after installing on a ssd, go here

Well, I observed that the post is not well balanced. It is like a non uniform graph, jumping about on the sheet. If you are reading it, you are definitely a fan of the rpi. So read on.

The public network is floating with optimizations available for the rpi 4. There are plenty of posts which help you to extract the last atom of juice from you rpi. Here are my recommendations. If you have any more feel free to share with me. Thanks in advance for all those efforts. Let me brief about my setup

1. rpi 4, 4GB
2. 4TB spinning HDD and a 1TB spinning HDD
3. 4 Port(USB 3.0) powered hub for connecting the above HDDs to the pi
4. Official charger for the rpi 4(This cant supply power to the second hdd)
5. 4K 32" monitor
6. Logitech wireless keyboard(K 400) with both keyboard and a touchpad. You will love this setup if you are invested in window managers. More on this later in the post
7. 8GB sd card
8. 128GB SSD connected to the USB 3.0 Port
9. A transparent case
10. Copper heat sinks for the main processor and the graphic processor
11. Fan

I have flashed the fully featured raspbian on the 8GB sd card. I then followed this excellent post to move the root file system to an SSD. Huge thanks to the OP and all the users/devs contributing o this huge thread. Dont use the option of using the method of device names like /dev/sda1 use the other option of specifying the id of the partitions for better compatibility and allowing the dirty job of allocating the device names to the OS by giving it a free hand and not doling out names which would make your device not bootable. If you are sure you are not going to connect any other disk then go ahead and do the first method. I suggest the partition id method.

Now it is time to disable the services which you don't want. There are plenty of posts and lots of directions in the raspberry pi forums for this. The sky is the limit and every user has his own requirements so go ahead and treat yourselves.

The default xfce4 desktop is quite good. That is if you are fan of traditional desktop environments. If you are a power user, then I would suggest you to shift to window managers. As their name they just manage windows. That is exactly what majority of us do when we fire up the desktop. For all other configurations we have the terminal. In my opinion, the most lightest terminal I have used to date has been urxvt. When I started searching for window managers and at last settling for i3, I was shocked to see that the majority of the configuration files shared by users on the public network mentioned urxvt as their terminal emulator. Once I started using it and configured it to my hearts content, any other terminal is bloated. When I fire up the rofi launcher and choose lxterminal, the hourglass is displayed for a brief amount of time. With an urxvt session, it is instantaneous. It is pure bliss. And when you are getting this response on a pi, it is a festival of sort whenever i fire up this emulator. I adore all the devs involved in this project. My favourite colour scheme is the solarized one and urxvt looks fabulous with this. Making it full screen without any borders and menus is........

The next piece of software I would like to talk is about youtube-dl. For all the command line junkies. This is a god send. Coupled with the unix philosophy of chaining the output of several commands, you have a miracle at your finger tips. Just combine it with omxplayer and you have a fantastic streaming solution. Did I tip my hat to the devs? Yes. Now, coming down to omxplayer. This is a quintessential piece of scripting to extract the maximum out of the video sub system of the pi. I am astonished at the video capabilities of the pi. All credit to the omxplayer devs. I do agree there might be some proprietary magic here. But, the foundation is working towards producing a good FLOSS representation of the graphics driver. All my best wishes for the team. Youtube does frequently defeat the purpose of youtube-dl but the devs have always found ways around it. I love you guys.


As always, all the ideas and optimizations mentioned here have been culled from all over the public network. If any credit is due, please drop a line and it will be acknowledged.

No comments:

Post a Comment

Nobody can deter me away from "free as in freedom" concept seeded by Sri RMS. See to it that u dont make fun of my belief. If u think otherwise, no need to comment.