A Linux and open source blog by experts from Finland
Save your time on the command-line with fuzzy finder
The command-line fuzzy finder by Junegunn Choi is a new interesting time saver and power user utility I find myself using all the time nowadays. Search the command history with fzf A very common thing for command-line power users is to use Ctrl+R to search the command history, and thus avoid typing the same command […]
The command-line fuzzy finder by Junegunn Choi is a new interesting time saver and power user utility I find myself using all the time nowadays. Search the command history with fzf A very common thing for command-line power users is to use Ctrl+R to search the command history, and thus avoid typing the same command over and over. But what if you remember parts of the command, but not in the correct order? Say I want to run dstat with --top- something, but I don’t remember if I ran dstat --top-cpu or maybe dstat -n --top-cpu. If there were some characters in between, a normal Ctrl+R search on dstat --top- would not find it. This is a use case where fzf excels. With it, I can simply press Ctrl+R and write dstat top and it will list all occurrences that had those words anywhere. I can simply browse the results with the arrow key and press enter to select what I’m looking for, and another enter to run it. Simple and quick! Command-line fuzzy finder demo on Ctrl+R use If you are wondering which prompt is used in the recording above, check out our post on Liquid Prompt! Jump immediately to correct directory with fzf Surely all command-line users have the experience of typing cd and ls all the time. What if you could find the correct directory and jump immediately to it with no effort? Just use the powers of fzf. When you have it installed, you can simply type Alt-C to activate the auto-complete with which you can conduct a search with one or more file names. In the demo below I want to go to the modules directory in the nginx source code. I just type nginx module and fzf presents me with the exact thing I wanted. Effortless! Command-line fuzzy finder demo on double wildcard use Find and manipulate multiple files effortlessly Another very common scenario on the command-line is to view or edit multiple files. Finding the files and writing the paths to each file can be slow. But not with fzf! Simply type the name of your command (in this example bat to view files) and then press Ctrl+T to trigger the file searcher and selector. Type the name you want to search with, use arrow keys to browse the list and press tab to select the files you want to return. Once you’re done, just press enter, and you have the command completed. Press enter again to launch it. Command-line fuzzy finder demo on Ctrl+T use Fzf can work with any list you give it By default, in file operations fzf uses a list retrieved by running find . in the current directory. There is nothing that inherently limits fzf to files. There are a lot of use cases where you want to give it a list manually, and then apply a search based on that. In the demo below a list from git branch is sent to fzf, so it is easy to find that old branch by typing in but a couple of characters. A list of git branches sent to fzf manually to search from In the demo above, you can also note that fzf looks a bit different here. That is because it was customized with export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'. There is more If typing ssh ** and then pressing tab, fzf presents a list of SSH hosts to choose from. The double wildcard will most of the time translate to a file list dialog, but in case of compatible software, fzf can show you a dialog, allowing you to select from the autocomplete options. There is a seamless integration for e.g. kill so you can type in process names, and out comes the process IDs. Demo of fzf completing process ids to kill What if your query is more complex? No worries, just type your query as a regular expression or using some of the special syntax fzf offers! Read the Usage section in the README of fzf to learn more. There are also many configuration options to choose from, such as window height, direction, margin, borders, file list generation methods, search result sorting etc. For a full list of all options, see the man fzf page. Installation If you’ve read this far, you probably want to install fzf and try it out yourself. The older version 0.17 is available in current stable Debian, and a bit newer 0.20 in Ubuntu releases. Simply run apt install fzf to get it on a Debian based system. To activate it in your shell, add the following lines to .bashrc: # fzf keybindings for Bash: source /usr/share/doc/fzf/examples/key-bindings.bash # fuzzy auto-completion for Bash: source /usr/share/doc/fzf/examples/completion.bash Open a new session and start fuzzing away!
Happy Free Software Day and thank you KeePassXC for your awesome work! <3 One of the cornerstones on how to keep yourself secure in the modern world is to use strong passwords + 2FA and encrypted communication methods when living your life on the net. To manage all the complex passwords needed for the services […]
Happy Free Software Day and thank you KeePassXC for your awesome work! <3 One of the cornerstones on how to keep yourself secure in the modern world is to use strong passwords + 2FA and encrypted communication methods when living your life on the net. To manage all the complex passwords needed for the services you use you should let a password manager do all the hard work. At Seravo we prefer to use offline password managers such as the open source KeePassXC, which is the modern fork of the older and still popular KeePass-project. For a long time the online password managers had the advantage of good browser integrations, since they are by definition made for online use, making them the go-to solution for the basic user. <img loading="lazy" width="540" height="271" src="https://linuxnatives.net/wp-content/uploads/2021/02/image-540x271.png" alt="" class="wp-image-4664" srcset="https://linuxnatives.net/wp-content/uploads/2021/02/image-540x271.png 540w, https://linuxnatives.net/wp-content/uploads/2021/02/image-300x151.png 300w, https://linuxnatives.net/wp-content/uploads/2021/02/image-150x75.png 150w, https://linuxnatives.net/wp-content/uploads/2021/02/image-768x386.png 768w, https://linuxnatives.net/wp-content/uploads/2021/02/image.png 1213w" sizes="(max-width: 540px) 100vw, 540px" /> Fortunately the makers of KeePassXC didn’t just accept this situation but started working on their own official browser integration. The extension is currently available for Chromium based browsers as well as Firefox and Edge. You can also get the package for the plugin via Debian packages if you wish. What is it for? The extension allows the user to easily to log in to an online service via browser, using the username and password from the password manager, without needing to manually input the username and password. This is instead done simply with a few clicks from the UI provided by the extension within your browser, no copy-pasting needed! <img loading="lazy" width="540" height="550" src="https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_login-540x550.png" alt="" class="wp-image-4665" srcset="https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_login-540x550.png 540w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_login-294x300.png 294w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_login-147x150.png 147w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_login-768x783.png 768w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_login.png 1046w" sizes="(max-width: 540px) 100vw, 540px" /> Using the extension you will remove the need for the passwords to be saved in clear text to the browser or to trust in a commercial online password manager provider. Is the extension secure? The official browser integration for the KeePassXC password manager is developed and maintained by the KeePassXC developers themselves. Unfortunately KeePassXC has not yet been audited by an external security company, read more in their FAQ. The KeePassXC-project is also completely open source and found by multiple users to be truly offline password manager, as all the code is available for the world to see. Still, we’d hope to see the project’s codebase being audited at some point. The browser extension does not transform the KeePassXC password manager to an online one, so no password data is not sent to some external server as there is feature that needs that. Also, the extension does not work if you haven’t unlocked the password database, so it doesn’t work on itself as it’s not saving any passwords in it. How do I install it? I recommend you either get the extension via the Debian repository or download the extension via the official browser stores. Also check the KeepassXC FAQ for more specific questions about the tech behind the project. Below you’ll find the steps to enable the extension in a browser: 1. Install and configure the KeePassXC password manager 2. Enable the browser integration from the settings <img loading="lazy" width="540" height="394" src="https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_integration-540x394.png" alt="" class="wp-image-4669" srcset="https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_integration-540x394.png 540w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_integration-300x219.png 300w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_integration-150x110.png 150w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_integration-768x561.png 768w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_integration-1536x1122.png 1536w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_integration-1320x964.png 1320w, https://linuxnatives.net/wp-content/uploads/2021/02/keepassxc_integration.png 1758w" sizes="(max-width: 540px) 100vw, 540px" /> 3. Install and setup the extension to your browser of choice 4. Refresh the extensions connection or restart your browser (depending on the browser) <img loading="lazy" width="540" height="266" src="https://linuxnatives.net/wp-content/uploads/2021/02/keepass_refresh-540x266.png" alt="" class="wp-image-4666" srcset="https://linuxnatives.net/wp-content/uploads/2021/02/keepass_refresh-540x266.png 540w, https://linuxnatives.net/wp-content/uploads/2021/02/keepass_refresh-300x148.png 300w, https://linuxnatives.net/wp-content/uploads/2021/02/keepass_refresh-150x74.png 150w, https://linuxnatives.net/wp-content/uploads/2021/02/keepass_refresh-768x379.png 768w, https://linuxnatives.net/wp-content/uploads/2021/02/keepass_refresh.png 793w" sizes="(max-width: 540px) 100vw, 540px" /> 5. Try to log in to a service with credentials you have saved into the password manager Now you’ll have a more smooth experience when logging in to services on the web!
Hosting my own cloud platform with Nextcloud
Nextcloud is a quality opensource alternative for commercial and “free” file-sharing and cloud platforms. It is originally based on ownCloud (initially released in 2010) and was forked to Nextcloud by the original developer Frank Karlitschek. The software is developed with security in mind, and the basic idea is to keep all the data under the […]
Nextcloud is a quality opensource alternative for commercial and “free” file-sharing and cloud platforms. It is originally based on ownCloud (initially released in 2010) and was forked to Nextcloud by the original developer Frank Karlitschek. The software is developed with security in mind, and the basic idea is to keep all the data under the users’ own control. Nextcloud is developed and managed by Nextcloud GmbH and the opensource community. The company also offers Software as a Service hosting for commercial customers. My use cases I personally prefer local storages and servers over commercial or “free” systems like Google Photos, Dropbox etc. Previously, I had multiple PHP galleries and simple web directories (with digest password authentication), but they are complex to maintain in the long run, and complex to use if users need to handle a ton of user accounts. Especially when used with smart devices, the user needs to have a specific URL and copy / paste the credentials (or use weak passwords, which are easy to remember and type). I use Nextcloud primarily to share photos and other files with my family and relatives. Features Nextcloud can be built to be a fully collaborative software for enterprises, but basically it offers a number of useful features, including: File server / sharing Web UI features, like: File manager Internal document viewer Internal text editor Photo gallery WebDAV (which integrates with file managers in Linux, Windows and OS X) Calendar with CalDAV (which integrates with e.g. Mozilla Thunderbird) Contacts with CardDAV Small utilities, like: Weather forecast Maps viewer RSS feed reader Hundreds of extensions Built-in security Nextcloud has built-in security features that can be enabled after installation. Two-Factor Authentication Server side file encryption Password policies to enforce use of strong passwords IP whitelists for restricting access only from certain networks or IP addresses My server environment I have a small and low-cost VPS instance for Nextcloud with LAMP installed. I use Debian 10 (stable version while writing this), Apache web server, MariaDB database and PHP 7.3. SSL is enabled using free Let’s Encrypt certificate, installed with CertBot software, which is provided with the Debian package. The installation procedure was easy and straightforward. Register domain (if not already done) and create an appropriate DNS configuration. In my case, I used a subdomain for Nextcloud. Create and enable VirtualHost in the webserver configuration. Install Let’s Encrypt certificate for the domain. In most cases, CertBot can do this automatically for previously created VirtualHost by just executing: sudo certbot --apache -d nextcloud.example.com Download and extract the latest version of NextCloud: /var/www$ wget https://download.nextcloud.com/server/releases/nextcloud-20.0.1.tar.bz2 /var/www$ tar xf nextcloud-20.0.1.tar.bz2 /var/www$ chown -R www-data:www-data nextcloud/ Create MySQL / MariaDB database and appropriate user (remember to create it with GRANT options, otherwise the install will fail, throwing up an error message for incorrect database credentials). Finish installation in web browser <img loading="lazy" width="540" height="379" src="https://linuxnatives.net/wp-content/uploads/2020/11/image-540x379.png" alt="" class="wp-image-4510" srcset="https://linuxnatives.net/wp-content/uploads/2020/11/image-540x379.png 540w, https://linuxnatives.net/wp-content/uploads/2020/11/image-300x211.png 300w, https://linuxnatives.net/wp-content/uploads/2020/11/image-150x105.png 150w, https://linuxnatives.net/wp-content/uploads/2020/11/image-768x539.png 768w, https://linuxnatives.net/wp-content/uploads/2020/11/image.png 1287w" sizes="(max-width: 540px) 100vw, 540px" /> <img loading="lazy" width="540" height="380" src="https://linuxnatives.net/wp-content/uploads/2020/11/image-1-540x380.png" alt="" class="wp-image-4512" srcset="https://linuxnatives.net/wp-content/uploads/2020/11/image-1-540x380.png 540w, https://linuxnatives.net/wp-content/uploads/2020/11/image-1-300x211.png 300w, https://linuxnatives.net/wp-content/uploads/2020/11/image-1-150x106.png 150w, https://linuxnatives.net/wp-content/uploads/2020/11/image-1-768x540.png 768w, https://linuxnatives.net/wp-content/uploads/2020/11/image-1.png 1285w" sizes="(max-width: 540px) 100vw, 540px" /> Dashboard view after installation Connecting to fileshares File shares can be used with web browsers, but also with mobile apps and DAV integrations. When using WebDAV, no DAV modules are needed as Nextcloud has integrated SabreDAV software. The file manager in a browser is very familiar and easy to use: <img loading="lazy" width="540" height="378" src="https://linuxnatives.net/wp-content/uploads/2020/11/image-2-540x378.png" alt="" class="wp-image-4515" srcset="https://linuxnatives.net/wp-content/uploads/2020/11/image-2-540x378.png 540w, https://linuxnatives.net/wp-content/uploads/2020/11/image-2-300x210.png 300w, https://linuxnatives.net/wp-content/uploads/2020/11/image-2-150x105.png 150w, https://linuxnatives.net/wp-content/uploads/2020/11/image-2-768x538.png 768w, https://linuxnatives.net/wp-content/uploads/2020/11/image-2.png 1288w" sizes="(max-width: 540px) 100vw, 540px" /> All files view <img loading="lazy" width="540" height="380" src="https://linuxnatives.net/wp-content/uploads/2020/11/image-3-540x380.png" alt="" class="wp-image-4516" srcset="https://linuxnatives.net/wp-content/uploads/2020/11/image-3-540x380.png 540w, https://linuxnatives.net/wp-content/uploads/2020/11/image-3-300x211.png 300w, https://linuxnatives.net/wp-content/uploads/2020/11/image-3-150x106.png 150w, https://linuxnatives.net/wp-content/uploads/2020/11/image-3-768x541.png 768w, https://linuxnatives.net/wp-content/uploads/2020/11/image-3.png 1287w" sizes="(max-width: 540px) 100vw, 540px" /> Directory listing <img loading="lazy" width="540" height="338" src="https://linuxnatives.net/wp-content/uploads/2020/11/image-5-540x338.png" alt="" class="wp-image-4519" srcset="https://linuxnatives.net/wp-content/uploads/2020/11/image-5-540x338.png 540w, https://linuxnatives.net/wp-content/uploads/2020/11/image-5-300x188.png 300w, https://linuxnatives.net/wp-content/uploads/2020/11/image-5-150x94.png 150w, https://linuxnatives.net/wp-content/uploads/2020/11/image-5-768x480.png 768w, https://linuxnatives.net/wp-content/uploads/2020/11/image-5.png 1280w" sizes="(max-width: 540px) 100vw, 540px" /> File manager in Android File sharing in Android works like within every Android app these days: Just tap ‘Share’ and choose Nextcloud and the folder into which you want to upload the file. WebDAV works out-of-the-box within Linux file managers, like Dolphin (default in KDE desktop), Caja (MATE desktop) and Nautilus (Gnome). WebDAV works also without external software or plug-ins in Windows and OS X. <img loading="lazy" width="540" height="361" src="https://linuxnatives.net/wp-content/uploads/2020/11/image-7-540x361.png" alt="" class="wp-image-4523" srcset="https://linuxnatives.net/wp-content/uploads/2020/11/image-7-540x361.png 540w, https://linuxnatives.net/wp-content/uploads/2020/11/image-7-300x201.png 300w, https://linuxnatives.net/wp-content/uploads/2020/11/image-7-150x100.png 150w, https://linuxnatives.net/wp-content/uploads/2020/11/image-7-768x513.png 768w, https://linuxnatives.net/wp-content/uploads/2020/11/image-7.png 1026w" sizes="(max-width: 540px) 100vw, 540px" /> Dolphin file manager with WebDAV URL opened Of course, the more native way in Linux is to mount DAV share to the filesystem mount point. This can be done with davfs2 file system driver, which is easy to install from Debian / Ubuntu repositories. Install the driver first from the repository and add your user into davfs2 group: sudo apt install davfs2 usermod -aG davfs2 simo Create mount point, eg. /mnt/webdav Create a secrets file using package template: mkdir ~/.davfs2 sudo cp /etc/davfs2/secrets ~/.davfs2/secrets sudo chown simo:simo ~/.davfs2/secrets Ensure that the secret file has the correct 600 (rw——-) permissions Add your credentials to the secret file: https://[SERVER]/share.php/remote.php/dav/files/[USER] [USER] [PASS] Add the mount information to /etc/fstab: https://[SERVER]/remote.php/dav/files/[USER]/ [MOUNT POINT] davfs user,rw,noauto 0 0 Mount the share: mount /mnt/webdav <img loading="lazy" width="540" height="362" src="https://linuxnatives.net/wp-content/uploads/2020/11/image-8-540x362.png" alt="" class="wp-image-4526" srcset="https://linuxnatives.net/wp-content/uploads/2020/11/image-8-540x362.png 540w, https://linuxnatives.net/wp-content/uploads/2020/11/image-8-300x201.png 300w, https://linuxnatives.net/wp-content/uploads/2020/11/image-8-150x101.png 150w, https://linuxnatives.net/wp-content/uploads/2020/11/image-8-768x515.png 768w, https://linuxnatives.net/wp-content/uploads/2020/11/image-8.png 971w" sizes="(max-width: 540px) 100vw, 540px" /> Directory listing in terminal after mounting the file system Conclusion I found Nextcloud very useful for my purposes. Here’s a short list of pros and cons from my point of view: Pros Data is always in own control Easy to install Easy to roll out to users’ smart phones etc. Easy to use file shares directly from Linux desktop Scalable. As it is self-hosted, there are no contract-based limits, just own-resource limits (disk space, bandwidth, transfer limits) Cons Consumes a lot of disk space with basic install (approximately 560MB before adding data) Self-hosted services need maintenance, upgrades, monitoring, etc.
Pain in the neck? Real workplace test of Logitech Ergo devices
Real workplace test of Logitech Ergo devices, with goals to avoid repetitive stress injury (RSI) and muscle strain in general.
I work at Seravo’s Customer Success team as a Support Specialist. Our team is responsible for taking care of support requests and phone calls from our customers. The most used channel for communication between the customers and us is email via a ticketing system. Our statistics show that, in roughly six months I sent over 2000 responses to our customers. Some of them are short, some of them are long but either way, that is a lot of typing. I got an assignment to test the Logitech Ergo K860 keyboard and MX Vertical mouse in my everyday work. The main goal was to reduce pressure on my wrists and general muscle strain during all that typing and mouse use, and to avoid repetitive stress injury (RSI) in the long run. <img loading="lazy" width="540" height="663" src="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-packages-540x663.jpg" alt="" class="wp-image-4574" srcset="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-packages-540x663.jpg 540w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-packages-244x300.jpg 244w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-packages-122x150.jpg 122w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-packages-768x943.jpg 768w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-packages.jpg 1080w" sizes="(max-width: 540px) 100vw, 540px" /> Packages waiting to be opened. Keyboard To connect the keyboard to my laptop running Ubuntu was super easy. Users can choose between the provided USB dongle or Bluetooth LE. To keep my two USB-A ports available for other devices I connected the keyboard using Bluetooth. After inserting two AAA batteries, the setup required to initiate the connection from Bluetooth devices and after typing the provided six number key from the computer screen a connection was created. Three devices can be connected and switching between them is easy using the designated keys. <img loading="lazy" width="540" height="280" src="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mainprofile-1-540x280.jpg" alt="" class="wp-image-4576" srcset="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mainprofile-1-540x280.jpg 540w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mainprofile-1-300x155.jpg 300w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mainprofile-1-150x78.jpg 150w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mainprofile-1-768x398.jpg 768w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mainprofile-1-1320x683.jpg 1320w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mainprofile-1.jpg 1491w" sizes="(max-width: 540px) 100vw, 540px" /> Ergo K860 layout. Keys to switch between devices are located above Insert / Home / PgUp. Judging the keyboard by its looks, my first thought was “I’m never going to learn to type with this thing”, as the main keyboard layout is split into two parts. My muscle memory is accustomed to a very basic generic layout found on most laptops or external keyboards. For the previous six months, I had been using a generic Microsoft Desktop 900 keyboard and mouse set. <img loading="lazy" width="540" height="201" src="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-profiledifference1-540x201.jpg" alt="" class="wp-image-4577" srcset="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-profiledifference1-540x201.jpg 540w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-profiledifference1-300x112.jpg 300w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-profiledifference1-150x56.jpg 150w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-profiledifference1-768x286.jpg 768w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-profiledifference1-1536x573.jpg 1536w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-profiledifference1-1320x492.jpg 1320w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-profiledifference1.jpg 1733w" sizes="(max-width: 540px) 100vw, 540px" /> Vertical profile comparison. The K860’s curved palm rest allows the user’s wrists to stay more still. Surprisingly, after only one day of normally replying to emails and writing documentation, I realized that my fingers found their places on this layout very quickly. By the end of the day, I didn’t have to think about or look to find the correct keys. One small detail I noticed was that I had been mostly typing the letter ‘B’ with my right hand. This is definitely inefficient since ‘B’ is located on the left-hand side of the keyboard layout. Basically, the keyboard layout taught me how to press a certain key more efficiently. Another thing that I learned was that, using the laptop keys, my wrists are constantly working on multiple axes. To move my wrists, I also tend to move the whole arm, even if only slightly. The Ergo keyboard enables me to rest my wrists in one spot when typing a long text, leading to less strain on my neck and upper back muscles. Mouse I use quite a lot of shortcut keys but the mouse is still an essential part of my everyday work. E.g. selecting text in a web browser using just a keyboard is difficult, if not impossible. Just like the Ergo keyboard, the MX Vertical mouse can be connected using a dongle or Bluetooth and it supports three devices. The device selector button can be found on the bottom. The mouse has a built-in battery that’s charged via USB-C. Battery life seems very impressive, as I only had to charge the mouse twice in three months. <img loading="lazy" src="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mouse-540x731.jpg" alt="" class="wp-image-4578" width="270" height="366" srcset="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mouse-540x731.jpg 540w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mouse-222x300.jpg 222w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mouse-111x150.jpg 111w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mouse-768x1039.jpg 768w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mouse-1135x1536.jpg 1135w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-mouse.jpg 1159w" sizes="(max-width: 270px) 100vw, 270px" /> The MX Vertical looks weird, but allows your hand and wrist to be in a more natural position, almost like a kind of handshake grip. After the first day of use, I felt a strange pressure on the outer part of my wrist, around the pisiform bone. Perhaps it was just related to adjusting to the new angle because the pressure had not returned since. The mouse has a button to change between two DPI settings. Unfortunately it lacks manufacturer level Linux support so getting this button to work needs a little tinkering. Open source enthusiasts have created libratbag that allows configuring input devices. Another tool called piper enables a GUI on top of libratbag. With piper I was able to change the DPI setting. After finding a suitable setting I noticed that pressing the DPI switch button switched between two values, the default and my own setting. So it turned out that the button had worked the whole time, it just didn’t seem to do anything as it was switching between the same two values. Since then, I’ve been using the faster default setting when moving windows etc., i.e. tasks that don’t need as much precision. <img loading="lazy" src="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-scrollwheel-540x829.jpg" alt="" class="wp-image-4579" width="270" height="415" srcset="https://linuxnatives.net/wp-content/uploads/2021/01/ergo-scrollwheel-540x829.jpg 540w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-scrollwheel-195x300.jpg 195w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-scrollwheel-98x150.jpg 98w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-scrollwheel-768x1179.jpg 768w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-scrollwheel-1000x1536.jpg 1000w, https://linuxnatives.net/wp-content/uploads/2021/01/ergo-scrollwheel.jpg 1079w" sizes="(max-width: 270px) 100vw, 270px" /> An unlockable wheel would make this mouse even better. Logitech is known for creating great mouse wheels that can be unlocked. Unfortunately, the MX Vertical does not unlock, so with long documents it becomes a lot of scrolling. I should figure out how to create a custom scrolling solution for the wheel. xbindkeys might be the solution I’m looking for. I’d like to keep the default setting available, for precision tasks, so changing the operating system’s mouse settings is not ideal. Maybe the mouse wheel could initiate Page Up and Page Down keys when having a modifier button pressed on the keyboard. Conclusions The keyboard layout was surprisingly easy to learn. My wrists are definitely under less pressure and there’s no need for so many small but tiring adjustments regarding wrist or arm angle. Using the mouse precisely took a while to learn but now I’m moving between three screens faster and with a lot less arm movement. I’m using a much higher DPI value than previously with a “normal” mouse. The mouse wheel is a minus, so I better take a look at creating that modifier key ASAP.
Casting Android Device To Your PC With Scrcpy
Scrcpy is a free and open source tool that allows you to simply hook your android device to your computer via usb, allowing you to cast the mobile device’s display to your computer screen. It’s available for Windows, mac & Linux, including as a flatpak, snap or deb. Using Scrcpy Scrcpy requires USB debugging to […]
Scrcpy is a free and open source tool that allows you to simply hook your android device to your computer via usb, allowing you to cast the mobile device’s display to your computer screen. It’s available for Windows, mac & Linux, including as a flatpak, snap or deb. <img loading="lazy" width="1600" height="953" src="https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-linuxnatives.jpg" alt="Linuxnatives on browser, on scrcpy and on phone side-by-side" class="wp-image-4393" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-linuxnatives.jpg 1600w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-linuxnatives-300x179.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-linuxnatives-540x322.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-linuxnatives-150x89.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-linuxnatives-768x457.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-linuxnatives-1536x915.jpg 1536w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-linuxnatives-1320x786.jpg 1320w" sizes="(max-width: 1600px) 100vw, 1600px" /> Linuxnatives on browser, on scrcpy and on phone side-by-side Using Scrcpy Scrcpy requires USB debugging to be enabled. However it leaves nothing installed to your mobile device. The software allows you to control the android device with mouse and keyboard. Additionally, it has drag and drop utilities, allowing you to upload files to your phone. Scrcpy is fast. It takes about one second from launching the tool on your computer for the image of the device to appear on your computer screen. There is some latency when using the mobile device from computer, but it’s low enough to allow you to smoothly operate the device. Scrcpy can also work wirelessly, although that requires a bit more tinkering than just plugging your device via usb. Android development Using an actual phone is invaluable when developing with mobile devices. While the virtual devices that you can run in Android Studio are handy, they have their own issues. More often than not, they do not operate or behave the same as an actual phone would. Scrcpy allows you to speed up your development as you can quickly see the results of changes on your computer screen instead of your handheld device. Having the device on your computer screen makes it easy to capture images of the application on the computer screen. Not just android development Within the past year, especially with the Covid-19 pandemic, there has been a significant increase in the number of people that have started to work remotely. Most popular remote communication tools have some sort of a screen share feature in them. There are bound to be situations where you would want to share something from your phone during such a conference call. Whether it’s to demonstrate some mobile app you’ve found, or maybe how something looks off on your phone’s screen. <img loading="lazy" width="540" height="720" src="https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-google-meet-540x720.jpg" alt="Cat memes in Google meet via screen sharing a scrcpy window" class="wp-image-4434" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-google-meet-540x720.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-google-meet-225x300.jpg 225w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-google-meet-113x150.jpg 113w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-google-meet-768x1023.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/10/scrcpy-google-meet.jpg 800w" sizes="(max-width: 540px) 100vw, 540px" /> In Google meet sharing scrcpy window of cat memes from the phone.
Everybody knows these basic keyboard shortcuts for copying and pasting: Ctrl+C and Ctrl+V. But there’s much more to them! With these handy tips, you can copy-paste more efficiently than ever before. The tips are convenient for all Linux and Gnome users in particular, as most of the shortcuts work out-of-the-box. There is no need to […]
Everybody knows these basic keyboard shortcuts for copying and pasting: Ctrl+C and Ctrl+V. But there’s much more to them! With these handy tips, you can copy-paste more efficiently than ever before. The tips are convenient for all Linux and Gnome users in particular, as most of the shortcuts work out-of-the-box. There is no need to install additional software – simply memorize these shortcuts to be more productive! Copy-pasting was invented in the 1970’s Did you know? The modern copy-pasting method of selecting some text and using a single keyboard shortcut to copy and paste it was originally invented by Larry Tesler, way back in the 1970’s. Tesler conceived and implemented many graphical user interface (GUI) features, which are taken for granted today. We find it very interesting to read more about Larry Tesler and his crusade against “modes” in human-computer interfaces. Knowing how to copy-paste efficiently is an essential skill all computer users should learn to be productive. Memorize them today! Watch the full presentation Plain presentation slides are available on Slideshare. Quick summary Action Shortcut Select text lines to copy Drag with mouse Select text columns to copy Press Ctrl while dragging with mouse Copy Ctrl+C or simply click the middle mouse button Copy in terminal Shift+Ctrl+C Copy in terminal with formatting Shift+Ctrl+H Paste Ctrl+V Paste without formatting Shift+Ctrl+V Take a full screen screenshot directly to clipboard Ctrl+PrtScr Take a window screenshot to clipboard Ctrl+Alt+PrtScr Select area to screenshot directly to clipboard Ctrl+Shift+PrtScr Record full screen to video Ctrl+Shift+Alt+R
MariaDB 10.5 is the latest major stable release of MariaDB, released in the spring of 2020. It was imported into Debian.org in late summer 2020 by the author of this blog post. Debian is one of the most popular Linux distributions and the “mother” of many other distributions, most notably Ubuntu. Thus when MariaDB 10.5 […]
MariaDB 10.5 is the latest major stable release of MariaDB, released in the spring of 2020. It was imported into Debian.org in late summer 2020 by the author of this blog post. Debian is one of the most popular Linux distributions and the “mother” of many other distributions, most notably Ubuntu. Thus when MariaDB 10.5 was introduced in Debian’s official repositories, it automatically became also available in Ubuntu and many other Debian derivatives. Debian and Ubuntu release engineering Initially, any new package in Debian is available only in the unstable package archive, but that is eventually distilled into the testing package archive which then becomes the next stable release. MariaDB 10.5 was already released in Ubuntu 20.10 but that it will only appear in Debian 11 when released later in 2021. This means that, although MariaDB 10.5 has been out already for many months, the stage when all current Debian 10 users upgrade to Debian 11 and thus start using MariaDB 10.5 is still some time in the future. To check what version is available in which distribution version, you can check packages.debian.org or packages.ubuntu.com. There is also the MariaDB 10.5 tracker page for a packaging status overview in Debian/Ubuntu. MariaDB replaced MySQL in Debian since 2015 MariaDB is a database server made by the original authors of MySQL, including, among others, Michael “Monty” Widenius. MariaDB is actually a fork of MySQL and almost a drop-in-replacement for MySQL, and we recommend all MySQL users to migrate to MariaDB. There are many good reasons to do so, and Debian as a distribution opted for MariaDB in Debian 9, released in 2015. Ever since, all Debian users have been running MariaDB in all their MySQL-type use cases (for example when running WordPress). <img loading="lazy" width="540" height="294" src="https://linuxnatives.net/wp-content/uploads/2021/01/mariadb-in-debian-timeline-540x294.png" alt="MariaDB and MySQL in Debian timeline" class="wp-image-4595" srcset="https://linuxnatives.net/wp-content/uploads/2021/01/mariadb-in-debian-timeline-540x294.png 540w, https://linuxnatives.net/wp-content/uploads/2021/01/mariadb-in-debian-timeline-300x163.png 300w, https://linuxnatives.net/wp-content/uploads/2021/01/mariadb-in-debian-timeline-150x82.png 150w, https://linuxnatives.net/wp-content/uploads/2021/01/mariadb-in-debian-timeline-768x418.png 768w, https://linuxnatives.net/wp-content/uploads/2021/01/mariadb-in-debian-timeline-1320x719.png 1320w, https://linuxnatives.net/wp-content/uploads/2021/01/mariadb-in-debian-timeline.png 1337w" sizes="(max-width: 540px) 100vw, 540px" /> Debian 8 shipped both MariaDB and MySQL. Since Debian 9 only MariaDB has been included. Currently the latest Debian 10 shipped with MariaDB 10.3 and the next Debian 11 will ship with MariaDB 10.5. As there is a major new MariaDB release almost annually but Debian’s cadence is usually bi-annual, the MariaDB version 10.4 was skipped for Debian. Compatibility with MySQL Prior to 2013, the versions 5.5 of both MySQL and MariaDB were very similar to each other but over the years the differences have increased. It is possible to do an in-place upgrade from MySQL 5.7, 5.6 and 5.5 easily to MariaDB as MariaDB is almost fully backwards compatible on a binary format level with those versions of MySQL. However, starting from MySQL 8.0 there are major changes which prevents MariaDB from being binary compatible, but it is still logically compatible. This means that an in-place upgrade is not possible from MySQL 8.0, but you can dump a database from an instance of MySQL 8.0 and import it into an instance of MariaDB 10.5. Oracle MySQL does not strive for any kind of MariaDB compatibility, so while you can upgrade from an older version of MySQL to a new MariaDB version, the other way around is not supported by Oracle. Most apps (such as WordPress or NextCloud) work fine with both MariaDB or MySQL since those applications make use of any MySQL-only or MariaDB-only features. What is new in MariaDB 10.5? One immediately visible change is that starting from version 10.5, MariaDB has made most of its commands available using command names of form mariadb-*. For example the command mysqldump is now available also as mariadb-dump. Also, the server daemon itself is now running as mariadbd insteaf of mysqld. Keep that in mind when running ps faxu, for example! Another naming change is that from this version onwards, the term REPLICA is a synonym for SLAVE in SQL statements. The new term was introduced in response to the political developments in 2020 in the US, where the use of black or slave in computer science lingo was viewed by some as an form of structural racism. These connotations are not in general shared by MariaDB developers, which of the majority live in Europe and which of many are also ethnically slavic (which is the origin to the word slave) and don’t associate the word slave with race, but because of US-centric power structures in the IT industry, MariaDB went along with the movement. To remain backwards compatible the old terms will continue to supported long in to the future. A new storage engine S3 (packaged as mariadb-plugin-s3) makes it easy to archive selected tables into Amazon S3. Reading and writing to S3 is naturally slow compared to local storage, but this storage engine is not meant for daily usage but rather to transparently archive parts of a database so that they don’t consume disk space locally but can still occasionally be read and accessed. On the performance side there are many enhancements such as: InnoDB redo log format optimized to be faster and to need fewer log operations Binary row logging is faster Connect speed is faster (up to 25%) New PCRE regex library version New crc32 function New performance_schema_* variables Many small performance improvements across the code base ANALYZE improved for easier visibility into query optimizer On the security side of things there is a new configuration option require_secure_transport to force encryption in transit. There are also two new JSON functions, JSON_ARRAYAGG and JSON_OBJECTAGG. What is new in Galera 4? Upgrading from MariaDB 10.3 to 10.5 also brings Galera 4 in multi-master clustered setups. Galera 4 uses a new WSREP API version 26 (while Galera 3 was using version 25). Some notable changes are that there is group commit support, a more lightweight SST lock to help make backups, and new metadata tables (wsrep_cluster, wsrep_cluster_members, wsrep_streaming_log). The new cluster state tables makes it very easy to list the connected nodes. Watch DebConf20 presentation for more For more details, watch the DebConf 2020 presentation about MariaDB 10.5 in Debian by Otto Kekäläinen on YouTube or PeerTube. The slides are also available on SlideShare and SpeakerDeck. <img loading="lazy" width="540" height="304" src="https://linuxnatives.net/wp-content/uploads/2021/01/debconf20-mariadb-slides-540x304.png" alt="MariaDB 10.5 and Galera 4 - State of MariaDB in Debian" class="wp-image-4602" srcset="https://linuxnatives.net/wp-content/uploads/2021/01/debconf20-mariadb-slides-540x304.png 540w, https://linuxnatives.net/wp-content/uploads/2021/01/debconf20-mariadb-slides-300x169.png 300w, https://linuxnatives.net/wp-content/uploads/2021/01/debconf20-mariadb-slides-150x84.png 150w, https://linuxnatives.net/wp-content/uploads/2021/01/debconf20-mariadb-slides-768x432.png 768w, https://linuxnatives.net/wp-content/uploads/2021/01/debconf20-mariadb-slides-1536x864.png 1536w, https://linuxnatives.net/wp-content/uploads/2021/01/debconf20-mariadb-slides-1320x743.png 1320w, https://linuxnatives.net/wp-content/uploads/2021/01/debconf20-mariadb-slides.png 1920w" sizes="(max-width: 540px) 100vw, 540px" />
Looking to create tutorial videos easily? We are starting a series of guides for OBS Studio. In the first part you'll learn how to record your screen and webcam simultaneously.
OBS Studio is a popular recording and streaming program. It is available across all major platforms, and is available as a snap and a flatpak. It has a very low learning curve and it’s also open-source, which makes us very happy at linuxnatives.net! This article starts an ongoing series focusing on OBS. Following this guide you’ll learn how to record your desktop and webcam simultaneously with OBS. There’s a lot of functionality out-of-the-box which opens a very wide variety of recording and streaming related possibilities. The program can be extended and customized with plugins, themes and scripts, making OBS Studio even more versatile. This guide was made on Ubuntu 20.04 running OBS Studio 26.0.0 from the main Ubuntu repository. Please be advised that the user interface experience may vary on your operating system and computer setup. Configuring OBS Studio using the setup wizard <img loading="lazy" width="540" height="426" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog04-540x426.png" alt="" class="wp-image-4342" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog04-540x426.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog04-300x236.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog04-150x118.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog04.png 576w" sizes="(max-width: 540px) 100vw, 540px" /> It is highly recommended for first time users to follow the setup wizard. The wizard will pop up when running OBS for the first time. Once the wizard has been launched, choose to optimize for recording and follow the steps. OBS Studio will test how much your computer can handle. These settings can always be changed later, and the wizard can also be re-run from Tools – Auto-Configuration Wizard. Using OBS Studio to record tutorials & screen capture presentations Ever wondered how all those tutorial videos on YouTube are made? The ones in which someone is showing what they do on their screen and their face is in some corner of the video? Well maybe not all, but definitely some have been made using OBS. With this setup we can easily create how-to / tutorial videos. What we want to achieve is: Capture output from a designated window or screen Capture video stream from a webcam (or another video input device) Capture sound from the computer microphone or input …and have all these sources combined and recorded into a single video file. How to Capture the output of a desktop window There’s always a scene defined in OBS Studio and it can’t be deleted. In this series of OBS Studio guides, we will cover using scenes later on. Let’s start by adding a source. Let’s go item by item, and begin with capturing a designated window. Adding sources to OBS Studio is relatively easy. A stream from an application window can be captured by: Clicking the plus sign under Sources and choosing Window Capture. Choosing your desired window and making sure Capture Cursor is checked. <img loading="lazy" width="1920" height="1080" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog02.png" alt="" class="wp-image-4331" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog02.png 1920w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog02-300x169.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog02-540x304.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog02-150x84.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog02-768x432.png 768w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog02-1536x864.png 1536w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog02-1320x743.png 1320w" sizes="(max-width: 1920px) 100vw, 1920px" /> Capturing the mouse cursor helps viewers to understand where to click to go through a step in your tutorial video. How to Capture the output from your webcam For the webcam capture we want to use Video Capture Device as a source. If your operating system can see your webcam, it will be listed in the Device dropdown menu. In this menu, you can adjust your camera brightness, saturation and other such settings. Depending on your camera, you might also want to configure the resolution and frame rate settings. <img loading="lazy" width="1920" height="1003" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog05.png" alt="" class="wp-image-4343" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog05.png 1920w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog05-300x157.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog05-540x282.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog05-150x78.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog05-768x401.png 768w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog05-1536x802.png 1536w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog05-1320x690.png 1320w" sizes="(max-width: 1920px) 100vw, 1920px" /> For demonstration purposes the webcam brightness setting have been lowered to zero, resulting in a black image. The size of your webcam stream on top of the window capture is by default using the webcam’s resolution. My canvas resolution is Full HD (1920×1080) and the webcam output is HD (1280×720), resulting in the webcam occupying a large portion of the canvas. With the webcam source active, press Ctrl+E to open the Transform window. Tinker with the settings until it fits your setup nicely. You can also position the source by dragging it around with your mouse and resize using the handles. <img loading="lazy" width="1249" height="706" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog10.png" alt="" class="wp-image-4374" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog10.png 1249w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog10-300x170.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog10-540x305.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog10-150x85.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog10-768x434.png 768w" sizes="(max-width: 1249px) 100vw, 1249px" /> Setting the webcam source size to 640×360 makes it use much less space on the canvas. Capturing sound <img loading="lazy" width="367" height="369" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog07.png" alt="" class="wp-image-4354" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog07.png 367w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog07-298x300.png 298w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog07-150x150.png 150w" sizes="(max-width: 367px) 100vw, 367px" /> Finally, as the third source you can add an audio source, such as a microphone. Add Audio Input Capture as a source but don’t click OK yet. It is likely OBS already recognizes your system microphone, so there shouldn’t be any need to setup a new one. Select Add Existing and continue. <img loading="lazy" width="667" height="174" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog08.png" alt="" class="wp-image-4355" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog08.png 667w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog08-300x78.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog08-540x141.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog08-150x39.png 150w" sizes="(max-width: 667px) 100vw, 667px" /> Make sure your input is not muted and make some noise. The level meter in the Audio Mixer should activate. Check your settings before recording Before starting to record, let’s take a look at the settings. We want to know where our recorded video will be saved, in what format and what kind of quality. <img loading="lazy" width="1001" height="774" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog09.png" alt="" class="wp-image-4366" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog09.png 1001w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog09-300x232.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog09-540x418.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog09-150x116.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog09-768x594.png 768w" sizes="(max-width: 1001px) 100vw, 1001px" /> Recording settings can be found in the Output tab. By default the Recording Quality is “Same as stream”. I prefer the High Quality preset because its quality is enough for keeping text readable, while maintaining a filesize my relatively small hard disk can handle. You can remux recordings to another format later, so sticking with mkv is recommended because it allows you to pause recordings. <img loading="lazy" width="1001" height="774" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog11.png" alt="" class="wp-image-4377" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog11.png 1001w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog11-300x232.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog11-540x418.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog11-150x116.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog11-768x594.png 768w" sizes="(max-width: 1001px) 100vw, 1001px" /> On the Advanced tab you can customize recordings’ filename formatting. Tip: mouse hover the formatting field to see all the possible tags for the filename. We are ready to hit Start Recording! Pay attention to the bottom right corner of the program. REC Icon will turn red and the timer starts. Also note that your CPU usage will go up as your computer is saving the file to your disk. If you chose the same settings I had, recordings can also be paused in this corner. <img loading="lazy" width="600" height="223" src="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog12.png" alt="" class="wp-image-4383" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog12.png 600w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog12-300x112.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog12-540x201.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/obs-blog12-150x56.png 150w" sizes="(max-width: 600px) 100vw, 600px" /> In the next OBS Studio guide we’ll get acquainted with Studio Mode, multiple scenes and how to work efficiently with these tools to live stream from your computer to the Internet. Final tip: Save your settings in the Scene Collection menu and Export. Now you can tinker with the settings however you like and revert back when it’s time to record another tutorial video.
In search of a modern browser to optimise your workflows? Search no more, use Vivaldi! Read more to learn why.
In search of a modern customisable web browser for the advanced user in 2020? Then Vivaldi is your pick. <img loading="lazy" width="540" height="137" src="https://linuxnatives.net/wp-content/uploads/2020/12/vivaldi_logo_dark-540x137.png" alt="" class="wp-image-4546" srcset="https://linuxnatives.net/wp-content/uploads/2020/12/vivaldi_logo_dark-540x137.png 540w, https://linuxnatives.net/wp-content/uploads/2020/12/vivaldi_logo_dark-300x76.png 300w, https://linuxnatives.net/wp-content/uploads/2020/12/vivaldi_logo_dark-150x38.png 150w, https://linuxnatives.net/wp-content/uploads/2020/12/vivaldi_logo_dark-768x195.png 768w, https://linuxnatives.net/wp-content/uploads/2020/12/vivaldi_logo_dark-1536x390.png 1536w, https://linuxnatives.net/wp-content/uploads/2020/12/vivaldi_logo_dark-2048x520.png 2048w, https://linuxnatives.net/wp-content/uploads/2020/12/vivaldi_logo_dark-1320x335.png 1320w" sizes="(max-width: 540px) 100vw, 540px" /> The initial release for Vivaldi was four years ago in April 6, 2016 so it’s a relatively new player in the field of browsers. The company behind the product, Vivaldi Technologies, was found on 2014 by Jon von Tetzchner and Tatsuki Tomita. Jon von Tetzchner is also a co-founder and the former CEO of Opera Software, a company which built the Opera browser loved by browser enthusiasts. Vivaldi advertises itself as a feature rich tool that you can modify almost as much as you please. However, the browser is also easy to use and easy to learn, so it’s not only for the mysterious “power user”. In the video below you can see how Google Chrome nowadays dominates the browser industry. This is not good and having more competition is a good way to prevent too much power from centralising to one service provider. Web browser is after all the way most of us are in touch with the internet, so it does matter which tools we use and who owns them. What are the main features of Vivaldi browser? Vivaldi is very customisable to the point where you can get lost in settings while trying to build the perfect browser experience for yourself. Let’s take a look at the features we’ve found to be the most useful. The out of the box split-screening You can tile two or more tabs to have them in a split-screen view within the browser window. This can be very useful, if for example you’re writing an article on one tab and browsing different sources on the other or doing a comparison of something. <img loading="lazy" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-10-540x132.png" alt="" class="wp-image-4465" width="683" height="167" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-10-540x132.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/image-10-300x74.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-10-150x37.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/image-10-768x188.png 768w, https://linuxnatives.net/wp-content/uploads/2020/10/image-10-1536x377.png 1536w, https://linuxnatives.net/wp-content/uploads/2020/10/image-10-2048x502.png 2048w, https://linuxnatives.net/wp-content/uploads/2020/10/image-10-1320x324.png 1320w" sizes="(max-width: 683px) 100vw, 683px" /> Two tabs tiled <img loading="lazy" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-11-540x201.png" alt="" class="wp-image-4466" width="631" height="235" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-11-540x201.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/image-11-300x112.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-11-150x56.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/image-11-768x286.png 768w, https://linuxnatives.net/wp-content/uploads/2020/10/image-11-1536x572.png 1536w, https://linuxnatives.net/wp-content/uploads/2020/10/image-11-2048x763.png 2048w, https://linuxnatives.net/wp-content/uploads/2020/10/image-11-1320x492.png 1320w" sizes="(max-width: 631px) 100vw, 631px" /> Tiling three tabs at the same time Improved tab management In Vivaldi you can manage your tabs in almost any way you can think of. From the settings page you can change the default tab behaviour in different situations. <img loading="lazy" width="540" height="459" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-12-540x459.png" alt="" class="wp-image-4469" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-12-540x459.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/image-12-300x255.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-12-150x128.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/image-12-768x653.png 768w, https://linuxnatives.net/wp-content/uploads/2020/10/image-12.png 1178w" sizes="(max-width: 540px) 100vw, 540px" /> If you’re on a lookout for a new laptop and are conducting an extensive product comparison, it can often get a bit crowded with many tabs open at the same time. In this case you can group the tabs with Vivaldi Tab Stack feature. <img loading="lazy" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-1-540x49.png" alt="" class="wp-image-4442" width="609" height="55" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-1-540x49.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/image-1-300x27.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-1-150x14.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/image-1.png 599w" sizes="(max-width: 609px) 100vw, 609px" /> You can change between the tabs in a stack by clicking. Modifying the user interface For the demanding user the customisation of the user interface is often almost as important as the actual technical features of the product. A browser is our personal tool to view the internet after all and Vivaldi does definitely deliver when it comes to customising the appearance. First off, yes, you can use the extensions from the Chrome Web Store as Vivaldi is Chromium based. Built in Vivaldi you have option to set a general colour theme for the browser and then tweak the separate sections. <img loading="lazy" width="540" height="289" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-13-540x289.png" alt="" class="wp-image-4470" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-13-540x289.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/image-13-300x161.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-13-150x80.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/image-13-768x411.png 768w, https://linuxnatives.net/wp-content/uploads/2020/10/image-13.png 1115w" sizes="(max-width: 540px) 100vw, 540px" /> When using Vivaldi you’ll notice that the colour schema of the tab section will change to represent the colours used on that specific page to unify the viewing experience. This happens because of the Vivaldi adaptive interface. You can also change many other appearance settings from the browser menu. <img loading="lazy" width="540" height="445" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-14-540x445.png" alt="" class="wp-image-4471" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-14-540x445.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/image-14-300x247.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-14-150x124.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/image-14-768x633.png 768w, https://linuxnatives.net/wp-content/uploads/2020/10/image-14.png 897w" sizes="(max-width: 540px) 100vw, 540px" /> Privacy & Security Vivaldi takes steps to protect the users privacy by keeping trackers at bay and having a built-in ad-blocker. Furthermore, the browser has an option to sync your data between devices using an end-to-end encrypted connection. <img loading="lazy" width="540" height="235" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-17-540x235.png" alt="" class="wp-image-4475" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-17-540x235.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/image-17-300x130.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-17-150x65.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/image-17-768x334.png 768w, https://linuxnatives.net/wp-content/uploads/2020/10/image-17-1320x573.png 1320w, https://linuxnatives.net/wp-content/uploads/2020/10/image-17.png 1331w" sizes="(max-width: 540px) 100vw, 540px" /> Privacy settings are easy to understand and implement. <img loading="lazy" width="464" height="400" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-15.png" alt="" class="wp-image-4472" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-15.png 464w, https://linuxnatives.net/wp-content/uploads/2020/10/image-15-300x259.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-15-150x129.png 150w" sizes="(max-width: 464px) 100vw, 464px" /> You can create a Vivaldi account to get access to their sync features. Defaults are important. That’s why Vivaldi has out-of-the-box several search engines available for you to choose. Personally I’d prefer StartPage.com for it’s strong privacy focus. <img loading="lazy" width="540" height="413" src="https://linuxnatives.net/wp-content/uploads/2020/10/image-16-540x413.png" alt="" class="wp-image-4473" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/image-16-540x413.png 540w, https://linuxnatives.net/wp-content/uploads/2020/10/image-16-300x229.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/image-16-150x115.png 150w, https://linuxnatives.net/wp-content/uploads/2020/10/image-16.png 713w" sizes="(max-width: 540px) 100vw, 540px" /> Is Vivaldi Open Source? The short answer is no(unfortunately). Vivaldi is not made available under one unified open source license. … … Vivaldi also contains third party code. Licenses for these parts can be found in the source package and in the installed browser by navigating to vivaldi://credits Taken from Vivaldi’s support article at https://help.vivaldi.com/article/is-vivaldi-open-source/ When looking at more closely on what kind of licences Vivaldi uses for their browser we can see that even though the browser is not completely Open Source it still is about 95% made with Open Source licensed code. Vivaldi’s code consist of three layers. a) The Chromium it’s based on b) Open Source code made by Vivaldi themselves and c) some closed source pieces of code. This means that roughly 92% of the browser’s code is open-source coming from Chromium, 3% is open-source coming from us and only 5% is our UI closed-source code. As stated by Vivaldi on July 30, 2020 at https://vivaldi.com/blog/vivaldi-browser-open-source/ Do I recommend using Vivaldi as your default browser? To be short: Yes. Vivaldi can be a great tool to boost up your productivity with its split-screen capabilities and enhanced tab management features. The possibility to modify the platform to support your individual needs doesn’t hurt either. Give it a try a try and start you journey with Vivaldi at vivaldi.com. Also, did you know that Vivaldi has a built in browser game at vivaldi://game/? <img loading="lazy" width="540" height="370" src="https://linuxnatives.net/wp-content/uploads/2020/12/image-540x370.png" alt="" class="wp-image-4543" srcset="https://linuxnatives.net/wp-content/uploads/2020/12/image-540x370.png 540w, https://linuxnatives.net/wp-content/uploads/2020/12/image-300x206.png 300w, https://linuxnatives.net/wp-content/uploads/2020/12/image-150x103.png 150w, https://linuxnatives.net/wp-content/uploads/2020/12/image-768x527.png 768w, https://linuxnatives.net/wp-content/uploads/2020/12/image-1320x905.png 1320w, https://linuxnatives.net/wp-content/uploads/2020/12/image.png 1412w" sizes="(max-width: 540px) 100vw, 540px" />
15 Keyboard Shortcuts To Make You a Terminal Ninja
Very often, using keyboard shortcuts in terminal is much faster than using the arrow keys on the keyboard. Master these keyboard shortcuts to become a terminal ninja!
TL;DR For everyone in a hurry. Here are the keyboard shortcuts covered in this article: Action Keyboard Shortcut Move forwards Ctrl+f (letter) / Alt+f (word) Move backwards Ctrl+b (letter) / Alt+b (word) Move to the start of the line Ctrl+a Move to the end of the line Ctrl+e Clear the screen Ctrl+l (Lowercase L) Clear the line towards the beginning Ctrl+u Clear the line towards the end Ctrl+k Modify current command and run it Ctrl+x+e Pause Ctrl+s Resume Ctrl+q Previous command in history Ctrl+p Next command in history Ctrl+n Reverse search Ctrl+r Keyboard shortcuts that can be used to speed up working in the terminal Terminal & command line tricks <img loading="lazy" width="540" height="345" src="https://linuxnatives.net/wp-content/uploads/2020/09/ninja-540x345.png" alt="Ninja with a laptop" class="wp-image-4301" srcset="https://linuxnatives.net/wp-content/uploads/2020/09/ninja-540x345.png 540w, https://linuxnatives.net/wp-content/uploads/2020/09/ninja-300x192.png 300w, https://linuxnatives.net/wp-content/uploads/2020/09/ninja-150x96.png 150w, https://linuxnatives.net/wp-content/uploads/2020/09/ninja-768x490.png 768w, https://linuxnatives.net/wp-content/uploads/2020/09/ninja-1320x843.png 1320w, https://linuxnatives.net/wp-content/uploads/2020/09/ninja.png 1339w" sizes="(max-width: 540px) 100vw, 540px" /> With these keyboard shortcuts, everyone can become a terminal ninja Since the dawn of time, mankind has struggled with the unnecessary hand movement during IT tasks. No more! Here are 15 keyboard shortcuts, that make you as fast and agile as a ninja! To avoid using the mouse when working in the terminal is a good skill to have when working with Linux. However, using arrow keys excessively involves lots of unnecessary movement from the alphabetical keys to the arrow keys and can be just as straining as using a mouse. Not all Linux users know that a lot of actions can be done from the keyboard without moving away from the alphabetic keys. In a lot of cases, the ninja way of keyboard shortcuts is much faster than the “normal” way. See this comparison about clearing the terminal: Okay, that was brutal. Are you convinced that the ninja way is the right way? Good. Let’s start! Moving around the command line Instead of using the arrow keys, or even mouse, keyboard shortcuts can be used to move the cursor back and forth the prompt. In order to move back and forth, use Ctrl+b (b as in backwards) and Ctrl+f (f as in forwards). It may be quicker to move one word at a time instead of one character at a time. In such a situation, Alt+b and Alt+f can be used. Moving to the start or the end of the line is often needed, when modifying the command on the prompt. Moving the cursor to the start and the end of the line can be done as follows (respectively): Ctrl+a and Ctrl+e. The moving to the end of a line is easy to remember, because it is “e as in end”. However, we a have been unable to come up with a memory rule for the Ctrl+a. Please suggest a memory rule in the comment field below! How to clear terminal output? There are situations, where it is beneficial to remove unneeded output from the terminal. With Ctrl+l (lowercase L), the output can be cleared easily without affecting the line with the command. This is especially useful, if clarity is needed in a presentation, or if someone is spying over your shoulder. For historical reasons, the command prompt clearing is not that easy. There are keyboard shortcuts Ctrl+u to clear towards the beginning of the line and Ctrl+k to clear towards the end of the line. A fearless terminal ninja can use combos to clear the prompt: Ctrl+a, Ctrl+k and Ctrl+e, Ctrl+u both clear the whole line. Also Ctrl+c works, but it has a side effect of changing the exit code of the last command (accessible with $?) to 130. Please see an example of command line clearing in the opening chapter. Start and stop the output flow in terminal Sometimes the output flows too quickly even for a ninja. Luckily, the output can be paused with Ctrl+s and continued with Ctrl+q. Please keep in mind, that this does not have the power to pause running commands, but it will not start new processes. Therefore, it can be used to pause bash loops. Navigating bash history There are times when it comes handy to be able to run commands from the history. Traditionally, this is achieved by pressing arrow up and arrow down keys. However, it is possible to search history with Ctrl+p (previous) and Ctrl+n (next) keys. If the command was run a long time ago, it may not be convenient to search it with next and previous keys. Instead, pressing Ctrl+r starts a “reverse-i-search”, to which the user should input a part of the command wanted and it returns the first command from the history, which matches the user input. Towards ninja mastery Congratulations! You are now one step closer to becoming a true terminal ninja! In order to advance with the ninja path you have chosen, please continue to read our comprehensive guide to vim editor.
Easy Encrypted Cloud Storage & Backups With Rclone
Looking for a simple way to create encrypted backups? Rclone is a command-line tool to encrypt and transfer files to cloud storage platforms or via SFTP.
Rclone is a command line tool that can be used to manage files on cloud storage. It’s supported by over 40 cloud storage providers including Google, Amazon, Microsoft etc. It’s easy to use and is open source. Rclone is a great tool, because once you are using it you can switch between your cloud storage options, without need of learning new commands or updating all your backup related scripts. Additionally, you don’t need other tools for encrypting your backup. Since your data is encrypted, you don’t need to ponder which cloud storage you can trust. Simply select the best deal that suits your needs! In this article I will show you how to create encrypted backup to a cloud storage, using Rclone. Installation Ubuntu/Debian: apt install rclone Fedora: dnf install rclone Default repositories don’t necessary have the newest version of Rclone, but you can check the other download options from Rclone.org download page. Setting up a remote destination Rclone has a helper tool to create the config file. This can be launched with the “rclone config” command. The “new remote” prompt can vary depending on which storage system is selected. In this article we will use an SFTP backend as an example. For other storage systems, there is further documentation available from Rclone’s website. SFTP in Rclone will work with any host you have SSH access to. If you have SSH key set up correctly, passwords are not required. When you run rclone config. It will give a prompt about missing config file on the first run. It should look like something like this: <img loading="lazy" width="531" height="427" src="https://linuxnatives.net/wp-content/uploads/2020/10/rclone_config-2.png" alt="" class="wp-image-4489" srcset="https://linuxnatives.net/wp-content/uploads/2020/10/rclone_config-2.png 531w, https://linuxnatives.net/wp-content/uploads/2020/10/rclone_config-2-300x241.png 300w, https://linuxnatives.net/wp-content/uploads/2020/10/rclone_config-2-150x121.png 150w" sizes="(max-width: 531px) 100vw, 531px" /> To proceed, press “n”. Next, come up with a name for your remote and then select from the list which storage system it is. After that, you will be prompted for a host, user, port and password. name> remote storage> sftp (number 26 in Rclone version 1.50.2) host> example.com user> (press enter for current user) port> (press enter for default port 22) password> (press enter to use SSH key) After these basic details you can leave the rest options empty unless you want to use the extra features. If something went wrong you can always manually edit .config/rclone/rclone.conf. Now you should have a working remote. Next you should create a directory on your remote that will be used in the next section for encrypted remote (many other storage systems than SFTP call directories “buckets” in the documentation). In this example remote is named “remote” and the new directory is called “directory”: rclone mkdir remote:directory With SFTP backend this will create a directory in your home folder on the host. For other backends it’s beneficial to check the dedicated storage system page from Rclone.org. Encrypted remote Now you should have a normal working remote and a directory so that we can use them to setup an encrypted remote. Run rclone config again and select “n” for another new remote. Encrypted remote in this example will be called “secret” but you can of course choose something else. The storage type should be “crypt” and remote should be what you previously created, in our example “remote:directory”. You could also crypt the whole remote with “remote:” but that is not really recommended according to the Rclone’s documentation. name> secret host> remote:directory storage> crypt (number 10 in Rclone version 1.50.2) Next, choose if you want to also encrypt the filenames or directories. Then enter your password and salt, or let Rclone generate those for you. Making a copy Once the encrypted remote is added, you can copy your local file to the cloud: rclone copy localfile secret: Or the whole content of a local directory to the cloud storage: rclone copy localdir secret:localdir Later, you can use sync to update the remote directory with just the changes. If you deleted files, sync will also delete them from the remote. Include --dry-run if you want to see the changes first. rclone sync localdir secret:localdir Restoring from the cloud to local: rclone copy secret:localdir localdir Useful features Rclone also has a mount command. You can easily mount your cloud storage with: rclone mount secret:localdir /mnt/somedir Mount doesn’t give any feedback on the screen when the storage is mounted (just an empty line). However, if you check the mount directory you chose, you should see your cloud storage content. You can stop the mount with Ctrl+C. Useful basic commands: ls, lsd mkdir, rmdir copy, sync delete ncdu cat See full list of commands from the Rclone website. Quick summary of the steps done: Create a remote Create a directory/bucket on the remote Create a new remote where storage is “crypt” and remote “remote:directory” Copy your files
Build a small and cheap Linux workstation with Intel NUC
Are you looking for a workstation that is easy-to-use, virtually maintenance free and incredibly cheap to run? Perhaps your Grandparents require want to connect with the rest of their family? Maybe you require a simple Internet kiosk for a public space? Whatever your needs, a modern Linux distribution, combined with inexpensive hardware, can provide viable […]
Are you looking for a workstation that is easy-to-use, virtually maintenance free and incredibly cheap to run? Perhaps your Grandparents require want to connect with the rest of their family? Maybe you require a simple Internet kiosk for a public space? Whatever your needs, a modern Linux distribution, combined with inexpensive hardware, can provide viable and effective solutions for a wide range of use cases. Intel NUC & Linux: Performance in a small form factor? Intel NUCs can be the ideal hardware for many use cases where there are performance and hardware costs to consider. Modern Linux distributions enable users to take advantage of this low-cost hardware, while delivering performance to match the user’s requirements. Additionally, Linux systems can often be easily optimized to minimize the upkeep burden in the long run. The Test Station: Intel NUC 6 Series Intel offer an impressive range of high-performance NUCs. For this project, we opted to explore the potential of their budget offering. We chose the older Intel NUC 6 series (model NUC6CAYB), which utilises an Intel Celeron processor. The official datasheet for details the specifications, with this particular model being fitted with 2x4GB RAM as an aftermarket modification (the model does not come with installed memory or a hard drive). Before use, we also installed a laptop SSD from a salvaged machine in order to complete the setup. In order to complete the installation of the Intel NUC 6, we combined the small form-factor device with a screen, and input peripherals (keyboard, mouse). The NUC6CAYB also supports VGA connections as well as HDMI, allowing us to up-cycle an old 24” HD screen from our legacy equipment store. A useful feature, albeit one that is not listed on the technical specification, is that this model of the NUC 6 series can also utilise a VESA mount. This is particularly valuable where desk or storage space is at a premium. Fitting the small form-factor device to the rear of the salvaged monitor was incredibly easy, and helped reduce the total device footprint by a significant margin. Combined with the fanless design, and minimal moving parts (mainly due to the salvaged SSD we utilised), not only did we create a workstation that was visually unobtrusive, but acoustically quiet as well. Additionally, the fanless design also contributes to the relatively low power requirements of the device, with its 10w rating making this a device a candidate of battery powered operations, or where energy efficiency is a deciding factor. Modern Linux desktop: Minimal Upkeep & Minimal Cost With the hardware installed, and mounted on the rear of our monitor, the focus could rest on the operating system of choice. While many options were discussed, with a sufficient amount of RAM and hard drive space, and the quad-core Intel Celeron J3455 processor included with the unit, Ubuntu raised itself as the natural choice for this device. Ubuntu Linux works well on many different device specifications, including low-end or legacy hardware. The operating system features also lend it to non-technical user groups who require automatic security updates, and enjoy the low upkeep procedures that the operating system can utilise. The length of support is also a significant factor in choosing an operating system. To this end, we installed Ubuntu 20.04, which is a “long term support” (LTS) version, meaning that it will continue to receive security updates until April 2025. The Ubuntu installation took only 15 minutes and resulted in fully functional workstation out-of-the-box. As expected from an operating system such as Ubuntu, everything worked flawlessly immediately. We did not need to fiddle around or tinker in order to get this machine working as expected and as required. The Intel NUC6: How much did it cost? Part of the specification for this design test was about keeping the costs low. Costs: Item Cost (€) Intel NUC6 (NUC6CAYB) €150 2 x 4GB RAM €50 SSD Free (Salvaged) VGA Compatible 24” HD Monitor Free (Salvaged) Keyboard Free (Salvaged) Mouse Free (Salvaged) Operating System Free (Open Source) Total cost of our new system: €200 Our Conclusions: In summary, this is a very easy, cheap, silent and handy solution for which can be implemented for many use cases. The cost-effectiveness, both from the initial investment, to the regular running costs, impressed us. Along with the small footprint, low acoustic disturbance, this is definitely a solution which we warmly recommend anybody who has similar needs. <img loading="lazy" width="540" height="304" src="https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-ubuntu-540x304.jpg" alt="" data-id="4089" data-link="https://linuxnatives.net/?attachment_id=4089" class="wp-image-4089" srcset="https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-ubuntu-540x304.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-ubuntu-150x84.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-ubuntu-300x169.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-ubuntu-768x432.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-ubuntu-600x338.jpg 600w" sizes="(max-width: 540px) 100vw, 540px" /> <img loading="lazy" width="540" height="304" src="https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-vesa-mounted-right-540x304.jpg" alt="" data-id="4090" data-link="https://linuxnatives.net/?attachment_id=4090" class="wp-image-4090" srcset="https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-vesa-mounted-right-540x304.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-vesa-mounted-right-150x84.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-vesa-mounted-right-300x169.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-vesa-mounted-right-768x432.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/07/intel-nuc-vesa-mounted-right-600x338.jpg 600w" sizes="(max-width: 540px) 100vw, 540px" /> <img loading="lazy" width="540" height="304" src="https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-ubuntu-installation-1-540x304.jpg" alt="" data-id="4091" data-link="https://linuxnatives.net/?attachment_id=4091" class="wp-image-4091" srcset="https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-ubuntu-installation-1-540x304.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-ubuntu-installation-1-150x84.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-ubuntu-installation-1-300x169.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-ubuntu-installation-1-768x432.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-ubuntu-installation-1-600x338.jpg 600w" sizes="(max-width: 540px) 100vw, 540px" /> <img loading="lazy" width="540" height="304" src="https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-chassis-opened-540x304.jpg" alt="" data-id="4092" data-link="https://linuxnatives.net/?attachment_id=4092" class="wp-image-4092" srcset="https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-chassis-opened-540x304.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-chassis-opened-150x84.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-chassis-opened-300x169.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-chassis-opened-768x432.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/07/inte-nuc-chassis-opened-600x338.jpg 600w" sizes="(max-width: 540px) 100vw, 540px" /> Intel NUC6CAYB chassis opened before memory and hard disk installation
Vim – The Ubiquitous Text Editor (… and your new best friend)
ubiquitous /juːˈbɪkwɪtəs/: present, appearing, or found everywhere Vim is one of the grand old text editors, and while it’s history begins long before many current computer scientists were born, it still has it’s place in the toolbox of 2020’s technology workers. It’s default settings might however be too simplified, and make the tool hard to use […]
ubiquitous /juːˈbɪkwɪtəs/: present, appearing, or found everywhere Vim is one of the grand old text editors, and while it’s history begins long before many current computer scientists were born, it still has it’s place in the toolbox of 2020’s technology workers. It’s default settings might however be too simplified, and make the tool hard to use for newcomers. It can be improved also for more experienced users, as there is lots of tasks to be automated, new keybindings to be added etc. Here we take a look on some customizations to improve Vim – maybe it even becomes your new best friend. Short trivia, courtesy of vim.org and Wikipedia: Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as “vi” with most UNIX systems and with Apple OS X. (vim.org) first released 1991 (Vi IMproved, based on vi from 1976…) written in C, charityware with GPL-compatible licensing Most popular development environments #5 in Stack Overflow’s 2019 survey (2nd for SRE/DevOps) probably also installed to your router and Smart TV… Other <img loading="lazy" width="540" height="296" src="https://linuxnatives.net/wp-content/uploads/2020/09/real_programmers-540x296.png" alt="xkcd#378: Real Programmers" class="wp-image-4269" srcset="https://linuxnatives.net/wp-content/uploads/2020/09/real_programmers-540x296.png 540w, https://linuxnatives.net/wp-content/uploads/2020/09/real_programmers-300x165.png 300w, https://linuxnatives.net/wp-content/uploads/2020/09/real_programmers-150x82.png 150w, https://linuxnatives.net/wp-content/uploads/2020/09/real_programmers.png 740w" sizes="(max-width: 540px) 100vw, 540px" /> xkcd#378: Real Programmers while not as featureful as Emacs, has lots of features built-in, and provides very extensible platform for custom plugins & mods by default almost everything is disabled extremely lightweight compared to newer node.js based massive text editor frameworks Maybe too lightweight by default? Maybe we can add some good features that modern editor should have, to make vim much more usable, while keeping its low resource usage? So, let’s see what we can do with some modifications. Notes Examples are based on the out-of-box experience (OOBE) on current Debian unstable/testing (future bullseye release). Some of the latter examples might depend on the customizations done on previous steps. $ vim --version |head -n1 VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 12 2020 02:37:13) vim is preinstalled on many systems, but you can install it easily, eg. # Debian/Ubuntu and derivatives sudo apt-get install vim # Centos/Fedora/RHEL and derivatives sudo dnf install vim You can optionally use Docker for testing, docker run -it ypcs/tools:vim-seravo has all tools and configs already installed for you. <img loading="lazy" width="540" height="372" src="https://linuxnatives.net/wp-content/uploads/2020/09/oobe-start-540x372.png" alt="" class="wp-image-4263" srcset="https://linuxnatives.net/wp-content/uploads/2020/09/oobe-start-540x372.png 540w, https://linuxnatives.net/wp-content/uploads/2020/09/oobe-start-300x207.png 300w, https://linuxnatives.net/wp-content/uploads/2020/09/oobe-start-150x103.png 150w, https://linuxnatives.net/wp-content/uploads/2020/09/oobe-start-768x529.png 768w, https://linuxnatives.net/wp-content/uploads/2020/09/oobe-start.png 774w" sizes="(max-width: 540px) 100vw, 540px" /> First start using default settings (no file opened) <img loading="lazy" width="540" height="372" src="https://linuxnatives.net/wp-content/uploads/2020/09/oobe-edit-540x372.png" alt="" class="wp-image-4264" srcset="https://linuxnatives.net/wp-content/uploads/2020/09/oobe-edit-540x372.png 540w, https://linuxnatives.net/wp-content/uploads/2020/09/oobe-edit-300x207.png 300w, https://linuxnatives.net/wp-content/uploads/2020/09/oobe-edit-150x103.png 150w, https://linuxnatives.net/wp-content/uploads/2020/09/oobe-edit-768x529.png 768w, https://linuxnatives.net/wp-content/uploads/2020/09/oobe-edit.png 774w" sizes="(max-width: 540px) 100vw, 540px" /> Editing a file using default settings <img loading="lazy" width="540" height="372" src="https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-540x372.png" alt="" class="wp-image-4265" srcset="https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-540x372.png 540w, https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-300x207.png 300w, https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-150x103.png 150w, https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-768x529.png 768w, https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit.png 774w" sizes="(max-width: 540px) 100vw, 540px" /> Editing a file using some customizations <img loading="lazy" width="540" height="372" src="https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-2-540x372.png" alt="" class="wp-image-4266" srcset="https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-2-540x372.png 540w, https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-2-300x207.png 300w, https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-2-150x103.png 150w, https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-2-768x529.png 768w, https://linuxnatives.net/wp-content/uploads/2020/09/custom-edit-2.png 774w" sizes="(max-width: 540px) 100vw, 540px" /> Editing a file using lots of customizations (including: git status, syntax checking) Different vim modes In vim there is four different operating modes, and this is something that might confuse newcomers. Current mode isn’t even shown by default. Mode Description How to enter NORMAL Default, navigate inside a file. (“Read mode”) Esc INSERT Edit/write: insert at cursor, at beginning of line iI insert after cursor, at end of line aA start new line before/after current oO REPLACE Just replace everything as you type R VISUAL Select characters / lines / blocks vV^V You can switch from other modes to normal usually by hitting Esc. Keyboard is your tool, but if you really want, :set mouse=a is there for some features… vim command structure vim commands consist of verb and noun. Commands can have a multiplier and commands can be repeated and chained. Some examples: i insert (verb) (at cursor) (noun) d$ delete (verb) (to) end of line (noun) 20k 20 times move up (verb) (a line) (noun) /myword search (verb) myword (noun) jj (twice) move down (verb) (a line) (noun) j2kl move down, then two times up, and one time right gv start visual mode at previous position More about vim keys follows… To quit vim… To quit: you must be in normal mode (hit Esc) and then :q quit :q! quit, discard changes :wq write changes and quit (:x write if there is changes, and quit) :wq! write changes (with force) and quit :qa quit all (tabs, split buffers etc.) :cq quit, discard changes and use exit code 1 Also :help for more tips Stack Overflow, How to exit Vim, answer with +5100 votes… There is some alternative ways to achieve somewhat similar results… Moving in the document You must be in other mode than insert or replace. h move one character left, l move one character right w move one word right (to begin), e move one word right (to end), b move one word left j move one line down, k move one line up ( move one sentence left, ) move one sentence right { move one paragraph left, } move one paragraph right % jump to next matching item, parenthesis /word search for word, n next match, d/word search and delete : move to line g; move to last edit Editing the document How to manipulate text. These apply either to current position of your line, or in visual mode your current selection. y yank / copy dw delete / cut a word, dd delete / cut a line, c cut rest of the line p paste u undo < dedent > indent . repeat previous command Basic configuration You can either configure vim via ~/.vimrc or by configuring at runtime. Only changes made to ~/.vimrc will persist. If you set runtime options, you need to switch to normal mode (usually hit Esc to exit other modes), and prefix the option with colon (:). Eg. :set showmode to show current operating mode (caveat: normal doesn’t still show anything…) Essential configuration Some basic configuration to make life with vim much nicer. " Show current mode set showmode " Set terminal title to current filename set title " Enable syntax highlighting syntax on " Always show ruler (current row/column etc.) set ruler " Security: Disable modelines set modelines=0 Full example: https://ypcs.fi/misc/code/vim/fullpage/vimrc.txt … essentials, more Some extra tuning for the basics. " Wrap long lines set wrap " Show line numbering set number " Set default encoding set encoding=utf8 " Wait 300ms until triggering plugins after text input stops set updatetime=300 " Modify how backspace works (don't be as restrictive as by default) set backspace=indent,eol,start Pick up where we left off You edit file, close the editor, do some tests maybe, and then decide that you need to modify same code again. What if vim could remember the last place you were in a file? " Return to last edit position when opening files autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif " Remember info about open buffers on close set viminfo^=% " Source: <https://stackoverflow.com/a/23036077> "set viminfo=%,<800,'10,/50,:100,h,f0,n~/.vim/cache/.viminfo " | | | | | | | + viminfo file path " | | | | | | + file marks 0-9,A-Z 0=NOT stored " | | | | | + disable 'hlsearch' loading viminfo " | | | | + command-line history saved " | | | + search history saved " | | + files marks saved " | + lines saved each register (old name for <, vi6.2) " + save/restore buffer list Leader key vim has special key, often denoted as <Leader> in configuration files. You can think this as custom namespace for your own keybindings, ie. some key that you press before actual command key(s). By default this is [, but that’s pretty awful key combination on non-US keyboard. So, let’s remap that to ,. " Map <Leader> key to , (default \), " think this as a custom namespace for keybindings let mapleader="," Indentation Quite often spaces are preferred over tabs, and you’d like to have SOME intelligence in how your editor handles indentation. Yet again, defaults need some tuning. " Convert tabs to spaces set expandtab " Use 4 spaces as default indentation set shiftwidth=4 " Set tabstop to 4 spaces set tabstop=4 " Use same indent as previous line set autoindent " Enable smart indent (syntax/filetype specific) set smartindent " Fix invalid indents (round to nearest) set shiftround Search By default there is no highlighting, search is case-sensitive and you can’t append to current search terms. Let’s change that. " Highlight search terms set hlsearch " Ignore case when searching set ignorecase " ... but if pattern contains uppercase letters, " then consider it case-insensitive set smartcase " Use incremental searching (move the highlight as you " type in new characters to search) set incsearch Abbreviations Good text editor is able to help you write correctly, eg. converts abbreviations to words, and maybe fixes some typos. " Some common terms abbr IANAL I am not a lawyer, but ... abbr AFAIK As far as I know abbr CGI Common Gateway Interface " Fix typos abbr lunix Linux abbr todo TODO " Hackish, but you can e.g define code snippets abbr pyclass class MyClass(object):<CR> def __init__(self, *args, **kwargs):<CR> pass Extras: Unicode emojis You can also misuse some features, eg. to have emojis autocompleted from :markup: using abbr feature. … because why not? " Define some emoji replacements using abbr feature abbr :grinningface: 😀 abbr :grinningfacewithbigeyes: 😃 abbr :grinningfacewithsmilingeyes: 😄 abbr :beamingfacewithsmilingeyes: 😁 abbr :grinningsquintingface: 😆 abbr :grinningfacewithsweat: 😅 abbr :rollingonthefloorlaughing: 🤣 abbr :facewithtearsofjoy: 😂 abbr :slightlysmilingface: 🙂 abbr :upside-downface: 🙃 abbr :winkingface: 😉[...] Show trailing whitespace etc. Sometimes you need to see if there is tabs, trailing whitespace or newlines in our code. Let’s map <Leader>l to show you these characters. " Visualize trailing whitespace, tabs and newlines set listchars=trail:·,tab:▸\ ,eol:¬ " Leader key + l = toggle showing whitespace/tab/newline map <leader>l :set list!<CR> I’m ready, let’s build When you complete your changes, you often like to build… :make build … or just any command :!mycustom_command --with-params Of course these can be also mapped to eg. file save event, autocmd BufWritePost *.py :!ls -lha Look up for a function implementation with ctags Using ctags it’s pretty easy to do code searches in vim. cd $REPOSITORY ctags -R * [../thirdparty/wordpress-core] vim myfile.php Then, using our custom mappings, we create easy mapping for looking up current word in ctags dataset. " ctags: jump to definition of current word with <leader>a nnoremap <leader>a <C-]> Now, while cursor is over some interesting function name, just hit <Leader>a to see the implementation. You can also look for specific function with :tag <searchterm>. Write with sudo You opened a file, did some changes and then realized you don’t have permissions to write that file, you’d need to be root? No problem! :w !sudo tee % ie. write buffer (and pipe) output to sudo tee %, where % points to current filename Miscellaneous Some misc. commands :sort sort selected lines See keymaps :map all :nmap normal mode :imap insert mode :vmap visual mode File explorer :Explore :Vexplore :Sexplore UI: tabs, split screen Yes, vim also supports tabs. :tabedit path/to/file opens a new file in tab :tabnext move to next tab :tabprev move to previous tab :help tab-page-commands for more and you can also split a screen to have multiple buffers visible simultaneously. :vsplit split screen vertically :split path/to/file split screen horizontally, and open a file :help split for more Extend: Plugins, color schemes, … If vim is missing some feature or eg. syntax higlighting support for specific language or filetype, it’s usually available as a plugin. Also, if you don’t like the default colors, there is lots of color schemes/themes available too. Plugins: Install This focuses solely on plugins included in Debian repos, as like any software, you should first asses the security of the software before you install something, and I just don’t have time to. So, let’s use plugins that Debian project has reviewed. Plugins we look here are included in these packages: apt-get install vim-scripts vim-gitgutter vim-airline vim-syntastic In this case we depend on files that are already in the system, so we use symlinks to “install” these to our user. Eg. mkdir -p ~/.vim/plugin ln -s /usr/share/vim-scripts/plugin/{vcscommand,vcsgit}.vim \ ~/.vim/plugin/ Plugins: Version control integration vim-scripts plugins: vcscommand.vim, vcsgit.vim So, you’d like to commit, blame and do other git stuff while editing file? It’s possible. Plugins: GnuPG vim-scripts plugin: gnupg.vim Automatically decrypt/encrypt files using GnuPG when opening/closing a file. No more need to decrypt, open editor, re-encrypt. Plugins: Secure modelines vim-scripts plugin: securemodelines.vim Modelines are vim feature, in which some details about file formatting (indentation etc.) get stored in target file. Modelines look like this: /* vim: set noai ts=4 sw=4: */ and you can quite often find them in source code. Unfortunately, this feature has seen some security issues in the past, and it’s often recommended to disable the default implementation (like we did in config earlier). But, there exists a little bit better implementation called securemodelines, that supports most of the features, but only those deemed secure. Plugin: GitGutter As almost all projects nowadays use git for their version control needs, it’s often desirable to have some support for VCS built in your text editor. For vim one great tool is plugin called GitGutter, which shows status of each line in left side of the window. Also, some fixes to default config… " Always show the sign column, removes some annoying on/off toggling set signcolumn=yes " Remap hunk modifier keys nmap ghn <Plug>(GitGutterNextHunk) nmap ghp <Plug>(GitGutterPrevHunk) nmap ghs <Plug>(GitGutterStageHunk) nmap ghu <Plug>(GitGutterUndoHunk) Syntax checking As no-one writes perfect code 100% of the time, it’s nice to have some helpers for checking your syntax. One nice tool is vim-syntastic, which does syntax checking. " Syntax checks / linting using Syntastic " Use flake8 for checking Python syntax let g:syntastic_python_checkers = ["flake8"] " Use PHP + PHPCS + PHPMD for checking PHP file syntax let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd'] " Update status for syntastic set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 Extras Add some filetype-specific extras (syntax fixes) " Delete trailing white space on save, useful for eg. Python func! DeleteTrailingWS() exe "normal mz" %s/\s\+$//ge exe "normal `z" endfunc autocmd BufWrite *.py :call DeleteTrailingWS() Final words Not everyone needs all these modifications. Your use-case might benefit from other plugins we didn’t describe here. Hopefully this however improved your knowledge, and gave some tips on improving your productivity. What is your most important vim tip?
Linux users, software developers and power users alike spend a lot of time in the command-line prompt. The default Bash shell that ships in most Linux distributions have stayed pretty much unchanged for years and years. We wanted to explore how to improve the every day command-line experience, and eventually came very fond of the […]
Linux users, software developers and power users alike spend a lot of time in the command-line prompt. The default Bash shell that ships in most Linux distributions have stayed pretty much unchanged for years and years. We wanted to explore how to improve the every day command-line experience, and eventually came very fond of the Liquid Prompt, which we recommend all Linux users to check out. Why Liquid Prompt? A lot of developers, in particular Mac users, seem to be using zsh nowadays, and extensions such as oh-my-zsh and powerline. While these look very fancy, the installing zsh with a lot of plugins quickly leads to a messy collection of scripts. At first it can feel cool, but one quickly runs into upgrade and interoperability issues. Also, changing the default shell from bash to zsh has profound effects on how shell scripts behave and the overall experience using SSH and working on multiple hosts can degrade. To cut through the flashy blog posts and marketing fluff we turned to the Debian Developers mailing list asking for thoughtful advice from true command-line professionals. From this advice we learned about the Liquid Prompt, a Bash extension that has been around since 2012 and packaged in since 2016 in Debian (and its derivates, such as Ubuntu). Check out the threads in May, June and July if you want to learn about the other tips shared on the mailing list. Main innovation: progressive disclosure The default prompt in Liquid Prompt is very simple: It shows the username (on this test machine it is ‘vagrant’) and hostname (on this machine it is ‘wordpress’) the path and the prompt sign $. This is basically the same as the default Bash prompt, but with colors, which will be explained later. However, it will automatically expand to tell the user more information when there is something special going on, hence the name ‘liquid’: <img loading="lazy" width="657" height="25" src="https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-more.png" alt="" class="wp-image-4253" srcset="https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-more.png 657w, https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-more-300x11.png 300w, https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-more-540x21.png 540w, https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-more-150x6.png 150w" sizes="(max-width: 657px) 100vw, 657px" /> In the screenshot above, there is now a lot of information available: the 3& tells that there are 3 processes running the in background the 2z tells that there are 2 processes stopped the path is expanded and after it the master tells the git branch name the +2/-0 tells that there are local commits that have not been pushed to the remote the * tells that there are also uncommitted changes the 15s is the unusually long duration of the previous command the 147 is the non-zero exit code from the previous command and the ± as the prompt tells that the directory uses git for version control The next screenshot shows another situation: <img loading="lazy" width="506" height="28" src="https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-another-user.png" alt="" class="wp-image-4254" srcset="https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-another-user.png 506w, https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-another-user-300x17.png 300w, https://linuxnatives.net/wp-content/uploads/2020/09/liquidprompt-another-user-150x8.png 150w" sizes="(max-width: 506px) 100vw, 506px" /> Here the prompt text and colors tells that: the user is now ‘mysql’ the @-character is yellow, which means that there is no X11 forwarding available the hostname ‘wordpress’ is bold and colored, which tells that the prompt is used over SSH the colon : is red as an indication that the current user does not have write permissions to the current path the long path name has been shortened with ... to save space for the prompt This is a great design principle, because extra information is revealed only when it is relevant, and otherwise the prompt stays short and sweet. The fact that Liquid Prompt is an extension to Bash means that there are no custom shell language and all of your Bash scripts work just as they should. There is no right aligned extra stuff that is prone to rendering errors and the whole layout works well in any screen/resolution or screen/tmux use without getting messed up. Liquid Prompt is an interoperable, stable and clean piece of software we can warmly recommend as your new daily tool. To learn about all features, check out Liquid Prompt’s README on Github. Installation Liquid Prompt is available by default in most Linux distributions. On Debian/Ubuntu you can simply run apt install liquidprompt. For each user that wants to activate it run liquidprompt_activate. This command adds to .bashrc the following lines: # Only load liquidprompt in interactive shells, not from a script or from scp echo $- | grep -q i 2>/dev/null && . /usr/share/liquidprompt/liquidprompt The new prompt will be active starting from the next new command-line session a user starts. To also have the laptop battery status and temperature showing, one also needs to have the extra packages acpi and lm-sensors installed. Customize settings It is possible to fine tune how Liquid Prompt works by editing the settings file at ~/.config/liquidpromptrc. While the default settings of Liquid Prompt are mostly fine, the following modifications made it feel a tad more usable: # Show laptop batter level only if below 20% LP_BATTERY_THRESHOLD=20 # Show CPU load only if above 40% LP_LOAD_THRESHOLD=40 # Don't show hostname on localhost LP_HOSTNAME_ALWAYS=0 # Don't show user is it is you LP_USER_ALWAYS=0 # Always show the wall clock at the beginning of the line. LP_ENABLE_TIME=1 # Show duration of previous command only is it was over 10s LP_ENABLE_RUNTIME=10 # Never show laptop temperature LP_ENABLE_TEMP=0 # Always enable colors if accessed via SSH LP_ENABLE_SSH_COLORS=1 With the settings above the default prompt will look as: Additionally you might want to make these additions to your .bashrc file: # Ensure Gnome Terminal shows the prompt correctly PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' PROMPT_COMMAND="history -a; history -c; history -r;$PROMPT_COMMAND" # This existing block should come after the lines above if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033> else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi Extra tip: make use of a bigger bash history, the Liquid Prompt compatible way # Store run time in .bash_history history HISTTIMEFORMAT="[%F %T] " # Collect very long history, disk space is cheap HISTSIZE=10000000 HISTFILESIZE=10000000 # Append each command to history, don't overwrite shopt -s histappend # Append each command to history immediately after it ran, dont' wait until the session ends PROMPT_COMMAND="history -a; history -c; history -r;$PROMPT_COMMAND" # Ignore duplicates and commands that started with a space character HISTCONTROL=ignoredups:ignorespace Want to find more hidden gems? While doing research on this topic we came across a great Youtube video series by Jonathan Carter (highvoltage): Debian Package of the Day and in particular the Week of Terminal Emulators in episodes 46–51.
Step-by-step instructions on how to clean your keyboard.
You wake up and the sun is shining. Everything is great and you sit down at your desk, ready to join the first video call of the day. And then – OOPS! You spill your breakfast smoothie over your keyboard. Does this sound familiar? If you’ve ever encountered a situation such as the one described above and didn’t know how to act, after this post you will. We’ve written here easy to follow, step-by-step instructions on how to clean your keyboard. Steps for salvaging the situation Turn off your device and place it upside down and wait for the liquid to drain. Turn the device around and clean away all visible traces of the liquid. Take a photo of your keyboard for future reference. Find a flat but sturdy tool, that can be inserted under the keycap. A flat-headed screwdriver is an option, but it might scratch the device and its components. Use a plastic tool, if possible. Some keyboards require the keys to be removed from the top, some from the bottom. Insert the tool under the keycap and gently apply upward pressure by pressing the tool. Continue to do so until you hear a snap and the keycap comes off. Remove also the small plastic parts underneath. Notice: If there is unusual resistance when detaching a key, stop! The keys might require a different method for removal.<img loading="lazy" width="3543" height="1994" class="wp-image-4037" style="width: 500px;" src="https://linuxnatives.net/wp-content/uploads/2020/06/keyboard-dirty-1-e1591012729255.jpg" alt="" srcset="https://linuxnatives.net/wp-content/uploads/2020/06/keyboard-dirty-1-e1591012729255.jpg 3543w, https://linuxnatives.net/wp-content/uploads/2020/06/keyboard-dirty-1-e1591012729255-150x84.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/06/keyboard-dirty-1-e1591012729255-300x169.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/06/keyboard-dirty-1-e1591012729255-768x432.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/06/keyboard-dirty-1-e1591012729255-540x304.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/06/keyboard-dirty-1-e1591012729255-600x338.jpg 600w" sizes="(max-width: 3543px) 100vw, 3543px" /> Place all the plastic parts in a bowl of warm water with mild detergent, such as dishwasher soap. Let them soak for a while to allow the dirt to come off. <img loading="lazy" width="3308" height="2160" class="wp-image-3987" style="width: 500px;" src="https://linuxnatives.net/wp-content/uploads/2020/05/keys-washing-e1591010955634.jpg" alt="" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/keys-washing-e1591010955634.jpg 3308w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-washing-e1591010955634-150x98.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-washing-e1591010955634-300x196.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-washing-e1591010955634-768x501.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-washing-e1591010955634-540x353.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-washing-e1591010955634-600x392.jpg 600w" sizes="(max-width: 3308px) 100vw, 3308px" /> Rinse and repeat until all the plastic parts look clean. If the parts are extra dirty, use fingertips to rub off the dirt. Notice: Be careful not to rinse the plastic parts down the drain. Place the plastic parts on a paper towel and let them dry.<img loading="lazy" width="3840" height="2160" class="wp-image-3984" style="width: 500px;" src="https://linuxnatives.net/wp-content/uploads/2020/05/keys-drying.jpg" alt="" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/keys-drying.jpg 3840w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-drying-150x84.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-drying-300x169.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-drying-768x432.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-drying-540x304.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-drying-600x338.jpg 600w" sizes="(max-width: 3840px) 100vw, 3840px" /> Cleaning the bare keyboard While the plastic parts are drying, clean rest of the keyboard. You will need two clean cloths (preferably microfiber) and cotton swabs. The cloth used for cleaning should be damp. You can use either water or isopropyl alcohol. Alcohol evaporates quickly and is less likely to leave any moisture around. Cotton swabs are great for hard to reach areas. Finish the cleaning with a dry cloth. <img loading="lazy" src="https://linuxnatives.net/wp-content/uploads/2020/05/keys-cleaned-one-by-one-540x960.jpg" alt="" class="wp-image-3982" width="270" height="480" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/keys-cleaned-one-by-one-540x960.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-cleaned-one-by-one-84x150.jpg 84w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-cleaned-one-by-one-169x300.jpg 169w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-cleaned-one-by-one-768x1365.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/05/keys-cleaned-one-by-one-600x1067.jpg 600w" sizes="(max-width: 270px) 100vw, 270px" /> Use a cotton swab to wipe the dirt away. Reassembly Once everything has dried up, you can start reassembling the keyboard. Now is a good time to look at that photo you took in the beginning. If for some reason you didn’t take a photo or you lost it, no worries – Youtube and Google are your friends. When reassembling a key, do not use excessive force. It should easily snap in place and once so, test that it feels correct. If not, disassemble and reassemble until it does. When done, the keyboard should look just like new. Issue fixed! <img loading="lazy" width="540" height="304" src="https://linuxnatives.net/wp-content/uploads/2020/05/keyboard-complete-540x304.jpg" alt="" class="wp-image-3978" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/keyboard-complete-540x304.jpg 540w, https://linuxnatives.net/wp-content/uploads/2020/05/keyboard-complete-150x84.jpg 150w, https://linuxnatives.net/wp-content/uploads/2020/05/keyboard-complete-300x169.jpg 300w, https://linuxnatives.net/wp-content/uploads/2020/05/keyboard-complete-768x432.jpg 768w, https://linuxnatives.net/wp-content/uploads/2020/05/keyboard-complete-600x338.jpg 600w" sizes="(max-width: 540px) 100vw, 540px" /> Done! Maintenance in the future Cleaning your keyboard every once in a while is a good practice to keep it working properly. Dust, grease and crumbs can easily get under the keycaps and potentially harm the device. A thorough clean-up takes about an hour, but it ensures that your keyboard will be in the best working condition. If you want to try and speed up the process, use compressed air to blow out any loose dirt.
Improve your security with two-factor authentication
Two-factor authentication (or simply 2FA) is a way of authentication where a user must provide additional verification after username and password login. The form of verification can be a string of characters delivered via text message or generated with TOTP client. Two-factor authentication improves security because compromised username and password are not enough to get […]
Two-factor authentication (or simply 2FA) is a way of authentication where a user must provide additional verification after username and password login. The form of verification can be a string of characters delivered via text message or generated with TOTP client. Two-factor authentication improves security because compromised username and password are not enough to get the account breached. This article will explain how to use TOTP clients for two-factor authentication and why TOTP is better than many other two-factor methods. As an example, I will show how to enable and set up TOTP client Google Authenticator in Google’s services. What is TOTP? TOTP is a Time-based One-Time Password algorithm, and it can be used in two-factor authentication instead of SMS or paper list verification codes. TOTP client generates periodically a new code that can be used to verify the login. TOTP is based on cryptographic functions. When enabling TOTP, the service gives a shared secret that is entered to the client, either by scanning a QR code or writing it in text. Cryptographic functions use this shared secret and current time to generate codes to verify the login. The code generation also works without connection to the internet. The TOTP client on a smartphone is safer than many other two-factor authentication methods, like codes sent via SMS or email. Getting hold of someone’s SMS is somewhat troublesome but still possible. An email account can also be compromised – especially if the password is also used in other places. It’s a good idea to backup all the shared secrets that are used to generate TOTP codes. Either in text format or as a screenshot from the QR code. That way, you don’t get locked out from your accounts even if your phone gets lost. Backups of TOTP shared secrets should be stored with the same carefulness as passwords because anyone that receives the shared secrets can generate the same codes. All services don’t provide the shared secret in a text format, which should be considered when choosing a backup method. Google Authenticator is a popular and user-friendly TOTP client, but it doesn’t have functionality for backups. User needs to take care of backing up the shared secrets someplace else when adding them in the client. The client has import and export functionality, but it’s suitable only for transferring the data from an old phone to a new one. The old phone generates a QR code for the transfer, but if taking a screenshot is disabled, that can’t be easily utilized as a backup. Google Authenticator is available for Android and iOS. There are also other TOTP clients, for example, Authy, Duo Mobile, FreeOTP, and andOTP. Authy and Duo Mobile have a cloud backup feature. FreeOTP has no backup functionality, but andOTP allows exporting shared secrets in JSON format (plain-text or encrypted) and storing to your place of choice. Preparing Google account for 2FA Next, I will show you how to enable two-factor authentication in Google services. After that, we will install Google Authenticator and enable 2FA with Google account. In this guide, I will log in to a Google account with a desktop browser, which is very similar to how the process works for other services. Login to your Google Account and proceed in the menu to Security> Signing into Google > 2-step verification. If two-step verification is enabled on your Google account, you should already see an option for Google Authenticator on this page, and you can continue to the next part of this article (Installing Google Authenticator). Otherwise, continue this part. Google has now opened a window where is introduced two-step verification. You can read it through and then click forward. <img loading="lazy" width="540" height="541" src="https://linuxnatives.net/wp-content/uploads/2020/05/google-setup-540x541.png" alt="" class="wp-image-3948" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google-setup-540x541.png 540w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup-150x150.png 150w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup-300x300.png 300w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup-600x601.png 600w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup.png 679w" sizes="(max-width: 540px) 100vw, 540px" /> On the next page, you need to select the phone you would like to use. If you can’t see your preferred phone there you need to add the Google account in question to your preferred phone: Android: Go Settings > Accounts > Add account. Choose Google and log in. iOS: Install Google app and login with your Google account. Google doesn’t let you choose Google Authenticator right away. First, you need to enable some other way of two-step verification: Google Prompts (default), security key, text message, or a phone call. Google Prompts is a window that will open on your phone and let you select yes or no. Keep the default, and move forward. <img loading="lazy" width="540" height="599" src="https://linuxnatives.net/wp-content/uploads/2020/05/google-setup4-540x599.png" alt="" class="wp-image-3949" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google-setup4-540x599.png 540w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup4-135x150.png 135w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup4-270x300.png 270w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup4-600x666.png 600w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup4.png 612w" sizes="(max-width: 540px) 100vw, 540px" /> Select “yes” in the prompt when it on your phone. After that, you still need to set a backup option for getting verification codes. You can add a secondary phone number to get into your account even if your phone is lost. You can use your primary phone number here if you promise to back up the shared secret, which we will get to later. Select the text message or a call and write the code you get to the window that opens after pressing “send.” Text messages can sometimes take a long time to arrive, and a phone call could be faster (in this alternative, a robot voice reads you the code). <img loading="lazy" width="540" height="568" src="https://linuxnatives.net/wp-content/uploads/2020/05/google-setup5-1-540x568.png" alt="" class="wp-image-3950" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google-setup5-1-540x568.png 540w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup5-1-143x150.png 143w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup5-1-285x300.png 285w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup5-1-600x632.png 600w, https://linuxnatives.net/wp-content/uploads/2020/05/google-setup5-1.png 608w" sizes="(max-width: 540px) 100vw, 540px" /> After that one more time is asked if you want to enable 2-step verification. Select yes and continue. Installing Google Authenticator Installing Google Authenticator to a smartphone is straightforward. It can be installed just like any other app from the app store. The app is free and will also work offline after the installation. When opening the app the first time, it will show you a few introduction slides. Browse through them and press forward. Then you will see the following view where accounts (shared secrets) can be added to the app. Google Authenticator is now installed, and it’s ready to receive shared secrets. Leave your phone wait in this view. <img loading="lazy" width="540" height="584" src="https://linuxnatives.net/wp-content/uploads/2020/05/goog_auth_add_account-540x584.png" alt="" class="wp-image-3952" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/goog_auth_add_account-540x584.png 540w, https://linuxnatives.net/wp-content/uploads/2020/05/goog_auth_add_account-139x150.png 139w, https://linuxnatives.net/wp-content/uploads/2020/05/goog_auth_add_account-278x300.png 278w, https://linuxnatives.net/wp-content/uploads/2020/05/goog_auth_add_account-600x648.png 600w, https://linuxnatives.net/wp-content/uploads/2020/05/goog_auth_add_account.png 720w" sizes="(max-width: 540px) 100vw, 540px" /> Your desktop browser should now be in Google account’s page 2-step verification (if not, go to Security > Signing into Google > 2-step verification). Roll down until you see the Authenticator app and press “set up.” In the opening window you can choose your phone’s OS: <img loading="lazy" width="475" height="494" src="https://linuxnatives.net/wp-content/uploads/2020/05/google2.png" alt="" class="wp-image-3955" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google2.png 475w, https://linuxnatives.net/wp-content/uploads/2020/05/google2-144x150.png 144w, https://linuxnatives.net/wp-content/uploads/2020/05/google2-288x300.png 288w" sizes="(max-width: 475px) 100vw, 475px" /> After this, a window opens where you can scan the QR code. Choose the option “scan a barcode” on your phone and scan the code. <img loading="lazy" width="478" height="563" src="https://linuxnatives.net/wp-content/uploads/2020/05/google3.png" alt="" class="wp-image-3957" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google3.png 478w, https://linuxnatives.net/wp-content/uploads/2020/05/google3-127x150.png 127w, https://linuxnatives.net/wp-content/uploads/2020/05/google3-255x300.png 255w" sizes="(max-width: 478px) 100vw, 478px" /> After scanning, you can press the link “Can’t scan it?” to get the shared secret in text format for backup purposes. After the scan, your Google Authenticator should look something like this: <img loading="lazy" width="540" height="646" src="https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-1-540x646.png" alt="" class="wp-image-3958" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-1-540x646.png 540w, https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-1-125x150.png 125w, https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-1-251x300.png 251w, https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-1-600x718.png 600w, https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-1.png 720w" sizes="(max-width: 540px) 100vw, 540px" /> On the right side of the code, you can see a diminishing pie icon, which indicates how long the current code is valid. A new code is generated every 30 seconds by default. After this, proceed in the browser window and click next. The next page asks you to insert a verification code. Write the code you see in the app and hit verify before a new code is generated. <img loading="lazy" width="478" height="437" src="https://linuxnatives.net/wp-content/uploads/2020/05/google4.png" alt="" class="wp-image-3959" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google4.png 478w, https://linuxnatives.net/wp-content/uploads/2020/05/google4-150x137.png 150w, https://linuxnatives.net/wp-content/uploads/2020/05/google4-300x274.png 300w" sizes="(max-width: 478px) 100vw, 478px" /> After this, Google Authenticator has been successfully enabled. <img loading="lazy" width="478" height="437" src="https://linuxnatives.net/wp-content/uploads/2020/05/google5.png" alt="" class="wp-image-3961" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google5.png 478w, https://linuxnatives.net/wp-content/uploads/2020/05/google5-150x137.png 150w, https://linuxnatives.net/wp-content/uploads/2020/05/google5-300x274.png 300w" sizes="(max-width: 478px) 100vw, 478px" /> From now on, Google will ask a verification code when you log in to Google. Just opening the app on your phone is enough, and you can see the code. Other accounts can be added to the app from the plus sign button in the bottom right. <img loading="lazy" width="540" height="692" src="https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-3-540x692.png" alt="" class="wp-image-3962" srcset="https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-3-540x692.png 540w, https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-3-117x150.png 117w, https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-3-234x300.png 234w, https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-3-600x769.png 600w, https://linuxnatives.net/wp-content/uploads/2020/05/google_authenticator_account_added-3.png 720w" sizes="(max-width: 540px) 100vw, 540px" /> Please note that if you want to disable two-factor authentication, you must first disable it from Google’s settings (or whichever service is in question). Just removing the Google Authenticator or the shared secret does not disable two-factor authentication. You might only end up locking yourself out from your account. You have now significantly improved the security of your Google account. Next, you should check which other services that you use offer two-factor authentication.
Magic wormhole – easiest way to transfer a file across the Internet
Transferring files between two computers on the Internet is as old of a problem as the Internet itself, and surprisingly hard. Sending an attachment over e-mail involves all kind of hassles and does not work for big files. Having both the sending and receiving part sign up for Dropbox or a similar service, or setting […]
Transferring files between two computers on the Internet is as old of a problem as the Internet itself, and surprisingly hard. Sending an attachment over e-mail involves all kind of hassles and does not work for big files. Having both the sending and receiving part sign up for Dropbox or a similar service, or setting up your own Nextcloud server requires unreasonably much work if you simply want to transfer just one file from one computer to another. Luckily we live now in 2020, and there is a solution: the Magic Wormhole, an open source software in Python by Brian Warner. All you need to do is install it on both computers (e.g. apt install magic-wormhole) and run it. No user account or any other setup is required. It works across any networks, no need to have public IP addresses or anything. To send a file, simply run wormhole send and the file name. To receive a file, just run wormhole receive, and enter the key phrase that given by the sending party. Screenshot from sending party: $ wormhole send Maperitive-1000.zip Sending 3.7 MB file named 'Maperitive-1000.zip' On the other computer, please run: wormhole receive Wormhole code is: 7-virginia-drumbeat Sending (->relay:tcp:magic-wormhole-transit.debian.net:4001).. 100%|████████████████████| 3.75M/3.75M [00:01<00:00, 2.74MB/s] File sent.. waiting for confirmation Confirmation received. Transfer complete. Screenshot from receiving party: $ wormhole receive Enter receive wormhole code: 7-virginia-drumbeat (note: you can use <Tab> to complete words) Receiving file (3.7 MB) into: Maperitive-1000.zip ok? (y/N): y Receiving (->relay:tcp:magic-wormhole-transit.debian.net:4001).. 100%|████████████████████| 3.75M/3.75M [00:02<00:00, 1.81MB/s] Received file written to Maperitive-1000.zip Simple and brilliant!
Align user IDs inside and outside Docker with subuser mapping
While Docker is quite handy in many ways, one inconvenient aspect is that if one mounts some host machine directory inside Docker, and the Docker image does something to those files as a non-root user, one will run into problems if the UID of the host machine user and the Docker image user do not […]
While Docker is quite handy in many ways, one inconvenient aspect is that if one mounts some host machine directory inside Docker, and the Docker image does something to those files as a non-root user, one will run into problems if the UID of the host machine user and the Docker image user do not match. Consider this scenario: I my user ‘otto’ is running on the host machine as UID 1001. Then I spin up a development image with Docker where I do development and store files in a locally mounted directory. Inside there is a temporary Docker user called ‘vagrant’ with the UID 1000. Now whenever any files are updated (say via composer update for example) it will fail to work, as the mounted directory is owned by UID 1001 and the Docker image user with UID 1000 will not be able to write anything. Docker run –user does not help If one has complete control of the Docker image, one could modify the UID of the Docker user and rebuild. Most of the time that is however not an option. Docker run has the option --user but that does not help if the Docker image already has created the user with a particular name and UID/GID settings. Subuser and subgroup mapping to the rescue To use subuser and subgroup mapping, first enable the feature in Docker by editing the /etc/docker/daemon.json config file to include: { "userns-remap": "otto" } Naturally, replace ‘otto’ with your own username. For changes to take effect, restart Docker with sudo systemctl restart docker and check with sudo systemctl status docker that is restarted wihtout failures and is running. To instruct the mapping, edit the files /etc/subuid (for user IDs) and /etc/subgid (for group IDs). In the case above, I mapped users 0-1000 to have the same UID/GID both inside and outside Docker. I want for root to have UID 0 all the time. However the user IDs should start from 1001 and not from 1000. This way the most common UID inside the Docker container 1000 will match my own laptop UID 1001 of my user. otto:0:1000 otto:1001:65536 Voila! Read more Original idea by https://ilya-bystrov.github.io/posts/docker-daemon-remapping/ Details at http://man7.org/linux/man-pages/man5/subuid.5.html and https://echorand.me/posts/docker-user-namespacing-remap-system-user/
Partition like a pro with fdisk, sfdisk and cfdisk
Most Linux distributions ship the hard drive partition tool fdisk by default. Knowing how to use it is a good skill for every Linux system administrator since having to rescue a system that has disk issues is a very common task. If the admin is faced with a prompt in a rescue mode boot, often […]
Most Linux distributions ship the hard drive partition tool fdisk by default. Knowing how to use it is a good skill for every Linux system administrator since having to rescue a system that has disk issues is a very common task. If the admin is faced with a prompt in a rescue mode boot, often fdisk is the only partitioning tool available and must be used, since if the main root filesystem is broken, one cannot install and use any other partitioning tools. When installing Debian based systems (e.g. Ubuntu) in the text mode server installer, keep in mind that you can at any time during the installation process press Ctrl+Alt+F2 to jump to a text console running a limited shell prompt (Busybox) and manipulate the systems as you wish, among others run fdisk. When done press Ctrl+Alt+F1 to jump back to the installer screen. In fact, fdisk is not a single utility but actually a tool that ships with three commands together: fdisk, sfdisk and cfdisk. fdisk Most Linux sysadmins have at some point used fdisk, the classic partitioning tool. There is also a tool with the same name in Windows, but its not the same tool. Across the Unix ecosystem the fdisk tool is however nowadays the same one, even on MacOS X. To list the current partition layout one can simply run fdisk -l /dev/sda. Below is an example of the output. One can also run fdisk -l /dev/sd* to print the partition info of all sd devices in one go. The fdisk man page lists all the command line parameters available. <img loading="lazy" width="540" height="204" src="https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-list-540x204.png" alt="" class="wp-image-3869" srcset="https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-list-540x204.png 540w, https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-list-150x57.png 150w, https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-list-300x113.png 300w, https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-list-600x226.png 600w, https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-list.png 676w" sizes="(max-width: 540px) 100vw, 540px" /> Example output of fdisk -l If one runs just fdisk it will launch in interactive mode. Pressing m will show the help. To create a new GPT (for modern disk) partition table (resetting any existing partition table) and add a new Linux partition that uses all available disk space one can simply enter the commands g, n and w in sequence and pressing enter to all questions to accept them at their default values. <img loading="lazy" src="https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-help.png" alt="" class="wp-image-3870" width="363" height="372" srcset="https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-help.png 483w, https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-help-146x150.png 146w, https://linuxnatives.net/wp-content/uploads/2019/05/fdisk-help-293x300.png 293w" sizes="(max-width: 363px) 100vw, 363px" /> In-command help in fdisk, printed when pressing m cfdisk The command cfdisk servers the same purpose as fdisk with the difference that it provides a slightly fancier user interface based on ncurses so there are menus one can browse with arrows and the tab button without having to remember the single letter commands fdisk uses. <img loading="lazy" width="540" height="318" src="https://linuxnatives.net/wp-content/uploads/2019/05/cfdisk-540x318.png" alt="" class="wp-image-3871" srcset="https://linuxnatives.net/wp-content/uploads/2019/05/cfdisk-540x318.png 540w, https://linuxnatives.net/wp-content/uploads/2019/05/cfdisk-150x88.png 150w, https://linuxnatives.net/wp-content/uploads/2019/05/cfdisk-300x177.png 300w, https://linuxnatives.net/wp-content/uploads/2019/05/cfdisk-768x452.png 768w, https://linuxnatives.net/wp-content/uploads/2019/05/cfdisk-600x353.png 600w, https://linuxnatives.net/wp-content/uploads/2019/05/cfdisk.png 778w" sizes="(max-width: 540px) 100vw, 540px" /> Screenshot of cfdisk sfdisk The third tool in the suite is sfdisk. This tool is designed to be scripted, enabling administrators to script and automate partitioning operations. The key to sfdisk operations is to first dump the current layout using the -d argument, for example sfdisk -d /dev/sda > partition-table. An example output would be: $ cat partition-table label: gpt label-id: AF7B83C8-CE8D-463D-99BF-E654A68746DD device: /dev/sda unit: sectors first-lba: 34 last-lba: 937703054 /dev/sda1 : start= 2048, size= 997376, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=F35A875F-1A53-493E-85D4-870A7A749872 /dev/sda2 : start= 999424, size= 936701952, type=A19D880F-05FC-4D3B-A006-743F0F84911E, uuid=725EAB2A-F2E2-475E-81DC-9A5E18E29678 This text file describes the partition type, the layout and also includes the device UUIDs. The file above can be considered a backup of the /dev/sda partition table. If something has gone wrong with the partition table and this file was saved at some earlier time, one can recover the partition table by running: sfdisk /dev/sda < partition-table. Copying the partition table to multiple disks One neat application of sfdisk is that it can be used to copy the partition layout to many devices. Say you have a big server computer with 16 hard disks. Once you have partitioned the first disk, you can dump the partition table of the first disk with sfdisk -d and then edit the dump file (remember, it is just a plain-text file) to remove references to the device name and UUID’s, which are unique to a specific device and not something you want to clone to other disks. If the initial dump was the example above, the version with unique identifiers removed would look like this: label: gpt unit: sectors first-lba: 34 last-lba: 937703054 start= 2048, size= 997376, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 start= 999424, size= 936701952, type=A19D880F-05FC-4D3B-A006-743F0F84911E This can applied to the another disk, for example /dev/sdb simply by running sfdisk /dev/sdb < partition-table. Now all the admin needs to do is run this same command a couple of times with only the one character changed on each invocation. Listing device UUID’s with blkid Keep in mind that the Linux kernel uses the device UUIDs for indentifying partitions and file systems. Be vary not to accidentally make two disks have the same UUID with sfdisk. Technically it is possible, and maybe useful in some situation where one wants to replace a hard drive and make the new hard drive 100% identical, but in a running system different disks should all have unique UUIDs. To list all UUIDs use blkid. Below is an example of the output: $ blkid /dev/sda1: UUID="F379-8147" TYPE="vfat" PARTUUID="f35a875f-1a53-493e-85d4-870a7a749872" /dev/sda2: UUID="5f12f800-1d8d-6192-0881-966a70daa16f" UUID_SUB="2d667c5b-b9f3-6510-cf76-9231122533ce" LABEL="fi-e3:0" TYPE="linux_raid_member" PARTUUID="725eab2a-f2e2-475e-81dc-9a5e18e29678" /dev/sdb2: UUID="5f12f800-1d8d-6192-0881-966a70daa16f" UUID_SUB="0221fce5-2762-4b06-2d72-4f4f43310ba0" LABEL="fi-e3:0" TYPE="linux_raid_member" PARTUUID="cd2a477f-0b99-4dfc-baa6-f8ebb302cbbb" /dev/md0: UUID="dcSgSA-m8WA-IcEG-l29Q-W6ti-6tRO-v7MGr1" TYPE="LVM2_member" /dev/mapper/ssd-ssd--swap: UUID="2f2a93bd-f532-4a6d-bfa4-fcb96fb71449" TYPE="swap" /dev/mapper/ssd-ssd--root: UUID="660ce473-5ad7-4be9-a834-4f3d3dfc33c3" TYPE="ext4" Extra tip: listing all disk with lsblk While fdisk -l is nice for listing partition tables, often admins also want to know the partition sizes in human readable formats and what the partitions are used for. For this purpose the command lsblk is handy. While the default output is often enough, supplying the extra arguments -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINTmakes it even better. See below an example of the output: $ lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT NAME SIZE FSTYPE TYPE MOUNTPOINT sda 447,1G disk ├─sda1 487M vfat part /boot/efi └─sda2 446,7G linux_raid_member part └─md0 446,5G LVM2_member raid1 ├─ssd-ssd--swap 8,8G swap lvm [SWAP] └─ssd-ssd--root 437,7G ext4 lvm / sdb 447,1G disk ├─sdb1 487M part └─sdb2 446,7G linux_raid_member part └─md0 446,5G LVM2_member raid1 ├─ssd-ssd--swap 8,8G swap lvm [SWAP] └─ssd-ssd--root 437,7G ext4 lvm / sdc 447,1G disk ├─sdc1 487M part └─sdc2 446,7G part A word of warning… Remember that modifying the partition table is a destructive process. It is something the admin does while installing new systems or recovering broken ones. If done wrongly, all data might be lost!
A couple years back we wrote a guide on how to create good OpenPGP/GnuPG keys and now it is time to write a guide on SSH keys for much of the same reasons: SSH key algorithms have evolved in past years and the keys generated by the default OpenSSH settings a few years ago are […]
A couple years back we wrote a guide on how to create good OpenPGP/GnuPG keys and now it is time to write a guide on SSH keys for much of the same reasons: SSH key algorithms have evolved in past years and the keys generated by the default OpenSSH settings a few years ago are no longer considered state-of-the-art. This guide is intended both for those completely new to SSH and to those who have already been using it for years and who want to make sure they are following the latest best practices. Use OpenSSH 7 or later Related to SSH keys there have been some relevant changes in versions 5.7, 6.5 and 7.0. Latest version is 7.9. You should be running at least 7.0. Current Debian stable (“Stretch”) shipped version 7.4 and for example Ubuntu 16.04 (“Xenial”) shipped 7.2, so nobody should be running on their laptop any later versions than these. Generate Ed25519 keys With a recent version of OpenSSH, simply run ssh-keygen -t ed25519. This will create a private and public key pair files at .ssh/id_ed25519 (and .pub) using the Ed25519 algorithm, which is considered state of the art. Elliptic curve algorithms in general are sleek and efficient and unlike the other well known elliptic curve algorithm ECDSA, this Ed25519 does not depend on any suspicious NIST defined constants. If you encounter a server that is very old and does not support Ed25519 keys, you might need to have a more traditinal RSA keypair. A strong 4k RSA key pair can be generated with ssh-keygen -b 4096. Hopefully you won’t need to ever do that. Running ssh-keygen will prompt for a password. If your laptop is encrypted and well protected you can omit the password and gain some speed and convenience in your SSH commands. Store the private key securely Hopefully your laptop is well protected with full disk encryption etc and you can trust that nobody else than yourself has access to your /home/<username>/.ssh directory. Hopefully you also have securely stored encrypted backups of your laptop so that you can recover the .ssh directory if your laptop for any reason is lost or broken. The SSH keyfiles are stored as armored ASCII, which means that you could even print them on paper and store the printed key in a real vault just to be extra sure you never loose your private key (.ssh/id_ed25519). The public key is indeed designed to be public The public key .ssh/id_ed25519.pubon the other hand is meant to be public. Here is mine for example: ~/.ssh$ cat id_ed25519.pub ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMdBlrVoDupARk3pd1Q9sDImaGCxEalcFt7QTqBa36kH otto@XPS-13-9370 You can find a lot of public SSH keys for example on Github using the URL https://github.com/<username>.keys. You may also want to check out the excellent Github SSH usage docs. This public key is the one you will distribute to remote servers. Place them on the remote server in the .ssh/authorized_keys file. The servers you try to access will use the public key to create a challenge, and only your laptop that has the private key pair can solve that challenge, and thus authenticate that your connection to the server is authorized. On Linux machines a shorthand to copy your SSH key to a remote server is to run ssh-copy-id remote.example.com. This will ask for a password on the first time, but once the key is in place, a SSH keys will be used instead and no password is asked anymore. Best practices Once you are familiar with SSH key usage basics, please adopt these policies: Disable password authentication on the SSH servers you control altogether. The less there are passwords, the less there as ones that can leak or be forgotten etc. For passwords less is indeed more. Only use keys for authentication on SSH connections. Use a separate key per client you SSH from. So don’t copy the private key from your laptop to another laptop for use in parallel. Each client system should have only one key, so in case a key leaks, you know which client system was compromised. If you stop using your old laptop and start using a new one it is naturally another case and then you can copy the key. Avoid chaining SSH connections. Any system that is used for chaining SSH connections incurs a potential man-in-the-middle situation. For the same reasons try to avoid X11 forwarding and agent forwarding. Consider putting these in your .ssh/config: Host * ForwardX11 no ForwardAgent no Using ProxyCommand You shouldn’t forward SSH agent (ssh -A), but it’s ok to use ProxyCommand or ProxyJump. You can permanently configure it in your .ssh/config like this: Host backend.example.com Hostname 1.2.3.4. Port 23 ProxyCommand ssh bastion.example.com -W %h:%p Stay vigilant If running ssh remote.example.comyields some error messages, don’t ignore them! SSH has an opportunistic key model, which is convenient, but it also means that if you are confronted with warnings that the connection might be eavesdropped you should really take note and not proceed.
Back in 2012 we blogged about Meego/Mer/Nemo, Android for x86 and other Linux operating systems for touchscreens and tablets. Back in the day we also compared Ubuntu Unity vs. Gnome 3 and which would work better as a touch operated system, and Gnome 3 was clearly the more mature system. Since then Ubuntu has dropped Unity […]
Back in 2012 we blogged about Meego/Mer/Nemo, Android for x86 and other Linux operating systems for touchscreens and tablets. Back in the day we also compared Ubuntu Unity vs. Gnome 3 and which would work better as a touch operated system, and Gnome 3 was clearly the more mature system. Since then Ubuntu has dropped Unity and migrated to Gnome 3, and many other parts of the software ecosystem have matured as well, so we decided to take Ubuntu on a tablet for another spin. Ubuntu 18.04 LTS on the ExoPC (WeTab) – easy to install! The ExoPC is a tablet device from Intel with regular Intel Atom x86 processor, 2 GB RAM, a 64 GB SSD, 2 USB ports, touch screen etc. Not a high-end tablet by today’s specs, but it was pretty nice back in 2013 when it came out. It is still a decent piece of hardware, and not the least because all of the device drivers for it can be found in the mainline Linux kernel and therefore Ubuntu 18.04 installed on it works fully out-of-the-box as expected. Installation is easy. Just boot the tablet with a USB installation drive inserted, and during the boot press the “BBS” icon and start the installation and the rest is familiar to anybody who has installed Ubuntu before. An external keyboard connected via USB is helpful during the process though. All of the hardware is detected as one would expect. WLAN works, camera works, sound, microphone and everything else we tested works. Even the rotation sensor works and the screen turns around as the tablet physically rotates. Since the tablet is very old, the experience is a bit sluggish though. Touch screen functionality The basic Gnome 3 desktop that Ubuntu 18.04 comes with works fairly well on a touch device. Naturally many of the apps don’t work that well as they have been designed for desktop/laptop use, but you can manage it. For example connecting to a wifi is easy – just tap on the system settings in the top right corner, select wireless network, enter the password using the on-screen-keyboard and there you go. To play Aisleriot just click on the apps icon in the lower left corner, scroll to the game icon and tap it to launch. Playing cards using your finger works well, but for example playing Mines is impossible since there is not secondary mouse button gesture to tap on a mine. Some parts of the UI are adapted to react to long-tap by popping up a menu, just like a right-click would do, but long-tap is not a built-in feature into all of Ubuntu/Gnome. Why not just use Android? Nowadays Android tablets are very capable and dirty cheap. So why waste time on exploring options? Most Android tablets are consumer devices. That means that the seller makes their money purely on the hardware as a one-off deal. The manufacturer is unlikely to provide software updates for more than 1-2 years, and even for that time just minimally. In a professional setting one would need to be able to have the same line of devices for multiple years, have security updates ensured, backups, management, multi-user capabilities etc. With a real Linux distribution (e.g. Debian, Ubuntu, RedHat, SUSE etc) you get all of these “corporate” features. Using Ubuntu 18.04 you are guaranteed to have security updates until 2023. With a real Linux system you can run rsync+rdiff-backup on the /home directory to make backups via SSH automatically to a secure location, and if you device breaks down it is easy to re-install a clean device. With Android each version has its vendor-specific quirks and as you mostly don’t get root access to the devices at all, which makes the management of these devices often cumbersome and unreliable. Being able to control the operating system and contents of the computer can be very important in a corporate setting. Say you build a fleet management system and have a tablet installed in 500 trucks. Having a stable and dependable device and software strategy for 5–10 years will be much more achievable using real Linux systems instead of Android. As a consumer or hobbyist you might also want to have control. With a real Linux distribution on your tablet you can manage it just like you manage your laptops and workstations. <img loading="lazy" width="1744" height="981" src="/wp-content/uploads/2018/12/ubuntu-tablet-exopc.jpg" alt="" class="wp-image-3730" srcset="https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-tablet-exopc.jpg 1744w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-tablet-exopc-150x84.jpg 150w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-tablet-exopc-300x169.jpg 300w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-tablet-exopc-768x432.jpg 768w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-tablet-exopc-540x304.jpg 540w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-tablet-exopc-600x338.jpg 600w" sizes="(max-width: 1744px) 100vw, 1744px" /> The ExoPC tablet <img loading="lazy" width="1366" height="768" src="/wp-content/uploads/2018/12/ubuntu-on-tablet-desktop.png" alt="" class="wp-image-3732" srcset="https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-desktop.png 1366w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-desktop-150x84.png 150w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-desktop-300x169.png 300w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-desktop-768x432.png 768w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-desktop-540x304.png 540w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-desktop-600x337.png 600w" sizes="(max-width: 1366px) 100vw, 1366px" /> Ubuntu 18.04 on a tablet <img loading="lazy" width="1366" height="768" src="/wp-content/uploads/2018/12/ubuntu-on-tablet-apps.png" alt="" class="wp-image-3737" srcset="https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-apps.png 1366w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-apps-150x84.png 150w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-apps-300x169.png 300w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-apps-768x432.png 768w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-apps-540x304.png 540w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-apps-600x337.png 600w" sizes="(max-width: 1366px) 100vw, 1366px" /> Apps view <img loading="lazy" width="1366" height="768" src="/wp-content/uploads/2018/12/ubuntu-on-tablet-long-press-favorites.png" alt="" class="wp-image-3736" srcset="https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-long-press-favorites.png 1366w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-long-press-favorites-150x84.png 150w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-long-press-favorites-300x169.png 300w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-long-press-favorites-768x432.png 768w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-long-press-favorites-540x304.png 540w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-long-press-favorites-600x337.png 600w" sizes="(max-width: 1366px) 100vw, 1366px" /> Landscape mode. Favorites can be edited by long pressing. <img loading="lazy" width="768" height="1366" src="/wp-content/uploads/2018/12/ubuntu-on-tablet-portrait-mode.png" alt="" class="wp-image-3735" srcset="https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-portrait-mode.png 768w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-portrait-mode-84x150.png 84w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-portrait-mode-169x300.png 169w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-portrait-mode-540x960.png 540w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-portrait-mode-600x1067.png 600w" sizes="(max-width: 768px) 100vw, 768px" /> Same screen in portrait mode when tablet is rorated. <img loading="lazy" width="329" height="456" src="/wp-content/uploads/2018/12/ubuntu-on-tablet-rotate-lock.png" alt="" class="wp-image-3728" srcset="https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-rotate-lock.png 329w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-rotate-lock-108x150.png 108w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-rotate-lock-216x300.png 216w" sizes="(max-width: 329px) 100vw, 329px" /> The settings menu automatically shows a Rotate Lock icon when Ubuntu 18.04 is installed on a tablet. <img loading="lazy" width="1366" height="768" src="/wp-content/uploads/2018/12/ubuntu-on-tablet-on-screen-keyboard.png" alt="" class="wp-image-3734" srcset="https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-on-screen-keyboard.png 1366w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-on-screen-keyboard-150x84.png 150w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-on-screen-keyboard-300x169.png 300w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-on-screen-keyboard-768x432.png 768w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-on-screen-keyboard-540x304.png 540w, https://linuxnatives.net/wp-content/uploads/2018/12/ubuntu-on-tablet-on-screen-keyboard-600x337.png 600w" sizes="(max-width: 1366px) 100vw, 1366px" /> The new on-screen-keyboard is sleek! Where to buy an Ubuntu tablet? Unfortunately we were unable to find any online stores that sell pre-installed Ubuntu tablets. There are nowadays plenty of pre-installed Ubuntu laptop sellers, but no tablets. Hopefully there will be more people that realize the benefits of having more control over their digital systems and that pre-installed Linux tablets (other than just Android) will become more common in the future!
Secure and flexible backup server with dm-crypt and btrfs
In our previous article we described an idea setup for a modern server with btrfs for flexibility and redundancy. In this article we describe another kind of setup that is ideal only for a backup server. For a backup server redundancy and high availability are not important, but instead maximal disk space capacity and the […]
In our previous article we described an idea setup for a modern server with btrfs for flexibility and redundancy. In this article we describe another kind of setup that is ideal only for a backup server. For a backup server redundancy and high availability are not important, but instead maximal disk space capacity and the amount of backups it can hold. Additionally it is good if the disks are encrypted to protect agains physical theft. In this article we explain how to encrypt the disks with LUKS/dm-crypt so that all files are encrypted, and how all disks can be automatically opened using one single password entered by the administrator at boot time, as having multiple passwords would just add complexity without any gain, since all passwords are equally strongly protected by the same encryption technology. Use Ubuntu installer to get the basic LUKS/dm-crypt in place The easiest way to get started and get all pieces of software, Grub modules and other in place is to run the Ubuntu installer and install on a single disk a standard system using the option Encrypted disk. This will deploy an unencrypted /boot partition, and an encrypted LUKS/dm-crypt, LVM and a ext4 / (root) partition and an encrypted swap partition on the first disk. Once booted into this freshly installed system you can start tweaking it. Create one big encrypted btrfs filesystem as /data Next we will explain how to encrypt additional disks and how to use btrfs to glue multiple differently sized physical disks together for maximal disk space, and how to use btrfs snapshots to enable as much historical backups as needed with minimal additional disk usage. The following commands dmsetup ls --tree and dmsetup status will list what devices Device Mapper knows about. To view all physical devices and the block devices they map to, the tool lsblk is also excellent. The following command will show information about the encryption: $ cryptsetup -v luksDump /dev/sda5 LUKS header information for /dev/sda5 Version: 1 Cipher name: aes Cipher mode: xts-plain64 Hash spec: sha256 Payload offset: 4096 MK bits: 512 MK digest: aa bb cc ddaa bb cc dd ee ff aa bb cc dd ee ff aa bb cc dd MK salt: aa bb cc dd ee ff aa bb cc dd ee ff aa bb cc dd aa bb cc dd ee ff aa bb cc dd ee ff aa bb cc dd MK iterations: 37500 UUID: 6507313f-d061-4150-9ca2-7966b17cdce2 Key Slot 0: ENABLED Iterations: 149532 Salt: aa bb cc dd ee ff aa bb cc dd ee ff aa bb cc dd aa bb cc dd ee ff aa bb cc dd ee ff aa bb cc dd Key material offset: 8 AF stripes: 4000 Key Slot 1: DISABLED Key Slot 2: DISABLED Key Slot 3: DISABLED Key Slot 4: DISABLED Key Slot 5: DISABLED Key Slot 6: DISABLED Key Slot 7: ENABLED Iterations: 153845 Salt: aa bb cc dd ee ff aa bb cc dd ee ff aa bb cc dd aa bb cc dd ee ff aa bb cc dd ee ff aa bb cc dd Key material offset: 3536 AF stripes: 4000 Command successful. This is the encrypted device created by the Ubuntu installer. There is one single device, which Ubuntu assigns as a LVM device, and then splits into a root and swap partition. sda 8:16 0 232,9G 0 disk ├─sda1 8:17 0 487M 0 part /boot └─sda5 8:21 0 232,4G 0 part └─sda5_crypt 252:0 0 232,4G 0 crypt ├─ubuntu--gnome--vg-root 252:1 0 230,5G 0 lvm / └─ubuntu--gnome--vg-swap_1 252:2 0 1,9G 0 lvm [SWAP] This can be left as is, and we will create a new /data partition for our btrfs filesystem using multiple encrypted hard disks. Encrypted disks After adding more physical disks to the server, boot it and run the following commands to get the software part done. First format all disks with fdisk so you have something like this: $ fdisk -l /dev/sdb Disk /dev/sdb: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x8a63d658 Device Boot Start End Sectors Size Id Type /dev/sdb1 * 2048 1953525167 997376 999G 83 Linux Then create a keyfile containing some random data. The keyfile will be stored on the encrypted system disk and used to open the encrypted drives. dd bs=512 count=4 if=/dev/urandom of=/etc/cryptkey iflag=fullblock This makes the boot process smooth: you only need to enter a password to unlock the system disk, and after that all other disks will open and mount automatically. Then format the new partitions as encrypted LUKS devices that can be opened using the one and same keyfile: cryptsetup -s 512 -v luksFormat /dev/sdb1 /etc/cryptkey cryptsetup -s 512 -v luksFormat /dev/sdc1 /etc/cryptkey Then test that you can open the devices with the command: cryptsetup open --key-file=/etc/cryptkey --type luks /dev/sdb1 wdc1tb The last parameter defines which name the device should have when presented by Device Mapper. In my naming scheme I use the disk brand (Western Digital) and size (1TB) so that it is easier later to somehow map which physical disk is which partition. To have the devices opened automatically at boot, add to /etc/crypttab wdc1tb /dev/sdb1 /etc/cryptkey luks,noearly wdc1tc /dev/sdc1 /etc/cryptkey luks,noearly A LUKS device can have multiple keys. There are up to 8 key slots available. A new key for slot 7 on device sdb1 can be added like this: sudo cryptsetup luksAddKey --key-slot 7 /dev/sdb1 -d /etc/cryptkey Once dm-crypt/LUKS devices are set up and opened, the system will see a new block device, which you can format to btrfs with: Create a btrfs filesystem mkfs.btrfs -m raid1 -d raid0 /dev/mapper/wdc1tb1 /dev/mapper/wdc1tc1 Add as many devices to this command as you like. You can also later add more devices with ‘btrfs device add’. With these parameters the disks will be joined to form one big logical paritition with the size of all disks combined (RAID0). Only metadata is duplicated (RAID1). Finally mount the new btrfs filesystem with: mount -t btrfs -o defaults,noatime,compress=lzo /dev/mapper/wdc1tb1 /data After this you’ll have at /data a big btrfs filesystem. Now you can start making your backups to /data using your preferred backup software. For most cases, simple rsync is enough. Using snapshots to get some backup history To make a read-only snapshot of all data in /data, run: btrfs subvolume snapshot -r /data /data/snapshot.$(date +%Y-%m-%d) Delete a snapshot with: btrfs subvolume delete snapshot.2017-08-12 To show how much disk space is used, run: btrfs qgroup show. Unfortunately on certain systems using quota groups makes the btrfs-cleaner run amok, so only enable quotas if your system is not affected by btrfs bug #116801. Using external USB disks? The default settings in Ubuntu are set to turn off external USB disks after a certain time of inactivity. This can be harmful is the disks are used as a part of an btrfs array. Disable autosuspend by running: for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 2 > $i; done for i in /sys/bus/usb/devices/*/power/level; do echo on > $i; done How to add more disks If you ever need to extend the setup, you need to remember to: Partition the new disk with fstab. Encrypt the new disk with cryptsetup. Mount the new encrypted device with cryptsetup open .... Add it to the the btrfs pool with btrfs device add /dev/mapper/... /data And finally update /etc/crypttab so that at boot the encrypted device is automatically mounted. Btrfs does not need any fstab changes as the pool will detect its members automatically.
Btrfs is probably the most modern filesystem of all widely used filesystems on Linux. In this article we explain how to use Btrfs as the only filesystem on a server machine, and how that enables some sweet capabilities, like very resilient RAID-1, flexible adding or replacing of disk drives, using snapshots for quick backups and […]
Btrfs is probably the most modern filesystem of all widely used filesystems on Linux. In this article we explain how to use Btrfs as the only filesystem on a server machine, and how that enables some sweet capabilities, like very resilient RAID-1, flexible adding or replacing of disk drives, using snapshots for quick backups and so on. The techniques described in this article were tested using the Ubuntu 16.04 server install, but are applicable on any system with about the same versions of btrfs, grub (2.02), the kernel (4.4) and the likes. The hardware requirements for a btrfs based RAID-1 disk setup are very flexible. The amount of disks can be anything above two. The size of the disks in the RAID array do not need to be identical, thanks to the flexibility of btrfs RAID-1 as it works on the data level, and not just on device level like traditional mdadm does. Btrfs also includes the features traditionally provided by LVM, so Btrfs conveniently replaces both mdadm and LVM in a single easy to use tool. The best practice is to start with a setup that has 2–4 disks, and then later keep adding new disks when more space is needed, and the size of those disks is whatever is the best price/size ratio at that later time. The Btrfs setup When the hardware is ready, the next step is to install the operating system (=Linux). During the partitioning phase, create one big partition that fills all of the disk. There is no need to create a /boot partition nor a swap disk. For Grub compatibility reasons we need to create a real partition (eg. sda1, sdb1..) on every disk and not assign the whole disk to Btrfs, even though Btrfs would support that too. Remember to mark every primary partition (eg. sda1, sdb1..) bootable in the partition table. After the partitioning step, select the first disk partition (e.g. sda1) as the root filesystem and use Btrfs as the filesystem type. Complete the installation and boot. After boot you can expand the root filesystem to use all disks with the command: btrfs device add /dev/sdb1 /dev/sdc1 /dev/sdd1 / You can check the status of the btrfs system with btrfs fi show (fi is short for filesystem): $ sudo btrfs fi show Label: 'root' uuid: 31e77d75-c07d-44dd-b969-d640dfdf5f81 Total devices 4 FS bytes used 1.78GiB devid 1 size 884.94GiB used 4.02GiB path /dev/sda1 devid 2 size 265.42GiB used 0.00B path /dev/sdb1 devid 3 size 283.18GiB used 0.00B path /dev/sdc1 devid 4 size 265.42GiB used 0.00B path /dev/sdd1 This pools the devices together and creates a big root filesystem. To make it a RAID-1 system run: sudo btrfs balance start -v -mconvert=raid1 -dconvert=raid1 / After this, the available disk space halves but becomes resilient against single disk failures. The read speed might also increase a bit, as data can be accesses in parallel on at least two devices. The command btrfs fi usage is a new command that explains how disk space is used and how much might be available: $ sudo btrfs fi usage / Overall: Device size: 1.66TiB Device allocated: 6.06GiB Device unallocated: 1.65TiB Device missing: 0.00B Used: 3.53GiB Free (estimated): 846.76GiB (min: 846.76GiB) Data ratio: 2.00 Metadata ratio: 2.00 Global reserve: 32.00MiB (used: 0.00B) Data,RAID1: Size:2.00GiB, Used:1.69GiB /dev/sda1 2.00GiB /dev/sdc1 2.00GiB Metadata,RAID1: Size:1.00GiB, Used:72.81MiB /dev/sda1 1.00GiB /dev/sdc1 1.00GiB System,RAID1: Size:32.00MiB, Used:16.00KiB /dev/sda1 32.00MiB /dev/sdc1 32.00MiB Unallocated: /dev/sda1 881.90GiB /dev/sdb1 265.42GiB /dev/sdc1 280.15GiB /dev/sdd1 265.42GiB By default the Linux system boot will hang if any of the devices used by the Btrfs root filesystem is missing. This is not the ideal behavior in a server environment, as we rather have the system boot and continue to operate in a degraded mode, so that services continue to work and admins can access remotely and assess the next steps. To enable btrfs to boot in degraded mode we need to add the ‘degraded‘ mount option to two locations. First we need to make sure that Grub can mount the root filesystem and access the kernel. To to that we edit the rootflags line in /etc/grub.d/10_linux to include the option ‘degraded‘ like this: GRUB_CMDLINE_LINUX="rootflags=degraded,subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" For the Grub config to take effect we need to run ‘update-grub‘ and after that install the new Grub on the master boot sector (MBR) of every disk. That can easily be scripted like this: for x in a b c d; do sudo grub-install /dev/sd$x; done Secondly we need to allow the Linux system to mount its filesystems in degraded more by adding the same option to /etc/fstab like this: UUID=.... / btrfs degraded,noatime,nodiratime,subvol=@ 0 1 Note that also noatime and noadirtime have been selected, as they increase performance with the drawback of not recording access times to files or directories, but that feature is almost never used by anything, so it does not have any practical drawback. With the setup above we now have a system with 4 disks, each disk containing one partition and those partitions are pooled together with Btrfs RAID-1. If any of the disks fail, the system will continue to operate and can also resume to operate after a reboot (thanks to mount option ‘degraded’) and it does not matter which of the disks break, as any disk is good for booting (thanks to having Grub in every disks’ MBR). If a disk failure occurs, it is up to the system administrator to detect it (e.g. from syslog) and then add a new disk and run ‘btrfs device replace...‘ as explained in our Btrfs recovery article. Using ZRAM for swap Note that this setup does not have any swap partitions. We can’t put a swap partition on the raw disk, as there is no redundancy on raw disk and if any of the disks fail, the swap partition and all memory stored on it would be lost and the kernel would most likely panic and halt. As btrfs RAID-1 is not a block level thing, we cannot have a swap partition on it either. We could have a swap file, but btrfs isn’t any good for keeping swap files. Our solution was not to have any traditional swap partition at all, but instead use ZRAM to store resident memory in a compressed format. To install zram simply run: apt install zram-config After next reboot there will automatically be a zram device that the system uses for swapping. It does not matter how much RAM a system has, because at some point the kernel will anyway swap something our from active memory to swap to use the active memory more efficiently. Using ZRAM for swap will prevent it from going to real disk therefore make both swap out and swap in faster (though with some cost of more CPU use). Using snapshots Would you like to make a full system backup that does not consume any disk space? On a copy-on-write filesystem like Btrfs it is possible to create snapshots as a window into the filesystem state at a certain point in time. A practical way to do it could be to have a directory called /snaphosts/ in the under the root filesystem and then save snapshots there at regular intervals. Using the -r option we make the snapshot read-only, which is ideal for backups. $ sudo mkdir /snapshots $ sudo btrfs subvolume snapshot -r / /snapshots/root.$(date +%Y%m%d-%H%M) Create a readonly snapshot of '/' in '/snapshots/root.20160919-0954' $ tree -L 3 /snapshots /snapshots `-- root.20160919-0954 |-- bin |-- boot |-- dev |-- etc |-- home |-- initrd.img -> boot/initrd.img-4.4.0-36-generic |-- initrd.img.old -> boot/initrd.img-4.4.0-31-generic |-- lib |-- lib64 |-- media |-- mnt ... To be able to track how much disk space a snapshot uses, or more exactly to view the amount of data that changed between two snapshots, we can use Btrfs quota groups. The are not enabled by default, so start by running: $ sudo bftrs quota enable / After that you can view the subvolumes (snapshots) disk usage: $ sudo btrfs qgroup show / qgroupid rfer excl -------- ---- ---- 0/5 16.00KiB 16.00KiB 0/257 1.75GiB 47.74MiB 0/258 48.00KiB 48.00KiB 0/267 0.00B 16.00EiB 0/268 48.00KiB 16.00EiB 0/269 1.75GiB 44.95MiB To find out which subvolume ID is mounted as what, list them with: $ sudo btrfs subvolume list / ID 257 gen 5367 top level 5 path @ ID 258 gen 5366 top level 5 path @home ID 269 gen 5354 top level 257 path snapshots/root.20160919-0954 To make a subvolume the new root (after reboot) study the btrfs subvolume set-default command, and to manipulate other properties of subvolumes, see the Btrfs property command.
World IPv6 Day and how to add IPv6 support to a web server
Today, 6th of June we celebrate World IPv6 day. Ipv6 is the new standard for IP protocols. IPv6 is important because, as everyone by now should know, the public IPv4 address space is running out. In fact all IPv4 address blocks have already been mostly consumed by registrars and the resource problem is being avoided […]
Today, 6th of June we celebrate World IPv6 day. Ipv6 is the new standard for IP protocols. IPv6 is important because, as everyone by now should know, the public IPv4 address space is running out. In fact all IPv4 address blocks have already been mostly consumed by registrars and the resource problem is being avoided by recycling old addresses and using NAT-techniques, which cause problems for many VoIP and P2P services. IPv6 also offers better network security (IPsec) built in. <img loading="lazy" class="size-full wp-image-3428 aligncenter" src="/wp-content/uploads/2016/03/World_IPv6_launch_banner_512.png" alt="World_IPv6_launch_banner_512" width="512" height="512" srcset="https://linuxnatives.net/wp-content/uploads/2016/03/World_IPv6_launch_banner_512.png 512w, https://linuxnatives.net/wp-content/uploads/2016/03/World_IPv6_launch_banner_512-150x150.png 150w, https://linuxnatives.net/wp-content/uploads/2016/03/World_IPv6_launch_banner_512-300x300.png 300w" sizes="(max-width: 512px) 100vw, 512px" /> We already wrote about taking IPv6 in use on a workstation earlier. Now we’ll explain how to add it to a web server. Note, we are deliberately not using old school commands (ifconfig, route, netstat) below, but instead the modern versions (ip and ss). It is time to move on with modern utilities too. First you need to add a IPv6 address to your network interface. On a Linux server to add a static address edit the file /etc/network/interfaces like this: auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 83.143.220.158 netmask 255.255.255.224 network 83.143.220.128 broadcast 83.143.220.159 gateway 83.143.220.129 # dns-* options are implemented by the resolvconf package, if installed #dns-nameservers 83.143.216.18 91.90.49.195 8.8.8.8 iface eth0 inet6 static address 2a00:14c0:1:307:aa51::158 netmask 64 gateway 2a00:14c0:1:307::1 The restart the network so that changes take effect: $ sudo /etc/init.d/networking restart The interface configuration should show something in the lines of: $ ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 52:54:00:87:05:3c brd ff:ff:ff:ff:ff:ff inet 83.143.220.158/27 brd 83.143.220.159 scope global eth0 inet6 2a00:14c0:1:307:aa51::158/64 scope global inet6 fe80::5054:ff:fe87:53c/64 scope link You may test from another machine running: $ ping6 2a00:14c0:1:307:aa51::158 You can verify that the routes are sensible using using the -6 option: $ ip -6 route 2a00:14c0:1:307::/64 dev eth0 proto kernel metric 256 expires 2592027sec fe80::/64 dev eth0 proto kernel metric 256 default via fe80::20c:86ff:fe14:d038 dev eth0 proto kernel metric 1024 expires 1665sec hoplimit 64 default via 2a00:14c0:1:307::1 dev eth0 metric 1024 For route testing you can use the tool traceroute6. To check that the traffic really flows correctly, try logging in remotely using ssh -6. Domain name records for IPv6 Now open in your browser http://[2a00:14c0:1:307:aa51::158]/ to see if you web server servers anything for the IPv6 address. Alternatively you can use the website ipv6proxy.net if you don’t yet have IPv6 configured on your workstation. Now when the service has a IPv6 address, you can start advertising it by adding a DNS AAAA record after your normal A record: wp.seravo.fi. A 83.143.220.158 wp.seravo.fi. AAAA 2a00:14c0:1:307:aa51::158 If you want to be extra cool, add a subdomain ipv6 (e.g. ipv6.seravo.fi, ipv6.google.com). With this address it is very visual to test if IPv6 works or not on any browser anywhere. Configuring web servers Apache or Nginx Next you need to configure you web server to listen for port 80 on both IPv4 and IPv6. In Apache you don’t need to configure anything special, as long as the Listen and NameVirtualHost directives don’t specify an IP-address but just port 80 in a generic way: NameVirtualHost *:80 Listen 80 For Nginx, add inside the server { } section the following line: server { listen [::]:80 default_server; listen [::]:443 default_server ssl; If you are missing a listen line altogether or it looks like listen 80; it means Nginx was listening only for the IPv4 address port 80. After the change, restart the server (reload is not enough) with: $ sudo service nginx reload Confirm with netstat that there indeed are servers listening: $ sudo ss -6lp State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 :::http :::* users:(("nginx",25706,28),("nginx",25705,28),("nginx",1826,28)) You can test the result with: curl -I -6 -v ipv6.seravo.fi * About to connect() to ipv6.seravo.fi port 80 (#0) * Trying 2a00:14c0:1:307:aa51::158... connected HTTP/1.1 302 Moved Temporarily Server: nginx
Why POWER8? With the enormous amount of data being generated every day, POWER8 was designed specifically to keep up with today’s data processing requirements on high end servers. POWER8 is a symmetric multiprocessor based on the power architecture by IBM. It’s designed specifically for server environments to have faster execution times and to really concentrate performing well on […]
Why POWER8? With the enormous amount of data being generated every day, POWER8 was designed specifically to keep up with today’s data processing requirements on high end servers. POWER8 is a symmetric multiprocessor based on the power architecture by IBM. It’s designed specifically for server environments to have faster execution times and to really concentrate performing well on high server workloads. POWER8 is very scalable architecture and scales from 1 to 100+ CPU core per server. Google was involved when POWER8 was designed and they currently use dual socket POWER8 system boards internally. Systems available with POWER8 cpus started shipping in late 2014. CPU clock ranges between 2.5Ghz all the way up to 5.0Ghz. It has support for DDR3 and DDR4 memory controllers. Memory support is designed to be future proof by being as generic as possible. <img aria-describedby="caption-attachment-3412" loading="lazy" class="wp-image-3412 size-full" src="/wp-content/uploads/2016/03/IBMPowerSystemE870-3.jpg" alt="IBMPowerSystemE870-3" width="800" height="530" srcset="https://linuxnatives.net/wp-content/uploads/2016/03/IBMPowerSystemE870-3.jpg 800w, https://linuxnatives.net/wp-content/uploads/2016/03/IBMPowerSystemE870-3-150x99.jpg 150w, https://linuxnatives.net/wp-content/uploads/2016/03/IBMPowerSystemE870-3-300x199.jpg 300w, https://linuxnatives.net/wp-content/uploads/2016/03/IBMPowerSystemE870-3-768x509.jpg 768w, https://linuxnatives.net/wp-content/uploads/2016/03/IBMPowerSystemE870-3-540x358.jpg 540w, https://linuxnatives.net/wp-content/uploads/2016/03/IBMPowerSystemE870-3-600x398.jpg 600w" sizes="(max-width: 800px) 100vw, 800px" /> Photo: Wikimedia Commons Open architecture Design is available for licensing via the OpenPower foundation mainly to support custom made processors for use in cloud computing and applications that need to calculate big amounts of scientific data. POWER8 processor specifications and firmware are available on liberal licensing. Collaborative development model is encouraged and it’s already happening. Linux has full support of POWER8 IBM has begun submitting code patches for the Linux kernel in 2012 to support POWER8 features. Linux now has full support for POWER8 since version the kernel version 3.8. Many big Linux distributions, including Debian, Fedora and OpenSUSE has installable iso images available for Power hardware. When it comes to applications almost all software available for traditional cpu architectures are also available for POWER8. Packages build for it usually has the prefix ppc64el/ppc64le or ppc64 when build for big endian mode. There is prebuilt software available for Linux distributions. For example, thousands of Debian Linux packages are available. Remember to limit the search results to include packages for ppc64el to get a better picture what’s available. While power hardware is transitioning from big endian to little endian, POWER8 is actually bi-endian architechure and it’s capable of accessing data is both modes. However, most Linux distributions concentrate on little endian mode as it has much wider application ecosystem. Future of POWER8 Some years ago it seemed like that ARM servers were going to be really popular, but as of today it seems that POWER8 is the only viable alternative for the Intel Xeon architecture.
Another new year has started, and we think it is time to look a bit back and review what became the most popular content in Seravo Blog in 2015. Alltogether, in 2015, Seravo’s web page gained 233 681 visits and 196 401 users – these are pretty cool numbers for a modest sized company that we […]
Another new year has started, and we think it is time to look a bit back and review what became the most popular content in Seravo Blog in 2015. Alltogether, in 2015, Seravo’s web page gained 233 681 visits and 196 401 users – these are pretty cool numbers for a modest sized company that we still are. Actually, there were more visits to seravo.fi during the year than there are people living in our hometown Tampere (being the third largest city in Finland with 225 269 inhabitants). For these great statistics we can blame this blog, which has attracted the vast majority of our online visitors. So let’s see what were the most popular blog posts last year – and which ones remain as the all-time favourites still today. The five most popular blog posts in Seravo.fi in 2015 1. 10 reasons to migrate to MariaDB (if still using MySQL) The most popular post last year – and actually the first article written in 2015 – was the one praising MariaDB and providing a list of reasons to start using it as your database. The article also created lively discussion in the comment section! 2. Ubuntu Phone and Unity vs Jolla and SailfishOS In August we compared two Linux-based mobile operating systems that stand as competitors to Android. As a conclusion we claimed that “Jolla and SailfishOS would be the technically and usabilitywise superior alternative, but then again Ubuntu could be able to leverage on it’s position as the most popular Linux distribution in desktops and servers”. All in all, we hoped for new innovations fueling from these (at least for now minor) competitors. 3. Ubuntu Phone review by a non-geek The new Ubuntu Phone was clearly in the center of the open source community’s attention in the summer of 2015. A not-that-technical review on the phone became the year’s third most visited blog post. After that the phone has been tested and tried by Seravo geeks too – and has not gained too admirable evaluations… 4. Continuous integration testing for WordPress plugins on Github using Travis CI If that wasn’t technical enough for you, maybe the article on testing WordPress plugins will do? And if you found youself puzzled after reading it, do not hesitate to contact us. Seravo can help you using PHPUnit, Rspec and Travis in your projects, please feel free to ask us about our WordPress testing via email at wordpress@seravo.fi . PS. If you identify yourself as a Finn (or for some other odd reason happen to be familiar with Finnish), check out our blog on WP-palvelu.fi that focuses on all things happening within and around WordPress. 5. Fixing black screen after login in Ubuntu 14.04 The fifth most read article in 2015 was our guide to fixing a Ubuntu login problem that raised from some of our customers. Instead of charging for one hour of work for fixing the problem, we provided the instructions for everyone to do it on their own. The all-time favourites Even though they say that infomation ages faster than ever, it seems that even ancient articles in the Seravo blog are still valid and popular today. The post on how to turn any computer into a wireless access point with Hostapd from August 2014 is actually still the most popular of all seravo.fi pages with over 67 000 page visits. The more recent post on why to migrate to MariaDB has taken the second place with nerly 57 000 visits. Next in the all-time top five favourites come the following articles: Free Your Android phone (and upgrade to the latest Android version)! Optimizing web server performance with Nginx and PHP Virtualized bridged networking with MacVTap In fact, our front page seravo.fi with approximately ten thousand visits per year only comes as sixth on the list of our most popular pages. This proves us that a blog is a great way to attract attention and to participate in the on-going technological discussion. Although located in the northern corner of the world, in this distant land of snow and software, Seravo has with its online presence drawn visitors from all over the world: United States, India, Germany and United Kingdom form the top four and our dear own Finland takes the fifth place on this list. At this point we would like to thank all of our visitors, readers and especially those who have commented on the blog posts! We will keep on posting new topics in 2016 as well, and the comment section is always open for new thoughts and constructive criticism. We are also more than happy to receive ideas for future blog posts from any of you. Happy new year!
Using RAID with btrfs and recovering from broken disks
Btrfs (pronounced Better FS) is a relatively new filesystem that operates on the copy-on-write principle (abbreviated COW, which stems a more friendly pronunciation for btrfs: Butter FS). Btrfs includes a lot of interesting functionality and replaces traditional Linux disk and filesystem tools like LVM (volume manager, disk snapshots) and mdadm (software RAID). In RAID usage btrfs is much more flexible […]
Btrfs (pronounced Better FS) is a relatively new filesystem that operates on the copy-on-write principle (abbreviated COW, which stems a more friendly pronunciation for btrfs: Butter FS). Btrfs includes a lot of interesting functionality and replaces traditional Linux disk and filesystem tools like LVM (volume manager, disk snapshots) and mdadm (software RAID). In RAID usage btrfs is much more flexible and space efficient than traditional mdadm, because in btrfs the disks in the RAID array do not conform to any predefined size or count requirements. You can attach any amount of disk of any size to a btrfs RAID array, and btrfs will automatically balance the data across the devices according to the requirements of the selected RAID level. RAID levels 0 and 1 are currently supported while RAID 5 and 6 are under development and will be available as officially supported configurations soon. Let’s take an example case to see how btrfs RAID works. In traditional mdadm based RAID if you have two 1 TB disks configured to mirror each other in RAID 1 mode, and you want to expand this setup, you basically need to install two more disks, and they need to be of equal size. In btrfs, life is much more flexible. To expand an array, you can add a disk of any size and btrfs will automatically adjust to the sitation. So if you have two 1 TB disks, and you add a 2 TB disk to the array, then all 4 TB would be utilised and you will have 2 TB of usable storage. Btrfs will make sure that as RAID 1 mandates, each file will exist in two copies and those copies are stored on physically different disks. If you would expand the two 1 TB array with one 1 TB disk, then btrfs would give you 1,5 TB of usable disk space in total while still satisfying the RAID 1 replicate requirements. Btrfs RAID is flexible also in the sense that you can either create the RAID array by running something like mkfs.btrfs -d raid1 -m raid1 /dev/sdb1 /dev/sdc1 when you create the partitions, or you can at any later time convert existing partitions to use RAID by running a command like btrfs balance start -dconvert=raid1 -mconvert=raid1 /home If RAID is active, it will be visible in the btrfs filesystem df command: $ btrfs fi df /home Data, RAID1: total=1.59TiB, used=1.59TiB System, RAID1: total=32.00MiB, used=256.00KiB Metadata, RAID1: total=10.00GiB, used=8.27GiB unknown, single: total=512.00MiB, used=0.00 Keep in mind, that the free values shown by the normal df are not reliable, as it is hard to predict how disk usage will behave in a copy-on-write and snapshotting filesystem like btrfs. Recovering from failed disks in btrfs If a disk in a btrfs RAID 1 array fails, then btrfs will refuse to mount that filesystem and error messages will be visible in the syslog. If it was the root filesystem, then the system will refuse to boot normally and the system will usually boot to an initramfs console. Luckily all decent systems that support btrfs (like Ubuntu 14.04) will have btrfs tools included in the initramfs environment, so you can run btrfs commands from there and try to recover from the situation without the need to boot the system form an alternative media, like a live CD. A btrfs volume with a failed (missing) disk will output something like this: $ btrfs fi show Label: none uuid: 4e90ec15-e6f5-470d-96be-677f654a5c79 Total devices 3 FS bytes used 1.59TiB devid 1 size 2.71TiB used 1.60TiB path /dev/sda1 devid 2 size 1.80TiB used 1.48TiB path devid 3 size 447.14GiB used 121.00GiB path /dev/sdc1/pre> To force the btrfs volume to mount anyway, the degraded option can be used: $ mount -t btrfs -o degraded /dev/sda2 /home The correct thing to do when a disk in an RAID array fails, is to replace it. Once you have a new disk in place notify btrfs about it with the command: $ btrfs replace start /dev/sdd1 /dev/sdb1 /home This command reads files both from the original drive (if still accessible) and from other disks in the RAID array, and uses that information to populate the new clean disk. If needed, the -r flag will prevent the system from trying to read from the outgoing drive if possible. Replacement operations can be canceled, but they cannot be paused. Once the operation is complete, /dev/sdc1 will no longer be a part of the array and can be disposed of. In some cases one could also run btrfs device delete missing /dev/sdb1 and then add a new drive, but the replace command is the primary command and can be run even if the old drive is completely dead. Recovering from filesystem corruption in btrfs In cases where the physical disk has not failed but instead something in the btrfs journal or checksum trees is corrupted and does not match, and the filesystem refuses to mount, this is the recommended procedure to try: First make a backup the volume. After that try to mount the volume in the read-only recovery mode: $ mount -t btrfs -o ro,recovery /dev/sda2 /home If that fails, look in syslog (or run dmesg) and look for btrfs errors: [ 74.926506] Btrfs loaded [ 74.927393] BTRFS: device fsid 4e90ec15-e6f5-470d-96be-677f654a5c79 devid 2 transid 691061 /dev/sdc1 [ 77.439765] BTRFS info (device sdc1): disk space caching is enabled [ 77.440620] BTRFS: failed to read the system array on sdc1 If there are messages relating to the log tree (not in the example above), then reset the log tree by running: $ btrfs-zero-log If syslog shows problems regarding the chunk tree, then btrfs rescue chunk-recover may be of used to replace the chunk blocks with new ones that should work (but may loose some data). Each disk has multiple copies of super blocks, and they are very unlikely to all get corrupted at the same time, but it happens they can be recovered with the rescue command: $ btrfs rescue super-recover -v /dev/sde1 All Devices: Device: id = 3, name = /dev/sdc1 Device: id = 1, name = /dev/sda2 Device: id = 2, name = /dev/sde1 Before Recovering: [All good supers]: device name = /dev/sdc1 superblock bytenr = 65536 device name = /dev/sdc1 superblock bytenr = 67108864 device name = /dev/sdc1 superblock bytenr = 274877906944 device name = /dev/sda2 superblock bytenr = 65536 device name = /dev/sda2 superblock bytenr = 67108864 device name = /dev/sda2 superblock bytenr = 274877906944 [All bad supers]: device name = /dev/sde1 superblock bytenr = 65536 device name = /dev/sde1 superblock bytenr = 67108864 device name = /dev/sde1 superblock bytenr = 274877906944 After those, try btrfsck, and possibly with options -s1, -s2, -s3. It the volume is still not mountable, then try btrfsck --repair. The command btrfsck --repair --init-extent-tree may be necessary if the extent tree was corrupted. If there is corruption in the checksums, try –init-csum-tree. Last resort is to run btrfs check --repair but it’s not recommended because it might write changes to the disk that destroys data. Generic tools might also be useful. For example the tool testdisk is able to scan disks and find lost partition tables, including ones with btrfs partitions. Restoring files from a broken btrfs filesystem If it simply is impossible to mount a btrfs filesystem, it is possible to use the command btrfs restore to fetch files from withing a damaged btrfs partition. The default command will get all files from the root volume. Sometimes simply restore isn’t enough. For example in Ubuntu, by default the /home directory is a separate btrfs subvolume. To fetch files from there the correct volume root must be defined via the -r option. Also you might not be interested in restoring all possible files, maybe just one particular directory, and for such use a filename filter can be defined with the --path-regex option. To fetch all files from /home/otto/Kuvat on a system there the @home subvolume object id is 258, the task can be accomplished with the command: $ btrfs restore -i -vvvv -r 258 --path-regex "^/(otto(|/Kuvat(|/.*)))$" /dev/sdc1 . ... Restoring ./otto/Kuvat/2015/08/09/IMG_2888.JPG Restoring ./otto/Kuvat/2015/08/09/IMG_2889.JPG Restoring ./otto/Kuvat/2015/08/09/IMG_2890.JPG Restoring ./otto/Kuvat/2015/08/09/IMG_2891.JPG Restoring ./otto/Kuvat/2015/08/09/IMG_2892.JPG Restoring ./otto/Kuvat/2015/08/09/IMG_2893.JPG Found objectid=18094703, key=18094702 Done searching /otto/Kuvat/2015/08/09 Found objectid=18094632, key=18094631 Done searching /otto/Kuvat/2015/08 Found objectid=8304076, key=8304075 Done searching /otto/Kuvat/2015 Found objectid=272, key=271 Done searching /otto/Kuvat Found objectid=258, key=257 Done searching /otto Found objectid=257, key=256 Done searching Detecting data corruption If btrfs detects errors, they will be logged to syslog. Btrfs also maintains error counters, which on normal healthy drives should always list all zeros: $ btrfs device stats /mnt [/dev/sda2].write_io_errs 0 [/dev/sda2].read_io_errs 0 [/dev/sda2].flush_io_errs 0 [/dev/sda2].corruption_errs 0 [/dev/sda2].generation_errs 0 [/dev/sdc1].write_io_errs 0 [/dev/sdc1].read_io_errs 0 [/dev/sdc1].flush_io_errs 0 [/dev/sdc1].corruption_errs 0 [/dev/sdc1].generation_errs 0 Btrfs automatically calculates CRC-32C checksums for both data and metadata blocks, and at regular intervals checks if the checksums still match or not. If data corruption is detected, then btrfs will log errors to syslog. If RAID 1 is enabled, btrfs will also automatically fix the corrupted data by overwriting with by the correct duplicate. This process can also be automatically triggered by running btrfs scrub. Checking disk health Disks that support the SMART standard are able to report their health status. The Gnome tool ‘disks’ provides a very easy way to access SMART data. Just open Disks, select a device and choose ‘Show SMART Data & Self-Tests’. <img width="300" height="191" src="https://linuxnatives.net/wp-content/uploads/2015/09/menu-300x191.png" class="attachment-medium size-medium" alt="Gnome Disks tool" loading="lazy" srcset="https://linuxnatives.net/wp-content/uploads/2015/09/menu-300x191.png 300w, https://linuxnatives.net/wp-content/uploads/2015/09/menu-150x95.png 150w, https://linuxnatives.net/wp-content/uploads/2015/09/menu-540x344.png 540w, https://linuxnatives.net/wp-content/uploads/2015/09/menu-600x382.png 600w, https://linuxnatives.net/wp-content/uploads/2015/09/menu.png 1050w" sizes="(max-width: 300px) 100vw, 300px" /> <img width="300" height="175" src="https://linuxnatives.net/wp-content/uploads/2015/09/smart-300x175.png" class="attachment-medium size-medium" alt="Gnome Disks tool SMART data" loading="lazy" srcset="https://linuxnatives.net/wp-content/uploads/2015/09/smart-300x175.png 300w, https://linuxnatives.net/wp-content/uploads/2015/09/smart-150x87.png 150w, https://linuxnatives.net/wp-content/uploads/2015/09/smart-540x314.png 540w, https://linuxnatives.net/wp-content/uploads/2015/09/smart-600x349.png 600w, https://linuxnatives.net/wp-content/uploads/2015/09/smart.png 971w" sizes="(max-width: 300px) 100vw, 300px" /> Alternatively a command line representation of the same data can be fetched with: $ sudo smartctl -A -H /dev/sda smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.2.0-90-generic] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED SMART Attributes Data Structure revision number: 1 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0 9 Power_On_Hours 0x0032 098 098 000 Old_age Always - 6322 12 Power_Cycle_Count 0x0032 097 097 000 Old_age Always - 2646 175 Program_Fail_Count_Chip 0x0032 100 100 010 Old_age Always - 0 176 Erase_Fail_Count_Chip 0x0032 100 100 010 Old_age Always - 0 177 Wear_Leveling_Count 0x0013 086 086 010 Pre-fail Always - 503 178 Used_Rsvd_Blk_Cnt_Chip 0x0013 094 094 010 Pre-fail Always - 184 179 Used_Rsvd_Blk_Cnt_Tot 0x0013 094 094 010 Pre-fail Always - 336 180 Unused_Rsvd_Blk_Cnt_Tot 0x0013 094 094 010 Pre-fail Always - 6192 181 Program_Fail_Cnt_Total 0x0032 100 100 010 Old_age Always - 0 182 Erase_Fail_Count_Total 0x0032 100 100 010 Old_age Always - 0 183 Runtime_Bad_Block 0x0013 100 100 010 Pre-fail Always - 0 187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0 195 Hardware_ECC_Recovered 0x001a 200 200 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0030 100 100 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x003e 253 253 000 Old_age Always - 0 232 Available_Reservd_Space 0x0013 094 094 000 Pre-fail Always - 3080 241 Total_LBAs_Written 0x0032 099 099 000 Old_age Always - 15812437286 242 Total_LBAs_Read 0x0032 099 099 000 Old_age Always - 11879385910 Storing data efficiently and dependably are fundamental tasks in computing. Data integrity and data availability are key principles in information security. Btrfs is a promising technology that will help system administrators fulfill these goals and in particular with SSD disks btrfs should be the default filesystem choice for all new systems, and a must for syadmins to read up on. Amendment 29.5.2016: Freeing up space on a Btrfs RAID system If you even end up in a situation that your production disk is full, and you urgently must resolve it by creating more space, you can convert a live Btrfs RAID device to a normal single data device. This naturally risks that your whole system could fail miserably if a disk failure would occur during the time you don’t have RAID, but it might be worth taking a chance if a imminent full disk situation can be avoided and thus operations continue until you have time to work out a long-term solution. Basically if your Btrfs device had RAID-1 and you convert it you normal single mode, your disk space will double: sudo btrfs balance start -dconvert=single -mconvert=raid1 /data This is a pretty nice feature that is made possible by the unique design in Btrfs. For example ZFS does not have a balance command at all.
OnePlus is a mobile phone manufacturer famous for selling the OnePlus One with pre-installed CyanogenMod, instead of a bloated custom Android as most manufacturers do. Their newest model OnePlus X was released on November 5th 2015 and after a few days of use, it seems to live up to its promises. Most Chinese brands suffer from the […]
OnePlus is a mobile phone manufacturer famous for selling the OnePlus One with pre-installed CyanogenMod, instead of a bloated custom Android as most manufacturers do. Their newest model OnePlus X was released on November 5th 2015 and after a few days of use, it seems to live up to its promises. <img aria-describedby="caption-attachment-3353" loading="lazy" class="wp-image-3353" src="/wp-content/uploads/2015/11/oneplus-x-02-540x360.jpg" alt="OnePlus X" width="700" height="467" srcset="https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-02-540x360.jpg 540w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-02-150x100.jpg 150w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-02-300x200.jpg 300w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-02-600x400.jpg 600w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-02.jpg 1728w" sizes="(max-width: 700px) 100vw, 700px" /> OnePlus X Most Chinese brands suffer from the lack of finishing and low quality. OnePlus is something completely different. Everything about OnePlus seems different. It is like a completely new generation. The One Plus website is exiting. Their marketing is based almost entirely on using social media – and in a good way! The device we ordered from China’s Silicon Valley Shenzhen arrived in just a few business days. The packaging had a premium feel to it and what was inside matched the expectations set by the hype on their website. <img aria-describedby="caption-attachment-3352" loading="lazy" class="wp-image-3352" src="/wp-content/uploads/2015/11/oneplus-x-01-540x382.jpg" alt="Packaging includes a silicon case for added protection" width="700" height="495" srcset="https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-01-540x382.jpg 540w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-01-150x106.jpg 150w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-01-300x212.jpg 300w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-01-600x424.jpg 600w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-01.jpg 1312w" sizes="(max-width: 700px) 100vw, 700px" /> Packaging includes a silicon case for added protection. Excellent craftsmanship with shiny glass-like panels in front and back, connected by a metallic bevel. A vivid display and a responsive and fast Android 5.1.1 experience inside. Dual SIM card capability, great camera and 3 GB of RAM are just some of the high-end technical features. There is no need to repeat those details, as they are already well presented at the original site. All we need to say is that those promises are true and the quality is unexpectedly good. It definitely competes with the other high-end mobile phones in the range of 500-700 euros. And at what price is the OnePlus X available? Only 269 € in Europe, including taxes and tolls. The only drawbacks we noted are related to problems in Android itself. Everything in what OnePlus has added and customized is done with good judgement and is a step forward. <img aria-describedby="caption-attachment-3354" loading="lazy" class="size-large wp-image-3354" src="/wp-content/uploads/2015/11/oneplus-x-03-e1447237636371-540x810.jpg" alt="Very fast and snappy UI" width="540" height="810" srcset="https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-03-e1447237636371-540x810.jpg 540w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-03-e1447237636371-100x150.jpg 100w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-03-e1447237636371-200x300.jpg 200w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-03-e1447237636371-600x900.jpg 600w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-03-e1447237636371.jpg 1152w" sizes="(max-width: 540px) 100vw, 540px" /> Very fast and snappy UI <img aria-describedby="caption-attachment-3355" loading="lazy" class="size-large wp-image-3355" src="/wp-content/uploads/2015/11/oneplus-x-04-540x806.jpg" alt="Inside is Android 5.1.1" width="540" height="806" srcset="https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-04-540x806.jpg 540w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-04-100x150.jpg 100w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-04-201x300.jpg 201w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-04-600x896.jpg 600w, https://linuxnatives.net/wp-content/uploads/2015/11/oneplus-x-04.jpg 811w" sizes="(max-width: 540px) 100vw, 540px" /> Inside is Android 5.1.1 For a Finns like us it was also delightful to notice that their website is also available in Finnish, and that the language is actually flawless and not an amateur translation. Naturally the device operating system Android also has Finnish as an option. Have any of you already experienced the OnePlus X? Feel free to share your thoughts in the comments!
Fixing black screen after login in Ubuntu 14.04
How to fix black screen after login in Ubuntu 14.04? (Ohje suomeksi lopussa.) A lot of Linux-support customers have contacted us recently asking to fix their Ubuntu laptops and workstations that suddently stopped working. The symptom is that after entering the username and password in the login screen, they are unable to get in. Instead […]
How to fix black screen after login in Ubuntu 14.04? (Ohje suomeksi lopussa.) A lot of Linux-support customers have contacted us recently asking to fix their Ubuntu laptops and workstations that suddently stopped working. The symptom is that after entering the username and password in the login screen, they are unable to get in. Instead they see a flickering screen that then goes all black for a while, and then returns back to the login screen. This problem is caused by an update that didn’t install cleanly and left the graphical desktop environment in a broken state. The fix is to open a text console by pressing Ctrl+Alt+F1 and then logging in in text mode. Once in, issue these commands to complete the upgrade successfully: sudo dpkg --configure -a sudo apt-get update sudo apt-get upgrade -y Finally run sudo reboot, Ubuntu restarts, and then you can log in again normally. <img loading="lazy" class="alignnone wp-image-3342 size-large" src="/wp-content/uploads/2015/11/Ubuntu_logo_orange-540x243.png" alt="Ubuntu_logo_orange" width="540" height="243" srcset="https://linuxnatives.net/wp-content/uploads/2015/11/Ubuntu_logo_orange.png 540w, https://linuxnatives.net/wp-content/uploads/2015/11/Ubuntu_logo_orange-150x68.png 150w, https://linuxnatives.net/wp-content/uploads/2015/11/Ubuntu_logo_orange-300x135.png 300w" sizes="(max-width: 540px) 100vw, 540px" /> Sisäänkirjautumisen jälkeen näkyvän mustan ruudun korjaaminen Ubuntu 14.04:ssä Useat Linux-tuki.fi:n asiakkaat ovat viime päivinä ottaneet meihin yhteyttä tilatakseen tukea Ubuntu-läppärin tai -työaseman korjaukseen, kun se yllättäen lakkasi toimimasta oikein. Oire on, että sisäänkirjautumisessa, käyttäjätunnuksen ja salasanan syöttämisen jälkeen ruutu vilkkuu ja on hetken musta. Tämän jälkeen näyttö tulee takaisin kirjautumisnäkymään. Ongelma johtuu Ubuntun päivityksestä, joka on epäonnistunut ja jättänyt graafisen työpöytäympäristön toimimattomaan tilaan. Korjauksen voi tehdä itse avaamalla tekstipäätteen painamalla Ctrl+Alt+F1 ja kirjautumalla sisään tekstitilassa. Sen jälkeen voi ajaa päivityksen loppuun onnistuneesti komentamalla: sudo dpkg --configure -a sudo apt-get update sudo apt-get upgrade -y Lopuksi aja sudo reboot. Ubuntun uudelleenkäynnistymisen jälkeen sisäänkirjautuminen ja käyttö pitäisi onnistua normaalisti.
A great deal of our work as Linux system administrators is related to security. Each server we maintain is bombarded on daily basis in a never ending cyberwar. Some of our customers (e.g. the website of the former Finnish Minister of Foreign Affairs, government websites, high profile political organisations and media sites) are obvious targets but […]
A great deal of our work as Linux system administrators is related to security. Each server we maintain is bombarded on daily basis in a never ending cyberwar. Some of our customers (e.g. the website of the former Finnish Minister of Foreign Affairs, government websites, high profile political organisations and media sites) are obvious targets but statistics show that really, any device with a public IP address gets targeted by a steady stream of attacks.<img loading="lazy" class="alignright wp-image-3301 size-medium" src="/wp-content/uploads/2015/09/norse-corp-attack-map-300x215.png" alt="Cyber war map" width="300" height="215" srcset="https://linuxnatives.net/wp-content/uploads/2015/09/norse-corp-attack-map-300x215.png 300w, https://linuxnatives.net/wp-content/uploads/2015/09/norse-corp-attack-map-150x107.png 150w, https://linuxnatives.net/wp-content/uploads/2015/09/norse-corp-attack-map-540x387.png 540w, https://linuxnatives.net/wp-content/uploads/2015/09/norse-corp-attack-map-600x430.png 600w, https://linuxnatives.net/wp-content/uploads/2015/09/norse-corp-attack-map.png 811w" sizes="(max-width: 300px) 100vw, 300px" /> Our global political system seems quite toothless on this matter; much due to the technical fact that it is next to impossible to track down the real source of a well executed cyber attack. In a case where the attacker’s IP address seems to originate from China, all we can really conclude is that China is probably the last place the attack came from. Cyber attacks are also very cheap, and you most often can’t tell if your harasser is a government funded organisation or just a 13-year-old boy with a laptop in his parents’ basement. This is asymmetric warfare, because proper defence for cyber attacks is certainly not cheap or easy to establish. Case example: attack on WP-palvelu.fi on September 3rd, 2015 Most of the time, cyber attacks are just a cost of doing business we need to withstand; but unfortunately sometimes effective attacks arise from the constant bombardment. Last week our own WordPress optimised cluster at WP-palvelu.fi got some extra heat from somebody trying to DDOS it. A regular denial of service (DOS) attack is easy to tackle by automatically blocking the IP source of the attack, but a distributed DOS is much harder as the requests come from many different IP addresses, so our automatic rate limiters can’t kick in. This attacker was also smart enough to have bypassed our downstream caches by making unique requests every time with requests like these: [03/Sep/2015:10:01:37 +0300] "GET /superdry4.php?tmpl/detail.tmpl?designer=Superdry%2Fshop.tmpl%3Fmysize%3DL%2CXL;designer=Superdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DSuperdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DBazlen%20accessoires;art_id=531863;pg=2044 HTTP/1.1" 404 [03/Sep/2015:10:01:37 +0300] "GET /superdry4.php?tmpl/detail.tmpl?designer=Superdry%2Fshop.tmpl%3Fmysize%3DL%2CXL;designer=Superdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DSuperdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DSisterhood;art_id=106485;pg=81 HTTP/1.1" 404 [03/Sep/2015:10:01:37 +0300] "GET /superdry4.php?tmpl/detail.tmpl?designer=Superdry%2Fshop.tmpl%3Fmysize%3DL%2CXL;designer=Superdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DSuperdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DSpeedo;art_id=506899;pg=1719 HTTP/1.1" 404 [03/Sep/2015:10:01:37 +0300] "GET /superdry4.php?tmpl/detail.tmpl?designer=Superdry%2Fshop.tmpl%3Fmysize%3DL%2CXL;designer=Superdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DSuperdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DNikita;art_id=480217;pg=82 HTTP/1.1" 404 [03/Sep/2015:10:01:37 +0300] "GET /superdry4.php?tmpl/detail.tmpl?designer=Superdry%2Fshop.tmpl%3Fmysize%3DL%2CXL;designer=Superdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DSuperdry%2Ftmpl%2Fshop.tmpl%3Fdesigner%3DPlomo%20o%20Plata;art_id=554941;pg=107 HTTP/1.1" 404 Using this method, the attacker managed to trigger a fairly heavy PHP heap to generate the WordPress 404 pages on our client’s website, thus maximising the impact of the attack. Our first defensive action was to quickly take the targeted site offline, and then re-launch it on a separate, more powerful host that could better withstand the massively increased load. We also took other defensive steps, like trying to block some of the attacker’s IP ranges during the attack, which proved not to be as effective fighting against the DDOS. Remedy in this case When the dust settled and we had time to analyse the logs, we discovered the details of this attack. Using these discoveries, we made the decision to apply more of a white-listing approach to the HTTP requests our customers’ WordPress applications receive. The most important step was to only pass through requests for PHP files that actually exist, and then deny all other *.php requests, returning code 404 error pages instead of bothering the WordPress instances at all. This change is very conservative and has already been applied to our development version, and will be deployed to all WP-palvelu.fi sites during the next round of system upgrades. What’s next In the longer run we’ll start to apply even more white-listing principles, which are possible thanks to the fact that our WP-palvelu.fi hosts only WordPress sites, and we can safely assume that the sites have certain structures. We also plan to start caching 404 responses for up to 1 minute to prevent this WordPress 404 page generation attack, even though caching 404 pages is generally discouraged. We’ve also made it easy for our client to purge the downstream caches if the 1 minute cache is just too large a window for their operation. Related to this, we’re also developing automated scanning of our clients’ access logs that could detect anomalies like large spikes in traffic so that we can notice attacks before they show any visible effects. We will be sharing all of our upcoming cyber-fighting techniques in future blog posts. Stay tuned!