My desktop replacement setup

You're next desktop ?Recently, I decided to move from a decent desktop setup to a desktop replacement setup. Here’s the why and the how of this move.</p>

For years, I had a barebone on my desktop with a huge screen :

  • Xeon CPU with 4 core, but low voltage
  • 8 GB Ram
  • Nvidia Geforce .....
  • 128 GB SSD
  • Dell 30"

As I stopped playing on my computer for at least the last 4 years, I noted several disadvantages of such setup :

  • It consumes a lot of power (the power supply of the barebone and the screen consume a tremendous amount of power)
  • It takes a lot of space just to surf
  • If I want to go to another place with my "desktop" to continue my work it was not so easy (ok I could use some remote desktop thing on a tablet but yet, more devices to use ...)
  • 30" display on a desktop, if you're not doing graphics is just so useless ...
  • Having a powerful computer just to surf over the web, or admin my servers, is just as driving a McLaren during rush hours, in the streets of Paris

So, at the end of last year, I decided to review all my equipment and optimize my usage, my habits, but also my power consumption. From this, my desk was one of the key elements to work on.

Which desktop ?

At about the same time, I received, graciously, a dead Lenovo X220. It didn't boot any more (Fan error at starting time, forbidding any access to the Bios setup), case had severe knocks all over, the battery was out, ... I love challenges and seeing this dead laptop, I saw the answer to my desk revamp : I'll revive it ! Ok I may loose some MIPS and MFLOPS, but frankly, who cares when surfing and ssh-ing ?

Ok, I'll skip the disassemble time where I got it partly back. Partly because it survived to 10 days during my Chinese trip. Then, the fatal Fan error message came back. Luckily, I was in China. I brought the corpse to a local computer mall and go the welded fan totally replaced ... for 5€ (the guys spent almost his day on it ... !).

Back in France, I was able to go through the next steps :

  1. upgrade the memory from the 6 GB (2+4) it had : Lenovo specs announces that we can go up to 8 GB on this little guy but as it's a Sandy Bridge powered laptop, I decided to give a try up to 16 GB (2x8 GB PC10600 CL9 from G.Skill)
  2. upgrade the harddrive from the 300 GB classical drive to an SSD : first, I assumed I would recycle the SSD from my barebone ; but it was to thick so I decided to get a Scandisk SSD Plus 240 GB which is only 7mm, and therefore can fit perfectly
  3. avoid to damage the bunch of connectors on the laptop : as I would use the laptop as desktop replacement but still as a laptop, having to plug all the USB cable, power, display, ... quite often, would damage them ; getting a dock was the solution and I found one (UltraBase 3 station) on E-bay for just a few bucks ...
  4. Replace my huge 30" Dell screen with something that fit more to my usage but will also consume a hell less : I moved to a Samsung SE650PL, as it has a DisplayPort (as the x220), incorporated speakers (even if not very powerful - but don't care, it's not my multimedia center), low blue light, and is not high energy.

Now, I have all my components, next step was to move forward to setup the box. I'm getting old (I swear it, I have two grey hairs now !), and therefore, I'm getting Lazy. In my old days, I would have install a very light Linux and compile everything from scratch, fine tuning every component. Now I just want to use my computer. Based on that, I decided to use Linux Mint as my distro. The following is not totally exhaustive as I'll skip the secure part that you should apply to any system.

Graphics

The default setup is almost perfect. Almost, because I still had to fix some little glitches. First, Configure the display properly. This starts with the login screen. The MDM, which handle the login screen, does not care about your Cinnamon config. It will still try to push the display toward the internal display and duplicate it, as it, on the DisplayPort. As my lid is closed, seeing the login screen just on a quarter if my screen is not fun ... I had to edit my /etc/mdm/Init/Default file to add the following lines by the end (just before the "exit 0") :

mode="$(xrandr -q|grep -A1 "DP2 connected"| tail -1 |awk '{ print $1 }')"
if [ -n "$mode" ]; then
  xrandr --output LVDS1 --off
  xrandr --output DP2 --primary --mode 1920x1080
fi

Then, I would focus on the video card and how it's used. It's an internal HD Graphic card from the Sandy Bridge. This would require the proper drive and proper configuration from the kernel.

sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install  libva-intel-vaapi-driver
sudo add-apt-repository ppa:tigerite/mint-xorg-update
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install xorg-update

Next to this, we'll have to edit our boot parameters for the kernel. Edit /etc/default/grub and update  GRUB_CMDLINE_LINUX_DEFAULT, for instance :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.i915_enable_rc6=1 i915.semaphores=1 i915.i915_enable_fbc=1 pcie_aspm=force"

Then, reload the grub configuration :

sudo update-grub

Now, thanks to this, the display will work as intended. Let's enhance the rest. For this, let's remove the Visual Effects. As usual, it's fancy but not very useful and also quite performance killer. This is quite simply as you can do it via the System Settings : "Appearance" > "Visual Effects" > "None". Easy, isn't it ?

System

Lots of small stuff in the system will enhance the usage. First, lets focus on the /etc/sysctl.conf file :

net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1
net.ipv4.tcp_syncookies=1
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0
vm.swappiness=1
vm.vfs_cache_pressure=50
vm.dirty_background_bytes = 536870912
vm.dirty_bytes = 1073741824
vm.dirty_expire_centisecs = 250
vm.dirty_writeback_centisecs = 500

Why all these ? First to secure, second to enhance. Indeed, we're not a router nor we'll inspect everything on the network from this computer : I'll do it from the router if needed. The second part is how we'll use the swap (with 16 GB Ram, as few as possible) and the different network shares we'll connect to (at least in CIFS for now).

We can also improve part of the SSD usage by updating the options in /etc/fstab :

UUID=04f97099-2f75-4599-92fa-9e455ba38925 / ext4 errors=remount-ro,noatime,discard 0 1

Then we'll change the relative scheduler by providing the info in the /etc/rc.local :

echo noop > /sys/block/sda/queue/scheduler

We'll replicate this choice for the global kernel options, in /etc/default/grub, by updating GRUB_CMDLINE_LINUX_DEFAULT :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.i915_enable_rc6=1 i915.semaphores=1 i915.i915_enable_fbc=1 pcie_aspm=force elevator=noop profile"

You'll need to update grub, next to this. As you noticed, I added also the word "profile". This will slow down the very next reboot but will progressively speed up all your boot time : it will tell the kernel to profile your system to adapt its own boot. Very useful.

You should also mind about updating the BIOS : it might be a very stock version, and several updates went out through the years.

Next, you'll need to ensure about the CPU usage, temperature, ... Anything related to the fact you rely on a laptop. Tools can do this for you :

aptitude install thermald laptop-mode-tools

You may have this kind of errors during setup :

SETTING OF KERNEL PARAMETER FAILED: echo ondemand 
gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

This is normal as the "ondemand" governor does not exists for your x220 : only "performance" and "powersave". To fix this, just edit /etc/laptop-mode/conf.d/cpufreq.conf and replace all the "ondemand" by "powersave". It should do the trick.

Conclusion

Thanks to all these, you're now ready to use your x220 as your desktop replacement. Feel free to amend this text based on your specific needs, especially regarding the budget and therefore, the components, or any software you'd like to use.

Vus : 1464
Publié par Francois Aichelbaum : 171