<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bogdan Cornianu</title>
    <description>The latest articles on DEV Community by Bogdan Cornianu (@bogdancornianu).</description>
    <link>https://dev.to/bogdancornianu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F92497%2Fdf061255-3b8a-42c6-a088-ef3e4de3d94a.jpg</url>
      <title>DEV Community: Bogdan Cornianu</title>
      <link>https://dev.to/bogdancornianu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bogdancornianu"/>
    <language>en</language>
    <item>
      <title>A possible solution for no sound in Firefox on Ubuntu</title>
      <dc:creator>Bogdan Cornianu</dc:creator>
      <pubDate>Sun, 07 Feb 2021 11:58:35 +0000</pubDate>
      <link>https://dev.to/bogdancornianu/a-possible-solution-for-no-sound-in-firefox-on-ubuntu-66a</link>
      <guid>https://dev.to/bogdancornianu/a-possible-solution-for-no-sound-in-firefox-on-ubuntu-66a</guid>
      <description>&lt;p&gt;For the last couple of days I was having a weird issue with Firefox on Ubuntu, namely there was no sound.&lt;/p&gt;

&lt;p&gt;After searching all over the Internet and trying different solutions I finally found one that worked and I wanted to share it with you in case you find yourself in the same situation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; before running the following command, please make sure you have a backup of your data!&lt;/p&gt;

&lt;p&gt;Run this command in a terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm ~/.config/pulse/*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And restart your computer.&lt;/p&gt;

&lt;p&gt;You should now have a working sound in Firefox.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://bogdancornianu.com/a-possible-solution-for-no-sound-in-firefox-on-ubuntu/"&gt;A possible solution for no sound in Firefox on Ubuntu&lt;/a&gt; appeared first on &lt;a href="https://bogdancornianu.com"&gt;Bogdan Cornianu&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>firefox</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>How to get environment variables from a running process in Linux</title>
      <dc:creator>Bogdan Cornianu</dc:creator>
      <pubDate>Sun, 04 Oct 2020 10:24:57 +0000</pubDate>
      <link>https://dev.to/bogdancornianu/how-to-get-environment-variables-from-a-running-process-in-linux-36cd</link>
      <guid>https://dev.to/bogdancornianu/how-to-get-environment-variables-from-a-running-process-in-linux-36cd</guid>
      <description>&lt;p&gt;In Linux, everything is a file. Even running processes are represented as files. You will find all the running processes in &lt;code&gt;/proc/&lt;/code&gt;, with a separate directory for each process id.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ps aux | grep [process name] # to get the process ID
cat /proc/[process ID]/environ | tr '\0' '\n'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What the above commands do, is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get the id of a process by name&lt;/li&gt;
&lt;li&gt;print the contents of the “environ” file for that process&lt;/li&gt;
&lt;li&gt;print each environment variable on a new line; &lt;code&gt;tr&lt;/code&gt; stands for “translate”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The post &lt;a href="https://bogdancornianu.com/how-to-get-environment-variables-from-a-running-process-in-linux/"&gt;How to get environment variables from a running process in Linux&lt;/a&gt; appeared first on &lt;a href="https://bogdancornianu.com"&gt;Bogdan Cornianu&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>software</category>
      <category>environment</category>
    </item>
    <item>
      <title>How to investigate Ubuntu slow boot</title>
      <dc:creator>Bogdan Cornianu</dc:creator>
      <pubDate>Thu, 13 Dec 2018 04:22:30 +0000</pubDate>
      <link>https://dev.to/bogdancornianu/how-to-investigate-ubuntu-slow-boot-4e81</link>
      <guid>https://dev.to/bogdancornianu/how-to-investigate-ubuntu-slow-boot-4e81</guid>
      <description>&lt;p&gt;Investigating why Ubuntu boots slowly can be difficult. There are a lot of things that can go wrong: a lingering service, a bad config file, a wrong disk uuid in fstab and others.&lt;/p&gt;

&lt;p&gt;In my opinion the easiest way to start is by using “systemd-analyze” which is part of systemd.&lt;br&gt;&lt;br&gt;
Since version 15.04, Ubuntu has switched from upstart to systemd as the default system and service manager. Systemd is not something specific to Ubuntu, but rather an industry standard that other major distributions have adopted as well: Debian, Fedora and CentOS to name a few.&lt;br&gt;&lt;br&gt;
“systemd-analyze” gives us information about what programs are run on startup and how much time they need to start.&lt;/p&gt;

&lt;p&gt;There are around a dozen options that we can use from systemd-analyze to see where the startup bottleneck is. But from a time perspective we’re only interested in a few of them (to see the rest of the options available you can run “man systemd-analyze” in a terminal):&lt;/p&gt;

&lt;p&gt;The options that we are interested in are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;plot&lt;/li&gt;
&lt;li&gt;time&lt;/li&gt;
&lt;li&gt;blame&lt;/li&gt;
&lt;li&gt;critical-chain&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;plot&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Outputs the svg code with all the started services, their dependencies and how long it took for them to start.&lt;/p&gt;

&lt;p&gt;For a better visualization you can pipe the output to an svg file and then open it with an image viewer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ systemd-analyze plot &amp;gt; init.svg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should be looking for long red bars. These bars represent the time it took for that process to start.  &lt;/p&gt;

&lt;p&gt;When opening the generated svg, you should see something similiar to&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/bogdancornianu.com/wp-content/uploads/2018/12/systemd-analyze-plot-1.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qeBspOvL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/bogdancornianu.com/wp-content/uploads/2018/12/systemd-analyze-plot-1.png%3Fresize%3D700%252C394%26ssl%3D1" alt="systemd-analyze plot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;time&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Shows the amount of time spent after the bootloader has given control to the kernel up until the userspace finished initialization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ systemd-analyze time
Startup finished in 7.541s (firmware) + 5.696s (loader) + 4.053s (kernel) + 8.206s (userspace) = 25.498sgraphical.target reached after 8.068s in userspace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The values in this example are for my laptop which has an i7 processor, 16GB of RAM and a 512GB SSD.&lt;br&gt;&lt;br&gt;
If you use an older system, you may not see the firmware data as this is available only for EFI/UEFI systems.&lt;br&gt;&lt;br&gt;
If a lot of time is spent in &lt;strong&gt;&lt;em&gt;firmware&lt;/em&gt;&lt;/strong&gt; , there might be an hardware issue.&lt;br&gt;&lt;br&gt;
Time in &lt;strong&gt;&lt;em&gt;loader&lt;/em&gt;&lt;/strong&gt; is the time needed by your bootloader, typically Grub. If a considerable amount of time is spent here it might mean that the bootloader can’t find some disks or maybe some kernel boot parameters are wrong.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Kernel&lt;/em&gt;&lt;/strong&gt; time is used for loading drivers and other initializations. After the kernel finished its startup it will launch the init process (which usually has the id 1).&lt;br&gt;&lt;br&gt;
The init process, in our case is systemd and represents time spent in &lt;strong&gt;&lt;em&gt;userspace&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;blame&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Displays an ordered list of services, from slowest to fastest.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ systemd-analyze blame
6.272s NetworkManager-wait-online.service
          2.998s plymouth-quit-wait.service
           930ms dev-sda6.device
           795ms fwupd.service
           632ms snapd.service
           547ms motd-news.service
           449ms plymouth-start.service
           396ms NetworkManager.service
           325ms upower.service
           274ms systemd-logind.service

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;em&gt;critical-chain&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Similar to blame, but it takes into account dependencies between services. The slow starting services will be highlighted in red.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @8.068s
└─multi-user.target @8.068s
  └─kerneloops.service @8.058s +10ms
    └─network-online.target @8.056s
      └─NetworkManager-wait-online.service @1.783s +6.272s
        └─NetworkManager.service @1.385s +396ms
          └─dbus.service @1.359s
            └─basic.target @1.356s
              └─sockets.target @1.356s
                └─snapd.socket @1.354s +2ms
                  └─sysinit.target @1.354s
                    └─systemd-timesyncd.service @1.137s +215ms
                      └─systemd-tmpfiles-setup.service @1.125s +9ms
                        └─local-fs.target @1.123s
                          └─run-snapd-ns-docker.mnt.mount @2.093s
                            └─run-snapd-ns.mount @1.818s
                              └─swap.target @262ms
                                └─swapfile.swap @157ms +104ms
                                  └─systemd-remount-fs.service @147ms +7ms
                                    └─systemd-journald.socket @140ms
                                      └─system.slice @139ms
                                        └─-.slice @137ms

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using all this information from &lt;strong&gt;&lt;em&gt;systemd-analyze&lt;/em&gt;&lt;/strong&gt;  we can find out what is slowing the startup process. Once we know that, we can dig deeper and get to the root of the problem.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://bogdancornianu.com/how-to-investigate-ubuntu-slow-boot/"&gt;How to investigate Ubuntu slow boot&lt;/a&gt; appeared first on &lt;a href="https://bogdancornianu.com"&gt;Bogdan Cornianu&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>boot</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Change swap size in Ubuntu 18.04 or newer</title>
      <dc:creator>Bogdan Cornianu</dc:creator>
      <pubDate>Sat, 11 Aug 2018 16:57:09 +0000</pubDate>
      <link>https://dev.to/bogdancornianu/change-swap-size-in-ubuntu-18-04-or-newer-2j0i</link>
      <guid>https://dev.to/bogdancornianu/change-swap-size-in-ubuntu-18-04-or-newer-2j0i</guid>
      <description>&lt;p&gt;&lt;em&gt;[Updated July 26, 2020]: Change swapfile permission; Set swapfile in /etc/fstab.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Swap is a special area on your computer, which the operating system can use as additional RAM.&lt;br&gt;&lt;br&gt;
Starting with Ubuntu 17.04, the swap partition was replaced by a swap file. The main advantage of the swap file is easy resizing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; before running the following commands, please make sure you have a backup of your data!&lt;/p&gt;

&lt;p&gt;In the following example, we’ll extend the swap space available in the /swapfile from 4 GB to 8 GB.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn off all swap processes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo swapoff -a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Resize the swap
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo dd if=/dev/zero of=/swapfile bs=1G count=8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;if = input file&lt;br&gt;&lt;br&gt;
of = output file&lt;br&gt;&lt;br&gt;
bs = block size&lt;br&gt;&lt;br&gt;
count = multiplier of blocks&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Change permission
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chmod 600 /swapfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Make the file usable as swap
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkswap /swapfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Activate the swap file
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo swapon /swapfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Edit /etc/fstab and add the new swapfile if it isn’t already there
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/swapfile none swap sw 0 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check the amount of swap available
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grep SwapTotal /proc/meminfo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The post &lt;a href="https://bogdancornianu.com/change-swap-size-in-ubuntu/"&gt;Change swap size in Ubuntu 18.04 or newer&lt;/a&gt; appeared first on &lt;a href="https://bogdancornianu.com"&gt;Bogdan Cornianu&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>swap</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Tankr Online Game</title>
      <dc:creator>Bogdan Cornianu</dc:creator>
      <pubDate>Sun, 08 Apr 2018 10:19:41 +0000</pubDate>
      <link>https://dev.to/bogdancornianu/tankr-online-game-2f9k</link>
      <guid>https://dev.to/bogdancornianu/tankr-online-game-2f9k</guid>
      <description>&lt;p&gt;Together with Zoltán Szeredi at the 2017 HackTM edition we built a clone of the “Tanks” game. We used &lt;a href="https://phaser.io/"&gt;PhaserJS&lt;/a&gt; which is a great HTML5 game framework.&lt;br&gt;&lt;br&gt;
You can play the game online and also see the source code on Github:&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/hacktm2017BoZo/Tankr"&gt;https://github.com/hacktm2017BoZo/Tankr&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/bogdancornianu.com/wp-content/uploads/2018/04/Tankr.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3GPWEsmG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/bogdancornianu.com/wp-content/uploads/2018/04/Tankr.png%3Fresize%3D700%252C345%26ssl%3D1" alt="Tankr online game"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://bogdancornianu.com/tankr-online-game/"&gt;Tankr Online Game&lt;/a&gt; appeared first on &lt;a href="https://bogdancornianu.com"&gt;Bogdan Cornianu&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>projects</category>
    </item>
  </channel>
</rss>
